Bo's Oracle Station

【博客文章2024】疑难场景处置:恢复带有多个历史化身的RAC 19c数据库时,因备份部分缺失而导致的连续出现UNNAME00000X问题的成功处置

2024-3-22 21:18| 发布者: admin| 查看: 76| 评论: 0|原作者: Bo Tang

摘要: 记录了恢复带有多个历史化身的RAC 19c数据库时,因备份部分缺失而导致的连续出现UNNAME00000X问题的成功处置的全部过程。
【博客文章2024】疑难场景处置:恢复带有多个历史化身的RAC 19c数据库时,因备份部分缺失而导致的连续出现UNNAME00000X问题的成功处置



Author: Bo Tang

1. 疑难场景描述

 

    一套RAC 19c数据库启动失败:

     

[root@station11 ~]# . oraenv

ORACLE_SID = [root] ? +ASM1

The Oracle base has been set to /u01/app/grid

[root@station11 ~]# crsctl start cluster -all 

CRS-2672: Attempting to start 'ora.cssd' on 'station11'

CRS-2672: Attempting to start 'ora.diskmon' on 'station11'

CRS-2672: Attempting to start 'ora.cssd' on 'station12'

CRS-2672: Attempting to start 'ora.diskmon' on 'station12'

CRS-2676: Start of 'ora.diskmon' on 'station11' succeeded

CRS-2676: Start of 'ora.diskmon' on 'station12' succeeded

CRS-2676: Start of 'ora.cssd' on 'station11' succeeded

CRS-2672: Attempting to start 'ora.cluster_interconnect.haip' on 'station11'

CRS-2672: Attempting to start 'ora.ctssd' on 'station11'

CRS-2676: Start of 'ora.cssd' on 'station12' succeeded

CRS-2672: Attempting to start 'ora.ctssd' on 'station12'

CRS-2672: Attempting to start 'ora.cluster_interconnect.haip' on 'station12'

CRS-2676: Start of 'ora.ctssd' on 'station11' succeeded

CRS-2676: Start of 'ora.ctssd' on 'station12' succeeded

CRS-2676: Start of 'ora.cluster_interconnect.haip' on 'station11' succeeded

CRS-2672: Attempting to start 'ora.asm' on 'station11'

CRS-2676: Start of 'ora.cluster_interconnect.haip' on 'station12' succeeded

CRS-2672: Attempting to start 'ora.asm' on 'station12'

CRS-2676: Start of 'ora.asm' on 'station12' succeeded

CRS-2672: Attempting to start 'ora.storage' on 'station12'

CRS-2676: Start of 'ora.asm' on 'station11' succeeded

CRS-2672: Attempting to start 'ora.storage' on 'station11'

CRS-2676: Start of 'ora.storage' on 'station11' succeeded

CRS-2672: Attempting to start 'ora.crsd' on 'station11'

CRS-2676: Start of 'ora.crsd' on 'station11' succeeded

CRS-2676: Start of 'ora.storage' on 'station12' succeeded

CRS-2672: Attempting to start 'ora.crsd' on 'station12'

CRS-2676: Start of 'ora.crsd' on 'station12' succeeded

 
    从上面的输出来看,似乎CLUSTER启动成功了,但是数据库实际上没有启动成功。station11和station12两台主机上分别运行着racorcl1和racorcl2实例。数据库名为racorcl.example.com。目前两个实例都无法启动:

[oracle@station11 ~]$ srvctl status database -d racorcl -v 

Instance racorcl1 is not running on node station11

Instance racorcl2 is not running on node station12


    从sqlplus的报错信息来看,表面上看是data file 1无法被识别造成的:

[oracle@station11 ~]$ sqlplus /nolog


SQL*Plus: Release 19.0.0.0.0 - Production on Thu Mar 7 16:28:19 2024

Version 19.3.0.0.0


Copyright (c) 1982, 2019, Oracle.  All rights reserved.


SQL> conn / as sysdba

Connected to an idle instance.

SQL> startup

ORACLE instance started.


Total System Global Area 4949276568 bytes

Fixed Size                  8906648 bytes

Variable Size            1040187392 bytes

Database Buffers         3892314112 bytes

Redo Buffers                7868416 bytes

Database mounted.

ORA-01157: cannot identify/lock data file 1 - see DBWR trace file

ORA-01110: data file 1: '+DATA/RACORCL/DATAFILE/system.283.1162980303'

 
    同时发现:thread 1 sequence 7日志也缺失:

[grid@station11 ~]$ asmcmd ls +FRA/RACORCL/ARCHIVELOG/2024_03_07 | sort -n -t . -k 3 

thread_2_seq_3.271.1162981899

thread_1_seq_7.275.1162984797

thread_1_seq_8.274.1162984797

thread_2_seq_4.270.1162985105

thread_2_seq_5.269.1162985107

thread_2_seq_6.268.1162985111

thread_2_seq_7.267.1162985111

thread_1_seq_9.266.1162985113

thread_2_seq_8.261.1162985113

thread_2_seq_9.262.1162985119

thread_1_seq_10.256.1162996409

thread_1_seq_9.282.1162996409

thread_2_seq_10.259.1162996409

thread_2_seq_9.260.1162996409

thread_2_seq_1.258.1162996415

thread_2_seq_2.287.1162996935

thread_2_seq_3.292.1162996939

thread_1_seq_1.293.1162996941

thread_2_seq_4.294.1162996943

thread_2_seq_5.295.1162996945

thread_2_seq_6.296.1162996945

thread_1_seq_2.298.1162996949

thread_2_seq_7.297.1162996949

thread_1_seq_2.272.1162998105

thread_1_seq_3.257.1162998107

thread_2_seq_7.263.1162998153

thread_2_seq_8.278.1162998153

thread_1_seq_4.273.1162998397

thread_1_seq_5.265.1162998399

thread_1_seq_6.299.1162998407

thread_2_seq_9.300.1162998409

*************缺失thread 1 seq 7

thread_1_seq_8.302.1162998411

thread_1_seq_9.303.1162998413

thread_2_seq_10.304.1162998419

thread_2_seq_11.305.1162998425


2. 第一次尝试恢复

    根据出错的反馈,还原全库备份,并进行set until sequence方式的恢复:

[oracle@station11 ~]$ rman target /


Recovery Manager: Release 19.0.0.0.0 - Production on Thu Mar 7 16:35:23 2024

Version 19.3.0.0.0


Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.


connected to target database: RACORCL (DBID=2908490689, not open)


RMAN> run {

2> set until sequence 7 thread 1;

3> restore database;

4> recover database;

5> }


executing command: SET until clause


Starting restore at 07-MAR-24

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=1712 instance=racorcl1 device type=DISK

allocated channel: ORA_DISK_2

channel ORA_DISK_2: SID=249 instance=racorcl1 device type=DISK

