Professional Documents
Culture Documents
-- create the tablespace on both sides, but most important the downstream site:
BEGIN
DBMS_STREAMS_AUTH.GRANT_ADMIN_PRIVILEGE(
grantee => ' DWSTREAMS ',
grant_privileges => true);
END;
/
conn dwstreams/dwstreams;
LOCATION - place where archived-logs will be written from the standby redo logs
coming from the source site.
Note : We didn’t specify the log_archive_dest_2 location in the test as we don’t want
to create the archive log in any other location. It will create in the same location as
where we enable the archive log.
System altered.
Creating standby redo-logs to receive redo data from Source:
==============================================
Note:
- The standby log file size must exactly match (or be larger than) the source
database log file size.
- The number of standby log file groups must be at least one more than the number
of online log file groups on the source database.
For example, the source database has three online redo log file groups and each log
file size of 50 MB. In this case, use the following statements to create the appropriate
standby log file groups:
Database altered.
Database altered.
Database altered.
**************************************************
*** Preparing the Source site (ORCL102C) ****
**************************************************
1) Enable Shipping of online redo log data from Source to Downstream database:
==================================================
System altered.
NOREGISTER - Specify this attribute so that the location of the archived redo log files
is not
recorded in the downstream database control file.
*********************************************
**** Setting up Streams Replication ****
*********************************************
NAME QUEUE_TABLE
------------------------------------------------------------------------------------------ -------------------------------------------------
AQ$_DOWNSTREAM_Q_TABLE_E DOWNSTREAM_Q_TABLE
DOWNSTREAM_Q DOWNSTREAM_Q_TABLE
SQL> BEGIN
DBMS_APPLY_ADM.CREATE_APPLY(
queue_name => 'dwstreams.DOWNSTREAM_Q',
apply_name => 'DOWNSTREAM_APPLY',
apply_captured => TRUE
);
END; 2 3 4 5 6 7
8 /
ALLOW_DUPLICATE_ROWS N NO
COMMIT_SERIALIZATION FULL NO
DISABLE_ON_ERROR Y NO
DISABLE_ON_LIMIT N NO
MAXIMUM_SCN INFINITE NO
PARALLELISM 1 NO
STARTUP_SECONDS 0 NO
TIME_LIMIT INFINITE NO
TRACE_LEVEL 0 NO
TRANSACTION_LIMIT INFINITE NO
TXN_LCR_SPILL_THRESHOLD 10000 NO
WRITE_ALERT_LOG Y NO
Value:
Capture process
Conn dwstreams/dwstreams
SQL> BEGIN
DBMS_CAPTURE_ADM.CREATE_CAPTURE(
queue_name => 'dwstreams.DOWNSTREAM_Q',
capture_name => 'DOWNSTREAM_CAPTURE',
rule_set_name => NULL,
start_scn => NULL,
source_database => 'DSTRM',
use_database_link => true,
first_scn => NULL,
logfile_assignment => 'implicit');
END;
/
CAPTURE_NAME STATUS
------------------------------------------------------------------------------------------ ------------------------
CAPTURE_STREAM ENABLED
DOWNSTREAM_CAPTURE DISABLED
SQL> BEGIN
DBMS_CAPTURE_ADM.SET_PARAMETER(
capture_name => 'DOWNSTREAM_CAPTURE',
parameter => 'downstream_real_time_mine',
value => 'y');
END;
/ 2 3 4 5 6 7
Note :Archiving the current log file at the source database starts real time
mining of the source database redo log.
BEGIN
DBMS_STREAMS_ADM.ADD_SCHEMA_RULES(
schema_name => ' TSTDWSTREAMS',
streams_type => 'capture',
streams_name => 'downstream_capture',
queue_name => 'dwstreams.downstream_q',
include_dml => true,
include_ddl => true,
include_tagged_lcr => false,
source_database => 'DSTRM',
inclusion_rule => TRUE);
END;
/
- From Source:
exp system/manager owner=tstdwstreams file= tstdwstreams.dump log=
tstdwstreams.log object_consistent=Y
-- From Downstream:
Note:
When doing STREAMS_INSTANTIATION=Y and having the export done with
object_consistent=Y, the instantiation SCN for the apply will be modified to the SCN
at the time the export was taken, and this will insure that data at the target is
consistent with data at the source.
DECLARE
iscn NUMBER; -- Variable to hold instantiation SCN value
BEGIN
iscn := DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER@DSTRM; -- Get current SCN from
Source
DBMS_APPLY_ADM.SET_SCHEMA_INSTANTIATION_SCN(
source_schema_name => ' TSTDWSTREAMS ',
source_database_name => 'DSTRM',
instantiation_scn => iscn,
recursive => TRUE);
END;
/
* You have to make sure that objects between source and downstream are consistent
at the time you set the instantiation manually, or you may end up with ORA-01403.
conn strmadmin/strmadmin
conn strmadmin/strmadmin
***********************
*** Testing... ****
***********************
Source database :
1 row inserted
Sql> commit;
Target database
Check whether the inserted data replicated in the Target database or not.
Monitoring Scripts:
CAPTURING CHANGES - Scanning the redo log for changes that evaluate to TRUE against the
capture process rule sets.
WAITING FOR DICTIONARY REDO - Waiting for redo log files containing the dictionary
build related to the first SCN to be added to the capture process session. A capture process cannot
begin to scan the redo log files until all of the log files containing the dictionary build have been
added.
PAUSED FOR FLOW CONTROL - Unable to enqueue LCRs either because of low memory or
because propagations and apply processes are consuming messages slower than the capture
process is creating them. This state indicates flow control that is used to reduce spilling
of captured messages when propagation or apply has fallen behind or is unavailable
ENQUEUING MESSAGE - Enqueuing an LCR that satisfies the capture process rule sets into
the capture process queue.
2) SELECT CAPTURE_NAME,
(ELAPSED_CAPTURE_TIME/100) ELAPSED_CAPTURE_TIME,
(ELAPSED_RULE_TIME/100) ELAPSED_RULE_TIME,
(ELAPSED_ENQUEUE_TIME/100) ELAPSED_ENQUEUE_TIME,
(ELAPSED_LCR_TIME/100) ELAPSED_LCR_TIME,
(ELAPSED_PAUSE_TIME/100) ELAPSED_PAUSE_TIME
FROM V$STREAMS_CAPTURE;
APPLY_NAME STATE
------------------------------------------------------------------------------------------ -------------------------------------
DOWNSTREAM_APPLY DEQUEUE MESSAGES
APPLY_NAME STATE
------------------------------------------------------------------------------------------ --------------------------------------
DOWNSTREAM_APPLY IDLE
APPLY_NAME STATE
------------------------------------------------------------------------------------------ --------------------------------------
DOWNSTREAM_APPLY IDLE