|
先找个测试环境按照如下操作做一下,如果可行,以后定期去处理。
自己整理了个测试脚本:
select 'DECLARE
app_scn NUMBER;
req_scn NUMBER;' || '
BEGIN
SELECT APPLIED_SCN,REQUIRED_CHECKPOINT_SCN INTO app_scn,req_scn FROM dba_capture WHERE capture_name=''&original_capture'';' || '
DBMS_cAPTURE_ADM.ALTER_CAPTURE(
capture_name => ''&temp_capture'',
start_scn => acked_scn,
first_scn => acked_scn);' || '
END;' || '
/'
from dual;
以下是文档说明:
Setting the First SCN for an Existing Capture Process
You can set the first SCN for an existing capture process using the ALTER_CAPTURE procedure in the DBMS_CAPTURE_ADM package. The specified first SCN must meet the following requirements:
It must be greater than the current first SCN for the capture process.
It must be less than or equal to the current applied SCN for the capture process. However, this requirement does not apply if the current applied SCN for the capture process is zero.
It must be less than or equal to the required checkpoint SCN for the capture process.
You can determine the current first SCN, applied SCN, and required checkpoint SCN for each capture process in a database using the following query:
SELECT CAPTURE_NAME, FIRST_SCN, APPLIED_SCN, REQUIRED_CHECKPOINT_SCN
FROM DBA_CAPTURE;
When you reset a first SCN for a capture process, information below the new first SCN setting is purged from the LogMiner dictionary for the capture process automatically. Therefore, after the first SCN is reset for a capture process, the start SCN for the capture process cannot be set lower than the new first SCN. Also, redo log files prior that contain information prior to the new first SCN setting will never be needed by the capture process.
For example, the following procedure sets the first SCN for a capture process named strm01_capture to 351232.
BEGIN
DBMS_CAPTURE_ADM.ALTER_CAPTURE(
capture_name => 'strm01_capture',
first_scn => 351232);
END;
/
--------------------------------------------------------------------------------
Note:
If the specified first SCN is higher than the current start SCN for the capture process, then the start SCN is set automatically to the new value of the first SCN.
If you need to capture changes in the redo log from a point in time in the past, then you can create a new capture process and specify a first SCN that corresponds to a previous data dictionary build in the redo log. The BUILD procedure in the DBMS_CAPTURE_ADM package performs a data dictionary build in the redo log.
You can query the DBA_LOGMNR_PURGED_LOG data dictionary view to determine which redo log files will never be needed by any capture process.
--------------------------------------------------------------------------------
See Also:
"SCN Values Relating to a Capture Process"
"The LogMiner Data Dictionary for a Capture Process"
"First SCN and Start SCN Specifications During Capture Process Creation"
"Displaying the Redo Log Files That Will Never Be Needed by Any Capture Process"
Setting the Start SCN for an Existing Capture Process
You can set the start SCN for an existing capture process using the ALTER_CAPTURE procedure in the DBMS_CAPTURE_ADM package. Typically, you reset the start SCN for a capture process if point-in-time recovery must be performed on one of the destination databases that receive changes from the capture process.
The specified start SCN must be greater than or equal to the first SCN for the capture process. You can determine the first SCN for each capture process in a database using the following query:
SELECT CAPTURE_NAME, FIRST_SCN FROM DBA_CAPTURE;
Also, when you reset a start SCN for a capture process, make sure the required redo log files are available to the capture process.
For example, the following procedure sets the start SCN for a capture process named strm01_capture to 750338.
BEGIN
DBMS_CAPTURE_ADM.ALTER_CAPTURE(
capture_name => 'strm01_capture',
start_scn => 750338);
END;
/
See Also:
"SCN Values Relating to a Capture Process"
Oracle Streams Replication Administrator's Guide for information about performing database point-in-time recovery on a destination database in a Streams environment |
|