allocated channel: ORA_DISK_3

channel ORA_DISK_3: SID=1226 instance=racorcl1 device type=DISK

allocated channel: ORA_DISK_4

channel ORA_DISK_4: SID=1469 instance=racorcl1 device type=DISK

allocated channel: ORA_DISK_5

channel ORA_DISK_5: SID=1592 instance=racorcl1 device type=DISK

allocated channel: ORA_DISK_6

channel ORA_DISK_6: SID=1713 instance=racorcl1 device type=DISK

allocated channel: ORA_DISK_7

channel ORA_DISK_7: SID=1837 instance=racorcl1 device type=DISK

allocated channel: ORA_DISK_8

channel ORA_DISK_8: SID=5 instance=racorcl1 device type=DISK

allocated channel: ORA_DISK_9

channel ORA_DISK_9: SID=127 instance=racorcl1 device type=DISK

allocated channel: ORA_DISK_10

channel ORA_DISK_10: SID=250 instance=racorcl1 device type=DISK


RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of restore command at 03/07/2024 16:37:35

RMAN-06026: some targets not found - aborting restore

RMAN-06023: no backup or copy of datafile 8 found to restore

RMAN-06023: no backup or copy of datafile 7 found to restore

RMAN-06023: no backup or copy of datafile 5 found to restore

RMAN-06023: no backup or copy of datafile 4 found to restore

RMAN-06023: no backup or copy of datafile 3 found to restore

RMAN-06023: no backup or copy of datafile 2 found to restore

RMAN-06023: no backup or copy of datafile 1 found to restore


RMAN> 


    如果找不到数据文件的备份,就要希望有Recovery Catalog能够帮助提供备份元数据来帮助寻找数据文件的备份。由于这套RAC环境是生产环境,一直连接着Recovery Catalog运行,所以可以做下面的尝试:

[oracle@station11 ~]$ rman target / catalog urcat/oracle_4U@rcat


Recovery Manager: Release 19.0.0.0.0 - Production on Thu Mar 7 16:38:56 2024

Version 19.3.0.0.0


Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.


connected to target database: RACORCL (DBID=2908490689, not open)

connected to recovery catalog database


RMAN> run {

2> set until sequence 7 thread 1;

3> restore database;

4> recover database;

5> }


executing command: SET until clause


Starting restore at 07-MAR-24

starting full resync of recovery catalog

full resync complete

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=1226 instance=racorcl1 device type=DISK

allocated channel: ORA_DISK_2

channel ORA_DISK_2: SID=1469 instance=racorcl1 device type=DISK

allocated channel: ORA_DISK_3

channel ORA_DISK_3: SID=1591 instance=racorcl1 device type=DISK

allocated channel: ORA_DISK_4

channel ORA_DISK_4: SID=1712 instance=racorcl1 device type=DISK

allocated channel: ORA_DISK_5

channel ORA_DISK_5: SID=1837 instance=racorcl1 device type=DISK

allocated channel: ORA_DISK_6

channel ORA_DISK_6: SID=5 instance=racorcl1 device type=DISK

allocated channel: ORA_DISK_7

channel ORA_DISK_7: SID=127 instance=racorcl1 device type=DISK

allocated channel: ORA_DISK_8

channel ORA_DISK_8: SID=250 instance=racorcl1 device type=DISK

allocated channel: ORA_DISK_9

channel ORA_DISK_9: SID=373 instance=racorcl1 device type=DISK

allocated channel: ORA_DISK_10

channel ORA_DISK_10: SID=496 instance=racorcl1 device type=DISK


RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of restore command at 03/07/2024 16:39:30

RMAN-06026: some targets not found - aborting restore

RMAN-06023: no backup or copy of datafile 8 found to restore

RMAN-06023: no backup or copy of datafile 2 found to restore

 
    但是datafile 2和datafile 8仍然没有备份。查找生产环境的记录发现:datafile 2和datafile 8是两个新建的表空间对应的数据文件,可能没有及时备份。通过report schema进一步进行验证:

RMAN> report schema;

Report of database schema for database with db_unique_name RACORCL

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    900      SYSTEM               YES     +DATA/RACORCL/DATAFILE/system.283.1162980303
2    5        TBSOCP05_TEST2       NO      +DATA/RACORCL/DATAFILE/tbsocp05_test2.286.1162985105
3    510      SYSAUX               NO      +DATA/RACORCL/DATAFILE/sysaux.295.1162980337
4    350      UNDOTBS1             YES     +DATA/RACORCL/DATAFILE/undotbs1.288.1162980353
5    25       UNDOTBS2             YES     +DATA/RACORCL/DATAFILE/undotbs2.301.1162980561
7    5        USERS                NO      +DATA/RACORCL/DATAFILE/users.303.1162980353
8    5        TBSOCP05_TEST3       NO      +DATA/RACORCL/DATAFILE/tbsocp05_test3.284.1162996935

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    50       TEMP                 32767       +DATA/RACORCL/TEMPFILE/temp.304.1162998221

3. 使用控制文件脚本,第二次尝试恢复

    没有别的办法,只好先还原除了datafile 2和datafile 8以外的备份
 

RMAN> restore datafile 1,3,4,5,7;


