16086问题修复详细过程(2)

3,重建redo log
再查看下看一下现在的redo log状态
select group#,bytes/1024/1024,members,status from v$log;
SQL> select group#,bytes/1024/1024,members,status from v$log;


GROUP# BYTES/1024/1024 MEMBERS STATUS
---------- --------------- ---------- ----------------
1 50 1 UNUSED
2 50 1 CLEARING
3 50 1 CLEARING_CURRENT

redo log损坏,但是clear不管用,因为是备库 read-only不让切换日志
重建redo日志文件,先停redo应用
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

alter database add logfile group 4 ('/home/oradata/powerdes/redo04.log') size 50M;
alter database add logfile group 5 ('/home/oradata/powerdes/redo05.log') size 50M;
alter database add logfile group 6 ('/home/oradata/powerdes/redo06.log') size 50M;

日志管理是自动的,所以不能操作,要先设置成手动管理的
SQL> alter system set standby_file_management='manual';
System altered.
SQL> alter database add logfile group 4 ('/home/oradata/powerdes/redo04.log') size 50M;
Database altered.
SQL> alter database add logfile group 5 ('/home/oradata/powerdes/redo05.log') size 50M;
Database altered.
SQL> alter database add logfile group 6 ('/home/oradata/powerdes/redo06.log') size 50M;
Database altered.
SQL>

查看一下日志状态
SQL> select group#,bytes/1024/1024,members,status from v$log;
GROUP# BYTES/1024/1024 MEMBERS STATUS
---------- --------------- ---------- ----------------
1 50 1 CLEARING_CURRENT
2 50 1 CLEARING
3 50 1 CLEARING
4 50 1 UNUSED
5 50 1 UNUSED
6 50 1 UNUSED

6 rows selected.

清空redo日志组
SQL>
alter database clear logfile group 1;
alter database clear logfile group 2;
alter database clear logfile group 3;

SQL>
alter database clear logfile group 1;
alter database clear logfile group 2;
alter database clear logfile group 3;

Database altered.

SQL>
Database altered.

SQL>
Database altered.

SQL>

查看redo 日志组信息
SQL> select group#,bytes/1024/1024,members,status from v$log;
GROUP# BYTES/1024/1024 MEMBERS STATUS
---------- --------------- ---------- ----------------
1 50 1 CURRENT
2 50 1 UNUSED
3 50 1 UNUSED
4 50 1 UNUSED
5 50 1 UNUSED
6 50 1 UNUSED

6 rows selected.

alter database drop logfile group 1;
alter database drop logfile group 2;
alter database drop logfile group 3;

SQL>
alter database drop logfile group 1;
alter database drop logfile group 2;
alter database drop logfile group 3;

Database altered.

SQL>
Database altered.

SQL> alter database drop logfile group 3
*
ERROR at line 1:
ORA-01623: log 3 is current log for instance powerdes (thread 1) - cannot drop
ORA-00312: online log 3 thread 1: '/home/oradata/powerdes/redo03.log'

SQL>

4,检查归档文件是否完整
从库redo log损坏了的话,只要从库的归档日志在,还是可以修复的,不用重新做Standy。
从库上执行check:
SQL> SELECT DISTINCT THREAD#,max(SEQUENCE#) OVER(PARTITION BY THREAD#) A FROM V$ARCHIVED_LOG;
THREAD# A
---------- ----------
1 23826
SQL>

主库上执行check:
SQL> SELECT DISTINCT THREAD#,max(SEQUENCE#) OVER(PARTITION BY THREAD#) A FROM V$ARCHIVED_LOG;
THREAD# A
---------- ----------
1 24022

SQL>
取出primary和standy库上各线程已经归档文件最大序列号,看到两者不相同,必须将多出的序列号对应的归档文件复制到standy库。
也就是说主库从库的归档日志相差蛮大的。

如何查看归档路径,最高可用模式的时候 dg会尽力的让日志应用到standby
去查一下
SELECT GROUP#,THREAD#,SEQUENCE#,ARCHIVED,STATUS FROM V$STANDBY_LOG;
从库:
SQL> SELECT GROUP#,THREAD#,SEQUENCE#,ARCHIVED,STATUS FROM V$STANDBY_LOG;
no rows selected
SQL>

主库:
SQL> SELECT GROUP#,THREAD#,SEQUENCE#,ARCHIVED,STATUS FROM V$STANDBY_LOG;
no rows selected
SQL>
表名从库的standby log都空的,需要重建standby log。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/cad3dd69be1c5c87ae197ec2f221fb99.html