一、 oracle 利用flashback将备库激活为read wirte
SQL> alter system switch logfile; System altered. SQL> |
SQL> alter database recover managed standby database cancel;
Database altered.
SQL> |
SQL> create restore point restore_point_dg guarantee flashback database;
Restore point created.
SQL> |
(这样后台不会报错,防止主库传输数据到备库)
官方解释
defer
Specifies that valid destination information and attributes are preserved, but the destination is excluded from archiving operations until re-enable
SQL> alter system set log_archive_dest_state_2=defer; |
SQL> alter database activate standby database;
Database altered.
SQL> alter database open;
Database altered.
SQL> |
SQL> select open_mode from v$database;
OPEN_MODE ---------- READ WRITE
SQL> |
二、 导出数据
expdp \" sys\oracle as sysdba\" DIRECTORY= DATA_PUMP_DIR DUMPFILE=expdp_f%U.dmp LOGFILE=expdp_f.log FILESIZE=10g FULL=y PARALLEL=8 FLASHBACK_TIME=systimestamp |
附:执行导出日志。
三、 准备重新恢复到dg备库环境
1. 重启数据库到mount状态。SQL> startup mount force;
ORACLE instance started.
Total System Global Area 450953216 bytes Fixed Size 2254144 bytes Variable Size 301992640 bytes Database Buffers 138412032 bytes Redo Buffers 8294400 bytes Database mounted. |
2. 闪回数据库
SQL> flashback database to restore point restore_point_dg;
Flashback complete.
SQL>
SQL> shutdown immediate; ORA-01507: database not mounted ORACLE instance shut down. |
3. 把激活的备库重新转换成备库
SQL> startup nomount; ORACLE instance started.
Total System Global Area 450953216 bytes Fixed Size 2254144 bytes Variable Size 301992640 bytes Database Buffers 138412032 bytes Redo Buffers 8294400 bytes SQL> alter database mount;
Database altered.
SQL> alter database convert to physical standby; |
4. 主库操作,使能log_archive_dest_state_2
SQL> alter system set log_archive_dest_state_2=enable scope=both;
System altered.
SQL> |
5. 备库操作,检查进程是否正常
SQL> select process,status from v$managed_standby;
PROCESS STATUS --------- ------------ ARCH CONNECTED ARCH CONNECTED ARCH CLOSING ARCH CLOSING RFS IDLE RFS IDLE RFS IDLE MRP0 WAIT_FOR_LOG
8 rows selected. |
四、 验证是否同步
col dest_name for a20 col status for a20 col error for a20 select dest_name,status,error from v$archive_dest
说明: 出现log_archive_dest_1 valid log_archive_dest_2 valid 这样的提示说明已经连通。 |
alter database recover managed standby database disconnect from session; |
select database_role,protection_level,open_mode from v$database; select switchover_status from v$database; |
select thread#, low_sequence#, high_sequence# from v$archive_gap; |
select group#,members,bytes/1024/1024,status from v$log; select group# ,thread#, sequence#,archived from v$log; |
alter system switch logfile; alter system checkpoint; |
select sequence#,applied from v$archived_log; |
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/16615244/viewspace-1870415/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/16615244/viewspace-1870415/