Starting restore at 07-MAR-24
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
using channel ORA_DISK_5
using channel ORA_DISK_6
using channel ORA_DISK_7
using channel ORA_DISK_8
using channel ORA_DISK_9
using channel ORA_DISK_10

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00005 to +DATA/RACORCL/DATAFILE/undotbs2.301.1162980561
channel ORA_DISK_1: reading from backup piece +FRA/RACORCL/BACKUPSET/2024_03_07/nnndn0_1d_whole_incr0_0.279.1162981859
channel ORA_DISK_2: starting datafile backup set restore
channel ORA_DISK_2: specifying datafile(s) to restore from backup set
channel ORA_DISK_2: restoring datafile 00007 to +DATA/RACORCL/DATAFILE/users.303.1162980353
channel ORA_DISK_2: reading from backup piece +FRA/RACORCL/BACKUPSET/2024_03_07/nnndn0_1d_whole_incr0_0.264.1162981859
channel ORA_DISK_3: starting datafile backup set restore
channel ORA_DISK_3: specifying datafile(s) to restore from backup set
channel ORA_DISK_3: restoring datafile 00001 to +DATA/RACORCL/DATAFILE/system.283.1162980303
channel ORA_DISK_3: reading from backup piece +FRA/RACORCL/BACKUPSET/2024_03_07/nnndn0_1d_whole_incr0_0.284.1162981857
channel ORA_DISK_4: starting datafile backup set restore
channel ORA_DISK_4: specifying datafile(s) to restore from backup set
channel ORA_DISK_4: restoring datafile 00003 to +DATA/RACORCL/DATAFILE/sysaux.295.1162980337
channel ORA_DISK_4: reading from backup piece +FRA/RACORCL/BACKUPSET/2024_03_07/nnndn0_1d_whole_incr0_0.285.1162981857
channel ORA_DISK_5: starting datafile backup set restore
channel ORA_DISK_5: specifying datafile(s) to restore from backup set
channel ORA_DISK_5: restoring datafile 00004 to +DATA/RACORCL/DATAFILE/undotbs1.288.1162980353
channel ORA_DISK_5: reading from backup piece +FRA/RACORCL/BACKUPSET/2024_03_07/nnndn0_1d_whole_incr0_0.280.1162981857
channel ORA_DISK_1: piece handle=+FRA/RACORCL/BACKUPSET/2024_03_07/nnndn0_1d_whole_incr0_0.279.1162981859 tag=1D_WHOLE_INCR0
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:00
channel ORA_DISK_2: piece handle=+FRA/RACORCL/BACKUPSET/2024_03_07/nnndn0_1d_whole_incr0_0.264.1162981859 tag=1D_WHOLE_INCR0
channel ORA_DISK_2: restored backup piece 1
channel ORA_DISK_2: restore complete, elapsed time: 00:00:00
channel ORA_DISK_4: piece handle=+FRA/RACORCL/BACKUPSET/2024_03_07/nnndn0_1d_whole_incr0_0.285.1162981857 tag=1D_WHOLE_INCR0
channel ORA_DISK_4: restored backup piece 1
channel ORA_DISK_4: restore complete, elapsed time: 00:00:03
channel ORA_DISK_5: piece handle=+FRA/RACORCL/BACKUPSET/2024_03_07/nnndn0_1d_whole_incr0_0.280.1162981857 tag=1D_WHOLE_INCR0
channel ORA_DISK_5: restored backup piece 1
channel ORA_DISK_5: restore complete, elapsed time: 00:00:03
channel ORA_DISK_3: piece handle=+FRA/RACORCL/BACKUPSET/2024_03_07/nnndn0_1d_whole_incr0_0.284.1162981857 tag=1D_WHOLE_INCR0
channel ORA_DISK_3: restored backup piece 1
channel ORA_DISK_3: restore complete, elapsed time: 00:00:07
Finished restore at 07-MAR-24
starting full resync of recovery catalog
full resync complete

    遇到缺失部分备份的场景,重要的尝试方式就是:创建控制文件的脚本:

[oracle@station11 ~]$ sqlplus /nolog


SQL*Plus: Release 19.0.0.0.0 - Production on Thu Mar 7 16:46:25 2024

Version 19.3.0.0.0


Copyright (c) 1982, 2019, Oracle.  All rights reserved.


SQL> conn / as sysdba

Connected.

SQL> alter database backup controlfile to trace as '/home/oracle/control.sql';


Database altered.


    trace文件中有两个部分:set1和set2。我们的环境中由于日志文件缺失,需要resetlogs,所以使用set2部分:

--

--     Set #2. RESETLOGS case

--

-- The following commands will create a new control file and use it

-- to open the database.

-- Data used by Recovery Manager will be lost.

-- The contents of online logs will be lost and all backups will

-- be invalidated. Use this only if online logs are damaged.


-- After mounting the created controlfile, the following SQL

-- statement will place the database in the appropriate

-- protection mode:

--  ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE


STARTUP NOMOUNT

CREATE CONTROLFILE REUSE DATABASE "RACORCL" RESETLOGS  ARCHIVELOG

    MAXLOGFILES 192

    MAXLOGMEMBERS 3

    MAXDATAFILES 1024

    MAXINSTANCES 32

    MAXLOGHISTORY 292

LOGFILE

  GROUP 1 (

    '+DATA/RACORCL/ONLINELOG/group_1.293.1162980421',

    '+FRA/RACORCL/ONLINELOG/group_1.290.1162980421'

  ) SIZE 200M BLOCKSIZE 512,

  GROUP 2 (

    '+DATA/RACORCL/ONLINELOG/group_2.290.1162980421',

    '+FRA/RACORCL/ONLINELOG/group_2.289.1162980421'

  ) SIZE 200M BLOCKSIZE 512

-- STANDBY LOGFILE

DATAFILE

  '+DATA/RACORCL/DATAFILE/system.301.1163004103',

  '+DATA/RACORCL/DATAFILE/tbsocp05_test2.286.1162985105',

  '+DATA/RACORCL/DATAFILE/sysaux.288.1163004103',

  '+DATA/RACORCL/DATAFILE/undotbs1.283.1163004103',

  '+DATA/RACORCL/DATAFILE/undotbs2.302.1163004103',

  '+DATA/RACORCL/DATAFILE/users.295.1163004103',

  '+DATA/RACORCL/DATAFILE/tbsocp05_test3.284.1162996935'

CHARACTER SET AL32UTF8

;


    将其编辑,删除2号和8号文件,生成如下脚本:

CREATE CONTROLFILE REUSE DATABASE "RACORCL" RESETLOGS  ARCHIVELOG

    MAXLOGFILES 192

    MAXLOGMEMBERS 3

    MAXDATAFILES 1024

    MAXINSTANCES 32

    MAXLOGHISTORY 292

LOGFILE

  GROUP 1 (

    '+DATA/RACORCL/ONLINELOG/group_1.293.1162980421',

    '+FRA/RACORCL/ONLINELOG/group_1.290.1162980421'

  ) SIZE 200M BLOCKSIZE 512,

  GROUP 2 (

    '+DATA/RACORCL/ONLINELOG/group_2.290.1162980421',

    '+FRA/RACORCL/ONLINELOG/group_2.289.1162980421'

  ) SIZE 200M BLOCKSIZE 512

DATAFILE

  '+DATA/RACORCL/DATAFILE/system.301.1163004103',

  '+DATA/RACORCL/DATAFILE/sysaux.288.1163004103',

  '+DATA/RACORCL/DATAFILE/undotbs1.283.1163004103',

  '+DATA/RACORCL/DATAFILE/undotbs2.302.1163004103',

  '+DATA/RACORCL/DATAFILE/users.295.1163004103'

CHARACTER SET AL32UTF8

;


-- Configure RMAN configuration record 1

VARIABLE RECNO NUMBER;

EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('DEVICE TYPE','DISK PARALLELISM 10 BACKUP TYPE TO BACKUPSET');

-- Commands to re-create incarnation table

-- Below log names MUST be changed to existing filenames on

-- disk. Any one log file from each branch can be used to

-- re-create incarnation records.

-- ALTER DATABASE REGISTER LOGFILE '+FRA';

-- Recovery is required if any of the datafiles are restored backups,

-- or if the last shutdown was not normal or immediate.


    执行该脚本前,需要设置cluster_database参数为false:

