欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

ORA-01156 ORA-01275 备库重建redo 报错

程序员文章站 2022-06-03 18:30:38
...

今天 redo 的路径不对, 导致 dataguard 备库的 不能open:ORA-01275: 自动进行备用文件管理时, 不允许进行 ADD LOGFILE 操作

今天 redo 的路径不对, 导致 dataguard 备库的 不能open:

ORA-01275: 自动进行备用文件管理时, 不允许进行 ADD LOGFILE 操作

下面来说一下:

先看一下备库的信息:
SQL> select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
RECOVERY NEEDED
SQL> select database_role , open_mode from v$database;
DATABASE_ROLE OPEN_MODE
---------------- ----------
PHYSICAL STANDBY MOUNTED
SQL> alter database recover managed standby database cancel;
alter database recover managed standby database cancel
*
第 1 行出现错误:
ORA-16136: ?????????

SQL> alter database recover managed standby database disconnect from session;
数据库已更改。
SQL> alter database open;
alter database open
*
第 1 行出现错误:
ORA-16004: ?????????
ORA-01152: ?? 1 ???????????
ORA-01110: ???? 1: 'C:\Oracle\PRODUCT\10.2.0\ORADATA\SHENG\SYSTEM01.DBF'
检查一下alert 日志:
发现undo 文件没有从主库上copy 到备库:
----------------
把primary 上的undospace copy 到standby 上后:
SQL> alter database recover managed standby database disconnect from session;
数据库已更改。
SQL> alter database open;
alter database open
*
第 1 行出现错误:
ORA-01154: ????????????, ??, ?????
检查一下备库的alert 日志:
Clearing online redo logfile 1 D:\ORACLE\PRODUCT\10.2.0\ORADATA\SHENG\REDO01.LOG
Clearing online log 1 of thread 1 sequence number 11
Sat Dec 31 10:14:26 2011
Errors in file c:\oracle\product\10.2.0\admin\sheng\bdump\sheng_mrp0_1724.trc:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\SHENG\REDO01.LOG'
ORA-27041: unable to open file
OSD-04002: 无法打开文件
O/S-Error: (OS 21) 设备未就绪。
Sat Dec 31 10:14:26 2011
Errors in file c:\oracle\product\10.2.0\admin\sheng\bdump\sheng_mrp0_1724.trc:
ORA-19527: physical standby redo log must be renamed
ORA-00312: online log 1 thread 1: 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\SHENG\REDO01.LOG'
看一下备库上的redo :
SQL> set wrap off
SQL> select * from v$logfile;
行将被截断

GROUP# STATUS TYPE MEMBER
---------- ------- ------- -----------------------------------------------------
3 ONLINE D:\ORACLE\PRODUCT\10.2.0\ORADATA\SHENG\REDO03.LOG
2 ONLINE D:\ORACLE\PRODUCT\10.2.0\ORADATA\SHENG\REDO02.LOG
1 ONLINE D:\ORACLE\PRODUCT\10.2.0\ORADATA\SHENG\REDO01.LOG

很明显,备机上没有相关联的路径:
好,,下面进行redo log 的重建和 standby redo log 的重建:
SQL> alter database drop logfile group 1;
alter database drop logfile group 1
*
第 1 行出现错误:
ORA-01156: ??????????????
ORA-01156:
ORA-01275: 自动进行备用文件管理时, 不允许进行 ADD LOGFILE 操作。
关闭数据库,在开启状态下。将auto修改成manual
SQL>alter system set standby_file_management=manual

alter database rename 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\SHENG\REDO03.LOG' to 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\SHENG\REDO03.LOG';
alter database rename 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\SHENG\REDO01.LOG' to 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\SHENG\REDO01.LOG';
alter database rename 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\SHENG\REDO02.LOG' to 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\SHENG\REDO02.LOG';

在添加:
SQL> alter database add standby logfile group 4 ('C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\redo04.log') size 50m;

SQL> alter database add standby logfile group 5 ('C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\redo05.log') size 50m;

SQL> alter database add standby logfile group 6 ('C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\redo06.log') size 50m;

SQL> alter database add standby logfile group 7 ('C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\redo07.log') size 50m;


SQL> select * from v$logfile;

GROUP# STATUS TYPE MEMBER
---------- ------- ------- -----------------------------------------------------
3 ONLINE C:\ORACLE\PRODUCT\10.2.0\ORADATA\SHENG\REDO03.LOG
2 ONLINE C:\ORACLE\PRODUCT\10.2.0\ORADATA\SHENG\REDO02.LOG
1 ONLINE C:\ORACLE\PRODUCT\10.2.0\ORADATA\SHENG\REDO01.LOG
4 STANDBY C:\ORACLE\PRODUCT\10.2.0\ORADATA\SHENG\REDO04.LOG
5 STANDBY C:\ORACLE\PRODUCT\10.2.0\ORADATA\SHENG\REDO05.LOG
6 STANDBY C:\ORACLE\PRODUCT\10.2.0\ORADATA\SHENG\REDO06.LOG
7 STANDBY C:\ORACLE\PRODUCT\10.2.0\ORADATA\SHENG\REDO07.LOG
已选择7行。

ORA-01156 ORA-01275 备库重建redo 报错