Oracle数据库10gR2中stream多源复制方法(2)
exclude_flags => dbms_streams_adm.exclude_flags_unsupported +
dbms_streams_adm.exclude_flags_dml + dbms_streams_adm.exclude_flags_ddl);
end;
/
如果参与复制的源库与目标库的db link等配置的正确,该过程将成功结束,
并且在strmadmin模式创建一系统用于复制的队列与字典表,如果db link配置出错,
执行pre_instantiation_setup过程时,将会报如下错误:
ORA-23621: Operation corresponding
3.用rman复制源库到目标库
a 对源库用rman进行备份,拷贝备份集与产生的归档到目标库,
并将目标库down下来,启动nomount状态。
rman nocatalog target /
rman>backup database;
rman>sqlalter system archive log current;
b 求得源库的scn
SQL>connect ;
SQL>set serveroutput on size 1000000
SQL>declare
until_scn number;
begin
until_scn:= dbms_flashback.get_system_change_number;
dbms_output.put_line(until scn: ||until_scn);
end;
/
until scn: 429596
c 用rman将源库复制到目标库
rman nocatalog target /
rman> connect auxiliary ;
rman> run
{
set until scn 429596;
duplicate target database to TEST
nofilenamecheck
open restricted;
}
d 重新命名目标库的global_name
alter database rename global_name to test99.net;
e 重新创建目标库的db link
connect ;
create database link test96.net connect to strmadmin
identified by strmadminpw using test96;
4.执行post_instantiation_setup过程
post_instantiation_setup也在源库执行,需要注意的参数是instantiation_scn?
它的取值是我们从源库上获的scn的值-1=429595.
SQL>connect ;
SQL>declare
empty_tbs dbms_streams_tablespace_adm.tablespace_set;
begin
dbms_streams_adm.post_instantiation_setup(
maintain_mode => GLOBAL,
tablespace_names => empty_tbs,
source_database => test96.net,
destination_database => test99.net,
perform_actions => true,
bi_directional => true,
include_ddl => true,
start_processes => true,
instantiation_scn => 429595,
exclude_schemas => *,
exclude_flags => dbms_streams_adm.exclude_flags_unsupported +
dbms_streams_adm.exclude_flags_dml + dbms_streams_adm.exclude_flags_ddl);
end;
/
在目标库禁止restricted session
SQL>connect as sysdba
SQL>alter system disable restricted session;
5.测试stream的配置结果
a 在test96上创建一个schema,并在该schema下创建一些对象,可以在test99上看到
b 在test99上创建一个schema,并在该schema下创建一些对象,可以在test96上看到
6 关于双向复制中avoid change cycling
查看目标库apply进程的tag:
COLUMN APPLY_NAME HEADING Apply Process Name FORMAT A30
COLUMN APPLY_TAG HEADING Tag Value FORMAT A30
SQL>connect as sysdba;
SELECT APPLY_NAME, APPLY_TAG FROM DBA_APPLY;
Apply Process Name Tag Value
相关新闻>>
- 发表评论
-
- 最新评论 更多>>