SQL> show parameter cluster_database


NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

cluster_database                     boolean     TRUE

cluster_database_instances           integer     2

SQL> alter system set cluster_database=false scope=spfile;


System altered.


SQL> shutdown immediate

ORA-01109: database not open



Database dismounted.

ORACLE instance shut down.

SQL> startup nomount

ORACLE instance started.


Total System Global Area 4949276568 bytes

Fixed Size                  8906648 bytes

Variable Size            1040187392 bytes

Database Buffers         3892314112 bytes

Redo Buffers                7868416 bytes

SQL> @/home/oracle/control.sql


Control file created.



PL/SQL procedure successfully completed.


    执行该脚本后,需要设置cluster_database参数为true:
 

SQL> alter system set cluster_database=true scope=spfile;


System altered.


SQL> shutdown immediate 

ORA-01109: database not open



Database dismounted.

ORACLE instance shut down.

SQL> startup mount 

ORACLE instance started.


Total System Global Area 4949276568 bytes

Fixed Size                  8906648 bytes

Variable Size            1040187392 bytes

Database Buffers         3892314112 bytes

Redo Buffers                7868416 bytes

Database mounted.


    执行recover database using backup controlfile until cancel,但是第一归档日志就找不到:

SQL> recover database using backup controlfile until cancel;

ORA-00279: change 2077990 generated at 03/07/2024 10:30:57 needed for thread 1

ORA-00289: suggestion : +FRA

ORA-00280: change 2077990 for thread 1 is in sequence #6



Specify log: {=suggested | filename | AUTO | CANCEL}


ORA-00283: recovery session canceled due to errors

ORA-19906: recovery target incarnation changed during recovery



ORA-01112: media recovery not started


4. 寻找消失的归档日志

    恢复过程中寻找的是SCN开始于2077990的thread 1 sequence 6的日志,但是查询后发现thread 1 sequence 6的SCN开始位置是2303370,而且其resetlogs_id是2087612。这一切说明要找的日志不在当前的数据库化身:

SQL> select  FIRST_CHANGE#, NEXT_CHANGE#, RESETLOGS_CHANGE# , RESETLOGS_ID  from v$archived_log where  THREAD#=1 and SEQUENCE#=6;


FIRST_CHANGE# NEXT_CHANGE# RESETLOGS_CHANGE# RESETLOGS_ID

------------- ------------ ----------------- ------------

      2303370      2303388           2087612   1162996408

--------------------------------------------------------------------


[oracle@station11 ~]$ rman target / catalog urcat/oracle_4U@rcat


Recovery Manager: Release 19.0.0.0.0 - Production on Thu Mar 7 17:18:41 2024

Version 19.3.0.0.0


Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.


connected to target database: RACORCL (DBID=2908490689, not open)

connected to recovery catalog database


RMAN> list incarnation of database;



List of Database Incarnations

DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time

------- ------- -------- ---------------- --- ---------- ----------

1       17      RACORCL  2908490689       PARENT  1          17-APR-19

1       2       RACORCL  2908490689       PARENT  1920977    07-MAR-24

1       185     RACORCL  2908490689       CURRENT 2087612    07-MAR-24

 
    重设化身,寻找消失的日志:

RMAN> list backup of archivelog sequence 6 thread 1;


specification does not match any backup in the repository

RMAN> reset database to incarnation 2;


database reset to incarnation 2

RMAN>  list backup of archivelog sequence 6 thread 1;



List of Backup Sets

===================



BS Key  Size       Device Type Elapsed Time Completion Time

------- ---------- ----------- ------------ ---------------

72      9.50K      DISK        00:00:00     07-MAR-24      

        BP Key: 75   Status: AVAILABLE  Compressed: NO  Tag: 1D_WHOLE_INCR0

        Piece Name: +FRA/RACORCL/BACKUPSET/2024_03_07/annnf0_1d_whole_incr0_0.277.1162981865


  List of Archived Logs in backup set 72

  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time

  ---- ------- ---------- --------- ---------- ---------

  1    6       2077927    07-MAR-24 2078008    07-MAR-24



RMAN> restore archivelog sequence 6 thread 1;


Starting restore at 07-MAR-24

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=373 instance=racorcl1 device type=DISK

allocated channel: ORA_DISK_2

channel ORA_DISK_2: SID=495 instance=racorcl1 device type=DISK

allocated channel: ORA_DISK_3

channel ORA_DISK_3: SID=1347 instance=racorcl1 device type=DISK

allocated channel: ORA_DISK_4

channel ORA_DISK_4: SID=1469 instance=racorcl1 device type=DISK

allocated channel: ORA_DISK_5

channel ORA_DISK_5: SID=1592 instance=racorcl1 device type=DISK

allocated channel: ORA_DISK_6

channel ORA_DISK_6: SID=1713 instance=racorcl1 device type=DISK

allocated channel: ORA_DISK_7

channel ORA_DISK_7: SID=1836 instance=racorcl1 device type=DISK

allocated channel: ORA_DISK_8

channel ORA_DISK_8: SID=5 instance=racorcl1 device type=DISK

allocated channel: ORA_DISK_9

channel ORA_DISK_9: SID=128 instance=racorcl1 device type=DISK

allocated channel: ORA_DISK_10

channel ORA_DISK_10: SID=250 instance=racorcl1 device type=DISK


channel ORA_DISK_1: starting archived log restore to default destination

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=6

channel ORA_DISK_1: reading from backup piece +FRA/RACORCL/BACKUPSET/2024_03_07/annnf0_1d_whole_incr0_0.277.1162981865

channel ORA_DISK_1: piece handle=+FRA/RACORCL/BACKUPSET/2024_03_07/annnf0_1d_whole_incr0_0.277.1162981865 tag=1D_WHOLE_INCR0

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:00:02

Finished restore at 07-MAR-24


    成功找到thread 1 sequence 6后,继续寻找reset incarnation中的后续日志(2087612是下一个化身开始的SCN):

RMAN> restore archivelog scn between 2077990 and 2087612;


Starting restore at 09-MAR-24

using channel ORA_DISK_1

using channel ORA_DISK_2

using channel ORA_DISK_3

using channel ORA_DISK_4

using channel ORA_DISK_5

using channel ORA_DISK_6

using channel ORA_DISK_7

using channel ORA_DISK_8

using channel ORA_DISK_9

using channel ORA_DISK_10


archived log for thread 1 with sequence 6 is already on disk as file +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_6.301.1163006471

archived log for thread 1 with sequence 7 is already on disk as file +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_7.275.1162984797

archived log for thread 1 with sequence 8 is already on disk as file +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_8.274.1162984797

archived log for thread 1 with sequence 9 is already on disk as file +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_9.266.1162985113

archived log for thread 1 with sequence 10 is already on disk as file +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_10.256.1162996409

