異機使用完全備份恢復指定的PDB
#恢復spfile,建立pfile並修改引數檔案,再建立spfile
[oracle@ray103 dbs]$ rman target / Recovery Manager: Release 19.0.0.0.0 - Production on Thu Jul 14 14:51:20 2022 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved. connected to target database (not started) RMAN> startup nomount startup failed: ORA-01078: failure in processing system parameters LRM-00109: could not open parameter file '/u01/app/oracle/product/19.3.0/dbhome_1/dbs/initraysuen.ora' starting Oracle instance without parameter file for retrieval of spfile Oracle instance started Total System Global Area 1073737800 bytes Fixed Size 8904776 bytes Variable Size 276824064 bytes Database Buffers 784334848 bytes Redo Buffers 3674112 bytes RMAN> restore spfile to '/u01/app/oracle/product/19.3.0/dbhome_1/dbs/spfileraysuen.ora' from '/u01/app/oracle/rman/spfile_c-3765622762-20220714-02'; Starting restore at 14-JUL-22 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=38 device type=DISK channel ORA_DISK_1: restoring spfile from AUTOBACKUP /u01/app/oracle/rman/spfile_c-3765622762-20220714-02 channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete Finished restore at 14-JUL-22 RMAN> create pfile from spfile; using target database control file instead of recovery catalog Statement processed #編輯pfile檔案 [oracle@ray103 dbs]$ vi initraysuen.ora [oracle@ray103 dbs]$ rm -f spfileraysuen.ora oracle@ray103 dbs]$ rman target / Recovery Manager: Release 19.0.0.0.0 - Production on Thu Jul 14 15:11:41 2022 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved. connected to target database: DUMMY (not mounted) RMAN> shutdown immediate using target database control file instead of recovery catalog Oracle instance shut down [oracle@ray103 dbs]$ sqlplus /nolog SQL*Plus: Release 19.0.0.0.0 - Production on Thu Jul 14 15:14:13 2022 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 nomount ORACLE instance started. Total System Global Area 1191178288 bytes Fixed Size 9134128 bytes Variable Size 385875968 bytes Database Buffers 788529152 bytes Redo Buffers 7639040 bytes SQL> create spfile from pfile; File created. SQL> shutdown immediate ORA-01507: database not mounted ORACLE instance shut down. SQL> startup nomount ORACLE instance started. Total System Global Area 1191178288 bytes Fixed Size 9134128 bytes Variable Size 385875968 bytes Database Buffers 788529152 bytes Redo Buffers 7639040 bytes SQL>
#恢復控制檔案
[oracle@ray103 oracle]$ rman target / Recovery Manager: Release 19.0.0.0.0 - Production on Thu Jul 14 15:19:51 2022 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved. connected to target database: RAYSUEN (not mounted) RMAN> restore controlfile from '/u01/app/oracle/backup/ctl_20220714_RAYSUEN_db_14_1.bak'; Starting restore at 14-JUL-22 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=38 device type=DISK channel ORA_DISK_1: restoring control file channel ORA_DISK_1: restore complete, elapsed time: 00:00:03 output file name=/u01/app/oracle/oradata/RAYSUEN/current01.ora output file name=/u01/app/oracle/oradata/RAYSUEN/current02.ora Finished restore at 14-JUL-22 RMAN> sql 'alter database mount'; sql statement: alter database mount released channel: ORA_DISK_1
#把備份檔案資訊讀入控制檔案
RMAN> catalog start with '/u01/app/oracle/backup/'; searching for all files that match the pattern /u01/app/oracle/backup/ List of Files Unknown to the Database ===================================== File Name: /u01/app/oracle/backup/incr0_20220714_RAYSUEN_7_1.bak File Name: /u01/app/oracle/backup/incr0_20220714_RAYSUEN_8_1.bak File Name: /u01/app/oracle/backup/incr0_20220714_RAYSUEN_9_1.bak File Name: /u01/app/oracle/backup/incr0_20220714_RAYSUEN_10_1.bak File Name: /u01/app/oracle/backup/arc_20220714_RAYSUEN_12_1.bak File Name: /u01/app/oracle/backup/ctl_20220714_RAYSUEN_db_14_1.bak File Name: /u01/app/oracle/backup/spfile_c-3765622762-20220714-02 Do you really want to catalog the above files (enter YES or NO)? yes cataloging files... cataloging done List of Cataloged Files ======================= File Name: /u01/app/oracle/backup/incr0_20220714_RAYSUEN_7_1.bak File Name: /u01/app/oracle/backup/incr0_20220714_RAYSUEN_8_1.bak File Name: /u01/app/oracle/backup/incr0_20220714_RAYSUEN_9_1.bak File Name: /u01/app/oracle/backup/incr0_20220714_RAYSUEN_10_1.bak File Name: /u01/app/oracle/backup/arc_20220714_RAYSUEN_12_1.bak File Name: /u01/app/oracle/backup/ctl_20220714_RAYSUEN_db_14_1.bak File Name: /u01/app/oracle/backup/spfile_c-3765622762-20220714-02 RMAN> RMAN> list backup;
#恢復cdb和pdb
恢復cdb$root run { set newname for database to '/u01/app/oracle/oradata/RAYSUEN/%b'; restore database root ; } 恢復PDB$SEED run { set newname for database to '/u01/app/oracle/oradata/RAYSUEN/pdbseed/%b'; restore database "PDB$SEED"; } 恢復pdb:rmanpdb run { set newname for database to '/u01/app/oracle/oradata/RAYSUEN/rmanpdb/%b'; restore database rmanpdb; } #恢復cdb RMAN> run { 2> set newname for database to '/u01/app/oracle/oradata/RAYSUEN/%b'; 3> restore database root ; 4> } executing command: SET NEWNAME Starting restore at 14-JUL-22 using channel ORA_DISK_1 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 /u01/app/oracle/oradata/RAYSUEN/system.261.1105292797 channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/RAYSUEN/sysaux.263.1105292821 channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/RAYSUEN/undotbs1.265.1105292839 channel ORA_DISK_1: restoring datafile 00007 to /u01/app/oracle/oradata/RAYSUEN/users.269.1105292891 channel ORA_DISK_1: reading from backup piece /u01/app/oracle/rman/incr0_20220714_RAYSUEN_7_1.bak channel ORA_DISK_1: errors found reading piece handle=/u01/app/oracle/rman/incr0_20220714_RAYSUEN_7_1.bak channel ORA_DISK_1: failover to piece handle=/u01/app/oracle/backup/incr0_20220714_RAYSUEN_7_1.bak tag=TAG20220714T142334 channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:01:05 Finished restore at 14-JUL-22 RMAN> run { 2> set newname for database to '/u01/app/oracle/oradata/RAYSUEN/pdbseed/%b'; 3> restore database "PDB$SEED"; 4> } executing command: SET NEWNAME Starting restore at 14-JUL-22 using channel ORA_DISK_1 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 00002 to /u01/app/oracle/oradata/RAYSUEN/pdbseed/system.262.1105292813 channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/RAYSUEN/pdbseed/sysaux.264.1105292835 channel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/RAYSUEN/pdbseed/undotbs1.266.1105292845 channel ORA_DISK_1: reading from backup piece /u01/app/oracle/rman/incr0_20220714_RAYSUEN_10_1.bak channel ORA_DISK_1: errors found reading piece handle=/u01/app/oracle/rman/incr0_20220714_RAYSUEN_10_1.bak channel ORA_DISK_1: failover to piece handle=/u01/app/oracle/backup/incr0_20220714_RAYSUEN_10_1.bak tag=TAG20220714T142334 channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:00:36 Finished restore at 14-JUL-22 RMAN> run { 2> set newname for database to '/u01/app/oracle/oradata/RAYSUEN/rmanpdb/%b'; 3> restore database rmanpdb; 4> } executing command: SET NEWNAME Starting restore at 14-JUL-22 using channel ORA_DISK_1 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 00012 to /u01/app/oracle/oradata/RAYSUEN/rmanpdb/system.279.1109946625 channel ORA_DISK_1: restoring datafile 00013 to /u01/app/oracle/oradata/RAYSUEN/rmanpdb/sysaux.280.1109946625 channel ORA_DISK_1: restoring datafile 00014 to /u01/app/oracle/oradata/RAYSUEN/rmanpdb/undotbs1.278.1109946625 channel ORA_DISK_1: reading from backup piece /u01/app/oracle/rman/incr0_20220714_RAYSUEN_8_1.bak channel ORA_DISK_1: errors found reading piece handle=/u01/app/oracle/rman/incr0_20220714_RAYSUEN_8_1.bak channel ORA_DISK_1: failover to piece handle=/u01/app/oracle/backup/incr0_20220714_RAYSUEN_8_1.bak tag=TAG20220714T142334 channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:00:46 Finished restore at 14-JUL-22 switch database root to copy; switch database "PDB$SEED" to copy; switch database rmanpdb to copy; RMAN> switch database root to copy; datafile 1 switched to datafile copy "/u01/app/oracle/oradata/RAYSUEN/system.261.1105292797" datafile 3 switched to datafile copy "/u01/app/oracle/oradata/RAYSUEN/sysaux.263.1105292821" datafile 5 switched to datafile copy "/u01/app/oracle/oradata/RAYSUEN/undotbs1.265.1105292839" datafile 7 switched to datafile copy "/u01/app/oracle/oradata/RAYSUEN/users.269.1105292891" RMAN> switch database "PDB$SEED" to copy; datafile 2 switched to datafile copy "/u01/app/oracle/oradata/RAYSUEN/pdbseed/system.262.1105292813" datafile 4 switched to datafile copy "/u01/app/oracle/oradata/RAYSUEN/pdbseed/sysaux.264.1105292835" datafile 6 switched to datafile copy "/u01/app/oracle/oradata/RAYSUEN/pdbseed/undotbs1.266.1105292845" RMAN> switch database rmanpdb to copy; datafile 12 switched to datafile copy "/u01/app/oracle/oradata/RAYSUEN/rmanpdb/system.279.1109946625" datafile 13 switched to datafile copy "/u01/app/oracle/oradata/RAYSUEN/rmanpdb/sysaux.280.1109946625" datafile 14 switched to datafile copy "/u01/app/oracle/oradata/RAYSUEN/rmanpdb/undotbs1.278.1109946625" recover database skip forever tablespace RAYPDB:SYSTEM,RAYPDB:SYSAUX,RAYPDB:UNDOTBS1,RAYPDB:USERS;RAYPDB:temp01 RMAN> recover database skip forever tablespace RAYPDB:SYSTEM,RAYPDB:SYSAUX,RAYPDB:UNDOTBS1,RAYPDB:USERS;RAYPDB:temp01 Starting recover at 14-JUL-22 using channel ORA_DISK_1 Executing: alter database datafile 8 offline drop Executing: alter database datafile 9 offline drop Executing: alter database datafile 10 offline drop Executing: alter database datafile 11 offline drop starting media recovery channel ORA_DISK_1: starting archived log restore to default destination channel ORA_DISK_1: restoring archived log archived log thread=1 sequence=35 channel ORA_DISK_1: reading from backup piece /u01/app/oracle/rman/arc_20220714_RAYSUEN_21_1.bak channel ORA_DISK_1: errors found reading piece handle=/u01/app/oracle/rman/arc_20220714_RAYSUEN_21_1.bak channel ORA_DISK_1: failover to piece handle=/u01/app/oracle/backup/arc_20220714_RAYSUEN_21_1.bak tag=TAG20220714T163116 channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:00:03 archived log file name=/u01/app/oracle/arch1_35_1105292778.dbf thread=1 sequence=35 unable to find archived log archived log thread=1 sequence=36 RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of recover command at 07/14/2022 16:44:50 RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 36 and starting SCN of 2319857 #這裡應為redo的指向到了磁碟組,需要rename redo日誌檔案位置 RMAN> select member from v$logfile; MEMBER -------------------------------------------------------------------------------- +DATA01/RAYSUEN/ONLINELOG/group_1.258.1105292783 +DATA01/RAYSUEN/ONLINELOG/group_2.259.1105292787 +DATA01/RAYSUEN/ONLINELOG/group_3.260.1105292791 SQL> select 'alter database rename file '||chr(39)||MEMBER||chr(39)||' to '||chr(39)||member||chr(39)||';' from gv$logfile b; 'ALTERDATABASERENAMEFILE'||CHR(39)||MEMBER||CHR(39)||'TO'||CHR(39)||MEMBER||CHR( -------------------------------------------------------------------------------- alter database rename file '+DATA01/RAYSUEN/ONLINELOG/group_1.258.1105292783' to '/u01/app/oracle/oradata/RAYSUEN/group_1.258.1105292783'; alter database rename file '+DATA01/RAYSUEN/ONLINELOG/group_2.259.1105292787' to '/u01/app/oracle/oradata/RAYSUEN/group_2.259.1105292787'; alter database rename file '+DATA01/RAYSUEN/ONLINELOG/group_3.260.1105292791' to '/u01/app/oracle/oradata/RAYSUEN/group_3.260.1105292791'; #編輯sql,並執行rename的sql語句 alter database rename file '+DATA01/RAYSUEN/ONLINELOG/group_1.258.1105292783' to '/u01/app/oracle/oradata/RAYSUEN/redo01.log'; alter database rename file '+DATA01/RAYSUEN/ONLINELOG/group_2.259.1105292787' to '/u01/app/oracle/oradata/RAYSUEN/redo02.log'; alter database rename file '+DATA01/RAYSUEN/ONLINELOG/group_3.260.1105292791' to '/u01/app/oracle/oradata/RAYSUEN/redo03.log’; SQL> alter database rename file '+DATA01/RAYSUEN/ONLINELOG/group_1.258.1105292783' to '/u01/app/oracle/oradata/RAYSUEN/redo01.log'; alter database rename file '+DATA01/RAYSUEN/ONLINELOG/group_2.259.1105292787' to '/u01/app/oracle/oradata/RAYSUEN/redo02.log'; alter database rename file '+DATA01/RAYSUEN/ONLINELOG/group_3.260.1105292791' to '/u01/app/oracle/oradata/RAYSUEN/redo03.log'; Database altered. SQL> Database altered. SQL> Database altered. #以resetlogs的方式啟動資料庫 SQL> alter database open resetlogs; Database altered. SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 RAYPDB MOUNTED 4 RMANPDB MOUNTED #RAYPDB沒有恢復,open失敗,可以刪除這個pdb SQL> alter pluggable database RAYPDB open; alter pluggable database RAYPDB open * ERROR at line 1: ORA-01147: SYSTEM tablespace file 8 is offline SQL> drop pluggable database RAYPDB including datafiles; Pluggable database dropped. SQL> SQL> alter pluggable database RMANPDB open; Pluggable database altered. SQ>
#更新切換temp表空間
Set linesize 300 Col datafile_path for a100 select t.con_id,t.ts#,t.name tablespace_name,tp.name datafile_path from v$tablespace t,V$TEMPFILE tp where t.ts#=tp.ts# and t.con_id=tp.con_id order by t.ts#,datafile_path; CON_ID TS# TABLESPACE_NAME DATAFILE_PATH ---------- ---------- -------------------- ---------------------------------------------------------------------------------------------------- 2 3 TEMP +DATA01/RAYSUEN/DF837B992FC72AB6E0536538A8C00D08/TEMPFILE/temp.268.1105292847 4 3 TEMP +DATA01/RAYSUEN/E3AAEB6E55B60ECDE0536538A8C0FCB9/TEMPFILE/temp.281.1109946665 1 3 TEMP +DATA01/RAYSUEN/TEMPFILE/temp.267.1105292847 SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 4 RMANPDB READ WRITE NO SQL> create temporary tablespace TEMP02 tempfile '/u01/app/oracle/oradata/RAYSUEN/temp02_01.dbf' size 32M reuse autoextend on next 5M Maxsize 32767M; Tablespace created. SQL> alter database default temporary tablespace TEMP02; Database altered. SQL> drop tablespace TEMP including contents and datafiles; Tablespace dropped. #切換到pdb,切換pdb的temp表空間 SQL> alter session set container=RMANPDB; Session altered. SQL> create temporary tablespace TEMP02 tempfile '/u01/app/oracle/oradata/RAYSUEN/rmanpdb/temp02_01.dbf' size 32M reuse autoextend on next 5M Maxsize 32767M; Tablespace created. SQL> alter database default temporary tablespace TEMP02; Database altered. SQL> drop tablespace TEMP including contents and datafiles; Tablespace dropped. SQL> Set linesize 300 SQL> Col datafile_path for a100 SQL> select t.con_id,t.ts#,t.name tablespace_name,tp.name datafile_path from v$tablespace t,V$TEMPFILE tp where t.ts#=tp.ts# and t.con_id=tp.con_id order by t.ts#,datafile_path; CON_ID TS# TABLESPACE_NAME DATAFILE_PATH ---------- ---------- -------------------- ---------------------------------------------------------------------------------------------------- 2 3 TEMP +DATA01/RAYSUEN/DF837B992FC72AB6E0536538A8C00D08/TEMPFILE/temp.268.1105292847 4 4 TEMP02 /u01/app/oracle/oradata/RAYSUEN/rmanpdb/temp02_01.dbf 1 5 TEMP02 /u01/app/oracle/oradata/RAYSUEN/temp02_01.dbf
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28572479/viewspace-2905959/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- RMAN備份異機恢復
- G017-ORACLE-MIGRATION-01 RMAN備份異機不完全恢復Oracle
- rman備份異機恢復(原創)
- RMAN備份恢復典型案例——異機恢復未知DBID
- 利用innobackupex備份集恢復指定庫
- 12C PDB使用RMAN的4種完全恢復場景
- 【RECO_ORACLE】Oracle 12c之CDB與PDB的備份與恢復(四)PDB的幾種恢復方式Oracle
- 【BAK_ORACLE】Oracle 12c之CDB與PDB的備份與恢復(三)CDB與PDB的備份方式Oracle
- RMAN備份恢復典型案例——跨平臺遷移pdb
- OceanBase-OB備份異地恢復流程
- 【ASK_ORACLE】Oracle 12c之CDB與PDB的備份與恢復(二)備份恢復之前你需要知道的Oracle
- RAC備份恢復之Voting備份與恢復
- 從dataguard備份的恢復機制
- 備份與恢復:polardb資料庫備份與恢復資料庫
- MySQL備份與恢復——基於Xtrabackup物理備份恢復MySql
- 備份和恢復
- mydumper備份恢復
- Mysql備份恢復MySql
- 透過搭建恢復目錄實現RMAN異地備份和恢復
- GitLab的備份與恢復Gitlab
- DB的備份與恢復
- 詳解叢集級備份恢復:物理細粒度備份恢復
- MySQL備份與恢復——基於MyDumper/MyLoader 邏輯備份恢復MySql
- oracle 12c 針對cdb的差異0備與對pdb進行恢復Oracle
- GitLab的自動備份、清理備份與恢復Gitlab
- Mysql備份與恢復(1)---物理備份MySql
- MySQL 備份與恢復MySql
- redis 備份和恢復Redis
- RMAN備份恢復技巧
- Jenkins備份與恢復Jenkins
- KunlunDB備份和恢復
- Grafana 備份恢復教程Grafana
- rman 增量備份恢復
- Postgresql 備份與恢復SQL
- 【ASK_ORACLE】Oracle 12c之CDB與PDB的備份與恢復(一)什麼是CDB與PDB?Oracle
- 12 使用RMAN備份和恢復檔案
- 使用Xtrabackup完整備份中恢復單表
- MySQL備份與恢復——基於OUTFILE /LOAD DATA 邏輯備份恢復MySql