ITPub博客

首页 > Linux操作系统 > Linux操作系统 > STREAMS-单向复制(1)

STREAMS-单向复制(1)

原创 Linux操作系统 作者:www_xylove 时间:2013-07-29 13:55:11 0 删除 编辑

Oracle11gr2 streams replication in a two database

(流复制-单向复制-单表复制)

1.创建streams管理用户

 首先创建管理用户strmadmin的表空间streams_tbs

CREATE TABLESPACE streams_tbs DATAFILE 'C:\app\oradata\dbmaster\streams_tbs.dbf'

  SIZE 100M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;

 创建管理用户strmadmin

CREATE USER strmadmin IDENTIFIED BY strmadmin DEFAULT TABLESPACE streams_tbs QUOTA UNLIMITED ON streams_tbs;

 授予dba权限给管理用户strmadmin

GRANT DBA TO strmadmin;

 授予GRANT_ADMIN_PRIVILEGE权限给管理用户 strmadmin

BEGIN

  DBMS_STREAMS_AUTH.GRANT_ADMIN_PRIVILEGE(

    grantee          => 'strmadmin',   

    grant_privileges => TRUE);

END;

/

 

使用GRANT_ADMIN_PRIVILEGE产生下面的脚本,并且执行之:

  首先创建directory目录.

CREATE DIRECTORY strms_dir AS 'c:\streams\admin';

  运行 GRANT_ADMIN_PRIVILEGE过程,产生grant_strms

_privs.sql脚本.放置在c:\streams\admin目录下面.

BEGIN

  DBMS_STREAMS_AUTH.GRANT_ADMIN_PRIVILEGE(

    grantee          => 'strmadmin',   

    grant_privileges => FALSE,

    file_name        => 'grant_strms_privs.sql',

    directory_name   => 'strms_dir');

END;

/

生成脚本:grant_strms_privs.sql

 

执行脚本:

@c:\streams\admin\grant_strms_privs.sql

 

destination database进行相同的操作

(略)

2.配置网络连接与dblink

DBMASTER =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.23.5.212)(PORT = 1521))

    )

    (CONNECT_DATA =

      (SERVICE_NAME = dbmaster.com)

    )

  )

 

DBSNAP =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.23.5.211)(PORT = 1521))

    )

    (CONNECT_DATA =

      (SERVICE_NAME = dbsnap.com)

    )

  )

 

C:\Users\user>sqlplus strmadmin/strmadmin@dbmaster

 

CREATE DATABASE LINK dbsnap.com CONNECT TO strmadmin

   IDENTIFIED BY password USING 'dbsnap.com';

 

SQL> select * from global_name@dbsnap.com;

 

GLOBAL_NAME

----------------------------------

DBSNAP.COM

 

C:\Users\user>sqlplus strmadmin/strmadmin@dbsnap

SQL> select * from global_name@dbmaster.com;

 

GLOBAL_NAME

-----------------------------------------

DBMASTER.COM

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/21266384/viewspace-767359/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2010-11-12

  • 博文量
    99
  • 访问量
    220724