Bo's Oracle Station

【博客文章2024】RAC 19c磁盘硬件严重故障处置系列四:RAC数据库全损的恢复

2024-4-11 11:38| 发布者: admin| 查看: 66| 评论: 0|原作者: Bo Tang

摘要: 这是“RAC 19c磁盘硬件严重故障处置系列”的最后一篇。博客详细介绍了RAC数据库全损的恢复。包含:数据库的备份的回顾、为了启动数据库编写pfile、连接Recovery Catalog还原数据库的备份、根据还原出来的数据库文件的位置编写创建控制文件的脚本、生成spfile、生成password file、让spfile生效以及最终恢复数据库。 到此,集群的恢复成功完成。
【博客文章2024】RAC 19c磁盘硬件严重故障处置系列四:RAC数据库全损的恢复




Author: Bo Tang


    RAC 19c集群底层结构和mgmtdb已经修复,详见这篇博客:https://www.botangdb.com/mytec/mytec_rac/202404/00900119.html通过本文进行集群的最终恢复,即:RAC数据库全损的恢复:

[grid@station11 ~]$ crsctl status res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.LISTENER.lsnr
               ONLINE  ONLINE       station11                STABLE
               ONLINE  ONLINE       station12                STABLE
ora.chad
               ONLINE  ONLINE       station11                STABLE
               ONLINE  ONLINE       station12                STABLE
ora.net1.network
               ONLINE  ONLINE       station11                STABLE
               ONLINE  ONLINE       station12                STABLE
ora.ons
               ONLINE  ONLINE       station11                STABLE
               ONLINE  ONLINE       station12                STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.ASMNET1LSNR_ASM.lsnr(ora.asmgroup)
      1        ONLINE  ONLINE       station11                STABLE
      2        ONLINE  ONLINE       station12                STABLE
      3        ONLINE  OFFLINE                               STABLE
ora.DATA.dg(ora.asmgroup)
      1        ONLINE  ONLINE       station11                STABLE
      2        ONLINE  ONLINE       station12                STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.FRA.dg(ora.asmgroup)
      1        ONLINE  ONLINE       station11                STABLE
      2        ONLINE  ONLINE       station12                STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       station12                STABLE
ora.LISTENER_SCAN2.lsnr
      1        ONLINE  ONLINE       station11                STABLE
ora.LISTENER_SCAN3.lsnr
      1        ONLINE  ONLINE       station11                STABLE
ora.MGMTLSNR
      1        ONLINE  ONLINE       station11                169.254.14.179 172.3
                                                             1.118.11 172.31.118.
                                                             211,STABLE
ora.asm(ora.asmgroup)
      1        ONLINE  ONLINE       station11                Started,STABLE
      2        ONLINE  ONLINE       station12                Started,STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.asmnet1.asmnetwork(ora.asmgroup)
      1        ONLINE  ONLINE       station11                STABLE
      2        ONLINE  ONLINE       station12                STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.cvu
      1        ONLINE  ONLINE       station11                STABLE
ora.mgmtdb
      1        ONLINE  ONLINE       station11                Open,STABLE
ora.qosmserver
      1        ONLINE  ONLINE       station11                STABLE
ora.racorcl.db
      1        ONLINE  OFFLINE                               Instance Shutdown,ST
                                                             ABLE
      2        ONLINE  OFFLINE                               Instance Shutdown,ST
                                                             ABLE

ora.scan1.vip
      1        ONLINE  ONLINE       station12                STABLE
ora.scan2.vip
      1        ONLINE  ONLINE       station11                STABLE
ora.scan3.vip
      1        ONLINE  ONLINE       station11                STABLE
ora.station11.vip
      1        ONLINE  ONLINE       station11                STABLE
ora.station12.vip
      1        ONLINE  ONLINE       station12                STABLE
--------------------------------------------------------------------------------