archived log for thread 2 with sequence 3 is already on disk as file +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_3.271.1162981899

archived log for thread 2 with sequence 4 is already on disk as file +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_4.270.1162985105

archived log for thread 2 with sequence 5 is already on disk as file +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_5.269.1162985107

archived log for thread 2 with sequence 6 is already on disk as file +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_6.268.1162985111

archived log for thread 2 with sequence 7 is already on disk as file +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_7.267.1162985111

archived log for thread 2 with sequence 8 is already on disk as file +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_8.261.1162985113

archived log for thread 2 with sequence 9 is already on disk as file +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_9.262.1162985119

archived log for thread 2 with sequence 10 is already on disk as file +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_10.259.1162996409

channel ORA_DISK_1: starting archived log restore to default destination

channel ORA_DISK_1: restoring archived log

archived log thread=2 sequence=2

channel ORA_DISK_1: reading from backup piece +FRA/RACORCL/BACKUPSET/2024_03_07/annnf0_1d_whole_incr0_0.276.1162981865

channel ORA_DISK_1: piece handle=+FRA/RACORCL/BACKUPSET/2024_03_07/annnf0_1d_whole_incr0_0.276.1162981865 tag=1D_WHOLE_INCR0

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:00:01

Finished restore at 09-MAR-24



RMAN> 


    restore完日志后,一定要把化身设置回来:

RMAN> reset database to incarnation 185;


database reset to incarnation 185


5. 第三次尝试恢复

    执行recover database using backup controlfile until cancel,很快就遇到2号文件的ORA-01244错误:

[oracle@station11 ~]$ sqlplus /nolog


SQL*Plus: Release 19.0.0.0.0 - Production on Sat Mar 9 10:54:47 2024

Version 19.3.0.0.0


Copyright (c) 1982, 2019, Oracle.  All rights reserved.


SQL> conn / as sysdba

Connected.

SQL> recover database using backup controlfile until cancel;

ORA-00279: change 2077990 generated at 03/07/2024 10:30:57 needed for thread 1

ORA-00289: suggestion :

+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_6.301.1163006471

ORA-00280: change 2077990 for thread 1 is in sequence #6



Specify log: {=suggested | filename | AUTO | CANCEL}

auto

ORA-00279: change 2077990 generated at 03/07/2024 10:30:51 needed for thread 2

ORA-00289: suggestion :

+FRA/RACORCL/ARCHIVELOG/2024_03_09/thread_2_seq_2.306.1163156033

ORA-00280: change 2077990 for thread 2 is in sequence #2



ORA-00279: change 2078008 generated at 03/07/2024 10:31:03 needed for thread 1

ORA-00289: suggestion :

+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_7.275.1162984797

ORA-00280: change 2078008 for thread 1 is in sequence #7

ORA-00278: log file

'+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_6.301.1163006471' no longer

needed for this recovery



ORA-00279: change 2078012 generated at 03/07/2024 10:31:03 needed for thread 2

ORA-00289: suggestion :

+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_3.271.1162981899

ORA-00280: change 2078012 for thread 2 is in sequence #3

ORA-00278: log file

'+FRA/RACORCL/ARCHIVELOG/2024_03_09/thread_2_seq_2.306.1163156033' no longer

needed for this recovery



ORA-00288: to continue recovery type ALTER DATABASE RECOVER CONTINUE

ORA-00278: log file

'+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_3.271.1162981899' no longer

needed for this recovery



ORA-00279: change 2078728 generated at 03/07/2024 11:19:56 needed for thread 1

ORA-00289: suggestion :

+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_8.274.1162984797

ORA-00280: change 2078728 for thread 1 is in sequence #8

ORA-00278: log file

'+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_7.275.1162984797' no longer

needed for this recovery



ORA-00279: change 2078728 generated at 03/07/2024 11:19:56 needed for thread 2

ORA-00289: suggestion :

+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_4.270.1162985105

ORA-00280: change 2078728 for thread 2 is in sequence #4



ORA-00279: change 2078730 generated at 03/07/2024 11:19:56 needed for thread 1

ORA-00289: suggestion :

+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_9.282.1162996409

ORA-00280: change 2078730 for thread 1 is in sequence #9

ORA-00278: log file

'+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_8.274.1162984797' no longer

needed for this recovery



ORA-00283: recovery session canceled due to errors

ORA-01244: unnamed datafile(s) added to control file by media recovery

ORA-01110: data file 2: '+DATA/RACORCL/DATAFILE/tbsocp05_test2.286.1162985105'



ORA-01112: media recovery not started



    遇到ORA-01244,重要的尝试方式就是:下线对应的数据文件:

SQL> alter database datafile 2 offline;


Database altered.


SQL> recover database using backup controlfile until cancel;

ORA-00279: change 2085416 generated at 03/07/2024 11:25:05 needed for thread 2

ORA-00289: suggestion :

+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_4.270.1162985105

ORA-00280: change 2085416 for thread 2 is in sequence #4



Specify log: {=suggested | filename | AUTO | CANCEL}

auto

ORA-00279: change 2085416 generated at 03/07/2024 11:19:56 needed for thread 1

ORA-00289: suggestion :

+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_9.282.1162996409

ORA-00280: change 2085416 for thread 1 is in sequence #9



ORA-00279: change 2085445 generated at 03/07/2024 11:25:05 needed for thread 2

ORA-00289: suggestion :

+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_5.269.1162985107

ORA-00280: change 2085445 for thread 2 is in sequence #5

ORA-00278: log file

'+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_4.270.1162985105' no longer

needed for this recovery



ORA-00279: change 2087518 generated at 03/07/2024 11:25:07 needed for thread 2

ORA-00289: suggestion :

+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_6.268.1162985111

ORA-00280: change 2087518 for thread 2 is in sequence #6

ORA-00278: log file

'+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_5.269.1162985107' no longer

needed for this recovery



ORA-00279: change 2087525 generated at 03/07/2024 11:25:10 needed for thread 2

ORA-00289: suggestion :

+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_7.267.1162985111

ORA-00280: change 2087525 for thread 2 is in sequence #7

ORA-00278: log file

'+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_6.268.1162985111' no longer

needed for this recovery



ORA-00279: change 2087528 generated at 03/07/2024 11:25:10 needed for thread 2

ORA-00289: suggestion :

+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_8.261.1162985113

ORA-00280: change 2087528 for thread 2 is in sequence #8

ORA-00278: log file

'+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_7.267.1162985111' no longer

needed for this recovery



ORA-00279: change 2087535 generated at 03/07/2024 11:25:12 needed for thread 1

ORA-00289: suggestion :

+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_10.256.1162996409

ORA-00280: change 2087535 for thread 1 is in sequence #10

ORA-00278: log file

'+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_9.282.1162996409' no longer

