问题描述:物理备库在open数据库时报错ORA-01190,如下所示:
数据库:oracle 11.2.0.4
1、异常重现
SYS@orcldg> alter database open;
alter database open
*
ERROR at line 1:
ORA-10458: standby database requires recovery
ORA-01190: control file or data file 1 is from before the last RESETLOGS
ORA-01110: data file 1: '/u01/app/oracle/oradata/system.259.1132745549'
2、解决过程
SYS@orcldg> select hxfil   file_id,
  2         FHRLC   "RESET TIME",
  3         fhrlc_i "RESET COUNT",
  4         FHRLS   "RESET SCN",
  5         FHPRC   "LAST RESET TIME",
  6         FHPRC_I "LAST RESET COUNT",
  7         FHPRS   "LAST RESET SCN"
  8    from x$kcvfh;

   FILE_ID RESET TIME           RESET COUNT RESET SCN        LAST RESET TIME      LAST RESET COUNT LAST RESET SCN
---------- -------------------- ----------- ---------------- -------------------- ---------------- ----------------
         1 03/29/2023 11:32:23   1132745543 1                                                    0 0
         2 03/29/2023 11:32:23   1132745543 1                                                    0 0
         3 03/29/2023 11:32:23   1132745543 1                                                    0 0
         4 03/29/2023 11:32:23   1132745543 1                                                    0 0
         5 03/29/2023 11:32:23   1132745543 1                                                    0 0
         6 03/29/2023 11:32:23   1132745543 1                                                    0 0
         7 03/29/2023 11:32:23   1132745543 1                                                    0 0
         8 03/29/2023 11:32:23   1132745543 1                                                    0 0
         9 03/29/2023 11:32:23   1132745543 1                                                    0 0
        10 03/29/2023 11:32:23   1132745543 1                                                    0 0
        11 03/29/2023 11:32:23   1132745543 1                                                    0 0

   FILE_ID RESET TIME           RESET COUNT RESET SCN        LAST RESET TIME      LAST RESET COUNT LAST RESET SCN
---------- -------------------- ----------- ---------------- -------------------- ---------------- ----------------
        12 03/29/2023 11:32:23   1132745543 1                                                    0 0
        13 03/29/2023 11:32:23   1132745543 1                                                    0 0
        14 03/29/2023 11:32:23   1132745543 1                                                    0 0
        15 03/29/2023 11:32:23   1132745543 1                                                    0 0
        16 03/29/2023 11:32:23   1132745543 1                                                    0 0
        17 03/29/2023 11:32:23   1132745543 1                                                    0 0
        18 03/29/2023 11:32:23   1132745543 1                                                    0 0

18 rows selected.

SYS@orcldg> select hxfil,fhrls change#,fhrlc_i,fhrlc time from x$kcvfh;

     HXFIL CHANGE#             FHRLC_I TIME
---------- ---------------- ---------- --------------------
         1 1                1132745543 03/29/2023 11:32:23
         2 1                1132745543 03/29/2023 11:32:23
         3 1                1132745543 03/29/2023 11:32:23
         4 1                1132745543 03/29/2023 11:32:23
         5 1                1132745543 03/29/2023 11:32:23
         6 1                1132745543 03/29/2023 11:32:23
         7 1                1132745543 03/29/2023 11:32:23
         8 1                1132745543 03/29/2023 11:32:23
         9 1                1132745543 03/29/2023 11:32:23
        10 1                1132745543 03/29/2023 11:32:23
        11 1                1132745543 03/29/2023 11:32:23

     HXFIL CHANGE#             FHRLC_I TIME
---------- ---------------- ---------- --------------------
        12 1                1132745543 03/29/2023 11:32:23
        13 1                1132745543 03/29/2023 11:32:23
        14 1                1132745543 03/29/2023 11:32:23
        15 1                1132745543 03/29/2023 11:32:23
        16 1                1132745543 03/29/2023 11:32:23
        17 1                1132745543 03/29/2023 11:32:23
        18 1                1132745543 03/29/2023 11:32:23

18 rows selected.

SYS@orcldg> col name for a30
SYS@orcldg> col value for a20
SYS@orcldg> SELECT nam.ksppinm NAME, val.ksppstvl VALUE  FROM x$ksppi nam, x$ksppsv val WHERE nam.indx = val.indx  and nam.ksppinm='_allow_resetlogs_corruption';

NAME                           VALUE
------------------------------ --------------------
_allow_resetlogs_corruption    FALSE

--设置_allow_resetlogs_corruption为true,在数据库open过程中会跳过某些一致性检查。
SYS@orcldg> alter system set "_allow_resetlogs_corruption"=true scope=spfile;    

System altered.

SYS@orcldg> shutdown abort;
ORACLE instance shut down.
SYS@orcldg> startup mount;
ORACLE instance started.

Total System Global Area 2455228416 bytes
Fixed Size                  2255712 bytes
Variable Size             620758176 bytes
Database Buffers         1811939328 bytes
Redo Buffers               20275200 bytes
Database mounted.

SYS@orcldg> alter database open;

Database altered.

SYS@orcldg> alter system set "_allow_resetlogs_corruption"=false scope=spfile;    

System altered.

SYS@orcldg> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@orcldg> startup
ORACLE instance started.

Total System Global Area 2455228416 bytes
Fixed Size                  2255712 bytes
Variable Size             620758176 bytes
Database Buffers         1811939328 bytes
Redo Buffers               20275200 bytes
Database mounted.
Database opened.

SYS@orcldg> alter database recover managed standby database using current logfile disconnect from session;

Database altered.


参考文档:
http://blog.itpub.net/29618264/viewspace-2124635/
https://www.xifenfei.com/tag/ora-01190
https://www.modb.pro/db/5099