ITPub博客

首页 > Linux操作系统 > Linux操作系统 > rman_backup as copy_copy datafile

rman_backup as copy_copy datafile

原创 Linux操作系统 作者:wisdomone1 时间:2013-07-12 15:09:03 0 删除 编辑
查看数据文件
SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
/oracle10g/oradata/first/system01.dbf
/oracle10g/oradata/first/undotbs01.dbf
/oracle10g/oradata/first/sysaux01.dbf
/oracle10g/oradata/first/users01.dbf
/oracle10g/oradata/first/undotbs01_secondnewly.dbf
/oracle10g/oradata/first/tbs_test.dbf

6 rows selected.

查看表空间
SQL> select name from v$tablespace;

NAME
------------------------------
SYSTEM
UNDOTBS1
SYSAUX
USERS
TEMP
TBS_TEST

6 rows selected.


---镜像备份数据库所有表空间的数据文件
backup as copy db_file_name_convert=('/oracle10g/oradata/first','/oracle10g/oradata/second')
tablespace system,undotbs1,sysaux,users,temp,tbs_test

--临时表空间不能使用rman copy进行拷贝
RMAN> backup as copy db_file_name_convert=('/oracle10g/oradata/first','/oracle10g/oradata/second')
2> tablespace system,undotbs1,sysaux,users,temp,tbs_test;

Starting backup at 12-JUL-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=142 devtype=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 07/12/2013 15:00:41
RMAN-20202: tablespace not found in the recovery catalog
RMAN-06019: could not translate tablespace name "TEMP"

---移除临时表空间
backup as copy db_file_name_convert=('/oracle10g/oradata/first','/oracle10g/oradata/second')
tablespace system,undotbs1,sysaux,users,tbs_test


RMAN> backup as copy db_file_name_convert=('/oracle10g/oradata/first','/oracle10g/oradata/second')
2> tablespace system,undotbs1,sysaux,users,tbs_test;

Starting backup at 12-JUL-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile fno=00003 name=/oracle10g/oradata/first/sysaux01.dbf
output filename=/oracle10g/oradata/second/sysaux01.dbf tag=TAG20130712T150125 recid=18 stamp=820594915
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting datafile copy
input datafile fno=00001 name=/oracle10g/oradata/first/system01.dbf
output filename=/oracle10g/oradata/second/system01.dbf tag=TAG20130712T150125 recid=19 stamp=820594958
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting datafile copy
input datafile fno=00002 name=/oracle10g/oradata/first/undotbs01.dbf
output filename=/oracle10g/oradata/second/undotbs01.dbf tag=TAG20130712T150125 recid=20 stamp=820594976
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile fno=00006 name=/oracle10g/oradata/first/tbs_test.dbf
output filename=/oracle10g/oradata/second/tbs_test.dbf tag=TAG20130712T150125 recid=21 stamp=820594987
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile fno=00005 name=/oracle10g/oradata/first/undotbs01_secondnewly.dbf
output filename=/oracle10g/oradata/second/undotbs01_secondnewly.dbf tag=TAG20130712T150125 recid=22 stamp=820594989
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile fno=00004 name=/oracle10g/oradata/first/users01.dbf
output filename=/oracle10g/oradata/second/users01.dbf tag=TAG20130712T150125 recid=23 stamp=820594994
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
copying current control file
output filename=/oracle10g/flash_recovery_area/FIRST/controlfile/o1_mf_TAG20130712T150125_8xzbkm2s_.ctl tag=TAG20130712T150125 recid=24 stamp=820594995
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 12-JUL-13
channel ORA_DISK_1: finished piece 1 at 12-JUL-13
piece handle=/oracle10g/flash_recovery_area/FIRST/backupset/2013_07_12/o1_mf_nnsnf_TAG20130712T150125_8xzbkp76_.bkp tag=TAG20130712T150125 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 12-JUL-13

小结:1,如果数据文件路径基本一致,可采用此db_file_name_convert参数,减少rman脚本的代码量
            2,backup as copy datafile与copy data datafile基本相同,但测试发现前者会自动备份控制文件与spfile
            3,copy只能指定datafile,而backup as copy即可指定datafile也可指定tablespace

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9240380/viewspace-766143/,如需转载,请注明出处,否则将追究法律责任。

下一篇: 云和恩墨oow全国
请登录后发表评论 登录
全部评论
提供针对oracle初学者及进阶的数据库培训,欢迎大家咨询: 微信: wisdomone 微信公众号: lovedb qq: 305076427 微博: wisdomone9

注册时间:2008-04-04

  • 博文量
    2150
  • 访问量
    11859718