成都创新互联网站制作重庆分公司

怎么解决Oracle中提示PDB库有数据文件需要进行介质恢复问题-创新互联

这篇文章主要讲解了“怎么解决Oracle中提示PDB库有数据文件需要进行介质恢复问题”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“怎么解决Oracle中提示PDB库有数据文件需要进行介质恢复问题”吧!

Oracle Linux 7.1数据库为Oracle 12.2.0.1 RAC,数据库启用了归档,在手动关闭数据库后启动数据库时提示PDB库有数据文件需要进行介质恢复

[grid@jytest1 ~]$ srvctl stop database -db jy
[grid@jytest1 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ASMNET1LSNR_ASM.lsnr
               ONLINE  ONLINE       jytest1                  STABLE
               ONLINE  ONLINE       jytest2                  STABLE
ora.CRS.dg
               ONLINE  ONLINE       jytest1                  STABLE
               ONLINE  ONLINE       jytest2                  STABLE
ora.DATA.dg
               ONLINE  ONLINE       jytest1                  STABLE
               ONLINE  ONLINE       jytest2                  STABLE
ora.FRA.dg
               ONLINE  ONLINE       jytest1                  STABLE
               ONLINE  ONLINE       jytest2                  STABLE
ora.LISTENER.lsnr
               ONLINE  ONLINE       jytest1                  STABLE
               ONLINE  ONLINE       jytest2                  STABLE
ora.TEST.dg
               ONLINE  ONLINE       jytest1                  STABLE
               ONLINE  ONLINE       jytest2                  STABLE
ora.chad
               ONLINE  ONLINE       jytest1                  STABLE
               ONLINE  ONLINE       jytest2                  STABLE
ora.net1.network
               ONLINE  ONLINE       jytest1                  STABLE
               ONLINE  ONLINE       jytest2                  STABLE
ora.ons
               ONLINE  ONLINE       jytest1                  STABLE
               ONLINE  ONLINE       jytest2                  STABLE
ora.proxy_advm
               OFFLINE OFFLINE      jytest1                  STABLE
               OFFLINE OFFLINE      jytest2                  STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       jytest1                  STABLE
ora.LISTENER_SCAN2.lsnr
      1        ONLINE  ONLINE       jytest2                  STABLE
ora.LISTENER_SCAN3.lsnr
      1        ONLINE  ONLINE       jytest2                  STABLE
ora.MGMTLSNR
      1        ONLINE  ONLINE       jytest2                  169.254.237.250 88.8
                                                             8.88.2,STABLE
ora.asm
      1        ONLINE  ONLINE       jytest1                  Started,STABLE
      2        ONLINE  ONLINE       jytest2                  STABLE
      3        ONLINE  OFFLINE                               STABLE
ora.cvu
      1        ONLINE  ONLINE       jytest2                  STABLE
ora.jy.db
      1        OFFLINE OFFLINE                               Instance Shutdown,ST
                                                             ABLE
      2        OFFLINE OFFLINE                               Instance Shutdown,ST
                                                             ABLE
ora.jy.jy_srv.svc
      1        OFFLINE OFFLINE                               STABLE
ora.jytest1.vip
      1        ONLINE  ONLINE       jytest1                  STABLE
ora.jytest2.vip
      1        ONLINE  ONLINE       jytest2                  STABLE
ora.mgmtdb
      1        ONLINE  ONLINE       jytest2                  Open,STABLE
ora.qosmserver
      1        ONLINE  ONLINE       jytest1                  STABLE
ora.scan1.vip
      1        ONLINE  ONLINE       jytest1                  STABLE
ora.scan2.vip
      1        ONLINE  ONLINE       jytest2                  STABLE
ora.scan3.vip
      1        ONLINE  ONLINE       jytest2                  STABLE
--------------------------------------------------------------------------------

提示PDB的数据文件需要进行介质恢复,文件号是38

[grid@jytest1 ~]$ srvctl start database -db jy
PRCR-1079 : Failed to start resource ora.jy.db
CRS-5017: The resource action "ora.jy.db start" encountered the following error: 
ORA-01113: file 38 needs media recovery
ORA-01110: data file 38: '+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/system.271.962209649'
. For details refer to "(:CLSN00107:)" in "/u01/app/grid/diag/crs/jytest2/crs/trace/crsd_oraagent_oracle.trc".
CRS-2674: Start of 'ora.jy.db' on 'jytest2' failed
CRS-5017: The resource action "ora.jy.db start" encountered the following error: 
ORA-01113: file 38 needs media recovery
ORA-01110: data file 38: '+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/system.271.962209649'
. For details refer to "(:CLSN00107:)" in "/u01/app/grid/diag/crs/jytest1/crs/trace/crsd_oraagent_oracle.trc".
CRS-2674: Start of 'ora.jy.db' on 'jytest1' failed
CRS-2632: There are no more servers to try to place resource 'ora.jy.db' on that would satisfy its placement policy

对38号文件执行介质恢复

[oracle@jytest1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Wed Feb 13 17:47:55 2019
Copyright (c) 1982, 2016, Oracle.  All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 2147483648 bytes
Fixed Size                  8794848 bytes
Variable Size            1610616096 bytes
Database Buffers          520093696 bytes
Redo Buffers                7979008 bytes
Database mounted.
ORA-01113: file 38 needs media recovery
ORA-01110: data file 38:
'+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/system.271.962209649'
SQL> recover datafile 38;
Media recovery complete.

在对38号文件进行介质恢复后打开CDB时提示39号文件也需要进行介质恢复

SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01113: file 39 needs media recovery
ORA-01110: data file 39:
'+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/sysaux.316.962209649'

如是执行recover database命令来对CDB进行介质恢复并打开CDB

SQL> recover database;
Media recovery complete.
SQL> alter database open;
Database altered.

在打开JYPDB时提示PDB的45号文件需要进行介质恢复

SQL> alter pluggable database jypdb open;
alter pluggable database jypdb open
*
ERROR at line 1:
ORA-01113: file 45 needs media recovery
ORA-01110: data file 45:
'+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/cs.294.966380783'

如是对45号文件进行介质恢复,虽然介质恢复成功但在打开jypdb时仍然提示需要进行介质恢复

SQL>  recover datafile 45;
Media recovery complete.
SQL> alter pluggable database jypdb open;
alter pluggable database jypdb open
*
ERROR at line 1:
ORA-01113: file 45 needs media recovery
ORA-01110: data file 45:
'+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/cs.294.966380783'

如是查询数据文件检查点SCN与数据文件头SCN,发现44与45号文件的数据文件检查点SCN与数据文件头SCN号不一致并且数据文件检查点SCN比数据文件头SCN号大,因此需要进行日志文件来进行恢复。但在执行recover datafile命令成功后,打开JYPDB时仍然提示需要进行介质恢复。

SQL> select FILE#, CHECKPOINT_CHANGE#,LAST_CHANGE# from v$datafile;
     FILE# CHECKPOINT_CHANGE# LAST_CHANGE#
---------- ------------------ ------------
         1          176117998
         3          176117998
         4          176117998
         5            1449535      1449535
         6            1449535      1449535
         7          176117998
         8            1449535      1449535
         9          176117998
        38          176098593    176098593
        39          176098593    176098593
        40          176098593    176098593
     FILE# CHECKPOINT_CHANGE# LAST_CHANGE#
---------- ------------------ ------------
        41          176098593    176098593
        42          176098593    176098593
        43          176098593    176098593
        44          176098593    175898322
        45          176098593    175898322
        46           21664676     21664676
        47           21664676     21664676
        48           21664676     21664676
        49           21664676     21664676
        50           21664676     21664676
        51           21664676     21664676
22 rows selected.
SQL> select FILE#,CHECKPOINT_CHANGE# from v$datafile_header;
     FILE# CHECKPOINT_CHANGE#
---------- ------------------
         1          176117998
         3          176117998
         4          176117998
         5            1449535
         6            1449535
         7          176117998
         8            1449535
         9          176117998
        38          176098593
        39          176098593
        40          176098593
     FILE# CHECKPOINT_CHANGE#
---------- ------------------
        41          176098593
        42          176098593
        43          176098593
        44          175898322
        45          175898322
        46           21664676
        47           21664676
        48           21664676
        49           21664676
        50           21664676
        51           21664676
22 rows selected.

如是打算重建控制文件再执行介质恢复,下面先备份控制文件到跟踪文件,在跟踪文件中有重建控制文件的相关命令

SQL> alter database backup controlfile to trace as '/tmp/ctl.txt';
Database altered.

关闭RAC数据库

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

将RAC数据库启动到nomount状态

SQL> STARTUP NOMOUNT
ORACLE instance started.
Total System Global Area 2147483648 bytes
Fixed Size                  8794848 bytes
Variable Size            1610616096 bytes
Database Buffers          520093696 bytes
Redo Buffers                7979008 bytes

重建控制文件,提示数据库不是排他模式,也就是说在RAC环境不能重建控制文件

SQL> CREATE CONTROLFILE REUSE DATABASE "JY" NORESETLOGS  ARCHIVELOG
  2      MAXLOGFILES 192
  3      MAXLOGMEMBERS 3
  4      MAXDATAFILES 1024
  5      MAXINSTANCES 32
  6      MAXLOGHISTORY 292
  7  LOGFILE
  8    GROUP 1 '+DATA/JY/ONLINELOG/group_1.261.961976319'  SIZE 200M BLOCKSIZE 512,
  9    GROUP 2 '+DATA/JY/ONLINELOG/group_2.302.961976321'  SIZE 200M BLOCKSIZE 512,
 10    GROUP 3 '+DATA/JY/ONLINELOG/group_3.263.961976697'  SIZE 200M BLOCKSIZE 512,
 11    GROUP 4 '+DATA/JY/ONLINELOG/group_4.262.961976705'  SIZE 200M BLOCKSIZE 512,
 12    GROUP 6 (
 13      '+DATA/JY/ONLINELOG/group_6.280.972435899',
 14      '+FRA/JY/ONLINELOG/group_6.354.972435909'
 15    ) SIZE 200M BLOCKSIZE 512
 16  -- STANDBY LOGFILE
 17  DATAFILE
 18    '+DATA/JY/DATAFILE/system.317.962209603',
 19    '+DATA/JY/DATAFILE/sysaux.298.962209605',
 20    '+DATA/JY/DATAFILE/undotbs1.277.962209605',
 21    '+DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/system.256.962209675',
 22    '+DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/sysaux.270.962209675',
 23    '+DATA/JY/DATAFILE/users.301.962209605',
 24    '+DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/undotbs1.296.962209675',
 25    '+DATA/JY/DATAFILE/undotbs2.312.962209605',
 26    '+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/system.271.962209649',
 27    '+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/sysaux.316.962209649',
 28    '+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/undotbs1.264.962209649',
 29    '+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/undo_2.268.962209649',
 30    '+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/users.278.962209649',
 31    '+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/test.275.962210609',
 32    '+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/tts.257.966380353',
 33    '+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/cs.294.966380783',
 34    '+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/system.260.962469409',
 35    '+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/sysaux.259.962469409',
 36    '+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/undotbs1.265.962469409',
 37    '+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/undo_2.266.962469409',
 38    '+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/users.267.962469409',
 39    '+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/test.269.962469409'
 40  CHARACTER SET ZHS16GBK
 41  ;
CREATE CONTROLFILE REUSE DATABASE "JY" NORESETLOGS  ARCHIVELOG
*
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-12720: operation requires database is in EXCLUSIVE mode

修改数据库为排他模式

SQL> show parameter cluster
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
cdb_cluster                          boolean     FALSE
cdb_cluster_name                     string      jy
cluster_database                     boolean     TRUE
cluster_database_instances           integer     2
cluster_interconnects                string
SQL> alter system set cluster_database=false scope=spfile sid='*';
System altered.

重启数据库到nomount状态

SQL> shtudown immediate
SP2-0734: unknown command beginning "shtudown i..." - rest of line ignored.
SQL> shutdown immediate
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> STARTUP NOMOUNT
ORACLE instance started.
Total System Global Area 2147483648 bytes
Fixed Size                  8794848 bytes
Variable Size            1459621152 bytes
Database Buffers          671088640 bytes
Redo Buffers                7979008 bytes

重建控制文件

SQL> CREATE CONTROLFILE REUSE DATABASE "JY" NORESETLOGS  ARCHIVELOG
  2      MAXLOGFILES 192
  3      MAXLOGMEMBERS 3
  4      MAXDATAFILES 1024
  5      MAXINSTANCES 32
  6      MAXLOGHISTORY 292
  7  LOGFILE
  8    GROUP 1 '+DATA/JY/ONLINELOG/group_1.261.961976319'  SIZE 200M BLOCKSIZE 512,
  9    GROUP 2 '+DATA/JY/ONLINELOG/group_2.302.961976321'  SIZE 200M BLOCKSIZE 512,
 10    GROUP 3 '+DATA/JY/ONLINELOG/group_3.263.961976697'  SIZE 200M BLOCKSIZE 512,
 11    GROUP 4 '+DATA/JY/ONLINELOG/group_4.262.961976705'  SIZE 200M BLOCKSIZE 512,
 12    GROUP 6 (
 13      '+DATA/JY/ONLINELOG/group_6.280.972435899',
 14      '+FRA/JY/ONLINELOG/group_6.354.972435909'
 15    ) SIZE 200M BLOCKSIZE 512
 16  -- STANDBY LOGFILE
 17  DATAFILE
 18    '+DATA/JY/DATAFILE/system.317.962209603',
 19    '+DATA/JY/DATAFILE/sysaux.298.962209605',
 20    '+DATA/JY/DATAFILE/undotbs1.277.962209605',
 21    '+DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/system.256.962209675',
 22    '+DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/sysaux.270.962209675',
 23    '+DATA/JY/DATAFILE/users.301.962209605',
 24    '+DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/undotbs1.296.962209675',
 25    '+DATA/JY/DATAFILE/undotbs2.312.962209605',
 26    '+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/system.271.962209649',
 27    '+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/sysaux.316.962209649',
 28    '+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/undotbs1.264.962209649',
 29    '+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/undo_2.268.962209649',
 30    '+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/users.278.962209649',
 31    '+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/test.275.962210609',
 32    '+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/tts.257.966380353',
 33    '+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/cs.294.966380783',
 34    '+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/system.260.962469409',
 35    '+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/sysaux.259.962469409',
 36    '+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/undotbs1.265.962469409',
 37    '+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/undo_2.266.962469409',
 38    '+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/users.267.962469409',
 39    '+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/test.269.962469409'
 40  CHARACTER SET ZHS16GBK
 41  ;
Control file created.

如是查询数据文件检查点SCN与数据文件头SCN,现在44与45号文件的数据文件检查点SCN与数据文件头SCN号仍然不一致并且数据文件检查点SCN比数据文件头SCN号大

SQL> col name for a100
SQL> select name,checkpoint_change# from v$datafile_header;
NAME                                                                                                 CHECKPOINT_CHANGE#
---------------------------------------------------------------------------------------------------- ------------------
+DATA/JY/DATAFILE/system.317.962209603                                                                        176144167
+DATA/JY/DATAFILE/sysaux.298.962209605                                                                        176144167
+DATA/JY/DATAFILE/undotbs1.277.962209605                                                                      176144167
+DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/system.256.962209675                                         1449535
+DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/sysaux.270.962209675                                         1449535
+DATA/JY/DATAFILE/users.301.962209605                                                                         176144167
+DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/undotbs1.296.962209675                                       1449535
+DATA/JY/DATAFILE/undotbs2.312.962209605                                                                      176144167
+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/system.271.962209649                                       176098593
+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/sysaux.316.962209649                                       176098593
+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/undotbs1.264.962209649                                     176098593
+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/undo_2.268.962209649                                       176098593
+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/users.278.962209649                                        176098593
+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/test.275.962210609                                         176098593
+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/tts.257.966380353                                          175898322
+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/cs.294.966380783                                           175898322
+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/system.260.962469409                                        21664676
+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/sysaux.259.962469409                                        21664676
+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/undotbs1.265.962469409                                      21664676
+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/undo_2.266.962469409                                        21664676
+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/users.267.962469409                                         21664676
+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/test.269.962469409                                          21664676
22 rows selected.
SQL> select name,checkpoint_change# from v$datafile;
NAME                                                                                                 CHECKPOINT_CHANGE#
---------------------------------------------------------------------------------------------------- ------------------
+DATA/JY/DATAFILE/system.317.962209603                                                                        176144167
+DATA/JY/DATAFILE/sysaux.298.962209605                                                                        176144167
+DATA/JY/DATAFILE/undotbs1.277.962209605                                                                      176144167
+DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/system.256.962209675                                       176144167
+DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/sysaux.270.962209675                                       176144167
+DATA/JY/DATAFILE/users.301.962209605                                                                         176144167
+DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/undotbs1.296.962209675                                     176144167
+DATA/JY/DATAFILE/undotbs2.312.962209605                                                                      176144167
+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/system.271.962209649                                       176144167
+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/sysaux.316.962209649                                       176144167
+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/undotbs1.264.962209649                                     176144167
+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/undo_2.268.962209649                                       176144167
+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/users.278.962209649                                        176144167
+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/test.275.962210609                                         176144167
+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/tts.257.966380353                                          176144167
+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/cs.294.966380783                                           176144167
+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/system.260.962469409                                       176144167
+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/sysaux.259.962469409                                       176144167
+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/undotbs1.265.962469409                                     176144167
+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/undo_2.266.962469409                                       176144167
+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/users.267.962469409                                        176144167
+DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/test.269.962469409                                         176144167
22 rows selected.

对CDB执行介质恢复操作,根据提示输入相关的归档日志文件名来进行恢复并将CDB成功打开

SQL> recover database
ORA-00279: change 175898322 generated at  needed for thread 2
Specify log: {=suggested | filename | AUTO | CANCEL}
+TEST/JY/ARCHIVELOG/2019_02_13/thread_2_seq_1073.422.1000144183
ORA-00279: change 176098395 generated at 02/13/2019 17:49:43 needed for thread 2
ORA-00289: suggestion : +TEST/arch/2_1074_961976319.dbf
ORA-00280: change 176098395 for thread 2 is in sequence #1074
Specify log: {=suggested | filename | AUTO | CANCEL}
 +TEST/JY/ARCHIVELOG/2019_02_13/thread_2_seq_1074.382.1000144185
ORA-00279: change 176098399 generated at 02/13/2019 17:49:45 needed for thread 2
ORA-00289: suggestion : +TEST/arch/2_1075_961976319.dbf
ORA-00280: change 176098399 for thread 2 is in sequence #1075
Specify log: {=suggested | filename | AUTO | CANCEL}
+TEST/arch/2_1075_961976319.dbf
ORA-00279: change 176098399 generated at 02/13/2019 17:49:45 needed for thread 1
ORA-00289: suggestion : +TEST/arch/1_1182_961976319.dbf
ORA-00280: change 176098399 for thread 1 is in sequence #1182
Specify log: {=suggested | filename | AUTO | CANCEL}
 +TEST/arch/1_1182_961976319.dbf
ORA-00279: change 176098401 generated at 02/13/2019 17:49:45 needed for thread 2
ORA-00289: suggestion : +TEST/arch/2_1076_961976319.dbf
ORA-00280: change 176098401 for thread 2 is in sequence #1076
Specify log: {=suggested | filename | AUTO | CANCEL}
 +TEST/arch/2_1076_961976319.dbf
ORA-00288: to continue recovery type ALTER DATABASE RECOVER CONTINUE
ORA-00278: log file '+TEST/arch/2_1076_961976319.dbf' no longer needed for this recovery
ORA-00279: change 176098489 generated at 02/13/2019 17:49:50 needed for thread 1
ORA-00289: suggestion : +TEST/arch/1_1183_961976319.dbf
ORA-00280: change 176098489 for thread 1 is in sequence #1183
Specify log: {=suggested | filename | AUTO | CANCEL}
+TEST/arch/1_1183_961976319.dbf
Log applied.
Media recovery complete.
SQL> alter database open;
Database altered.

将PDB数据库打开

SQL> ALTER PLUGGABLE DATABASE ALL OPEN;
Pluggable database altered.
SQL> show pdbs
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 JYPDB                          READ WRITE NO

根据备份控制文件到跟踪文件重建控制文件的命令来添加临时表空间的相关文件

SQL> ALTER TABLESPACE TEMP ADD TEMPFILE '+DATA/JY/TEMPFILE/temp.299.961976339';
Tablespace altered.
SQL> ALTER SESSION SET CONTAINER = PDB$SEED;
Session altered.
SQL> ALTER TABLESPACE TEMP ADD TEMPFILE '+DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/TEMPFILE/temp.297.962209865'  SIZE 67108864  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;
Tablespace altered.
SQL> ALTER SESSION SET CONTAINER = JYPDB;
Session altered.
SQL> ALTER TABLESPACE TEMP ADD TEMPFILE '+DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/TEMPFILE/temp.276.967852391' REUSE;
Tablespace altered.

将数据库设置为集群模式并关闭数据库

SQL> alter system set cluster_database=true scope=spfile sid='*';
System altered.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

使用集群命令来启动数据库

[grid@jytest1 ~]$ srvctl start database -db jy

将JYPDB以读写方式打开

[oracle@jytest1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Wed Feb 13 22:30:53 2019
Copyright (c) 1982, 2016, Oracle.  All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> show pdbs
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 JYPDB                          MOUNTED
SQL> alter pluggable database jypdb open;
Pluggable database altered.
SQL> show pdbs
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 JYPDB                          READ WRITE NO
[oracle@jytest2 ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Wed Feb 13 22:31:17 2019
Copyright (c) 1982, 2016, Oracle.  All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> show pdbs
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 JYPDB                          MOUNTED
SQL> alter pluggable database jypdb open;
Pluggable database altered.
SQL> show pdbs
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 JYPDB                          READ WRITE NO

到此数据库的恢复操作就完成了

感谢各位的阅读,以上就是“怎么解决Oracle中提示PDB库有数据文件需要进行介质恢复问题”的内容了,经过本文的学习后,相信大家对怎么解决Oracle中提示PDB库有数据文件需要进行介质恢复问题这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是创新互联,小编将为大家推送更多相关知识点的文章,欢迎关注!


本文名称:怎么解决Oracle中提示PDB库有数据文件需要进行介质恢复问题-创新互联
当前网址:http://cxhlcq.com/article/dcisei.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部