1. 数据库的备份:

    数据库的文件系统上的备份已经在本系列的第一篇博客中执行了,详见:https://www.botangdb.com/mytec/mytec_rac/202404/00900121.html 。station11这台主机的/home/oracle/backup目录下保存有数据库的所有数据文件的备份(whole incremtal level 0 backup)。 station11这台主机上的/home/archivelog目录下保存有thread 1的一份归档日志; station12这台主机上的/home/archivelog目录下保存有thread 2的一份归档日志。作为生产环境的标准配置,数据库所注册的recovery catalog仍然可用。

2. 准备一份pfile:

    需要在station11上的pfile标准位置(/u01/app/oracle/product/19.3.0/dbhome_1/dbs)编写一个pfile,其文件名为initracorcl1.ora,而内容为:

[oracle@station11 ~]$ cd /u01/app/oracle/product/19.3.0/dbhome_1/dbs/
[oracle@station11 dbs]$ ls
hc_orcl1.dat  hc_racorcl1.dat  id_orcl1.dat  id_racorcl1.dat  init.ora  initracorcl1.ora  snapcf_racorcl1.f
[oracle@station11 dbs]$ cat initracorcl1.ora
*.audit_file_dest='/u01/app/oracle/admin/racorcl/adump'
*.audit_trail='db'
*.cluster_database=false
*.compatible='19.0.0'
*.control_files='+data','+fra'
*.db_block_size=8192
*.db_create_file_dest='+DATA'
*.db_domain='example.com'
*.db_name='racorcl'
*.db_recovery_file_dest='+FRA'
*.db_recovery_file_dest_size=426852m
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=racorclXDB)'
racorcl1.instance_number=1
racorcl2.instance_number=2
*.nls_language='AMERICAN'
*.nls_territory='AMERICA'
*.open_cursors=300
*.pga_aggregate_target=1G
*.processes=640
*.remote_login_passwordfile='exclusive'
*.sga_target=4G
racorcl2.thread=2
racorcl1.thread=1
racorcl2.undo_tablespace='UNDOTBS2'
racorcl1.undo_tablespace='UNDOTBS1'
*.remote_listener='scan11.lab.example.com:1521'


    特别需要注意的是:由于需要使用脚本创建控制文件,所以cluster_database必需先设置为false。控制文件由于还没创建,所以control_files必需暂时设置成“'+data','+fra'"。并且在数据库没有启动到mount这个阶段前,不可以从pfile转化生成spfile。因为如果那样做,spfile会出现在dbunknown这个目录之下而不是在数据库名的目录下。
    使用这个pfile启动station11主机上的实例:

[oracle@station11 ~]$ . oraenv
ORACLE_SID = [racorcl1] ?
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@station11 ~]$ sqlplus /nolog

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Apr 11 07:13:08 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 4294963272 bytes
Fixed Size            8904776 bytes
Variable Size          922746880 bytes
Database Buffers     3355443200 bytes
Redo Buffers            7868416 bytes
ORA-00205: error in identifying control file, check alert log for more info

3. 连接Recovery Catalog,还原数据库的备份:

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

Recovery Manager: Release 19.0.0.0.0 - Production on Thu Apr 11 07:38:40 2024
Version 19.3.0.0.0

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

connected to target database: RACORCL (not mounted)
connected to recovery catalog database

RMAN> set dbid 2908490689; (如果与别的数据库共享这个Recovery Catalog,那么在target数据库处于nomount状态时,需要申明target数据库的dbid。因此在生产环境中记住target数据库的dbid是一个良好的习惯,否则就需要查询Recovery Catalog数据库的db表中登记的dbid,逐个尝试)

executing command: SET DBID
database name is "RACORCL" and DBID is 2908490689

RMAN> restore database;

