單例項和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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 單例項和RAC打造的ORACLE STREAM(完)單例Oracle
- 單例項和RAC打造的ORACLE STREAM(三)單例Oracle
- 單例項和RAC打造的ORACLE STREAM(二)單例Oracle
- 單例項和RAC打造的ORACLE STREAM(一)單例Oracle
- oracle單例項轉RACOracle單例
- Oracle DataBase單例項遷移到Oracle RACOracleDatabase單例
- oracle rac及單例項開啟歸檔Oracle單例
- Oracle 11g RAC 配置單例項 DataGuardOracle單例
- RAC起單例項make單例
- oracle單例項通過dataguard遷移到RAC 轉Oracle單例
- RAC 例項 遷移到 單例項 -- 使用RMAN Duplicate單例
- oracle 10g rac 單例項恢復至ORACLE10G RAC RMANOracle 10g單例
- RAC+DG(asm單例項)ASM單例
- rac恢復到單例項單例
- 搭建RAC到單例項DG單例
- 單例項恢復至RAC單例
- Oracle 11g RAC到單例項OGG同步Oracle單例
- RAC+單例項DG的切換單例
- rac到單例項的rman恢復單例
- oracle rac 單個例項不能生成awr報告的問題Oracle
- Oracle11g使用rman從單例項遷移到racOracle單例
- Oracle 9i RAC向單例項遷移手記Oracle單例
- oracle10g單例項遷移至3節點RACOracle單例
- Oracle 10g 安裝及單例項遷移到RACOracle 10g單例
- 單例項環境利用備份恢復RAC資料庫(四)單例資料庫
- 單例項和RAC下建立表空間的小區別單例
- 單例項opatch出現RAC資訊單例
- OGG搭建(rac到-->單例項)單例
- RAC asm恢復到單例項ASM單例
- 從單例項資料庫轉換到RAC環境——RAC的建立和配置單例資料庫
- 判斷oracle是否是rac例項Oracle
- 利用STANDBY將單例項資料庫升級為RAC環境(四)單例資料庫
- Oracle 11g RAC 配置單例項 DataGuard(通過 DUPLICATE 方式)Oracle單例
- 單例項備份恢復成RAC單例
- rac asm 恢復到 單例項 1ASM單例
- rac asm 恢復到 單例項 2ASM單例
- RAC從帶庫到單例項的恢復單例
- ORA-29702複製RAC Oracle軟體啟動單例項Oracle單例