Şöyle yaparız
DROP USER myuser CASCADE;
CREATE USER adv IDENTIFIED BY "2Ab}7C";
GRANT ALL PRIVILEGES TO myuser;
GRANT EXECUTE ON utl_file TO myuser;
COMMIT;
QUIT
DROP USER myuser CASCADE;
CREATE USER adv IDENTIFIED BY "2Ab}7C";
GRANT ALL PRIVILEGES TO myuser;
GRANT EXECUTE ON utl_file TO myuser;
COMMIT;
QUIT
Açıklaması şöyle. Yani burada SYS'ye ait tablolara da erişim veriliyor.GRANT SELECT ON DBA_SCHEDULER_JOBS TO MYUSER;GRANT SELECT ON v_$database TO MYUSER;
v$database is actually a public synonym for the v_$database view owned by sys (checked in Oracle 12).
CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED MYSCHEMA.JavaToolsASpackage util.oracle;import java.io.*;import java.net.InetAddress;import java.util.List;public class JavaTools {public static double pingOSCommand(String Command){double time = -1;try {Process process = Runtime.getRuntime().exec(Command);process.waitFor();BufferedReader stdInput = new BufferedReader( new InputStreamReader(process.getInputStream()));BufferedReader stdError = new BufferedReader( new InputStreamReader(process.getErrorStream()));while ((String s = stdInput.readLine()) != null) {if (s.contains("time=")) {if (s.contains("ms")){time = Double.parseDouble(s.substring(s.indexOf("time=")+5, s.indexOf("ms")-1));}}}while ((s = stdError.readLine()) != null) {System.out.println(s);}return time;} catch (Exception e){System.out.println(e.getMessage());return -1;}}};//******************************************************************************/GRANT EXECUTE ON JAVA SOURCE MYSCHEMA.RailwayJavaTools TO MYUSER;COMMIT;Execute dbms_java.grant_permission( 'MYUSER', 'SYS:java.io.FilePermission', '<<ALL FILES>>', 'execute');execute dbms_java.grant_permission( 'MYUSER', 'SYS:java.lang.RuntimePermission', 'writeFileDescriptor', '*' );execute dbms_java.grant_permission( 'MYUSER', 'SYS:java.lang.RuntimePermission', 'readFileDescriptor', '*' );COMMIT;
CREATE OR REPLACE PACKAGE MYSCHEMA.MyTools AS function f_pingOSCommand(command varchar2) return number; END MyTools; / CREATE OR REPLACE PACKAGE body MYSCHEMA.MyTools AS function f_pingOSCommand(command varchar2) return number as language java NAME 'util.oracle.JavaTools.pingOSCommand(java.lang.String) return double'; end MYTools; /
SELECT MYSCHEMA.MyTools.f_pingOSCommand(?) FROM DUAL
DBMS_APPLY_ADM.START_APPLY(apply_name => 'SYNC_APPLY_1'); ... DBMS_APPLY_ADM.STOP_APPLY(apply_name => 'SYNC_APPLY_1'); DBMS_APPLY_ADM.DELETE_ALL_ERRORS(apply_name => 'SYNC_APPLY_1');
1. You cannot use Oracle Streams to replicate a table which has duplicate rows. It will not work.
2. If you don’t have unique constraint on your table in some form, you will have duplicate rows.
--on source CONNECT strmadmin/strmadminpw; CREATE DATABASE LINK REP01 CONNECT TO strmadmin IDENTIFIED BY strmadminpw USING 'REP01'; select count(*) from dba_tables@REP01; -- on target CONNECT strmadmin/strmadminpw; CREATE DATABASE LINK DB05 CONNECT TO strmadmin IDENTIFIED BY strmadminpw USING 'DB05'; select count(*) from dba_tables@DB05
DBMS_STREAMS_ADM.SET_UP_QUEUE(queue_table =>'STRADMIN.SQT_IMMEDIATE1_S',queue_name => 'STRADMIN.SQ_IMMEDIATE_S');
DBMS_STREAMS_ADM.ADD_TABLE_RULES( table_name => ..., streams_type => 'apply', streams_name => ..., queue_name => ... );
Synchronous Mode
Synchronous Capture uses triggers on the source database to capture change data. It has no latency because the change data is captured continuously and in real-time on the source database. The change tables are populated when DML operations on the source table are committed. Hence it is titled “Synchronous” Change Data Capture.
New change data arrives automatically as DML operations on the source tables are committed. Publishers can define new change sets in the predefined SYNC_SOURCE change source or use the predefined change set, SYNC_SET. The SYNC_SET change set cannot be altered or dropped.
While the “invasive” nature of the approach of the synchronous mode of Change Data Capture adds overhead to the source database at capture time, this mode can reduce costs (as compared to attempting to extract change data using table differencing or change-value section) by simplifying the extraction of change data.
DBMS_STREAMS_ADM.ADD_TABLE_RULES(table_name=>'DEV110.APP_QUEUE', streams_type=>'capture', streams_name=>'CAPTURE_110DEV', queue_name=>'REP_CAPTURE_QUEUE', include_dml=>TRUE, include_ddl=>TRUE, include_tagged_lcr=> FALSE, source_database=>'DB05', inclusion_rule=>FALSE, and_condition=>NULL);
srvctl status listener
srvctl status database -db MYDB