needed for this recovery



ORA-00279: change 2087539 generated at 03/07/2024 11:25:13 needed for thread 2

ORA-00289: suggestion :

+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_9.260.1162996409

ORA-00280: change 2087539 for thread 2 is in sequence #9

ORA-00278: log file

'+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_8.261.1162985113' no longer

needed for this recovery



ORA-00279: change 2087545 generated at 03/07/2024 11:25:18 needed for thread 2

ORA-00289: suggestion :

+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_10.259.1162996409

ORA-00280: change 2087545 for thread 2 is in sequence #10

ORA-00278: log file

'+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_9.260.1162996409' no longer

needed for this recovery



ORA-00279: change 2087612 generated at 03/07/2024 14:33:28 needed for thread 1

ORA-00289: suggestion :

+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_1.293.1162996941

ORA-00280: change 2087612 for thread 1 is in sequence #1

ORA-00278: log file

'+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_10.259.1162996409' no longer

needed for this recovery



ORA-00279: change 2087612 generated at 03/07/2024 14:33:28 needed for thread 2

ORA-00289: suggestion :

+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_1.258.1162996415

ORA-00280: change 2087612 for thread 2 is in sequence #1

ORA-00278: log file

'+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_10.259.1162996409' no longer

needed for this recovery



ORA-00288: to continue recovery type ALTER DATABASE RECOVER CONTINUE

ORA-00278: log file

'+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_1.258.1162996415' no longer

needed for this recovery



ORA-00279: change 2089035 generated at 03/07/2024 14:34:23 needed for thread 2

ORA-00289: suggestion :

+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_2.287.1162996935

ORA-00280: change 2089035 for thread 2 is in sequence #2



ORA-00283: recovery session canceled due to errors

ORA-01244: unnamed datafile(s) added to control file by media recovery

ORA-01110: data file 8: '+DATA/RACORCL/DATAFILE/tbsocp05_test3.284.1162996935'



ORA-01112: media recovery not started



    再次遇到ORA-01244,重要的尝试方式仍然是:下线对应的数据文件:

SQL> alter database datafile 8 offline;


Database altered.


SQL> recover database using backup controlfile until cancel;

ORA-00279: change 2093550 generated at 03/07/2024 14:42:15 needed for thread 2

ORA-00289: suggestion :

+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_2.287.1162996935

ORA-00280: change 2093550 for thread 2 is in sequence #2



Specify log: {=suggested | filename | AUTO | CANCEL}

auto

ORA-00279: change 2093550 generated at 03/07/2024 14:33:28 needed for thread 1

ORA-00289: suggestion :

+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_1.293.1162996941

ORA-00280: change 2093550 for thread 1 is in sequence #1



ORA-00279: change 2093576 generated at 03/07/2024 14:42:15 needed for thread 2

ORA-00289: suggestion :

+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_3.292.1162996939

ORA-00280: change 2093576 for thread 2 is in sequence #3

ORA-00278: log file

'+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_2.287.1162996935' no longer

needed for this recovery



ORA-00279: change 2095654 generated at 03/07/2024 14:42:19 needed for thread 2

ORA-00289: suggestion :

+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_4.294.1162996943

ORA-00280: change 2095654 for thread 2 is in sequence #4

ORA-00278: log file

'+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_3.292.1162996939' no longer

needed for this recovery



ORA-00279: change 2095661 generated at 03/07/2024 14:42:20 needed for thread 1

ORA-00289: suggestion :

+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_2.272.1162998105

ORA-00280: change 2095661 for thread 1 is in sequence #2

ORA-00278: log file

'+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_1.293.1162996941' no longer

needed for this recovery



ORA-00279: change 2095667 generated at 03/07/2024 14:42:22 needed for thread 2

ORA-00289: suggestion :

+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_5.295.1162996945

ORA-00280: change 2095667 for thread 2 is in sequence #5

ORA-00278: log file

'+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_4.294.1162996943' no longer

needed for this recovery



ORA-00279: change 2095672 generated at 03/07/2024 14:42:25 needed for thread 2

ORA-00289: suggestion :

+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_6.296.1162996945

ORA-00280: change 2095672 for thread 2 is in sequence #6

ORA-00278: log file

'+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_5.295.1162996945' no longer

needed for this recovery



ORA-00279: change 2095678 generated at 03/07/2024 14:42:25 needed for thread 2

ORA-00289: suggestion :

+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_7.263.1162998153

ORA-00280: change 2095678 for thread 2 is in sequence #7

ORA-00278: log file

'+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_6.296.1162996945' no longer

needed for this recovery



ORA-00279: change 2095686 generated at 03/07/2024 14:42:28 needed for thread 2

ORA-00289: suggestion :

+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_8.278.1162998153

ORA-00280: change 2095686 for thread 2 is in sequence #8

ORA-00278: log file

'+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_7.263.1162998153' no longer

needed for this recovery



ORA-00279: change 2095702 generated at 03/07/2024 14:42:29 needed for thread 1

ORA-00289: suggestion :

+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_3.257.1162998107

ORA-00280: change 2095702 for thread 1 is in sequence #3

ORA-00278: log file

'+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_2.272.1162998105' no longer

needed for this recovery



ORA-00279: change 2295760 generated at 03/07/2024 15:01:47 needed for thread 1

ORA-00289: suggestion :

+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_4.273.1162998397

ORA-00280: change 2295760 for thread 1 is in sequence #4

ORA-00278: log file

'+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_3.257.1162998107' no longer

needed for this recovery



ORA-00279: change 2297094 generated at 03/07/2024 15:02:33 needed for thread 2

ORA-00289: suggestion :

+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_9.300.1162998409

ORA-00280: change 2297094 for thread 2 is in sequence #9

ORA-00278: log file

'+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_8.278.1162998153' no longer

needed for this recovery



ORA-00279: change 2303357 generated at 03/07/2024 15:06:36 needed for thread 1

ORA-00289: suggestion :

+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_5.265.1162998399

ORA-00280: change 2303357 for thread 1 is in sequence #5

ORA-00278: log file

'+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_4.273.1162998397' no longer

needed for this recovery



ORA-00279: change 2303370 generated at 03/07/2024 15:06:38 needed for thread 1

ORA-00289: suggestion :

+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_6.299.1162998407

ORA-00280: change 2303370 for thread 1 is in sequence #6

ORA-00278: log file

'+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_5.265.1162998399' no longer

needed for this recovery



ORA-00279: change 2303388 generated at 03/07/2024 15:06:47 needed for thread 1

ORA-00289: suggestion : +FRA

ORA-00280: change 2303388 for thread 1 is in sequence #7

ORA-00278: log file

'+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_6.299.1162998407' no longer

needed for this recovery



ORA-00308: cannot open archived log '+FRA'