Starting restore at 11-APR-24
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=872 instance=racorcl1 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=129 instance=racorcl1 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=192 instance=racorcl1 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=255 instance=racorcl1 device type=DISK
allocated channel: ORA_DISK_5
channel ORA_DISK_5: SID=315 instance=racorcl1 device type=DISK
allocated channel: ORA_DISK_6
channel ORA_DISK_6: SID=376 instance=racorcl1 device type=DISK
allocated channel: ORA_DISK_7
channel ORA_DISK_7: SID=438 instance=racorcl1 device type=DISK
allocated channel: ORA_DISK_8
channel ORA_DISK_8: SID=502 instance=racorcl1 device type=DISK
allocated channel: ORA_DISK_9
channel ORA_DISK_9: SID=563 instance=racorcl1 device type=DISK
allocated channel: ORA_DISK_10
channel ORA_DISK_10: SID=626 instance=racorcl1 device type=DISK

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 00001 to +DATA/RACORCL/DATAFILE/system.283.1162980303
channel ORA_DISK_1: reading from backup piece /home/oracle/backup/0s2nfltc_1_1
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 00003 to +DATA/RACORCL/DATAFILE/sysaux.295.1162980337
channel ORA_DISK_2: restoring datafile 00007 to +DATA/RACORCL/DATAFILE/users.303.1162980353
channel ORA_DISK_2: reading from backup piece /home/oracle/backup/0t2nfltc_1_1
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 00004 to +DATA/RACORCL/DATAFILE/undotbs1.288.1162980353
channel ORA_DISK_3: restoring datafile 00005 to +DATA/RACORCL/DATAFILE/undotbs2.301.1162980561
channel ORA_DISK_3: reading from backup piece /home/oracle/backup/0u2nfltc_1_1
channel ORA_DISK_2: piece handle=/home/oracle/backup/0t2nfltc_1_1 tag=1D_WHOLE_INCR0
channel ORA_DISK_2: restored backup piece 1
channel ORA_DISK_2: restore complete, elapsed time: 00:00:03
channel ORA_DISK_3: piece handle=/home/oracle/backup/0u2nfltc_1_1 tag=1D_WHOLE_INCR0
channel ORA_DISK_3: restored backup piece 1
channel ORA_DISK_3: restore complete, elapsed time: 00:00:03
channel ORA_DISK_1: piece handle=/home/oracle/backup/0s2nfltc_1_1 tag=1D_WHOLE_INCR0
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
Finished restore at 11-APR-24


4. 根据还原出来的数据库文件的位置,编写创建控制文件的脚本:

4.1 以grid用户,使用asmcmd命令来查看还原出来的数据文件的位置:

[grid@station11 ~]$ . oraenv
ORACLE_SID = [+ASM1] ?
The Oracle base remains unchanged with value /u01/app/grid
[grid@station11 ~]$ asmcmd
ASMCMD> ls
DATA/
FRA/
ASMCMD> cd data
ASMCMD> ls
ASM/
RACORCL/
_MGMTDB/
cluster11/
ASMCMD> cd RACORCL/
ASMCMD> ls
DATAFILE/
ASMCMD> cd datafile
ASMCMD> ls
SYSAUX.288.1165995623
SYSTEM.287.1165995623
UNDOTBS1.289.1165995623
UNDOTBS2.291.1165995623
USERS.290.1165995623

ASMCMD> pwd
+data/RACORCL/datafile


4.2 以oracle用户,编写创建控制文件的脚本:

[oracle@station11 ~]$ cat  controlrac.sql
CREATE CONTROLFILE REUSE DATABASE "RACORCL" RESETLOGS  ARCHIVELOG
    MAXLOGFILES 192
    MAXLOGMEMBERS 3
    MAXDATAFILES 1024
    MAXINSTANCES 32
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 (
    '+DATA',
    '+FRA'
  ) SIZE 200M BLOCKSIZE 512,
  GROUP 2 (
    '+DATA',
    '+FRA'
  ) SIZE 200M BLOCKSIZE 512
DATAFILE
  '+DATA/RACORCL/DATAFILE/
SYSTEM.287.1165995623',
  '+DATA/RACORCL/DATAFILE/
SYSAUX.288.1165995623',
  '+DATA/RACORCL/DATAFILE/
UNDOTBS1.289.1165995623',
  '+DATA/RACORCL/DATAFILE/
UNDOTBS2.291.1165995623',
  '+DATA/RACORCL/DATAFILE/
USERS.290.1165995623'
CHARACTER SET AL32UTF8
;


