單例項和RAC打造的ORACLE STREAM(四)
第五步,啟用追加日誌:
可以基於Database級別或Table級別,啟用追加日誌(Supplemental Log)。在建立根據Schema粒度進行復制的Oracle Stream環境中,如果確認Schema下所有Table都有合理的主鍵(Primary Key),則不再需要啟用追加日誌。
#啟用Database 追加日誌
alter database add supplemental log data;
#啟用Table追加日誌
alter table add supplement log group log_group_name(table_column_name) always;
第六步,建立DBlink:
主庫:
SQL> conn strmadmin/strmadmin
Connected.
SQL> create database link storm connect to strmadmin identified by strmadmin using 'storm';
Database link created.
備庫:
SQL> conn strmadmin/strmadmin
Connected.
SQL> create database link ora connect to strmadmin identified by strmadmin using 'ora';
Database link created.
第七步,以strmadmin使用者登陸資料庫建立流佇列:
主庫:
SQL> show user;
USER is "STRMADMIN"
SQL> begin
2 dbms_streams_adm.set_up_queue(
3 queue_table => 'ora_queue_table',
4 queue_name => 'ora_queue');
5 end;
6 /
PL/SQL procedure successfully completed.
備庫:
SQL> show user;
USER is "STRMADMIN"
SQL> begin
2 dbms_streams_adm.set_up_queue(
3 queue_table => 'storm_queue_table',
4 queue_name => 'storm_queue');
5 end;
6 /
PL/SQL procedure successfully completed.
第八步,構造實驗用使用者:
主庫:
SQL> conn / as sysdba
Connected.
SQL> alter user scott account unlock;
User altered.
SQL> grant connect, resource to scott;
Grant succeeded.
SQL> conn scott/tiger
ERROR:
ORA-28001: the password has expired
Changing password for scott
New password:
Retype new password:
Password changed
Connected.
SQL> create table penguin(id number);
Table created.
SQL> insert into penguin values (1);
1 row created.
SQL> insert into penguin values (2);
1 row created.
SQL> select * from penguin;
ID
----------
1
2
備庫:
SQL> alter user scott account unlock;
User altered.
SQL> grant connect, resource to scott;
Grant succeeded.
第九步,建立捕獲程式:
connect strmadmin/strmadmin
SQL> begin
2 dbms_streams_adm.add_schema_rules(
3 schema_name => 'scott',
4 streams_type => 'capture',
5 streams_name => 'capture_ora',
6 queue_name => 'strmadmin.ora_queue',
7 include_dml => true,
8 include_ddl => true,
9 include_tagged_lcr => false,
10 source_database => null,
11 inclusion_rule => true);
12 end;
13 /
PL/SQL procedure successfully completed.
第十步,匯入匯出資料:
主庫下匯出檔案:
oracle@hpvm5:/home/db/oracle$exp userid=scott/tiger file='/arch/scott.dmp' object_consistent=y rows=y
Export: Release 10.2.0.1.0 - Production on Tue Jan 19 15:34:55 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses WE8ISO8859P1 character set (possible charset conversion)
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user SCOTT
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user SCOTT
About to export SCOTT's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export SCOTT's tables via Conventional Path ...
. . exporting table BONUS 0 rows exported
. . exporting table DEPT 4 rows exported
. . exporting table EMP 14 rows exported
. . exporting table PENGUIN 2 rows exported
. . exporting table SALGRADE 5 rows exported
. exporting synonyms
. exporting views
. exporting stored procedures
. exporting operators
. exporting referential integrity constraints
. exporting triggers
. exporting indextypes
. exporting bitmap, functional and extensible indexes
. exporting posttables actions
. exporting materialized views
. exporting snapshot logs
. exporting job queues
. exporting refresh groups and children
. exporting dimensions
. exporting post-schema procedural objects and actions
. exporting statistics
Export terminated successfully without warnings.
將匯出的檔案vscott.dmp遠端上傳到備庫:
oracle@hpvm5:/home/db/oracle$ftp 128.199.38.27
Connected to 128.199.38.27.
220 hpvm1 FTP server (Revision 1.1 Version wuftpd-2.6.1(PHNE_34698) Fri Nov 10 10:21:03 GMT 2006) ready.
Name (128.199.38.27:root): root
331 Password required for root.
Password:
230 User root logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> bin
200 Type set to I.
ftp> cd /arch
250 CWD command successful.
ftp> lcd /arch
Local directory now /arch
ftp> put scott.dmp
200 PORT command successful.
150 Opening BINARY mode data connection for scott.dmp.
226 Transfer complete.
8192 bytes sent in 0.00 seconds (63492.06 Kbytes/s)
ftp> bye
221-You have transferred 8192 bytes in 1 files.
221-Total traffic for this session was 8687 bytes in 1 transfers.
221-Thank you for using the FTP service on hpvm1.
221 Goodbye.
備庫下匯入檔案scott.dmp:
$ imp userid=scott/tiger file='/arch/scott.dmp' ignore=y commit=y streams_instantiation=y fromuser=scott touser=scott
$ sqlplus scott/tiger
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Jan 19 15:37:54 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
SQL> select * from penguin;
ID
----------
1
2
第十一步,主庫下建立傳播程式:
SQL> show user;
USER is "STRMADMIN"
SQL> begin
2 dbms_streams_adm.add_schema_propagation_rules(
3 schema_name => 'scott',
4 streams_name => 'ora_to_storm',
5 source_queue_name => 'strmadmin.ora_queue',
6 destination_queue_name => 'strmadmin.storm_queue@storm
可以基於Database級別或Table級別,啟用追加日誌(Supplemental Log)。在建立根據Schema粒度進行復制的Oracle Stream環境中,如果確認Schema下所有Table都有合理的主鍵(Primary Key),則不再需要啟用追加日誌。
#啟用Database 追加日誌
alter database add supplemental log data;
#啟用Table追加日誌
alter table add supplement log group log_group_name(table_column_name) always;
第六步,建立DBlink:
主庫:
SQL> conn strmadmin/strmadmin
Connected.
SQL> create database link storm connect to strmadmin identified by strmadmin using 'storm';
Database link created.
備庫:
SQL> conn strmadmin/strmadmin
Connected.
SQL> create database link ora connect to strmadmin identified by strmadmin using 'ora';
Database link created.
第七步,以strmadmin使用者登陸資料庫建立流佇列:
主庫:
SQL> show user;
USER is "STRMADMIN"
SQL> begin
2 dbms_streams_adm.set_up_queue(
3 queue_table => 'ora_queue_table',
4 queue_name => 'ora_queue');
5 end;
6 /
PL/SQL procedure successfully completed.
備庫:
SQL> show user;
USER is "STRMADMIN"
SQL> begin
2 dbms_streams_adm.set_up_queue(
3 queue_table => 'storm_queue_table',
4 queue_name => 'storm_queue');
5 end;
6 /
PL/SQL procedure successfully completed.
第八步,構造實驗用使用者:
主庫:
SQL> conn / as sysdba
Connected.
SQL> alter user scott account unlock;
User altered.
SQL> grant connect, resource to scott;
Grant succeeded.
SQL> conn scott/tiger
ERROR:
ORA-28001: the password has expired
Changing password for scott
New password:
Retype new password:
Password changed
Connected.
SQL> create table penguin(id number);
Table created.
SQL> insert into penguin values (1);
1 row created.
SQL> insert into penguin values (2);
1 row created.
SQL> select * from penguin;
ID
----------
1
2
備庫:
SQL> alter user scott account unlock;
User altered.
SQL> grant connect, resource to scott;
Grant succeeded.
第九步,建立捕獲程式:
connect strmadmin/strmadmin
SQL> begin
2 dbms_streams_adm.add_schema_rules(
3 schema_name => 'scott',
4 streams_type => 'capture',
5 streams_name => 'capture_ora',
6 queue_name => 'strmadmin.ora_queue',
7 include_dml => true,
8 include_ddl => true,
9 include_tagged_lcr => false,
10 source_database => null,
11 inclusion_rule => true);
12 end;
13 /
PL/SQL procedure successfully completed.
第十步,匯入匯出資料:
主庫下匯出檔案:
oracle@hpvm5:/home/db/oracle$exp userid=scott/tiger file='/arch/scott.dmp' object_consistent=y rows=y
Export: Release 10.2.0.1.0 - Production on Tue Jan 19 15:34:55 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses WE8ISO8859P1 character set (possible charset conversion)
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user SCOTT
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user SCOTT
About to export SCOTT's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export SCOTT's tables via Conventional Path ...
. . exporting table BONUS 0 rows exported
. . exporting table DEPT 4 rows exported
. . exporting table EMP 14 rows exported
. . exporting table PENGUIN 2 rows exported
. . exporting table SALGRADE 5 rows exported
. exporting synonyms
. exporting views
. exporting stored procedures
. exporting operators
. exporting referential integrity constraints
. exporting triggers
. exporting indextypes
. exporting bitmap, functional and extensible indexes
. exporting posttables actions
. exporting materialized views
. exporting snapshot logs
. exporting job queues
. exporting refresh groups and children
. exporting dimensions
. exporting post-schema procedural objects and actions
. exporting statistics
Export terminated successfully without warnings.
將匯出的檔案vscott.dmp遠端上傳到備庫:
oracle@hpvm5:/home/db/oracle$ftp 128.199.38.27
Connected to 128.199.38.27.
220 hpvm1 FTP server (Revision 1.1 Version wuftpd-2.6.1(PHNE_34698) Fri Nov 10 10:21:03 GMT 2006) ready.
Name (128.199.38.27:root): root
331 Password required for root.
Password:
230 User root logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> bin
200 Type set to I.
ftp> cd /arch
250 CWD command successful.
ftp> lcd /arch
Local directory now /arch
ftp> put scott.dmp
200 PORT command successful.
150 Opening BINARY mode data connection for scott.dmp.
226 Transfer complete.
8192 bytes sent in 0.00 seconds (63492.06 Kbytes/s)
ftp> bye
221-You have transferred 8192 bytes in 1 files.
221-Total traffic for this session was 8687 bytes in 1 transfers.
221-Thank you for using the FTP service on hpvm1.
221 Goodbye.
備庫下匯入檔案scott.dmp:
$ imp userid=scott/tiger file='/arch/scott.dmp' ignore=y commit=y streams_instantiation=y fromuser=scott touser=scott
$ sqlplus scott/tiger
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Jan 19 15:37:54 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
SQL> select * from penguin;
ID
----------
1
2
第十一步,主庫下建立傳播程式:
SQL> show user;
USER is "STRMADMIN"
SQL> begin
2 dbms_streams_adm.add_schema_propagation_rules(
3 schema_name => 'scott',
4 streams_name => 'ora_to_storm',
5 source_queue_name => 'strmadmin.ora_queue',
6 destination_queue_name => 'strmadmin.storm_queue@storm
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/90618/viewspace-659948/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle 11g RAC到單例項OGG同步Oracle單例
- oracle rac 單個例項不能生成awr報告的問題Oracle
- rac恢復到單例項單例
- RAC+DG(asm單例項)ASM單例
- RAC+單例項DG的切換單例
- ORA-29702複製RAC Oracle軟體啟動單例項Oracle單例
- 記錄一次Oracle 11.2.0.4 RAC異地恢復到單例項Oracle單例
- Oracle 資料庫巡檢指令碼 單例項 RAC 輸出HTML格式Oracle資料庫指令碼單例HTML
- oracle資料庫跨平臺(AIX)從RAC恢復至(linux)下的單例項Oracle資料庫AILinux單例
- Oracle 例項和RAC叢集下資料庫日誌目錄合集Oracle資料庫
- 將RAC軟體轉換為單例項軟體單例
- ORACLE11GR2 RAC解除安裝ASM例項步驟OracleASM
- oracle之 單例項監聽修改埠Oracle單例
- 將RAC備份集恢復為單例項資料庫單例資料庫
- 單例項Primary快速搭建Standby RAC參考手冊(19.16 ADG)單例
- Oracle搭建rac到單庫的adgOracle
- jq+css+html打造下拉導航選單例項CSSHTML單例
- oracle 11g 單例項資料庫的安裝Oracle單例資料庫
- 4.1. Oracle例項Oracle
- Oracle Far Sync例項Oracle
- oracle 12c RAC安裝,例項不能多節點同時啟動Oracle
- oracle資料庫與oracle例項Oracle資料庫
- ORACLE-LINUX環境字元介面單例項安裝OracleLinux字元單例
- Oracle 11G資料庫單例項安裝Oracle資料庫單例
- 【PSU】Oracle打PSU及解除安裝PSU(單例項)Oracle單例
- MySQL和Oracle的後設資料抽取例項分析KRGXMySqlOracle
- 從nub備份恢復(同平臺)恢復RAC至單例項單例
- 多個資料庫是否可以共有一個Oracle 11g RAC例項KG資料庫Oracle
- ORACLE事務和例項恢復過程梳理Oracle
- oracle 例項表查詢Oracle
- Networker恢復oracle rac到單機Oracle
- 【TUNE_ORACLE】Oracle 19c RAC搭建番外篇之RAC引數配置參考(四)Oracle
- JS 建立例項物件的四種模式JS物件模式
- 基本的 HTML 標籤 - 四個例項HTML
- oracle11g安裝 單例項 系統centos7Oracle單例CentOS
- 從例項出發,瞭解單例模式和靜態塊單例模式
- oracle RACOracle
- C#中WebService的建立、部署和呼叫的簡單例項C#Web單例
- 類和例項