今天三思问我一个问题:RMAN备份FORMAT格式中%a的含义。
其实Oracle的文档有这个表述:
%a
Specifies the activation ID of the database.
不过这个描述很不明确。其实junsansi的意思是,这个%a对应的信息在数据库中的哪里体现出来。
下面先看看备份信息里面的这个值:
[oracle@yans1 ~]$ rman target /
Recovery Manager: Release10.2.0.3.0 - Production on星期四7月16 14:18:14 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: TEST08 (DBID=3812548755)
RMAN> backup tablespace users format '/data/backup/test08_%a';
Starting backup at 16-7月-09
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=100 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 07/16/2009 14:18:38
ORA-19602: cannot backup or copy active file in NOARCHIVELOG mode
RMAN> sql 'alter tablespace users read only';
sql statement: alter tablespace users read only
RMAN> backup tablespace users format '/data/backup/test08_%a';
Starting backup at 16-7月-09
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00004 name=/data/oradata/test08/users01.dbf
channel ORA_DISK_1: starting piece 1 at 16-7月-09
channel ORA_DISK_1: finished piece 1 at 16-7月-09
piece handle=/data/backup/test08_657125523 tag=TAG20090716T141924 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 16-7月-09
RMAN> exit
Recovery Manager complete.
可以看到,对应的activation的ID是657125523。
而且根据文档的描述,这个属性是数据库的,但是在V$DATABASE视图中找不到这个对应的值。
SQL> SELECT VIEW_DEFINITION FROM V$FIXED_VIEW_DEFINITION
2 WHERE VIEW_NAME = 'GV$DATABASE';
VIEW_DEFINITION
--------------------------------------------------------------------------------------------
select di.inst_id,di.didbi,di.didbn,to_date(di.dicts,'MM/DD/RR HH24:MI:SS','NLS_CALENDAR=Gregorian'),to_number(di.dirls)
,to_date(di.dirlc,'MM/DD/RR HH24:MI:SS','NLS_CALENDAR=Gregorian'),to_number(di.diprs),to_date(di.diprc,'MM/DD/RR HH24:MI
:SS','NLS_CALENDAR=Gregorian'),decode(di.dimla,0,'NOARCHIVELOG',1,'ARCHIVELOG','MANUAL'),to_number(di.discn),to_number(d
i.difas),decode(bitand(di.diflg,256),256,'CREATED',decode(bitand(di.diflg,1024),1024,'STANDBY',decode(bitand(di.diflg,32
768),32768,'CLONE',decode(bitand(di.diflg,4096),4096,'BACKUP','CURRENT')))),to_date(di.dicct,'MM/DD/RR HH24:MI:SS','NLS_
CALENDAR=Gregorian'),di.dicsq,to_number(di.dickp_scn),to_date(di.dickp_tim,'MM/DD/RR HH24:MI:SS','NLS_CALENDAR=Gregorian
'),decode(bitand(di.diflg,4),4,'REQUIRED',decode(di.diirs,0,'NOT ALLOWED','ALLOWED')),to_date(di.divts,'MM/DD/RR HH24:MI
:SS','NLS_CALENDAR=Gregorian'),decode(di.didor,0,'MOUNTED',decode(di.didor,1,'READ WRITE','READ ONLY')),decode(bitand(di
.diflg,65536),65536,'MAXIMUM PROTECTION',decode(bitand(di.diflg,128),128,'MAXIMUM AVAILABILITY',decode(bitand(di.diflg,1
34217728),134217728,'RESYNCHRONIZATION',decode(bitand(di.diflg,8),8,'UNPROTECTED','MAXIMUM PERFORMANCE')))),decode(di.di
prt,1,'MAXIMUM PROTECTION',2,'MAXIMUM AVAILABILITY',3,'RESYNCHRONIZATION',4,'MAXIMUM PERFORMANCE',5,'UNPROTECTED', 'UNK
NOWN'),decode(di.dirae,0,'DISABLED',1,'SEND',2,'RECEIVE',3,'ENABLED','UNKNOWN'),to_number(di.diacid),to_number(di.diacid
),decode(bitand(di.diflg,33554432),33554432,'LOGICAL STANDBY',decode(bitand(di.diflg,1024),1024,'PHYSICAL STANDBY','PRIM
ARY')),to_number(di.diars),decode(bitand(difl2,1),1,'ENABLED','DISABLED'),decode(di.disos,0,'IMPOSSIBLE',1,'NOT ALLOWED'
,2,'SWITCHOVER LATENT',3,'SWITCHOVER PENDING',4,'TO PRIMARY',5,'TO STANDBY',6,'RECOVERY NEEDED',7,'SESSIONS ACTIVE',8,'P
REPARING SWITCHOVER',9,'PREPARING DICTIONARY',10,'TO LOGICAL STANDBY','UNKNOWN'),decode(di.didgd,0,'DISABLED','ENABLED')
本文URL地址:http://www.bianceng.cn/database/Oracle/201410/45461.htm