4.3 执行该脚本,创建控制文件(创建之后数据库处于mount状态):

[oracle@station11 ~]$ sqlplus /nolog

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Apr 11 07:53:28 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 4294963272 bytes
Fixed Size            8904776 bytes
Variable Size          872415232 bytes
Database Buffers     3405774848 bytes
Redo Buffers            7868416 bytes
ORA-00205: error in identifying control file, check alert log for more info

SQL> @controlrac.sql

Control file created.


4.4 以grid用户,使用asmcmd命令来查看生成的控制文件的位置:

[root@station11 ~]# su - grid
Last login: Thu Apr 11 09:18:16 CST 2024
[grid@station11 ~]$ . oraenv
ORACLE_SID = [+ASM1] ?
The Oracle base remains unchanged with value /u01/app/grid
[grid@station11 ~]$ asmcmd
ASMCMD> ls
DATA/
FRA/
ASMCMD> cd data
ASMCMD> ls
ASM/
RACORCL/
_MGMTDB/
cluster11/
ASMCMD> cd RACORCL/
ASMCMD> ls
CONTROLFILE/
DATAFILE/
ASMCMD> cd CONTROLFILE/
ASMCMD> ls
Current.292.1165996437
ASMCMD> pwd
+data/RACORCL/CONTROLFILE
ASMCMD> cd +fra
ASMCMD> ls
RACORCL/
ASMCMD> cd RACORCL/
ASMCMD> ls
CONTROLFILE/
ASMCMD> cd CONTROLFILE/
ASMCMD> ls
Current.256.1165996437
ASMCMD> pwd
+fra/RACORCL/CONTROLFILE
ASMCMD>

5. 在数据库处于mount的状态下,从pfile转化生成spfile:

    编辑之前的pfile,根据上面查到的路径填写控制文件的位置,并把cluster_database参数设置为true:

[oracle@station11 ~]$ cd /u01/app/oracle/product/19.3.0/dbhome_1/dbs/
[oracle@station11 dbs]$ ls
hc_orcl1.dat  hc_racorcl1.dat  id_orcl1.dat  id_racorcl1.dat  init.ora  initracorcl1.ora  snapcf_racorcl1.f
[oracle@station11 dbs]$ cat initracorcl1.ora
*.audit_file_dest='/u01/app/oracle/admin/racorcl/adump'
*.audit_trail='db'
*.cluster_database=true
*.compatible='19.0.0'
*.control_files='+data/RACORCL/CONTROLFILE/
Current.292.1165996437','+fra/racorcl/controlfile/Current.256.1165996437'
*.db_block_size=8192
*.db_create_file_dest='+DATA'
*.db_domain='example.com'
*.db_name='racorcl'
*.db_recovery_file_dest='+FRA'
*.db_recovery_file_dest_size=426852m
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=racorclXDB)'
racorcl1.instance_number=1
racorcl2.instance_number=2
*.nls_language='AMERICAN'
*.nls_territory='AMERICA'
*.open_cursors=300
*.pga_aggregate_target=1G
*.processes=640
*.remote_login_passwordfile='exclusive'
*.sga_target=4G
racorcl2.thread=2
racorcl1.thread=1
racorcl2.undo_tablespace='UNDOTBS2'
racorcl1.undo_tablespace='UNDOTBS1'
*.remote_listener='scan11.lab.example.com:1521'


    趁着数据库处于mount的状态,从pfile转化生成spfile:

[oracle@station11 dbs]$ sqlplus /nolog

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Apr 11 07:56:47 2024
Version 19.3.0.0.0

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

SQL> conn / as sysdba
Connected.
SQL> create spfile='+data' from pfile;

File created.

    以grid用户,使用asmcmd命令来查看生成的spfile的位置:

