创建非常简单,只需要在目标端执行下列过程即可(如果是有多个表空间要复制,只需要再添加t_names(2),t_names(3)...t_names(n)即可):
JSSSTR> DECLARE
2 t_names DBMS_STREAMS_TABLESPACE_ADM.TABLESPACE_SET;
3 BEGIN
4 -- Tablespace names
5 t_names(1) := ¨WEBDATA¨;
6 DBMS_STREAMS_ADM.MAINTAIN_TTS(
7 tablespace_names => t_names,
8 source_directory_object => ¨mydt_source¨,
9 destination_directory_object => ¨mydt_dest¨,
10 source_database => ¨jssweb.jss.cn¨,
11 destination_database => ¨jssstr.jss.cn¨,
12 dump_file_name => ¨webdt_rep.dmp¨,
13 perform_actions => true,
1 4 include_ddl => true);
1 5 END;
1 6 /
PL/SQL 过程已成功完成。
JSSSTR> conn strmadmin/strmadmin
已连接。
JSSSTR> select capture_name,status,capture_type from dba_capture;
CAPTURE_NAME STATUS CAPTURE_TY
------------------------------ -------- ----------
JSSWEB$CAP ENABLED DOWNSTREAM
JSSSTR> select propagation_name,status from dba_propagation;
PROPAGATION_NAME STATUS
------------------------------ --------
PROPAGATION$_75 ENABLED
JSSSTR> select apply_name,status from dba_apply;
APPLY_NAME STATUS
------------------------------ --------
APPLY$_JSSWEB_82 ENABLED
JSSWEB> insert into member.dt_tbl1 values (101,¨a¨);
1 row created.
JSSWEB> alter table member.dt_tbl1 add (vl varchar2(20));
Table altered.
JSSWEB> alter system switch logfile;
System altered.
JSSSTR> select count(0) from dt_tbl1;
COUNT(0)
----------
101
JSSSTR> desc dt_tbl1;
名称 是否为空? 类型
---------------------------------- -------- -------------------------------
ID NOT NULL NUMBER
NAME NOT NULL VARCHAR2(30)
VL VARCHAR2(20)
与前章全库级复制中方式一模一样,这里就不重复演示了。仅提示一点,这里我们配置了下游捕获,在移除了streams配置环境后,不要忘了在源端修改log_archive_dest_n参数,去掉归档日志的发送。