ORACLE11GR2_ADG Management TRUNCATE table in the recovery of the main library

Source: Internet
Author: User

Standby Library Open Flashback database
#关闭备库的同步SQL> alter database recover managed standby database cancel;Database altered.SQL> select flashback_on from v$database;FLASHBACK_ON------------------NOSQL> alter database flashback on;Database altered.SQL> select flashback_on from v$database;FLASHBACK_ON------------------YESSQL> alter database recover managed standby database using current logfile disconnect;Database altered.
View sync status, archive for real-time application of Master Library
#主库上执行SQL > Set linesize 300sql> col DESTINATION format a10sql> Col db_unique_name format a10sql> Col database_ Mode format a20sql> Col recovery_mode format a20sql> Col synchronization_status format a10sql> Col gap_status for Mat a10sql> SELECT destination,db_unique_name,type,status,database_mode,recovery_mode,archived_thread#, Archived_seq#,applied_seq#,synchronization_status,gap_status from V$archive_dest_status WHERE status <> '         DEFERRED ' and STATUS <> ' INACTIVE ';D estinatio db_unique_ TYPE STATUS database_mode Recovery_mode archived_thread# archived_seq# applied_seq# Synchroniz gap_status---------------------------------------------       ---------------------------------------------------------------------------------------------------NONE LOCAL VALID OPEN IDLE 1 0 CHECK                                               CONF                                                                                      Igurationsnewtest Snewtest Physi CAL VALID open_read-only MANAGED REAL time AP 1, CHECK CONF NO GA                                                              P PLY Igurationsql> SELECT CURRENT_SCN from V$database; CURRENT_SCN-----------4410236
Incorrect operation of the main library truncate out the table test
SQL> truncate table test;Table truncated.SQL> select count(*) from test;  COUNT(*)----------         0#记录scnSQL> SELECT CURRENT_SCN FROM V$DATABASE;CURRENT_SCN-----------    4410383#通过logminer搜索一定范围内的archivelog,确定drop操作对应的准确SCN号 SQL> exec dbms_logmnr.start_logmnr(startscn=>4410236,endscn=>4410383,options=>DBMS_LOGMNR.DICT_FROM_ONLINE_CATALOG + DBMS_LOGMNR.CONTINUOUS_MINE);PL/SQL procedure successfully completed.SQL> col sql_redo format a110SQL> set linesize 180SQL> select scn,sql_redo,timestamp from v$logmnr_contents where table_name='TEST';       SCN SQL_REDO                                                                                                       TIMESTAMP---------- -------------------------------------------------------------------------------------------------------------- ---------   4410319 truncate table test;   #确定flashback database的目标时间为4410319
Execute flashback database on the standby
SQL>  select count(*) from test;  COUNT(*)----------         0SQL> alter database recover managed standby database cancel;Database altered.SQL> flashback database to scn 4410236;Flashback complete.SQL> alter database open read only;Database altered.SQL> select count(1) from test;  COUNT(1)----------        23
Restore data to the main library using Dblink or DataPump

:
Create Public database link System_snewtest connect to sys identified by "Oracle" Using ' snewtest ';
INSERT INTO Test select * from [email protected]_snewtest;

SQL> select count(1) from test;    COUNT(1)----------        23
Re-open the MRP on the standby library
SQL> alter database recover managed standby database using current logfile disconnect  ;Database altered.SQL> select count(1) from test;    COUNT(1)----------        2

ORACLE11GR2_ADG Management TRUNCATE table in the recovery of the main library

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.