[grid@station11 ~]$ . oraenv
ORACLE_SID = [+ASM1] ?
The Oracle base remains unchanged with value /u01/app/grid
[grid@station11 ~]$ asmcmd
ASMCMD> ls
DATA/
FRA/
ASMCMD> cd data
ASMCMD> ls
ASM/
RACORCL/
_MGMTDB/
cluster11/
ASMCMD> cd RACORCL/
ASMCMD> ls
CONTROLFILE/
DATAFILE/
PARAMETERFILE/
ASMCMD> cd PARAMETERFILE/
ASMCMD> ls
spfile.293.1165996621
ASMCMD> pwd
+data/RACORCL/PARAMETERFILE

    我们验证到:数据库在集群的注册信息中的spfile项已经被自动设置,但是password file还没恢复(红色标注):

[grid@station11 ~]$ . oraenv
ORACLE_SID = [+ASM1] ?
The Oracle base remains unchanged with value /u01/app/grid
[grid@station11 ~]$ srvctl  config database -d racorcl -v
Database unique name: racorcl
Database name: racorcl
Oracle home: /u01/app/oracle/product/19.3.0/dbhome_1
Oracle user: oracle
Spfile: +DATA/RACORCL/PARAMETERFILE/spfile.293.1165996621
Password file: +data/RACORCL/PASSWORD/pwdracorcl.291.1162980283
Domain: example.com
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: FRA,DATA
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: dba
OSOPER group: oper
Database instances: racorcl1,racorcl2
Configured nodes: station11,station12
CSS critical: no
CPU count: 0
Memory target: 0
Maximum memory: 0
Default network number for database services:
Database is administrator managed

6. 创建password file:

[oracle@station11 ~]$ orapwd file='+data' password=mysql_4U   force=y dbuniquename=racorcl
    
    以grid用户,使用asmcmd命令来查看生成的password file的位置:

[grid@station11 ~]$ . oraenv
ORACLE_SID = [+ASM1] ?
The Oracle base remains unchanged with value /u01/app/grid
[grid@station11 ~]$ asmcmd
ASMCMD> ls
DATA/
FRA/
ASMCMD> cd data
ASMCMD> ls
ASM/
RACORCL/
_MGMTDB/
cluster11/
ASMCMD> cd RACORCL/
ASMCMD> ls
CONTROLFILE/
DATAFILE/
PARAMETERFILE/
PASSWORD/
ASMCMD> cd PASSWORD/
ASMCMD> ls
pwdracorcl.294.1166001013
ASMCMD> pwd
+data/RACORCL/PASSWORD

    我们验证到:数据库在集群的注册信息中的password file项已经被自动设置:

[grid@station11 ~]$ srvctl  config database -d racorcl
Database unique name: racorcl
Database name: racorcl
Oracle home: /u01/app/oracle/product/19.3.0/dbhome_1
Oracle user: oracle
Spfile: +DATA/RACORCL/PARAMETERFILE/spfile.293.1165996621
Password file: +DATA/RACORCL/PASSWORD/pwdracorcl.294.1166001013
Domain: example.com
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: FRA,DATA
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: dba
OSOPER group: oper
Database instances: racorcl1,racorcl2
Configured nodes: station11,station12
CSS critical: no
CPU count: 0
Memory target: 0
Maximum memory: 0
Default network number for database services:
Database is administrator managed
[grid@station11 ~]$

7. 重启集群,让spfile生效:

[oracle@station11 ~]$ . oraenv
ORACLE_SID = [racorcl1] ?
The Oracle base remains unchanged with value /u01/app/oracle

[oracle@station11 ~]$ sqlplus /nolog

SQL*Plus: Release 19.0.0.0.0 - Production on Fri Apr 12 02:15:29 2024
Version 19.3.0.0.0

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

SQL> conn / as sysdba
Connected.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 4294963272 bytes
Fixed Size            8904776 bytes
Variable Size          922746880 bytes
Database Buffers     3355443200 bytes
Redo Buffers            7868416 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open


SQL> show parameter spfile

NAME                     TYPE     VALUE
------------------------------------ ----------- ------------------------------
spfile                     string     +DATA/RACORCL/PARAMETERFILE/sp
                         file.293.1165996621


8. 合并station12文件系统上的archivelog到station11上:

    连接recovery catalog查看archivelog的详情:

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

Recovery Manager: Release 19.0.0.0.0 - Production on Thu Apr 11 12:34:53 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  archivelog all ;

