backup中的tag的使用
1、tag 用来给备份或者镜像做标记 tag + 标识名
法 1、在后面
backup as copy datafile 5 tag "datafile5";
法 2、在前面
backup tag "datafile5" as copy datafile 5 ;
2、用作筛选标识 from tag + 标识名
backup copy of datafile 5 from tag "datafile5";
测试环境:
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
下面是试验证明,试验过程如下:
测试过程:
RMAN> backup copy of datafile 5 from tag"datafile5";
Starting backup at 22-NOV-08
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 11/22/2008 16:20:36
RMAN-06587: one or more datafilecopies were not found
RMAN-06586: no copy of datafile 5 with tag DATAFILE5 found
RMAN> backup as copy datafile 5 tag "datafile5";
Starting backup at 22-NOV-08
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile fno=00005 name=/opt/oracle/oradata/ge02/users01.dbf
output filename=/opt/backup1/data_D-GE02_I-1566649158_TS-USERS_FNO-5_50k0bnj1 tag=DATAFILE5 recid=70 stamp=671473512
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:04:25
Finished backup at 22-NOV-08
Starting Control File and SPFILE Autobackup at 22-NOV-08
piece handle=/opt/oracle/flash_recovery_area/GE02/autobackup/2008_11_22/o1_mf_s_671473514_4lhjhhgn_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 22-NOV-08
RMAN> backup tag "datafile5" as copy datafile 5 ;
Starting backup at 22-NOV-08
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile fno=00005 name=/opt/oracle/oradata/ge02/users01.dbf
output filename=/opt/backup1/data_D-GE02_I-1566649158_TS-USERS_FNO-5_54k0bopq tag=DATAFILE5 recid=71 stamp=671474757
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:04:35
Finished backup at 22-NOV-08
Starting Control File and SPFILE Autobackup at 22-NOV-08
piece handle=/opt/oracle/flash_recovery_area/GE02/autobackup/2008_11_22/o1_mf_s_671474766_4lhkpm12_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 22-NOV-08
RMAN> backup copy of datafile 5 from tag"datafile5";
Starting backup at 22-NOV-08
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: including datafile copy of datafile 00005 in backupset
input filename=/opt/backup1/data_D-GE02_I-1566649158_TS-USERS_FNO-5_50k0bnj1
channel ORA_DISK_1: starting piece 1 at 22-NOV-08
channel ORA_DISK_1: finished piece 1 at 22-NOV-08
piece handle=/opt/backup1/52k0bob1_1_1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:04:25
Finished backup at 22-NOV-08
Starting Control File and SPFILE Autobackup at 22-NOV-08
piece handle=/opt/oracle/flash_recovery_area/GE02/autobackup/2008_11_22/o1_mf_s_671474283_4lhk7hhb_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 22-NOV-08