Oracle 10g Stream表级复制配置

1.实验环境配置
 本次实验在vmware9.0环境下进行,安装的操作系统CentOS-6.4-x86_64,数据库版本是Oracle10g10.2.0.1,源库和目标库都安装了数据库,源库ORACLE_SID=myorcl,目标库ORACLE_SID=orcl


 2.在源库与目标库初始化参数设置
 在源库操作如下:
 
SQL> select instance_name,status from v$instance;

INSTANCE_NAME    STATUS
 ---------------- ------------
 myorcl          OPEN

SQL> alter system set aq_tm_processes=1 scope=spfile;    --队列等待时间

SQL> alter system set job_queue_processes=2 scope=spfile;    --至少为2

SQL> alter system set global_names=true scope=spfile;  --用来控制database link同名

SQL> alter database rename global_name to myorcl.net;

SQL> alter system set streams_pool_size=50m scope=spfile;
 重启数据库并查看设置的global_name,如下:

SQL> shutdown immediate
 SQL> startup
 SQL> select * from global_name;

GLOBAL_NAME
 --------------------------------------------------------------------------------
 MYORCL.NET
 在目标库操作,如下:
 
SQL> select instance_name,status from v$instance;

INSTANCE_NAME    STATUS
 ---------------- ------------
 orcl            OPEN

SQL> alter system set aq_tm_processes=1 scope=spfile;

SQL> alter system set job_queue_processes=2 scope=spfile;

SQL> alter system set global_names=true scope=spfile;

SQL> alter database rename global_name to orcl.net;

SQL> alter system set streams_pool_size=50m scope=spfile;
 SQL> shutdown immediate
 重启数据库并查看设置的global_name,如下:

SQL> shutdown immediate
 SQL> startup

 


SQL> select * from global_name;

GLOBAL_NAME
 --------------------------------------------------------------------------------
 ORCL.NET

3.在源库和目标库配置tnsnames.ora,如下:

primary =
 
  (DESCRIPTION =
 
    (ADDRESS_LIST =
 
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.41.6.118)(PORT = 1521))
 
    )
 
    (CONNECT_DATA =
 
      (SERVICE_NAME = myorcl)
 
    )
 
  )
 
standby =
 
  (DESCRIPTION =
 
    (ADDRESS_LIST =
 
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.41.6.119)(PORT = 1521))
 
    )
 
    (CONNECT_DATA =
 
      (SERVICE_NAME = orcl)
 
    )
 
  )
 
测试能否连通,如下:
 首先关闭防火墙,service iptables stop
 在源库测试,如下:

[oracle@dayong ~]$ tnsping standby

TNS Ping Utility for Linux: Version 10.2.0.1.0 - Production on 03-APR-2014 11:47:41
 
Copyright (c) 1997, 2005, Oracle.  All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
 Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.41.6.119)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = orcl)))
 OK (10 msec)

在目标库测试,如下:
 [oracle@xiaoru ~]$ tnsping primary

TNS Ping Utility for Linux: Version 10.2.0.1.0 - Production on 03-APR-2014 11:53:24
 
Copyright (c) 1997, 2005, Oracle.  All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
 Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.41.6.118)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = myorcl)))
 OK (0 msec)

4.源库和目标库复制管理员的创建
 不能使用sys和system作为流管理员,流管理员不能使用system表空间作为默认表空间;
 源库操作如下:
 SQL> create tablespace streamtbs datafile '/u01/app/oradata/myorcl/streamtbs.dbf' size 100m;
 
SQL> create user streamadmin identified by oracle default tablespace streamtbs quota unlimited on streamtbs;
 
SQL> grant connect,resource,dba to streamadmin;

目标库操作如下:
 SQL> create tablespace streamtbs datafile '/u01/app/oradata/orcl/streamtbs.dbf' size 100m;
 
SQL> create user streamadmin identified by oracle default tablespace streamtbs quota unlimited on streamtbs;
 
SQL>  grant connect,resource,dba to streamadmin;

 

相关推荐