List of Archived Log Copies for database with db_unique_name RACORCL
=====================================================================

Key     Thrd Seq     S Low Time
------- ---- ------- - ---------
1089    1    13      A 05-APR-24
        Name: /home/oracle/archivelog/1_13_1162980420.dbf

1088    1    13      A 05-APR-24
        Name: +FRA/RACORCL/ARCHIVELOG/2024_04_05/thread_1_seq_13.271.1165481583

1091    1    14      A 05-APR-24
        Name: /home/oracle/archivelog/1_14_1162980420.dbf

1090    1    14      A 05-APR-24
        Name: +FRA/RACORCL/ARCHIVELOG/2024_04_05/thread_1_seq_14.275.1165481591

1098    1    15      A 05-APR-24
        Name: /home/oracle/archivelog/1_15_1162980420.dbf

1097    1    15      A 05-APR-24
        Name: +FRA/RACORCL/ARCHIVELOG/2024_04_05/thread_1_seq_15.277.1165481707

1209    1    16      A 05-APR-24
        Name: /home/oracle/archivelog/1_16_1162980420.dbf

1208    1    16      A 05-APR-24
        Name: +FRA/RACORCL/ARCHIVELOG/2024_04_05/thread_1_seq_16.264.1165482117

1240    1    17      A 05-APR-24
        Name: /home/oracle/archivelog/1_17_1162980420.dbf

1239    1    17      A 05-APR-24
        Name: +FRA/RACORCL/ARCHIVELOG/2024_04_05/thread_1_seq_17.280.1165482271

1099    2    8       A 05-APR-24
        Name: +FRA/RACORCL/ARCHIVELOG/2024_04_05/thread_2_seq_8.274.1165481711

1210    2    9       A 05-APR-24
        Name: +FRA/RACORCL/ARCHIVELOG/2024_04_05/thread_2_seq_9.284.1165482117

1242    2    10      A 05-APR-24
        Name: /home/oracle/archivelog/2_10_1162980420.dbf

1241    2    10      A 05-APR-24
        Name: +FRA/RACORCL/ARCHIVELOG/2024_04_05/thread_2_seq_10.278.1165482273 

    合并station12文件系统上的archivelog到station11上:

