红帽 6 上的 oracle 11.2.0.4
SERV1 是运行数据库 MAZ 的 prod 服务器,SERV2 是没有数据库的开发服务器。
我已经记下了 dbid 和最后一个 SCN,然后使用以下命令在 SERV1 上进行了备份
run
{
backup database plus archivelog tag "first";
}
现在将所有备份文件和 pfile 的副本复制到 SERV2。
在 SERV2 上
rman target /
set dbid 2711958994
startup mount pfile=/u01/app/oracle/product/11.2.0/dbhome_2/dbs/initmaz.ora
run {
set controlfile autobackup format for device type disk to '/u03/app/oracle/fast_recovery_area/TEST/autobackup/2015_05_15/%F';
restore spfile to pfile '/u01/app/oracle/product/11.2.0/dbhome_2/dbs/initmaz.ora' from autobackup;
}
shutdown immediate
startup nomount pfile=/u01/app/oracle/product/11.2.0/dbhome_2/dbs/initmaz.ora
run {
set controlfile autobackup format for device type disk to '/u03/app/oracle/fast_recovery_area/TEST/autobackup/2015_05_15/%F';
restore controlfile from autobackup;
}
alter database mount;
catalog start with '/u03/app/oracle/fast_recovery_area/MAZ/backupset/2015_05_15';
现在我检查了它在 SERV2 上可用的备份集
rman target /
RMAN> list backup
2> ;
using target database control file instead of recovery catalog
List of Backup Sets
===================
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
190 6.59M DISK 00:00:00 15-MAY-15
BP Key: 190 Status: AVAILABLE Compressed: YES Tag: FIRST
Piece Name: /u03/app/oracle/fast_recovery_area/MAZ/backupset/2015_05_15/o1_mf_annnn_FIRST_bocjlvfk_.bkp
List of Archived Logs in backup set 190
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 501 1950316 14-MAY-15 1973213 15-MAY-15
1 502 1973213 15-MAY-15 1973254 15-MAY-15
1 503 1973254 15-MAY-15 1974268 15-MAY-15
1 504 1974268 15-MAY-15 1974295 15-MAY-15
1 505 1974295 15-MAY-15 1974321 15-MAY-15
1 506 1974321 15-MAY-15 1976213 15-MAY-15
1 507 1976213 15-MAY-15 1976251 15-MAY-15
1 508 1976251 15-MAY-15 1977715 15-MAY-15
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
191 Full 76.84M DISK 00:00:30 15-MAY-15
BP Key: 191 Status: AVAILABLE Compressed: YES Tag: TAG20150515T105436
Piece Name: /u03/app/oracle/fast_recovery_area/MAZ/backupset/2015_05_15/o1_mf_nnndf_TAG20150515T105436_bocjlwr0_.bkp
List of Datafiles in backup set 191
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 1977721 15-MAY-15 /u02/app/oracle/oradata/maz/system01.dbf
2 Full 1977721 15-MAY-15 /u02/app/oracle/oradata/maz/sysaux01.dbf
3 Full 1977721 15-MAY-15 /u02/app/oracle/oradata/maz/undotbs01.dbf
4 Full 1977721 15-MAY-15 /u02/app/oracle/oradata/maz/users01.dbf
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
192 3.00K DISK 00:00:00 15-MAY-15
BP Key: 192 Status: AVAILABLE Compressed: YES Tag: FIRST
Piece Name: /u03/app/oracle/fast_recovery_area/MAZ/backupset/2015_05_15/o1_mf_annnn_FIRST_bocjmzy1_.bkp
List of Archived Logs in backup set 192
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 509 1977715 15-MAY-15 1977737 15-MAY-15
此时,如果我运行以下命令,那么一切正常
run {
set until scn 1977737;
restore database;
recover database;
}
alter database open resetlogs;
但我想使用标签名称(FIRST)恢复,所以我试试这个
run {
set until scn 1977737;
restore database from TAG=FIRST;
}
我收到消息
Starting restore at 15-MAY-15
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 05/15/2015 13:15:05
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
关于我做错了什么的任何想法?
谢谢
正确的备份语法应该是:
现在,如果您查看
list backup
输出,您会注意到只有带有归档日志的备份集具有标记 FIRST。包含数据文件备份的备份集具有自动生成的标签 TAG20150515T105436。首先像这样关闭数据库:
否则,您可以使用此方法: