方法一:从自动备份集中获取DBID–要求归档模式,并提前在RMAN中配置自动备份控制文件–此时有备份集产生就会自动备份控制文件
自动备份控制文件入SPFILE文件缺省格式%F命名规则:
如:C-IIIIIIII-YYYYMMDD-QQ 其中:C 控制文件;IIIIIIII DBID;YYYYMMDD 时间戳;QQ 序号00-FF。十六进制表示。
关于RMAN备份,更多信息
[oracle@bys3 archivelog]$ rman target /
Recovery Manager: Release 11.2.0.4.0 – Production on Sat Nov 16 12:03:47 2013
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database:
BYS3 (DBID=3358363031)
RMAN>
show all;
RMAN configuration parameters for database with db_unique_name BYS3 are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON; 自动备份控制文件已经开启
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO ‘%F’; # default 自动备份控制文件的格式使用系统默认的%F
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM ‘AES128’; # default
CONFIGURE COMPRESSION ALGORITHM ‘BASIC’ AS OF RELEASE ‘DEFAULT’ OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO ‘/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_bys3.f’; # default
RMAN>
backup tablespace users;
—省略输出-总之备份是成功的!
Starting Control File and SPFILE Autobackup at 2013/11/16 12:04:37 –这一句是自动备份控制文件的信息
piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/c-3358363031-20131116-00 comment=NONE –自动备份控制文件的位置
Finished Control File and SPFILE Autobackup at 2013/11/16 12:04:40
[oracle@bys3 archivelog]$ cd $ORACLE_HOME/dbs
[oracle@bys3 dbs]$ ls
–从这里和备份集中可以看到DBID–3358363031。RMAN默认的控制文件自动备份格式:%F,会在生成控制文件的备份集中包含DBID。–此参数很有用
01op3mrd_1_1 03op3nqk_1_1
c-3358363031-20131116-00 hc_bys3.dat initbys3.ora lkBYS3 orapwbys3 snapcf_bys3.f spfilebys3.ora
##############################################################################################################################
方法二.从备份时指定产生的日志获取DBID。
–这要求备份时要指定写日志,
可以在备份后通过查看日志确定TARGET数据库信息、备份是否完成、备份集位置或者出错信息排查等。
–不使用指定生成日志的话备份信息只在当前屏幕输出,像上一步那样(
如果用备份脚本,可能就是无屏幕输出了),以后无法查询到。
实际应用中经常是写成备份脚本来执行备份任务,下面用一个简单的备份脚本来演示。
使用备份脚本如下:
[oracle@bys3 ~]$
cat backusers.sh
#!/bin/sh
source /home/oracle/.bash_profile
/u01/app/oracle/product/11.2.0/dbhome_1/bin/rman
log /home/oracle/rmanlog-`date +%Y%m%d-%H%M`.log
生成的备份日志及备份集:
[oracle@bys3 ~]$
cat rmanlog-20131116-1223.log –
-查看生成的日志
Recovery Manager: Release 11.2.0.4.0 – Production on Sat Nov 16 12:23:10 2013
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
RMAN>
connected to target database: BYS3 (DBID=3358363031, not open) —这里会有RMAN连接到的TARGET数据库的库名及DBID信息,
RMAN> 2> 3>
Starting backup at 2013/11/16 12:23:13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=17 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00004 name=/u01/oradata/bys3/user01.dbf
channel ORA_DISK_1: starting piece 1 at 2013/11/16 12:23:15
channel ORA_DISK_1: finished piece 1 at 2013/11/16 12:23:16
piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/05op3otj_1_1 tag=TAG20131116T122315 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2013/11/16 12:23:16
Starting Control File and SPFILE Autobackup at 2013/11/16 12:23:16
piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/c-3358363031-20131116-01 comment=NONE
Finished Control File and SPFILE Autobackup at 2013/11/16 12:23:23
RMAN>
Recovery Manager complete.
通过日志中的备份集位置可以找到备份集
[oracle@bys3 ~]$ cd –
/u01/app/oracle/product/11.2.0/dbhome_1/dbs
[oracle@bys3 dbs]$ ls
01op3mrd_1_1 c-3358363031-20131116-00 initbys3.ora snapcf_bys3.f
03op3nqk_1_1
c-3358363031-20131116-01 lkBYS3 spfilebys3.ora
05op3otj_1_1 hc_bys3.dat orapwbys3
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
机房租用,北京机房租用,IDC机房托管, http://www.e1idc.net