[oracle@station11 ~]$ cd archivelog/
[oracle@station11 archivelog]$ pwd
/home/oracle/archivelog
[oracle@station11 archivelog]$ ls 
1_13_1162980420.dbf  1_14_1162980420.dbf  1_15_1162980420.dbf  1_16_1162980420.dbf  1_17_1162980420.dbf
[oracle@station11 archivelog]$ scp station12:/home/oracle/archivelog/*  ./
2_10_1162980420.dbf                                                                                                                                                              100%   23KB  15.4MB/s   00:00    
2_6_1162980420.dbf                                                                                                                                                               100% 5542KB 259.7MB/s   00:00    
2_7_1162980420.dbf                                                                                                                                                               100% 2048     2.1MB/s   00:00    
2_8_1162980420.dbf                                                                                                                                                               100%   24KB  20.9MB/s   00:00    
2_9_1162980420.dbf                                                                                                                                                               100% 4343KB 265.6MB/s   00:00   

9. 执行数据库的恢复:

[oracle@station11 ~]$ . oraenv
ORACLE_SID = [racorcl1] ? 
The Oracle base remains unchanged with value /u01/app/oracle

[oracle@station11 ~]$ sqlplus /nolog

SQL*Plus: Release 19.0.0.0.0 - Production on Fri Apr 12 02:15:29 2024
Version 19.3.0.0.0

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

SQL> conn / as sysdba
Connected.
SQL> recover database until cancel using backup controlfile;
ORA-00279: change 2104911 generated at 04/05/2024 08:58:20 needed for thread 1
ORA-00289: suggestion : +FRA
ORA-15173: entry 'ARCHIVELOG' does not exist in directory 'RACORCL'
ORA-00280: change 2104911 for thread 1 is in sequence #16

    从上面的ORA-00289的suggestion来看,这是第一个归档日志的建议,路径不清晰。我们只好根据SCN来查找这个归档日志:

RMAN> list archivelog from scn 2104911;

List of Archived Log Copies for database with db_unique_name RACORCL
=====================================================================

Key     Thrd Seq     S Low Time 
------- ---- ------- - ---------
1209    1    16      A 05-APR-24
        Name: /home/oracle/archivelog/1_16_1162980420.dbf

1208    1    16      A 05-APR-24
        Name: +FRA/RACORCL/ARCHIVELOG/2024_04_05/thread_1_seq_16.264.1165482117

1240    1    17      A 05-APR-24
        Name: /home/oracle/archivelog/1_17_1162980420.dbf

1239    1    17      A 05-APR-24
        Name: +FRA/RACORCL/ARCHIVELOG/2024_04_05/thread_1_seq_17.280.1165482271

1210    2    9       A 05-APR-24
        Name: +FRA/RACORCL/ARCHIVELOG/2024_04_05/thread_2_seq_9.284.1165482117

1242    2    10      A 05-APR-24
        Name: /home/oracle/archivelog2_10_1162980420.dbf

1241    2    10      A 05-APR-24
        Name: +FRA/RACORCL/ARCHIVELOG/2024_04_05/thread_2_seq_10.278.1165482273

    我们填写这个路径,和后续日志:

[oracle@station11 ~]$ . oraenv
ORACLE_SID = [racorcl1] ? 
The Oracle base remains unchanged with value /u01/app/oracle

[oracle@station11 ~]$ sqlplus /nolog

SQL*Plus: Release 19.0.0.0.0 - Production on Fri Apr 12 02:15:29 2024
Version 19.3.0.0.0

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

SQL> conn / as sysdba
Connected.
SQL> recover database until cancel using backup controlfile;
ORA-00279: change 2104911 generated at 04/05/2024 08:58:20 needed for thread 1
ORA-00289: suggestion : +FRA
ORA-15173: entry 'ARCHIVELOG' does not exist in directory 'RACORCL'
ORA-00280: change 2104911 for thread 1 is in sequence #16


Specify log: {
=suggested | filename | AUTO | CANCEL}
/home/oracle/archivelog/1_16_1162980420.dbf
ORA-00279: change 2104911 generated at    needed for thread 2


Specify log: {
=suggested | filename | AUTO | CANCEL}
--根据
 list archivelog from scn 2104911判断出这个thread 2日志是:
/home/oracle/archivelog/2_9_1162980420.dbf
ORA-00279: change 2106491 generated at 04/05/2024 09:01:56 needed for thread 1
ORA-00289: suggestion : +FRA
ORA-00280: change 2106491 for thread 1 is in sequence #17
ORA-00278: log file '/home/oracle/archivelog/1_16_1162980420.dbf' no longer
needed for this recovery


Specify log: {
=suggested | filename | AUTO | CANCEL}
/home/oracle/archivelog/1_17_1162980420.dbf
ORA-00279: change 2106495 generated at 04/05/2024 09:01:56 needed for thread 2
ORA-00289: suggestion : +FRA
ORA-00280: change 2106495 for thread 2 is in sequence #10
ORA-00278: log file '/home/oracle/archivelog/2_9_1162980420.dbf' no longer
needed for this recovery


Specify log: {
=suggested | filename | AUTO | CANCEL}
/home/oracle/archivelog/2_10_1162980420.dbf
ORA-00279: change 2106753 generated at 04/05/2024 09:04:30 needed for thread 1
ORA-00289: suggestion : +FRA
ORA-00280: change 2106753 for thread 1 is in sequence #18
ORA-00278: log file '/home/oracle/archivelog/1_17_1162980420.dbf' no longer
needed for this recovery


Specify log: {
=suggested | filename | AUTO | CANCEL}
/home/oracle/archivelog/1_17_1162980420.dbf
ORA-00310: archived log contains sequence 17; sequence 18 required
ORA-00334: archived log: '/home/oracle/archivelog/1_17_1162980420.dbf'

--thread 1 sequence 18的日志找不到,实际上它是onlinelog的current日志组:
SQL> recover database until cancel using backup controlfile;
ORA-00279: change 2106753 generated at 04/05/2024 09:04:30 needed for thread 1
ORA-00289: suggestion : +FRA
ORA-00280: change 2106753 for thread 1 is in sequence #18


Specify log: {
=suggested | filename | AUTO | CANCEL}
cancel
Media recovery cancelled.
SQL> alter database open resetlogs;

Database altered.


    启动其他的实例:

[oracle@station11 archivelog]$ srvctl start instance -i racorcl2 -d racorcl
[oracle@station11 archivelog]$ srvctl status database -d racorcl -v
Instance racorcl1 is running on node station11. Instance status: Open.
Instance racorcl2 is running on node station12. Instance status: Open.

    到此,恢复成功完成:

[grid@station11 ~]$ . oraenv
ORACLE_SID = [+ASM1] ?
The Oracle base remains unchanged with value /u01/app/grid
[grid@station11 ~]$ crsctl status res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.LISTENER.lsnr
               ONLINE  ONLINE       station11                STABLE
               ONLINE  ONLINE       station12                STABLE
ora.chad
               ONLINE  ONLINE       station11                STABLE
               ONLINE  ONLINE       station12                STABLE
ora.net1.network
               ONLINE  ONLINE       station11                STABLE
               ONLINE  ONLINE       station12                STABLE
ora.ons
               ONLINE  ONLINE       station11                STABLE
               ONLINE  ONLINE       station12                STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.ASMNET1LSNR_ASM.lsnr(ora.asmgroup)
      1        ONLINE  ONLINE       station11                STABLE
      2        ONLINE  ONLINE       station12                STABLE
      3        ONLINE  OFFLINE                               STABLE
ora.DATA.dg(ora.asmgroup)
      1        ONLINE  ONLINE       station11                STABLE
      2        ONLINE  ONLINE       station12                STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.FRA.dg(ora.asmgroup)
      1        ONLINE  ONLINE       station11                STABLE
      2        ONLINE  ONLINE       station12                STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       station12                STABLE
ora.LISTENER_SCAN2.lsnr
      1        ONLINE  ONLINE       station11                STABLE
ora.LISTENER_SCAN3.lsnr
      1        ONLINE  ONLINE       station11                STABLE
ora.MGMTLSNR
      1        ONLINE  ONLINE       station11                169.254.14.179 172.3
                                                             1.118.11 172.31.118.
                                                             211,STABLE
ora.asm(ora.asmgroup)
      1        ONLINE  ONLINE       station11                Started,STABLE
      2        ONLINE  ONLINE       station12                Started,STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.asmnet1.asmnetwork(ora.asmgroup)
      1        ONLINE  ONLINE       station11                STABLE
      2        ONLINE  ONLINE       station12                STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.cvu
      1        ONLINE  ONLINE       station11                STABLE
ora.mgmtdb
      1        ONLINE  ONLINE       station11                Open,STABLE
ora.qosmserver
      1        ONLINE  ONLINE       station11                STABLE
ora.racorcl.db
      1        ONLINE  ONLINE       station11                Open,HOME=/u01/app/o
                                                             racle/product/19.3.0
                                                             /dbhome_1,STABLE
      2        ONLINE  ONLINE       station12                Open,HOME=/u01/app/o
                                                             racle/product/19.3.0
                                                             /dbhome_1,STABLE
ora.scan1.vip
      1        ONLINE  ONLINE       station12                STABLE
ora.scan2.vip
      1        ONLINE  ONLINE       station11                STABLE
ora.scan3.vip
      1        ONLINE  ONLINE       station11                STABLE
ora.station11.vip
      1        ONLINE  ONLINE       station11                STABLE
ora.station12.vip
      1        ONLINE  ONLINE       station12                STABLE
--------------------------------------------------------------------------------






















路过

雷人

握手

鲜花

鸡蛋

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-4-11 14:54 , Processed in 0.041965 second(s), 21 queries .

返回顶部