ORA-17503: ksfdopn:2 Failed to open file +FRA

ORA-15045: ASM file name '+FRA' is not in reference form


    遇到缺失的日志thread 1 sequence 7,是时候执行cancel了:

SQL> recover database using backup controlfile until cancel;

ORA-00279: change 2303388 generated at 03/07/2024 15:06:47 needed for thread 1

ORA-00289: suggestion : +FRA

ORA-00280: change 2303388 for thread 1 is in sequence #7



Specify log: {=suggested | filename | AUTO | CANCEL}

cancel

Media recovery cancelled.

SQL> alter database open resetlogs;


Database altered.


6. 连续出现UNNAME00000X问题的处理:

    数据库虽然恢复完成,但是2号文件和8号文件分别显示成UNNAME000002和UNNAME000008:

SQL> col name format a60 trunc

SQL> set linesize 1000

SQL> select  name, status from v$datafile;


NAME      STATUS

------------------------------------------------------------ -------

+DATA/RACORCL/DATAFILE/system.301.1163004103      SYSTEM

/u01/app/oracle/product/19.3.0/dbhome_1/dbs/UNNAMED00002     OFFLINE

+DATA/RACORCL/DATAFILE/sysaux.288.1163004103      ONLINE

+DATA/RACORCL/DATAFILE/undotbs1.283.1163004103      ONLINE

+DATA/RACORCL/DATAFILE/undotbs2.302.1163004103      ONLINE

+DATA/RACORCL/DATAFILE/users.295.1163004103      ONLINE

/u01/app/oracle/product/19.3.0/dbhome_1/dbs/UNNAMED00008     OFFLINE


7 rows selected.


    产生的原因是:掌管物理结构的controlfile里删除了这两个文件,而打开数据库后访问到的掌管逻辑结构的数据字典里记忆着这两个文件的信息。换句话说:物理结构和逻辑结构的矛盾导致了UNAME00000X问题的出现。接下来,我们首先要rename这两个文件到它们在+ASM磁盘组中的路径:

SQL> alter database rename file '/u01/app/oracle/product/19.3.0/dbhome_1/dbs/UNNAMED00002' to '+DATA/RACORCL/DATAFILE/tbsocp05_test2.286.1162985105';


Database altered.


SQL> alter database rename file '/u01/app/oracle/product/19.3.0/dbhome_1/dbs/UNNAMED00008' to '+DATA/RACORCL/DATAFILE/tbsocp05_test3.284.1162996935';


Database altered.

SQL> select  file#,name , status from v$datafile;


     FILE# NAME  STATUS

---------- ------------------------------------------------------------ -------

 1 +DATA/RACORCL/DATAFILE/system.301.1163004103  SYSTEM

 2 +DATA/RACORCL/DATAFILE/tbsocp05_test2.286.1162985105  OFFLINE

 3 +DATA/RACORCL/DATAFILE/sysaux.288.1163004103  ONLINE

 4 +DATA/RACORCL/DATAFILE/undotbs1.283.1163004103 ONLINE

 5 +DATA/RACORCL/DATAFILE/undotbs2.302.1163004103 ONLINE

 7 +DATA/RACORCL/DATAFILE/users.295.1163004103 ONLINE

 8 +DATA/RACORCL/DATAFILE/tbsocp05_test3.284.1162996935  OFFLINE


7 rows selected.


    但是不能直接恢复这两个文件。如果这样做,会马上遇到孤儿化身问题:

SQL> recover datafile '+DATA/RACORCL/DATAFILE/tbsocp05_test2.286.1162985105';

ORA-00283: recovery session canceled due to errors

ORA-19909: datafile 2 belongs to an orphan incarnation

ORA-01110: data file 2: '+DATA/RACORCL/DATAFILE/tbsocp05_test2.286.1162985105'


SQL> recover datafile 8; 

ORA-00283: recovery session canceled due to errors

ORA-19909: datafile 8 belongs to an orphan incarnation

ORA-01110: data file 8: '+DATA/RACORCL/DATAFILE/tbsocp05_test3.284.1162996935'


    要重新创建这两个空白文件,当做restore后的备份来用:

SQL> alter database create datafile 2 as new; 


Database altered.


SQL> recover datafile 2; 

ORA-00279: change 2085414 generated at 03/07/2024 11:25:04 needed for thread 2

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_4.270.1162985105

ORA-00280: change 2085414 for thread 2 is in sequence #4



Specify log: {=suggested | filename | AUTO | CANCEL}

auto

ORA-00279: change 2085414 generated at 03/07/2024 11:19:56 needed for thread 1

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_9.282.1162996409

ORA-00280: change 2085414 for thread 1 is in sequence #9



ORA-00279: change 2085445 generated at 03/07/2024 11:25:05 needed for thread 2

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_5.269.1162985107

ORA-00280: change 2085445 for thread 2 is in sequence #5



ORA-00279: change 2087518 generated at 03/07/2024 11:25:07 needed for thread 2

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_6.268.1162985111

ORA-00280: change 2087518 for thread 2 is in sequence #6



ORA-00279: change 2087525 generated at 03/07/2024 11:25:10 needed for thread 2

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_7.267.1162985111

ORA-00280: change 2087525 for thread 2 is in sequence #7



ORA-00279: change 2087528 generated at 03/07/2024 11:25:10 needed for thread 2

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_8.261.1162985113

ORA-00280: change 2087528 for thread 2 is in sequence #8



ORA-00279: change 2087535 generated at 03/07/2024 11:25:12 needed for thread 1

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_10.256.1162996409

ORA-00280: change 2087535 for thread 1 is in sequence #10



ORA-00279: change 2087539 generated at 03/07/2024 11:25:13 needed for thread 2

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_9.260.1162996409

ORA-00280: change 2087539 for thread 2 is in sequence #9



ORA-00279: change 2087545 generated at 03/07/2024 11:25:18 needed for thread 2

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_10.259.1162996409

ORA-00280: change 2087545 for thread 2 is in sequence #10



ORA-00279: change 2087612 generated at 03/07/2024 14:33:28 needed for thread 1

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_1.293.1162996941

ORA-00280: change 2087612 for thread 1 is in sequence #1



ORA-00279: change 2087612 generated at 03/07/2024 14:33:28 needed for thread 2

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_1.258.1162996415

ORA-00280: change 2087612 for thread 2 is in sequence #1



ORA-00288: to continue recovery type ALTER DATABASE RECOVER CONTINUE

ORA-00278: log file '+FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_1.258.1162996415' no longer needed for this recovery



ORA-00279: change 2089035 generated at 03/07/2024 14:34:23 needed for thread 2

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_2.287.1162996935

ORA-00280: change 2089035 for thread 2 is in sequence #2



ORA-00279: change 2093576 generated at 03/07/2024 14:42:15 needed for thread 2

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_3.292.1162996939

