RMAN 备份路径困惑(使用plus archivelog时)
来源:互联网 发布:paxos一致性算法图解 编辑:程序博客网 时间:2024/06/07 04:03
--*******************************************
-- RMAN 备份路径困惑(使用plus archivelog时)
--*******************************************
最近RMAN备份时,碰到一点疑惑。即使用plusarchivelog时不管是使用format参数指定备份文件的路径还是使用configure配置RMAN备份路径,都不能
将数据文件和日志文件备份到同一路径。在因为以前使用RMAN备份,都是单独备份数据文件和日志文件,所以一直没有在意这个问题。下面给出具体事例。
一、指定备份路径备份数据库及归档日志
RMAN> backupdatabase format'/u01/bk/bk_db_%U' plusarchivelog;
Starting backupat02-MAY-11
currentlog archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=146 devtype=DISK
channel ORA_DISK_1: startingarchivelog backupset
channel ORA_DISK_1: specifyingarchivelog(s)inbackupset
input archivelogthread=1sequence=50 recid=10 stamp=750091269
input archivelogthread=1sequence=51 recid=11 stamp=750091281
input archivelogthread=1sequence=52 recid=12 stamp=750091286
input archivelogthread=1sequence=53 recid=13 stamp=750092325
input archivelogthread=1sequence=54 recid=14 stamp=750092487
input archivelogthread=1sequence=55 recid=15 stamp=750093621
input archivelogthread=1sequence=56 recid=16 stamp=750094799
input archivelogthread=1sequence=57 recid=17 stamp=750095198
input archivelogthread=1sequence=58 recid=18 stamp=750099671
input archivelogthread=1sequence=59 recid=19 stamp=750099848
input archivelogthread=1sequence=60 recid=20 stamp=750099945
input archivelogthread=1sequence=61 recid=21 stamp=750103678
channel ORA_DISK_1: starting piece1at02-MAY-11
channel ORA_DISK_1: finished piece1at02-MAY-11
piece handle=/u01/app/oracle/flash_recovery_area/ODBP/backupset/2011_05_02/ --归档日志放在了闪回区
o1_mf_annnn_TAG20110502T180758_6vx0mzl2_.bkp tag=TAG20110502T180758comment=NONE
channel ORA_DISK_1: backupsetcomplete, elapsedtime:00:00:02
Finished backupat02-MAY-11
Starting backupat02-MAY-11
using channel ORA_DISK_1
channel ORA_DISK_1: startingfulldatafile backupset
channel ORA_DISK_1: specifyingdatafile(s)in backupset
input datafile fno=00001name=/u01/app/oracle/oradata/odbp/system01.dbf
input datafile fno=00002name=/u01/app/oracle/oradata/odbp/undotbs01.dbf
input datafile fno=00003name=/u01/app/oracle/oradata/odbp/sysaux01.dbf
input datafile fno=00004name=/u01/app/oracle/oradata/odbp/users01.dbf
channel ORA_DISK_1: starting piece1at02-MAY-11
channel ORA_DISK_1: finished piece1at02-MAY-11
piece handle=/u01/bk/bk_db_1dmbbb40_1_1 tag=TAG20110502T180800comment=NONE --数据文件存放在了指定的路径
channel ORA_DISK_1: backupsetcomplete, elapsedtime:00:00:45
channel ORA_DISK_1: startingfulldatafile backupset
channel ORA_DISK_1: specifyingdatafile(s)in backupset
input datafile fno=00001name=/u01/app/oracle/oradata/odbp/system01.dbf
input datafile fno=00002name=/u01/app/oracle/oradata/odbp/undotbs01.dbf
input datafile fno=00003name=/u01/app/oracle/oradata/odbp/sysaux01.dbf
input datafile fno=00004name=/u01/app/oracle/oradata/odbp/users01.dbf
channel ORA_DISK_1: starting piece1at02-MAY-11
channel ORA_DISK_1: finished piece1at02-MAY-11
piece handle=/u01/app/oracle/flash_recovery_area/ODBP/backupset/2011_05_02/ --数据文件同时也存放在了闪回区
o1_mf_nnndf_TAG20110502T180800_6vx0og2z_.bkp tag=TAG20110502T180800comment=NONE
channel ORA_DISK_1: backupsetcomplete, elapsedtime:00:00:45
channel ORA_DISK_1: startingfulldatafile backupset
channel ORA_DISK_1: specifyingdatafile(s)in backupset
includingcurrent controlfilein backupset
includingcurrentSPFILEin backupset
channel ORA_DISK_1: starting piece1at02-MAY-11
channel ORA_DISK_1: finished piece1at02-MAY-11
piece handle=/u01/bk/bk_db_1fmbbb6r_1_1 tag=TAG20110502T180800comment=NONE --控制文件和spfile存放到了指定路径
channel ORA_DISK_1: backupsetcomplete, elapsedtime:00:00:02
channel ORA_DISK_1: startingfulldatafile backupset
channel ORA_DISK_1: specifyingdatafile(s)in backupset
includingcurrent controlfilein backupset
includingcurrentSPFILEin backupset
channel ORA_DISK_1: starting piece1at02-MAY-11
channel ORA_DISK_1: finished piece1at02-MAY-11
piece handle=/u01/app/oracle/flash_recovery_area/ODBP/backupset/2011_05_02/ --控制文件和spfile同时也保存到了闪回区
o1_mf_ncsnf_TAG20110502T180800_6vx0pycl_.bkp tag=TAG20110502T180800comment=NONE
channel ORA_DISK_1: backupsetcomplete, elapsedtime:00:00:01
Finished backupat02-MAY-11
Starting backupat02-MAY-11
currentlog archived
using channel ORA_DISK_1
channel ORA_DISK_1: startingarchivelog backupset
channel ORA_DISK_1: specifyingarchivelog(s)inbackupset
input archivelogthread=1sequence=62 recid=22 stamp=750103776
channel ORA_DISK_1: starting piece1at02-MAY-11
channel ORA_DISK_1: finished piece1at02-MAY-11
piece handle=/u01/app/oracle/flash_recovery_area/ODBP/backupset/2011_05_02/ --归档日志放在了闪回区
o1_mf_annnn_TAG20110502T180936_6vx0q1dg_.bkp tag=TAG20110502T180936comment=NONE
channel ORA_DISK_1: backupsetcomplete, elapsedtime:00:00:02
Finished backupat02-MAY-11
--查看备份的数据文件、控制文件等信息
[oracle@odbp 2011_05_02]$ ls -hltr
total 703M
-rw-r----- 1 oracle oinstall 4.5M May 2 18:08 o1_mf_annnn_TAG20110502T180758_6vx0mzl2_.bkp
-rw-r----- 1 oracle oinstall 691M May 2 18:09 o1_mf_nnndf_TAG20110502T180800_6vx0og2z_.bkp
-rw-r----- 1 oracle oinstall 6.9M May 2 18:09 o1_mf_ncsnf_TAG20110502T180800_6vx0pycl_.bkp
-rw-r----- 1 oracle oinstall 15K May 2 18:09 o1_mf_annnn_TAG20110502T180936_6vx0q1dg_.bkp
[oracle@odbp 2011_05_02]$ ls -hltr /u01/bk
total 698M
-rw-r----- 1 oracle oinstall 691M May 2 18:08 bk_db_1dmbbb40_1_1
-rw-r----- 1 oracle oinstall 6.9M May 2 18:09 bk_db_1fmbbb6r_1_1
从上面的情况来看,
1.当指定了db_recovery_file_dest参数为 /u01/app/oracle/flash_recovery_area时,则归档日志被备份到此目录。
2.在参数db_recovery_file_dest参数为闪回区时,则数据文件与控制文件及spfile被使用了双重备份。
--RMAN配置信息为缺省,未做任何调整
RMAN> showall;
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TOREDUNDANCY1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; #default
CONFIGURE DEFAULT DEVICE TYPETODISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; #default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICETYPEDISKTO'%F'; # default
CONFIGURE DEVICE TYPEDISK PARALLELISM1BACKUPTYPETO BACKUPSET; # default
CONFIGURE DATAFILEBACKUP COPIESFOR DEVICETYPEDISKTO1; # default
CONFIGURE ARCHIVELOGBACKUP COPIESFOR DEVICETYPEDISKTO1; # default
CONFIGURE MAXSETSIZE TOUNLIMITED; #default
CONFIGURE ENCRYPTIONFORDATABASEOFF; #default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; #default
CONFIGURE ARCHIVELOG DELETION POLICY TONONE; #default
CONFIGURE SNAPSHOTCONTROLFILENAMETO'/u01/app/oracle/10g/dbs/snapcf_odbp.f'; # default
--将db_recovery_file_dest参数置空
SQL>altersystemset db_recovery_file_dest='';
System altered.
二、再次使用RMAN进行备份
RMAN> backupdatabase format'/u01/bk/bk_db_%U' plusarchivelog;
Starting backupat02-MAY-11
currentlog archived
using targetdatabase controlfileinsteadofrecovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=138 devtype=DISK
channel ORA_DISK_1: startingarchivelog backupset
channel ORA_DISK_1: specifyingarchivelog(s)inbackupset
input archivelogthread=1sequence=50 recid=10 stamp=750091269
input archivelogthread=1sequence=51 recid=11 stamp=750091281
input archivelogthread=1sequence=52 recid=12 stamp=750091286
input archivelogthread=1sequence=53 recid=13 stamp=750092325
input archivelogthread=1sequence=54 recid=14 stamp=750092487
input archivelogthread=1sequence=55 recid=15 stamp=750093621
input archivelogthread=1sequence=56 recid=16 stamp=750094799
input archivelogthread=1sequence=57 recid=17 stamp=750095198
input archivelogthread=1sequence=58 recid=18 stamp=750099671
input archivelogthread=1sequence=59 recid=19 stamp=750099848
input archivelogthread=1sequence=60 recid=20 stamp=750099945
input archivelogthread=1sequence=61 recid=21 stamp=750103678
input archivelogthread=1sequence=62 recid=22 stamp=750103776
input archivelogthread=1sequence=63 recid=23 stamp=750104981
channel ORA_DISK_1: starting piece1at02-MAY-11
channel ORA_DISK_1: finished piece1at02-MAY-11
piece handle=/u01/app/oracle/10g/dbs/1imbbccm_1_1 tag=TAG20110502T182942 comment=NONE--归档日志备份位于$ORACLE_HOME/dbs路径下
channel ORA_DISK_1: backupsetcomplete, elapsedtime:00:00:02
Finished backupat02-MAY-11
Starting backupat02-MAY-11
using channel ORA_DISK_1
channel ORA_DISK_1: startingfulldatafile backupset
channel ORA_DISK_1: specifyingdatafile(s)in backupset
input datafile fno=00001name=/u01/app/oracle/oradata/odbp/system01.dbf
input datafile fno=00002name=/u01/app/oracle/oradata/odbp/undotbs01.dbf
input datafile fno=00003name=/u01/app/oracle/oradata/odbp/sysaux01.dbf
input datafile fno=00004name=/u01/app/oracle/oradata/odbp/users01.dbf
channel ORA_DISK_1: starting piece1at02-MAY-11
channel ORA_DISK_1: finished piece1at02-MAY-11
piece handle=/u01/bk/bk_db_1jmbbcco_1_1 tag=TAG20110502T182944comment=NONE --数据文件存放在了指定的路径
channel ORA_DISK_1: backupsetcomplete, elapsedtime:00:00:55
channel ORA_DISK_1: startingfulldatafile backupset
channel ORA_DISK_1: specifyingdatafile(s)in backupset
input datafile fno=00001name=/u01/app/oracle/oradata/odbp/system01.dbf
input datafile fno=00002name=/u01/app/oracle/oradata/odbp/undotbs01.dbf
input datafile fno=00003name=/u01/app/oracle/oradata/odbp/sysaux01.dbf
input datafile fno=00004name=/u01/app/oracle/oradata/odbp/users01.dbf
channel ORA_DISK_1: starting piece1at02-MAY-11
channel ORA_DISK_1: finished piece1at02-MAY-11
piece handle=/u01/app/oracle/10g/dbs/1kmbbceg_1_1 tag=TAG20110502T182944 comment=NONE--数据文件同时也存放在$ORACLE_HOME/dbs路径下
channel ORA_DISK_1: backupsetcomplete, elapsedtime:00:00:55
channel ORA_DISK_1: startingfulldatafile backupset
channel ORA_DISK_1: specifyingdatafile(s)in backupset
includingcurrent controlfilein backupset
includingcurrentSPFILEin backupset
channel ORA_DISK_1: starting piece1at02-MAY-11
channel ORA_DISK_1: finished piece1at02-MAY-11
piece handle=/u01/bk/bk_db_1lmbbcg7_1_1 tag=TAG20110502T182944comment=NONE --控制文件及spfile备份位于指定路径下
channel ORA_DISK_1: backupsetcomplete, elapsedtime:00:00:05
channel ORA_DISK_1: startingfulldatafile backupset
channel ORA_DISK_1: specifyingdatafile(s)in backupset
includingcurrent controlfilein backupset
includingcurrentSPFILEin backupset
channel ORA_DISK_1: starting piece1at02-MAY-11
channel ORA_DISK_1: finished piece1at02-MAY-11
piece handle=/u01/app/oracle/10g/dbs/1mmbbcgc_1_1 tag=TAG20110502T182944 comment=NONE--归档日志文件备份位于$ORACLE_HOME/dbs路径下
channel ORA_DISK_1: backupsetcomplete, elapsedtime:00:00:01
Finished backupat02-MAY-11
Starting backupat02-MAY-11
currentlog archived
using channel ORA_DISK_1
channel ORA_DISK_1: startingarchivelog backupset
channel ORA_DISK_1: specifyingarchivelog(s)inbackupset
input archivelogthread=1sequence=64 recid=24 stamp=750105102
channel ORA_DISK_1: starting piece1at02-MAY-11
channel ORA_DISK_1: finished piece1at02-MAY-11 --控制文件及spfile备同时也存放在$ORACLE_HOME/dbs路径下
piece handle=/u01/app/oracle/10g/dbs/1nmbbcge_1_1 tag=TAG20110502T183142 comment=NONE
channel ORA_DISK_1: backupsetcomplete, elapsedtime:00:00:02
Finished backupat02-MAY-11
从上面的情况来看,
1.当db_recovery_file_dest参数为空值时,则归档日志,控制文件及spfile被备份到$ORACLE_HOME/dbs路径下
2.数据文件及控制文件同样实现了双重备份,一份位于$ORACLE_HOME/dbs路径下,一份位于用户指定路径下
三、如何将归档日志文件,控制文件,spfile文件以及数据文件备份到同一路径下,
RMAN> run{
2>allocate channel ch1 devicetypedisk;
3>allocate channel ch2 devicetypedisk;
4>backupdatabase format'/u01/bk/bk_db_%U'
5> plusarchivelog format'/u01/bk/bk_lg_%U';
6> release channel ch1;
7> release channel ch2;}
using targetdatabase controlfileinsteadofrecovery catalog
allocated channel: ch1
channel ch1: sid=141 devtype=DISK
allocated channel: ch2
channel ch2: sid=148 devtype=DISK
Starting backupat02-MAY-11
currentlog archived
channel ch1: starting archivelog backupset
channel ch1: specifying archivelog(s)inbackupset
input archivelogthread=1sequence=59 recid=19 stamp=750099848
input archivelogthread=1sequence=60 recid=20 stamp=750099945
input archivelogthread=1sequence=61 recid=21 stamp=750103678
input archivelogthread=1sequence=62 recid=22 stamp=750103776
input archivelogthread=1sequence=63 recid=23 stamp=750104981
input archivelogthread=1sequence=64 recid=24 stamp=750105102
input archivelogthread=1sequence=65 recid=25 stamp=750767326
input archivelogthread=1sequence=66 recid=26 stamp=750769794
channel ch1: starting piece1at02-MAY-11
channel ch2: starting archivelog backupset
channel ch2: specifying archivelog(s)inbackupset
input archivelogthread=1sequence=50 recid=10 stamp=750091269
input archivelogthread=1sequence=51 recid=11 stamp=750091281
input archivelogthread=1sequence=52 recid=12 stamp=750091286
input archivelogthread=1sequence=53 recid=13 stamp=750092325
input archivelogthread=1sequence=54 recid=14 stamp=750092487
input archivelogthread=1sequence=55 recid=15 stamp=750093621
input archivelogthread=1sequence=56 recid=16 stamp=750094799
input archivelogthread=1sequence=57 recid=17 stamp=750095198
input archivelogthread=1sequence=58 recid=18 stamp=750099671
channel ch2: starting piece1at02-MAY-11
channel ch1: finished piece1at02-MAY-11
piece handle=/u01/bk/bk_lg_1ombvlk3_1_1 tag=TAG20110510T110954comment=NONE --归档日志存放到指定路径
channel ch1: backupsetcomplete, elapsedtime:00:00:03
channel ch2: finished piece1at02-MAY-11
piece handle=/u01/bk/bk_lg_1pmbvlk3_1_1 tag=TAG20110510T110954comment=NONE --归档日志存放到指定路径
channel ch2: backupsetcomplete, elapsedtime:00:00:03
Finished backupat02-MAY-11
Starting backupat02-MAY-11
channel ch1: starting fulldatafile backupset
channel ch1: specifying datafile(s) in backupset
input datafile fno=00001name=/u01/app/oracle/oradata/odbp/system01.dbf
input datafile fno=00003name=/u01/app/oracle/oradata/odbp/sysaux01.dbf
channel ch1: starting piece1at02-MAY-11
channel ch2: starting fulldatafile backupset
channel ch2: specifying datafile(s) in backupset
input datafile fno=00002name=/u01/app/oracle/oradata/odbp/undotbs01.dbf
input datafile fno=00004name=/u01/app/oracle/oradata/odbp/users01.dbf
channel ch2: starting piece1at02-MAY-11
channel ch2: finished piece1at02-MAY-11
piece handle=/u01/bk/bk_db_1rmbvlk7_1_1 tag=TAG20110510T110958comment=NONE --数据文件存放到指定路径
channel ch2: backupsetcomplete, elapsedtime:00:01:09
channel ch2: starting fulldatafile backupset
channel ch2: specifying datafile(s) in backupset
includingcurrent controlfilein backupset
channel ch2: starting piece1at02-MAY-11
channel ch2: finished piece1at02-MAY-11
piece handle=/u01/bk/bk_db_1smbvlmd_1_1 tag=TAG20110510T110958comment=NONE --数据文件存放到指定路径
channel ch2: backupsetcomplete, elapsedtime:00:00:07
channel ch2: starting fulldatafile backupset
channel ch2: specifying datafile(s) in backupset
includingcurrentSPFILEin backupset
channel ch2: starting piece1at02-MAY-11
channel ch2: finished piece1at02-MAY-11
piece handle=/u01/bk/bk_db_1tmbvlml_1_1 tag=TAG20110510T110958comment=NONE --控制文件,spfile文件存放到指定路径
channel ch2: backupsetcomplete, elapsedtime:00:00:08
channel ch1: finished piece1at02-MAY-11
piece handle=/u01/bk/bk_db_1qmbvlk7_1_1 tag=TAG20110510T110958comment=NONE
channel ch1: backupsetcomplete, elapsedtime:00:01:31
Finished backupat02-MAY-11
Starting backupat02-MAY-11
currentlog archived
channel ch1: starting archivelog backupset
channel ch1: specifying archivelog(s)inbackupset
input archivelogthread=1sequence=67 recid=27 stamp=750769890
channel ch1: starting piece1at02-MAY-11
channel ch1: finished piece1at02-MAY-11
piece handle=/u01/bk/bk_lg_1umbvln2_1_1 tag=TAG20110510T111130comment=NONE
channel ch1: backupsetcomplete, elapsedtime:00:00:02
Finished backupat02-MAY-11
released channel: ch1
released channel: ch2
四、总结(RMAN备份路径)
1.在未通过configure命令设定RMAN备份文件路径以及未修改db_recovery_file_dest,且指定了format参数,则备份的数据文件,参数文件,
控制文件,采用了双重保护方式,一份位于指定路径,一份位于缺省的闪回区。同时归档日志保存在闪回区。
2.一旦修改了db_recovery_file_dest至特定路径,则同上述功能一样,所不同的是存放到非缺省的闪回区。
3.当db_recovery_file_dest为空值时,同样使用双重保护,但这些文件被放置到了$ORACLE_HOME/dbs路径下。
4.当使用了configure channel device typedisk format ='/u01/bk/db_%U'配置RMAN,则对于badkupdatabase plus archivelog同样会出现上
述的情况。
5.如果指定了configure channel devicetypedisk format ='/u01/bk/db_%U',则单独备份数据文件和日志文件不存在问题,都会存放在指定路径。
6.在同一条命令来完成(badkupdatabase plusarchivelog)则需要单独指定数据文件和日志文件的位置,如下方式:
backupdatabase format'/u01/bk/bk_db_%U'
plus archivelog format '/u01/bk/bk_lg_%U'
五、更多参考
有关性能优化请参考
Oracle 硬解析与软解析
共享池的调整与优化(Shared pool Tuning)
Buffer cache 的调整与优化(一)
Oracle 表缓存(caching table)的使用
有关闪回特性请参考
Oracle 闪回特性(FLASHBACK DATABASE)
Oracle 闪回特性(FLASHBACK DROP & RECYCLEBIN)
Oracle 闪回特性(Flashback Query、Flashback Table)
Oracle 闪回特性(Flashback Version、Flashback Transaction)
有关基于用户管理的备份和备份恢复的概念请参考
Oracle 冷备份
Oracle 热备份
Oracle 备份恢复概念
Oracle 实例恢复
Oracle 基于用户管理恢复的处理(详细描述了介质恢复及其处理)
有关RMAN的恢复与管理请参考
RMAN 概述及其体系结构
RMAN 配置、监控与管理
RMAN 备份详解
RMAN 还原与恢复
- RMAN 备份路径困惑(使用plus archivelog时)
- RMAN 备份路径困惑(使用plus archivelog时)
- RMAN 备份路径困惑(使用plus archivelog时)
- RMAN 备份路径困惑(使用plus archivelog时)
- RMAN 备份路径困惑(使用plus archivelog时)
- 使用 RMAN 管理 archivelog
- RMAN BACKUP...PLUS ARCHIVELOG命令执行步骤
- RMAN BACKUP ... PLUS ARCHIVELOG & ORA-19809
- RMAN:backup database plus archivelog format ... or backup database format ... plus archivelog ...
- 使用Rman的Plus archvielog选项简化数据库备份操作
- oracle rman plus archivelog自动执行的步骤
- Rman 中备份归档日志时archivelog delete all input 与delete input的区别
- rman使用crosscheck archivelog all命令时验证归档日志失败
- 设置RMAN的备份路径
- rman 备份默认路径小结
- 使用RMAN备份数据库
- 使用RMAN进行备份
- 使用RMAN进行备份
- C++中对txt文件的读写操作
- javascript获取类元素
- 关闭窗口刷新父页面
- Flume NG 学习笔记(七)Sink Processors(故障转移与负载均衡)测试
- JAVA中String与StringBuffer的区别
- RMAN 备份路径困惑(使用plus archivelog时)
- 如何对PDF文件进行转换
- 产品设计“九步法”
- 静态代码块—构造块等执行顺序
- jquery强大的表单验证插件
- PAT 1002. A+B for Polynomials (25)
- android开源项目、框架
- 数据交换平台的双内存设计
- SqlServer连接异常java.sql.SQLException: Network error IOException: Connection refused: connect