早上接到医院电话,医院的一台备机网断了,恢复网络重启服务器后备库登陆不上了,看了下alert
Beginning Standby Crash Recovery.
Serial Media Recovery started
Managed Standby Recovery starting Real Time Apply
Media Recovery Waiting for thread 1 sequence 80215
Fetching gap sequence in thread 1, gap sequence 80215-80314
ARC3: Archival started
ARC0: STARTING ARCH PROCESSES COMPLETE
Sun May 19 10:57:43 2019
Standby crash recovery need archive log for thread 1 sequence 80215 to continue.
Please verify that primary database is transporting redo logs to the standby database.
Wait timeout: thread 1 sequence 80215
Standby Crash Recovery aborted due to error 16016.
Errors in file D:\APP\ADMINISTRATOR\diag\rdbms\tphybak\tphybak\trace\tphybak_ora_3516.trc:
ORA-16016: ?? 1 sequence# 80215 ????????
Recovery interrupted!
Some recovered datafiles maybe left media fuzzy
Media recovery may continue but open resetlogs may fail
Completed Standby Crash Recovery.
看日志提示 归档日志少了一段,80215-80314,然后查了下归档,现在都到85629了!!
也就是说很长一段时间 他主库传过来的日志在备库都没有应用了(要不然为什么要那么久的log去做media recovery)
主库备库上找了找,都没有这段归档日志了,且主库的最远备份是3天前的,也就是是只能重建备库了。
重建备库步骤:
1、删除备库所有的数据文件、日志文件和控制文件
2、备份备库的参数文件和密码文件
3、备库startup nomount
4、进入主库连接备库
rman target sys/xxx auxiliary sys/x'x'x@tphybak
(在这步我遇到了两个问题:
1.备库密码不对------解决办法是把主库的密码文件复制过来改名
2.rman连不上备库,RMAN-04006: 来自辅助数据库的错误: ORA-12528: TNS: 监听程序: 所有适用例程都无法建立新连接------解决办法是备库监听用静态注册)
5、复制主库数据文件、日志文件、控制文件到备库
duplicate target database for standby from active database nofilenamecheck;
6、打开备库
alter database open;
7、应用日志
alter database recover managed standby database using current logfile disconnect from session;
(这两步我也犯了个错,先7再6了,结果open一直提示ORA-10456: cannot open standby database; media recovery session may be in progress
这个的原因是恢复模式不可打开数据库,所以先要cancel日志应用,再打开库,再开启日志应用
操作流程如下:
1)alter database recover managed standby database cancel;
2)alter database open;
3)alter database recover managed standby database using current logfile disconnect from session;)
8、主库创建表插入数据,备库查询验证