ORA-00280: change 2093576 for thread 2 is in sequence #3



ORA-00279: change 2095654 generated at 03/07/2024 14:42:19 needed for thread 2

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_4.294.1162996943

ORA-00280: change 2095654 for thread 2 is in sequence #4



ORA-00279: change 2095661 generated at 03/07/2024 14:42:20 needed for thread 1

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_2.272.1162998105

ORA-00280: change 2095661 for thread 1 is in sequence #2



ORA-00279: change 2095667 generated at 03/07/2024 14:42:22 needed for thread 2

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_5.295.1162996945

ORA-00280: change 2095667 for thread 2 is in sequence #5



ORA-00279: change 2095672 generated at 03/07/2024 14:42:25 needed for thread 2

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_6.296.1162996945

ORA-00280: change 2095672 for thread 2 is in sequence #6



ORA-00279: change 2095678 generated at 03/07/2024 14:42:25 needed for thread 2

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_7.263.1162998153

ORA-00280: change 2095678 for thread 2 is in sequence #7



ORA-00279: change 2095686 generated at 03/07/2024 14:42:28 needed for thread 2

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_8.278.1162998153

ORA-00280: change 2095686 for thread 2 is in sequence #8



ORA-00279: change 2095702 generated at 03/07/2024 14:42:29 needed for thread 1

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_3.257.1162998107

ORA-00280: change 2095702 for thread 1 is in sequence #3



ORA-00279: change 2295760 generated at 03/07/2024 15:01:47 needed for thread 1

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_4.273.1162998397

ORA-00280: change 2295760 for thread 1 is in sequence #4



ORA-00279: change 2297094 generated at 03/07/2024 15:02:33 needed for thread 2

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_9.300.1162998409

ORA-00280: change 2297094 for thread 2 is in sequence #9



ORA-00279: change 2303357 generated at 03/07/2024 15:06:36 needed for thread 1

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_5.265.1162998399

ORA-00280: change 2303357 for thread 1 is in sequence #5



ORA-00279: change 2303370 generated at 03/07/2024 15:06:38 needed for thread 1

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_6.299.1162998407

ORA-00280: change 2303370 for thread 1 is in sequence #6



Log applied.

Media recovery complete.


SQL> alter database create datafile 8 as new;


Database altered.


SQL> recover datafile 8; 

ORA-00279: change 2093548 generated at 03/07/2024 14:42:15 needed for thread 2

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_2.287.1162996935

ORA-00280: change 2093548 for thread 2 is in sequence #2



Specify log: {=suggested | filename | AUTO | CANCEL}

auto

ORA-00279: change 2093548 generated at 03/07/2024 14:33:28 needed for thread 1

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_1.293.1162996941

ORA-00280: change 2093548 for thread 1 is in sequence #1



ORA-00279: change 2093576 generated at 03/07/2024 14:42:15 needed for thread 2

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_3.292.1162996939

ORA-00280: change 2093576 for thread 2 is in sequence #3



ORA-00279: change 2095654 generated at 03/07/2024 14:42:19 needed for thread 2

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_4.294.1162996943

ORA-00280: change 2095654 for thread 2 is in sequence #4



ORA-00279: change 2095661 generated at 03/07/2024 14:42:20 needed for thread 1

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_2.272.1162998105

ORA-00280: change 2095661 for thread 1 is in sequence #2



ORA-00279: change 2095667 generated at 03/07/2024 14:42:22 needed for thread 2

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_5.295.1162996945

ORA-00280: change 2095667 for thread 2 is in sequence #5



ORA-00279: change 2095672 generated at 03/07/2024 14:42:25 needed for thread 2

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_6.296.1162996945

ORA-00280: change 2095672 for thread 2 is in sequence #6



ORA-00279: change 2095678 generated at 03/07/2024 14:42:25 needed for thread 2

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_7.263.1162998153

ORA-00280: change 2095678 for thread 2 is in sequence #7



ORA-00279: change 2095686 generated at 03/07/2024 14:42:28 needed for thread 2

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_8.278.1162998153

ORA-00280: change 2095686 for thread 2 is in sequence #8



ORA-00279: change 2095702 generated at 03/07/2024 14:42:29 needed for thread 1

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_3.257.1162998107

ORA-00280: change 2095702 for thread 1 is in sequence #3



ORA-00279: change 2295760 generated at 03/07/2024 15:01:47 needed for thread 1

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_4.273.1162998397

ORA-00280: change 2295760 for thread 1 is in sequence #4



ORA-00279: change 2297094 generated at 03/07/2024 15:02:33 needed for thread 2

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_2_seq_9.300.1162998409

ORA-00280: change 2297094 for thread 2 is in sequence #9



ORA-00279: change 2303357 generated at 03/07/2024 15:06:36 needed for thread 1

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_5.265.1162998399

ORA-00280: change 2303357 for thread 1 is in sequence #5



ORA-00279: change 2303370 generated at 03/07/2024 15:06:38 needed for thread 1

ORA-00289: suggestion : +FRA/RACORCL/ARCHIVELOG/2024_03_07/thread_1_seq_6.299.1162998407

ORA-00280: change 2303370 for thread 1 is in sequence #6



Log applied.

Media recovery complete.

SQL> alter database datafile 2 online;


Database altered.


SQL> alter database datafile 8 online;


Database altered.



    我们成功处置了这个疑难环境:

SQL> select TABLESPACE_NAME, status from dba_tablespaces;


TABLESPACE_NAME        STATUS

------------------------------ ---------

SYSTEM        ONLINE

SYSAUX        ONLINE

UNDOTBS1        ONLINE

TEMP        ONLINE

USERS        ONLINE

UNDOTBS2        ONLINE

TBSOCP05_TEST2        ONLINE

TBSOCP05_TEST3        ONLINE


8 rows selected.


SQL> select  file#,name, status from v$datafile;


     FILE# NAME STATUS

---------- ------------------------------------------------------------ -------

1 +DATA/RACORCL/DATAFILE/system.301.1163004103 SYSTEM

2 +DATA/RACORCL/DATAFILE/tbsocp05_test2.307.1163157405 ONLINE

3 +DATA/RACORCL/DATAFILE/sysaux.288.1163004103 ONLINE

4 +DATA/RACORCL/DATAFILE/undotbs1.283.1163004103 ONLINE

5 +DATA/RACORCL/DATAFILE/undotbs2.302.1163004103 ONLINE

7 +DATA/RACORCL/DATAFILE/users.295.1163004103 ONLINE

8 +DATA/RACORCL/DATAFILE/tbsocp05_test3.286.1163157561 ONLINE


7 rows selected.




路过

雷人

握手

鲜花

鸡蛋

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-4-3 10:16 , Processed in 0.034819 second(s), 21 queries .

返回顶部