1.1 切换日志
|
SQL> alter system switch logfile; System altered. SQL> |
1.1 备库操作,取消归档应用
|
SQL> alter database recover managed standby database cancel;
Database altered.
SQL> |
1.2 创建还原点
|
SQL> create restore point restore_point_dg guarantee flashback database;
Restore point created.
SQL> |
1.3 主库操作,将备库的归档目的设置为defer
(这样后台不会报错,防止主库传输数据到备库)
官方解释
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; |
1.4 将备库激活为read/wirte
|
SQL> alter database activate standby database;
Database altered.
SQL> alter database open;
Database altered.
SQL> |
1.5 备库状态为read/write
|
SQL> select open_mode from v$database;
OPEN_MODE ---------- READ WRITE
SQL> |
1.6 到此可以在备库Export操作了
2.1 对于11 G执行命令
|
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 |
附:执行导出日志。
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. |
1)远程归档目录查看
|
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 这样的提示说明已经连通。 |
2)如果没有问题则应用日志:
|
alter database recover managed standby database disconnect from session; |
3)查看当前的数据库角色
|
select database_role,protection_level,open_mode from v$database; select switchover_status from v$database; |
4)查看当前数据库是否有gap.
|
select thread#, low_sequence#, high_sequence# from v$archive_gap; |
5)查看当前日志序列号
|
select group#,members,bytes/1024/1024,status from v$log; select group# ,thread#, sequence#,archived from v$log; |
6)切换日志文件
|
alter system switch logfile; alter system checkpoint; |
7)查看当前日志应用情况
|
select sequence#,applied from v$archived_log; |
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/16615244/viewspace-1870415/ ,如需转载,请注明出处,否则将追究法律责任。