[oracle@ln1 ~]$ more mydb_backup.sh
#!/bin/bash
source /home/oracle/.bash_profile
rman TARGET / @/home/oracle/rmanmydb.txt log=/home/oracle/mydb_backup.log append
[oracle@ln1 ~]$ cat rmanmydb.txt
RUN {
ALLOCATE CHANNEL c1 TYPE disk;
ALLOCATE CHANNEL c2 TYPE disk;
ALLOCATE CHANNEL c3 TYPE disk;
ALLOCATE CHANNEL c4 TYPE disk;
backup filesperset 3 database format '/media/mydbback/1320118228_%d_%T_%s_%p';
backup archivelog all delete input format '/media/mydbback/1320118228_%d_%T_%s_%p';
backup current controlfile format '/media/mydbback/1320118228_%d_%T_%s_%p';
delete noprompt obsolete device type disk;
release CHANNEL c1;
release CHANNEL c2;
release CHANNEL c3;
release CHANNEL c4;}
[oracle@localhost ~]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Thu Jul 6 16:23:05 2017
Copyright (c) 1982,2005,Oracle. All rights reserved.
connected to target database (not started)
RMAN> set dbid=1320118228
executing command: SET DBID
RMAN> startup nomount
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of startup command at 07/06/2017 16:25:45
RMAN-04014: startup Failed: ORA-01261: Parameter db_recovery_file_dest destination string cannot be translated
ORA-01262: Stat Failed on a file destination directory
Linux-ia64 Error: 2: No such file or directory
RMAN> startup nomount
Segmentation fault
[oracle@localhost ~]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Thu Jul 6 16:31:59 2017
Copyright (c) 1982,Oracle. All rights reserved.
connected to target database (not started)
RMAN> set dbid=1320118228
executing command: SET DBID
RMAN> startup nomount
Oracle instance started
Total System Global Area 2147483648 bytes
Fixed Size 1995784 bytes
Variable Size 301992952 bytes
Database Buffers 1828716544 bytes
Redo Buffers 14778368 bytes
RMAN> restore spfile from '/oracle/mydbback/1320118228_mydb_20170706_8100_1';
Starting restore at 06-JUL-17
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 07/06/2017 16:41:44
RMAN-06564: must use the TO clause when the instance is started with SPFILE
RMAN> restore controlfile from '/oracle/mydbback/1320118228_mydb_20170706_8100_1';
RMAN> restore controlfile from '/oracle/mydbback/1320118228_mydb_20170706_8100_1';
Starting restore at 06-JUL-17
using channel ORA_DISK_1
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete,elapsed time: 00:00:03
output filename=/oracle/oradata/mydb/controlfile/o1_mf_dovy39gj_.ctl
output filename=/oracle_back/flash_recovery_area/mydb/mydb/controlfile/o1_mf_dovy39sr_.ctl
Finished restore at 06-JUL-17
RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1
RMAN> restore database;
Starting restore at 06-JUL-17
Starting implicit crosscheck backup at 06-JUL-17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=541 devtype=DISK
Crosschecked 7 objects
Finished implicit crosscheck backup at 06-JUL-17
Starting implicit crosscheck copy at 06-JUL-17
using channel ORA_DISK_1
Crosschecked 5 objects
Finished implicit crosscheck copy at 06-JUL-17
searching for all files in the recovery area
cataloging files...
no files cataloged
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 07/06/2017 16:46:07
RMAN-06026: some targets not found - aborting 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> list backup of database;
using target database control file instead of recovery catalog
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
8026 Full 1.46G DISK 00:01:46 06-JUL-17
BP Key: 8026 Status: EXPIRED Compressed: NO Tag: TAG20170706T145108
Piece Name: /media/mydbback/1320118228_mydb_20170706_8095_1
List of Datafiles in backup set 8026
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 606382997 06-JUL-17 /oracle/oradata/mydb/datafile/o1_mf_system_4sx1c19w_.dbf
3 Full 606382997 06-JUL-17 /oracle/oradata/mydb/datafile/o1_mf_sysaux_4sx1c1lr_.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
8027 Full 6.78G DISK 00:04:23 06-JUL-17
BP Key: 8027 Status: EXPIRED Compressed: NO Tag: TAG20170706T145108
Piece Name: /media/mydbback/1320118228_mydb_20170706_8094_1
List of Datafiles in backup set 8027
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
2 Full 606382996 06-JUL-17 /oracle/oradata/mydb/datafile/o1_mf_undotbs1_4sx1c1vh_.dbf
4 Full 606382996 06-JUL-17 /oracle/oradata/mydb/datafile/o1_mf_users_4sx1c24d_.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
8028 Full 19.09G DISK 00:09:18 06-JUL-17
BP Key: 8028 Status: EXPIRED Compressed: NO Tag: TAG20170706T145108
Piece Name: /media/mydbback/1320118228_mydb_20170706_8093_1
List of Datafiles in backup set 8028
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
5 Full 606382995 06-JUL-17 /oracle/oradata/mydb/datafile/nbdl.dbf
2.5.2 注册单个文件,也可以注册整个目录 ---ASM: CATALOG START WITH '+disk'; # catalog allfiles from an ASM disk group --本地目录:最后一定要加/ CATALOG START WITH '/fs1/datafiles/'; #catalog all files in directory --有多个目录,注册多次:
RMAN> CATALOG BACKUPPIECE '/oracle/mydbback/1320118228_mydb_20170706_8093_1'; cataloged backuppiece backup piece handle=/oracle/mydbback/1320118228_mydb_20170706_8093_1 recid=8033 stamp=948646578 RMAN> CATALOG BACKUPPIECE '/oracle/mydbback/1320118228_mydb_20170706_8094_1'; cataloged backuppiece backup piece handle=/oracle/mydbback/1320118228_mydb_20170706_8094_1 recid=8034 stamp=948646604 RMAN> CATALOG BACKUPPIECE '/oracle/mydbback/1320118228_mydb_20170706_8095_1'; cataloged backuppiece backup piece handle=/oracle/mydbback/1320118228_mydb_20170706_8095_1 recid=8035 stamp=948646617 RMAN> CATALOG BACKUPPIECE '/oracle/mydbback/1320118228_mydb_20170706_8096_1'; cataloged backuppiece backup piece handle=/oracle/mydbback/1320118228_mydb_20170706_8096_1 recid=8036 stamp=948646640 RMAN> CATALOG BACKUPPIECE '/oracle/mydbback/1320118228_mydb_20170706_8097_1'; cataloged backuppiece backup piece handle=/oracle/mydbback/1320118228_mydb_20170706_8097_1 recid=8037 stamp=948646654 RMAN> CATALOG BACKUPPIECE '/oracle/mydbback/1320118228_mydb_20170706_8098_1'; cataloged backuppiece backup piece handle=/oracle/mydbback/1320118228_mydb_20170706_8098_1 recid=8038 stamp=948646679 RMAN> CATALOG BACKUPPIECE '/oracle/mydbback/1320118228_mydb_20170706_8099_1'; cataloged backuppiece backup piece handle=/oracle/mydbback/1320118228_mydb_20170706_8099_1 recid=8039 stamp=948646719 RMAN> CATALOG BACKUPPIECE '/oracle/mydbback/1320118228_mydb_20170706_8100_1'; cataloged backuppiece backup piece handle=/oracle/mydbback/1320118228_mydb_20170706_8100_1 recid=8040 stamp=948646729 RMAN> list backup; List of Backup Sets =================== BS Key Type LV Size ------- ---- -- ---------- 8026 Full 1.46G List of Datafiles in backup set 8026 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 1 Full 606382997 06-JUL-17 /oracle/oradata/mydb/datafile/o1_mf_system_4sx1c19w_.dbf 3 Full 606382997 06-JUL-17 /oracle/oradata/mydb/datafile/o1_mf_sysaux_4sx1c1lr_.dbf Backup Set Copy #1 of backup set 8026 Device Type Elapsed Time Completion Time Compressed Tag ----------- ------------ --------------- ---------- --- DISK 00:01:46 06-JUL-17 NO TAG20170706T145108 List of Backup Pieces for backup set 8026 Copy #1 BP Key Pc# Status Piece Name ------- --- ----------- ---------- 8026 1 EXPIRED /media/mydbback/1320118228_mydb_20170706_8095_1 Backup Set Copy #2 of backup set 8026 Device Type Elapsed Time Completion Time Compressed Tag ----------- ------------ --------------- ---------- --- DISK 00:01:46 06-JUL-17 NO TAG20170706T145108 List of Backup Pieces for backup set 8026 Copy #2 BP Key Pc# Status Piece Name ------- --- ----------- ---------- 8035 1 AVAILABLE /oracle/mydbback/1320118228_mydb_20170706_8095_1 BS Key Type LV Size ------- ---- -- ---------- 8027 Full 6.78G List of Datafiles in backup set 8027 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 2 Full 606382996 06-JUL-17 /oracle/oradata/mydb/datafile/o1_mf_undotbs1_4sx1c1vh_.dbf 4 Full 606382996 06-JUL-17 /oracle/oradata/mydb/datafile/o1_mf_users_4sx1c24d_.dbf Backup Set Copy #1 of backup set 8027 Device Type Elapsed Time Completion Time Compressed Tag ----------- ------------ --------------- ---------- --- DISK 00:04:23 06-JUL-17 NO TAG20170706T145108 List of Backup Pieces for backup set 8027 Copy #1 BP Key Pc# Status Piece Name ------- --- ----------- ---------- 8027 1 EXPIRED /media/mydbback/1320118228_mydb_20170706_8094_1 Backup Set Copy #2 of backup set 8027 Device Type Elapsed Time Completion Time Compressed Tag ----------- ------------ --------------- ---------- --- DISK 00:04:23 06-JUL-17 NO TAG20170706T145108 List of Backup Pieces for backup set 8027 Copy #2 BP Key Pc# Status Piece Name ------- --- ----------- ---------- 8034 1 AVAILABLE /oracle/mydbback/1320118228_mydb_20170706_8094_1 BS Key Type LV Size ------- ---- -- ---------- 8028 Full 19.09G List of Datafiles in backup set 8028 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 5 Full 606382995 06-JUL-17 /oracle/oradata/mydb/datafile/nbdl.dbf Backup Set Copy #1 of backup set 8028 Device Type Elapsed Time Completion Time Compressed Tag ----------- ------------ --------------- ---------- --- DISK 00:09:18 06-JUL-17 NO TAG20170706T145108 List of Backup Pieces for backup set 8028 Copy #1 BP Key Pc# Status Piece Name ------- --- ----------- ---------- 8028 1 EXPIRED /media/mydbback/1320118228_mydb_20170706_8093_1 Backup Set Copy #2 of backup set 8028 Device Type Elapsed Time Completion Time Compressed Tag ----------- ------------ --------------- ---------- --- DISK 00:09:18 06-JUL-17 NO TAG20170706T145108 List of Backup Pieces for backup set 8028 Copy #2 BP Key Pc# Status Piece Name ------- --- ----------- ---------- 8033 1 AVAILABLE /oracle/mydbback/1320118228_mydb_20170706_8093_1 BS Key Size ------- ---------- 8029 359.05M List of Archived Logs in backup set 8029 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 20701 606103905 04-JUL-17 606127880 04-JUL-17 1 20702 606127880 04-JUL-17 606155369 05-JUL-17 1 20703 606155369 05-JUL-17 606183950 05-JUL-17 1 20704 606183950 05-JUL-17 606216253 05-JUL-17 1 20705 606216253 05-JUL-17 606244270 05-JUL-17 1 20706 606244270 05-JUL-17 606267065 06-JUL-17 1 20707 606267065 06-JUL-17 606292725 06-JUL-17 1 20708 606292725 06-JUL-17 606345184 06-JUL-17 1 20709 606345184 06-JUL-17 606383818 06-JUL-17 Backup Set Copy #1 of backup set 8029 Device Type Elapsed Time Completion Time Compressed Tag ----------- ------------ --------------- ---------- --- DISK 00:00:23 06-JUL-17 NO TAG20170706T150036 List of Backup Pieces for backup set 8029 Copy #1 BP Key Pc# Status Piece Name ------- --- ----------- ---------- 8029 1 EXPIRED /media/mydbback/1320118228_mydb_20170706_8099_1 Backup Set Copy #2 of backup set 8029 Device Type Elapsed Time Completion Time Compressed Tag ----------- ------------ --------------- ---------- --- DISK 00:00:23 06-JUL-17 NO TAG20170706T150036 List of Backup Pieces for backup set 8029 Copy #2 BP Key Pc# Status Piece Name ------- --- ----------- ---------- 8039 1 AVAILABLE /oracle/mydbback/1320118228_mydb_20170706_8099_1 BS Key Size ------- ---------- 8030 501.20M List of Archived Logs in backup set 8030 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 20665 605258621 26-JUN-17 605287823 26-JUN-17 1 20666 605287823 26-JUN-17 605315902 26-JUN-17 1 20667 605315902 26-JUN-17 605322547 26-JUN-17 1 20668 605322547 26-JUN-17 605350759 27-JUN-17 1 20669 605350759 27-JUN-17 605384339 27-JUN-17 1 20670 605384339 27-JUN-17 605414261 27-JUN-17 1 20671 605414261 27-JUN-17 605435467 28-JUN-17 1 20672 605435467 28-JUN-17 605447866 28-JUN-17 1 20673 605447866 28-JUN-17 605480098 28-JUN-17 1 20674 605480098 28-JUN-17 605509623 28-JUN-17 1 20675 605509623 28-JUN-17 605527429 29-JUN-17 1 20676 605527429 29-JUN-17 605550990 29-JUN-17 Backup Set Copy #1 of backup set 8030 Device Type Elapsed Time Completion Time Compressed Tag ----------- ------------ --------------- ---------- --- DISK 00:00:29 06-JUL-17 NO TAG20170706T150036 List of Backup Pieces for backup set 8030 Copy #1 BP Key Pc# Status Piece Name ------- --- ----------- ---------- 8030 1 EXPIRED /media/mydbback/1320118228_mydb_20170706_8097_1 Backup Set Copy #2 of backup set 8030 Device Type Elapsed Time Completion Time Compressed Tag ----------- ------------ --------------- ---------- --- DISK 00:00:29 06-JUL-17 NO TAG20170706T150036 List of Backup Pieces for backup set 8030 Copy #2 BP Key Pc# Status Piece Name ------- --- ----------- ---------- 8037 1 AVAILABLE /oracle/mydbback/1320118228_mydb_20170706_8097_1 BS Key Size ------- ---------- 8031 499.61M List of Archived Logs in backup set 8031 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 20689 605775249 01-JUL-17 605809662 01-JUL-17 1 20690 605809662 01-JUL-17 605836089 02-JUL-17 1 20691 605836089 02-JUL-17 605859593 02-JUL-17 1 20692 605859593 02-JUL-17 605891423 02-JUL-17 1 20693 605891423 02-JUL-17 605926575 03-JUL-17 1 20694 605926575 03-JUL-17 605942538 03-JUL-17 1 20695 605942538 03-JUL-17 605978233 03-JUL-17 1 20696 605978233 03-JUL-17 606009927 03-JUL-17 1 20697 606009927 03-JUL-17 606026981 04-JUL-17 1 20698 606026981 04-JUL-17 606045497 04-JUL-17 1 20699 606045497 04-JUL-17 606071105 04-JUL-17 1 20700 606071105 04-JUL-17 606103905 04-JUL-17 Backup Set Copy #1 of backup set 8031 Device Type Elapsed Time Completion Time Compressed Tag ----------- ------------ --------------- ---------- --- DISK 00:00:31 06-JUL-17 NO TAG20170706T150036 List of Backup Pieces for backup set 8031 Copy #1 BP Key Pc# Status Piece Name ------- --- ----------- ---------- 8031 1 EXPIRED /media/mydbback/1320118228_mydb_20170706_8098_1 Backup Set Copy #2 of backup set 8031 Device Type Elapsed Time Completion Time Compressed Tag ----------- ------------ --------------- ---------- --- DISK 00:00:31 06-JUL-17 NO TAG20170706T150036 List of Backup Pieces for backup set 8031 Copy #2 BP Key Pc# Status Piece Name ------- --- ----------- ---------- 8038 1 AVAILABLE /oracle/mydbback/1320118228_mydb_20170706_8098_1 BS Key Size ------- ---------- 8032 503.21M List of Archived Logs in backup set 8032 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 20677 605550990 29-JUN-17 605581139 29-JUN-17 1 20678 605581139 29-JUN-17 605601367 29-JUN-17 1 20679 605601367 29-JUN-17 605628700 30-JUN-17 1 20680 605628700 30-JUN-17 605644283 30-JUN-17 1 20681 605644283 30-JUN-17 605676074 30-JUN-17 1 20682 605676074 30-JUN-17 605698490 30-JUN-17 1 20683 605698490 30-JUN-17 605713689 01-JUL-17 1 20684 605713689 01-JUL-17 605716951 01-JUL-17 1 20685 605716951 01-JUL-17 605721096 01-JUL-17 1 20686 605721096 01-JUL-17 605735708 01-JUL-17 1 20687 605735708 01-JUL-17 605744758 01-JUL-17 1 20688 605744758 01-JUL-17 605775249 01-JUL-17 Backup Set Copy #1 of backup set 8032 Device Type Elapsed Time Completion Time Compressed Tag ----------- ------------ --------------- ---------- --- DISK 00:00:33 06-JUL-17 NO TAG20170706T150036 List of Backup Pieces for backup set 8032 Copy #1 BP Key Pc# Status Piece Name ------- --- ----------- ---------- 8032 1 EXPIRED /media/mydbback/1320118228_mydb_20170706_8096_1 Backup Set Copy #2 of backup set 8032 Device Type Elapsed Time Completion Time Compressed Tag ----------- ------------ --------------- ---------- --- DISK 00:00:33 06-JUL-17 NO TAG20170706T150036 List of Backup Pieces for backup set 8032 Copy #2 BP Key Pc# Status Piece Name ------- --- ----------- ---------- 8036 1 AVAILABLE /oracle/mydbback/1320118228_mydb_20170706_8096_1 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 8033 Full 18.02M DISK 00:00:00 06-JUL-17 BP Key: 8040 Status: AVAILABLE Compressed: NO Tag: TAG20170706T150115 Piece Name: /oracle/mydbback/1320118228_mydb_20170706_8100_1 Control File Included: Ckp SCN: 606384144 Ckp time: 06-JUL-17 RMAN> RESTORE DATABASE; Starting restore at 06-JUL-17 allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=541 devtype=DISK channel ORA_DISK_1: starting datafile backupset restore channel ORA_DISK_1: specifying datafile(s) to restore from backup set restoring datafile 00001 to /oracle/oradata/mydb/datafile/o1_mf_system_4sx1c19w_.dbf restoring datafile 00003 to /oracle/oradata/mydb/datafile/o1_mf_sysaux_4sx1c1lr_.dbf channel ORA_DISK_1: reading from backup piece /oracle/mydbback/1320118228_mydb_20170706_8095_1 channel ORA_DISK_1: restored backup piece 1 piece handle=/oracle/mydbback/1320118228_mydb_20170706_8095_1 tag=TAG20170706T145108 channel ORA_DISK_1: restore complete,elapsed time: 00:00:36 channel ORA_DISK_1: starting datafile backupset restore channel ORA_DISK_1: specifying datafile(s) to restore from backup set restoring datafile 00002 to /oracle/oradata/mydb/datafile/o1_mf_undotbs1_4sx1c1vh_.dbf restoring datafile 00004 to /oracle/oradata/mydb/datafile/o1_mf_users_4sx1c24d_.dbf channel ORA_DISK_1: reading from backup piece /oracle/mydbback/1320118228_mydb_20170706_8094_1 channel ORA_DISK_1: restored backup piece 1 piece handle=/oracle/mydbback/1320118228_mydb_20170706_8094_1 tag=TAG20170706T145108 channel ORA_DISK_1: restore complete,elapsed time: 00:02:05 channel ORA_DISK_1: starting datafile backupset restore channel ORA_DISK_1: specifying datafile(s) to restore from backup set restoring datafile 00005 to /oracle/oradata/mydb/datafile/nbdl.dbf channel ORA_DISK_1: reading from backup piece /oracle/mydbback/1320118228_mydb_20170706_8093_1 channel ORA_DISK_1: restored backup piece 1 piece handle=/oracle/mydbback/1320118228_mydb_20170706_8093_1 tag=TAG20170706T145108 channel ORA_DISK_1: restore complete,elapsed time: 00:06:15 Finished restore at 06-JUL-17 RMAN> recover database; Starting recover at 06-JUL-17 using channel ORA_DISK_1 starting media recovery channel ORA_DISK_1: starting archive log restore to default destination channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=20709 channel ORA_DISK_1: reading from backup piece /oracle/mydbback/1320118228_mydb_20170706_8099_1 channel ORA_DISK_1: restored backup piece 1 piece handle=/oracle/mydbback/1320118228_mydb_20170706_8099_1 tag=TAG20170706T150036 channel ORA_DISK_1: restore complete,elapsed time: 00:00:07 archive log filename=/oracle_back/flash_recovery_area/mydb/mydb/archivelog/2017_07_06/o1_mf_1_20709_dovzogxo_.arc thread=1 sequence=20709 channel default: deleting archive log(s) archive log filename=/oracle_back/flash_recovery_area/mydb/mydb/archivelog/2017_07_06/o1_mf_1_20709_dovzogxo_.arc recid=20701 stamp=948647471 unable to find archive log archive log thread=1 sequence=20710 RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of recover command at 07/06/2017 17:11:16 RMAN-06054: media recovery requesting unknown log: thread 1 seq 20710 lowscn 606383818 RMAN> shutdown immediate database dismounted Oracle instance shut down RMAN> [oracle@localhost ~]$ sqlplus / as sysdba sql*Plus: Release 10.2.0.1.0 - Production on Thu Jul 6 17:11:59 2017 Copyright (c) 1982,Oracle. All rights reserved. Connected to an idle instance. sql> startup ORACLE instance started. Total System Global Area 2147483648 bytes Fixed Size 1995784 bytes Variable Size 301992952 bytes Database Buffers 1828716544 bytes Redo Buffers 14778368 bytes Database mounted. ORA-01589: must use RESETLOGS or NORESETLOGS option for database open sql> alter database open resetlogs; Database altered. Oracle RMAN 将 备份集 重新 注册到控制文件 说明 2.5 将备份集重新注册到控制文件 因为之前备份集的位置发生改变,导致coRSScheck之后,将之前备份的记录标记为expired,我们后来手工删除了这些expired的备份集信息。 现在我们要进行恢复,必须将之前的备份信息重新注册到控制文件中来。 2.5.1 方法一:注册单个备份片 RMAN> CATALOG BACKUPPIECE '/u01/bak/arch_0no76njh_1_1_20130416','/u01/bak/ctl_file_0oo76njm_1_1_20130416'; cataloged backup piece backup piecehandle=/u01/bak/arch_0no76njh_1_1_20130416 RECID=25 STAMP=812872014 cataloged backup piece backup piece handle=/u01/bak/ctl_file_0oo76njm_1_1_20130416RECID=26 STAMP=812872014 --可以正常查看: RMAN> list backupset summary; List of Backups =============== Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag ------- -- -- - ----------- ---------------------- ------- ---------- --- 25 B A A DISK 16-APR-13 1 1 NO ARC_BAK 26 B F A DISK 16-APR-13 1 1 NO BAK_CTLFILE RMAN> catalog start with'/data01/'; 2.5.2 方法二:注册整个目录 ---ASM: CATALOG START WITH '+disk'; # catalog allfiles from an ASM disk group --本地目录:最后一定要加/ CATALOG START WITH '/fs1/datafiles/'; #catalog all files in directory --有多个目录,注册多次: RMAN> catalog start with'/data01/'; RMAN>catalog start with '/data02/'; RMAN>catalog start with '/data03/'; --示例: RMAN> catalog start with '/u01/bak'; searching for all files that match thepattern /u01/bak List of Files Unknown to the Database ===================================== File Name: /u01/bak/dave_lev0_0io76nh7_1_1_20130416 File Name:/u01/bak/dave_lev0_21o687pl_1_1_20130404 File Name:/u01/bak/dave_spfile_1mo65679_1_1_20130403 File Name:/u01/bak/arch_27o687s8_1_1_20130404 File Name:/u01/bak/ctl_file_2ao6vobb_1_1_20130413 File Name: /u01/bak/arch_26o687rp_1_1_20130404 File Name:/u01/bak/arch_1ho6566m_1_1_20130403 File Name:/u01/bak/dave_lev0_20o687pl_1_1_20130404 File Name:/u01/bak/arch_1io6566n_1_1_20130403 File Name:/u01/bak/dave_spfile_29o687sc_1_1_20130404 File Name: /u01/bak/ctl_file_1lo65676_1_1_20130403 File Name: /u01/bak/block_change_tracking.f File Name:/u01/bak/ctl_file_28o687sa_1_1_20130404 File Name:/u01/bak/dave_lev0_0ko76nim_1_1_20130416 File Name:/u01/bak/dave_lev0_22o687qp_1_1_20130404 File Name: /u01/bak/dave_lev0_0jo76nh7_1_1_20130416 Do you really want to catalog the abovefiles (enter YES or NO)? YES cataloging files... cataloging done List of Cataloged Files ======================= File Name:/u01/bak/dave_lev0_0io76nh7_1_1_20130416 File Name: /u01/bak/ctl_file_2ao6vobb_1_1_20130413 File Name:/u01/bak/dave_lev0_0ko76nim_1_1_20130416 File Name:/u01/bak/dave_lev0_0jo76nh7_1_1_20130416 List of Files Which Where Not Cataloged ======================================= File Name: /u01/bak/dave_lev0_21o687pl_1_1_20130404 RMAN-07518: Reason: Foreign database file DBID: 854240218 Database Name: DAVE File Name:/u01/bak/dave_spfile_1mo65679_1_1_20130403 RMAN-07518: Reason: Foreign database file DBID: 854240218 Database Name: DAVE File Name: /u01/bak/arch_27o687s8_1_1_20130404 RMAN-07518: Reason: Foreign database file DBID: 854240218 Database Name: DAVE File Name:/u01/bak/arch_26o687rp_1_1_20130404 RMAN-07518: Reason: Foreign database file DBID: 854240218 Database Name: DAVE File Name: /u01/bak/arch_1ho6566m_1_1_20130403 RMAN-07518: Reason: Foreign database file DBID: 854240218 Database Name: DAVE File Name:/u01/bak/dave_lev0_20o687pl_1_1_20130404 RMAN-07518: Reason: Foreign database file DBID: 854240218 Database Name: DAVE File Name: /u01/bak/arch_1io6566n_1_1_20130403 RMAN-07518: Reason: Foreign database file DBID: 854240218 Database Name: DAVE File Name:/u01/bak/dave_spfile_29o687sc_1_1_20130404 RMAN-07518: Reason: Foreign database file DBID: 854240218 Database Name: DAVE File Name:/u01/bak/ctl_file_1lo65676_1_1_20130403 RMAN-07518: Reason: Foreign database file DBID: 854240218 Database Name: DAVE File Name: /u01/bak/block_change_tracking.f RMAN-07529: Reason: catalog is not supported for this file type File Name: /u01/bak/ctl_file_28o687sa_1_1_20130404 RMAN-07518: Reason: Foreign database file DBID: 854240218 Database Name: DAVE File Name:/u01/bak/dave_lev0_22o687qp_1_1_20130404 RMAN-07518: Reason: Foreign database file DBID: 854240218 Database Name: DAVE RMAN> --验证: RMAN> list backupset summary; List of Backups =============== Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag ------- -- -- - ----------- ---------------------- ------- ---------- --- 25 B A A DISK 16-APR-13 1 1 NO ARC_BAK 26 B F A DISK 16-APR-13 1 1 NO BAK_CTLFILE 27 B 0 A DISK 16-APR-13 1 1 NO DAVE_LEV0 28 B F A DISK 13-APR-13 1 1 NO BAK_CTLFILE 29 B 0 A DISK 16-APR-13 1 1 NO DAVE_LEV0 30 B 0 A DISK 16-APR-13 1 1 NO DAVE_LEV0