10gR2最酷的stream模式配置
1 在stream进行配置前,需要做些准备工作
a 源库与目标库初始化参数的设置
alter system set aq_tm_processes=1 scope=spfile;
alter system set job_queue_processes=2 scope=spfile;
alter system set global_names=true scope=spfile;
alter system set streams_pool_size=20m scope=spfile;
说明streams_pool_size在生产环境中最好>200m
b 源库与目标库tnsnames.ora配置
确保正确,可用tnsping通
c 源库与目标库复制管理员的创建
create user strmadmin identified by strmadminpw
default tablespace &tbs_name quota unlimited on &tbs_name;
grant connect, resource, dba to strmadmin;
d 源库与目标库创建互连的数据链
connect strmadmin/strmadminpw@test96;
create database link test99.net connect to strmadmin
identified by strmadminpw using 'test99';
connect strmadmin/strmadminpw@test99;
create database link test96.net connect to strmadmin
identified by strmadminpw using 'test96';
说明:必须确保双方的数据库链是可以连通.
用pre_instantiation_setup/post_instantiation_setup过程时
db link必须用db_name.domain的格式
e 源库与目标库必须处于归档模式
shutdown immediate;
startup mount;
alter database archivelog;
alter database open;
f 源库与目标库必须创建directory
create directory dir_test96 as '/home/oracle/worksh';
create directory dir_test99 as '/home/oracle/worksh';
6 创建测试用的schemas
create user yekai identified by yekai
default tablespace &tbs_name quota unlimited on &tbs_name;
grant connect,resource to yekai;
2 在源库执行MAINTAIN_SCHEMAS过程
SQL>connect strmadmin/strmadminpw@test96;
begin
dbms_streams_adm.maintain_schemas(
schema_names
=> 'yekai',
source_directory_object
=> 'dir_test96',
destination_directory_object
=> 'dir_test99',
source_database
=> 'test96.net',
destination_database
=> 'test99.net',
perform_actions => true,
include_ddl
=> true,
instantiation
=> dbms_streams_adm.instantiation_schema_network);
end;
/
说明:在执行maintain_schemas时,源库与目标库必须创建directory,然后在源库执行,
目标库几乎什么都不用做,stream环境已经配置好啦,测试(略)
|