分类: 服务器与存储
2009-04-05 21:48:05
connect system/passwd@SH create user repadmin identified by repadmin; begin dbms_repcat_admin.grant_admin_any_schema( username=>’repadmin’); end; / grant comment any table to REPADMIN; grant lock any table to REPADMIN; |
grant select any dictionary to REPADMIN; |
begin dbms_defer_sys.reGISter_purpagator(username=>’repadmin’); end; |
disconnect; connect repadmin/repadmin@SH; begin dbms_defer_sys.schedule_purge( next_date=>sysdate,interval=>’sysdate + 1’,delay_seconds=>0); end; |
disconnect; connect system/passwd@SH; create user proxy_bjoracle identified by proxy_bjoracle; begin dbms_repcat_admin.register_user_repgroup( user_name=>’proxy_bjoracle, privilege_type => ’proxy_snapadmin’,list_of_gnames => NULL); end; / grant select_catalog_role to proxy_bjoracle; |
disconnect; connect repadmin/repadmin@SH; begin dbms_repcat.create_master_repgroup(gname=>’sh_rep’); end; / |
begin dbms_repcat.create_master_repobject( gname=>’sh_rep’, type=>’TABLE’, oname=>’ CREDIT_CARD’ sname=>’SHORACL’ use_existing_object=>TRUE, copy_rows=>TRUE); end; |
begin dbms_repcat.create_master_repobject( gname=>’sh_rep’, type=>’INDEX’, oname=>’ INDEX_CREDIT_CARD’ sname=>’SHORACL’ use_existing_object=>TRUE, copy_rows=>FALSE); end; / |
begin dbms_repcat.set_columns( sname => ’SHORACL’, oname => ’ CREDIT_CARD ’, column_list => ’ CREDIT_CARD_ID’); end; / |
begin dbms_repcat.generate_replication_support( sname=>’SHORACL’, oname=>’ CREDIT_CARD’, type=>’TABLE’, min_communication=>TRUE); end; / |
create materialized view log on SHORACL. CREDIT_CARD; |
create materialized view log on SHORACL. CREDIT_CARD with rowid excluding new values; |
begin dbms_repcat.resume_master_activity( name=>’sh_rep’); end; / |
disconnect; connect system/passwd@BJ; create user mvadmin identified by mvadmin; begin dbms_repcat_admin. grant_admin_any_schema(username=> ’mvadmin’); end; / grant comment any table to mvadmin; grant lock any table to mvadmin; grant select any dictionary to mvadmin; |
begin dbms_defer_sys.reGISter_propagator( username => ’mvadmin’); end; / |
create public database link ORACLSH using ’Oracle.shanghai. com’; |
create public database link ORACLSH using ’(description= (address=(protocol=tcp)(host=127.0.0.1)(port=1521)) (connect_data=(service_name=oracl)))’ |
disconnect; connect mvadmin/mvadmin@BJ; begin dbms_defer_sys.schedule_purge( next_date => sysdate, interval => ’/*1:hr*/ sysdate + 1’, delay_seconds => 0, rollback_segment => ’’); end; |
create database link ORACLSH connect to proxy_bjoracle identified by proxy_bjoralce Connect to ... Identified by ...子句指明用什么用户连接远程数据库 |
begin dbms_defer_sys.schedule_push( destination => ’ora92zjk’,interval => ’/*1:hr*/ sysdate + 1’, next_date => sysdate,stop_on_error => false, delay_seconds => 0,parallelism => 0); end; / |
disconnect; connect system/passwd@BJ; grant alter session to crm; grant create cluster to crm; grant create database link to crm; grant create sequence to crm; grant create session to crm; grant create synonym to crm; grant create table to crm; grant create view to crm; grant create procedure to crm; grant create trigger to crm; grant unlimited tablespace to crm; grant create type to crm; grant create any snapshot to crm; grant alter any snapshot to crm; |
disconnect; connect SHORACL/SHORACL@BJ; create database link ORACLSH connect to ORACL identified by ORACL; |
disconnect; connect mvadmin/mvadmin@BJ; create materialized view SHORACL.CREDIT_CARD refresh fast wit h pr imar y key as sele ct * from ORA CL. CREDIT_CARD@ORACLSH; |
create materialized view SHORACL. CREDIT_CARD refresh fast with rowid as select * from ORACL. CREDIT_CARD@ORACLSH; |
begin dbms_refresh.make ( name => ’mvadmin.sh_refresh’,list => ’’, next_date => sysdate,interval => ’sysdate + 1’, implicit_destroy => false,rollback_seg => ’’, push_deferred_rpc => true,refresh_after_errors => false); end; |
begin dbms_refresh.add (name => ’mvadmin.sh_refresh’,list => ’SHORACL.CREDIT_CARD ’,lax => true); end; / |
a) declare rc binary_integer; begin rc := sys.dbms_defer_sys. purge( delay_seconds=>0); end; b) declare rc binary_integer; begin rc := sys.dbms_defer_sys. push(destination=>’ORACLSH’, stop_on_error=>FALSE, delay_seconds=>0, parallelism=>0); end; c) dbms_refresh.refresh(’"MVADMIN"."SH_REFRESH"’); |
begin dbms_job.run(job_no); end; / |