Backup And Recovery User's Guide-从RMAN开始-脚本化RMAN操作

RMAN支持使用命令文件来管理循环的任务,例如每周的备份。

命令文件是一个包含RMAN命令的客户端文本文件,和你在RMAN提示符下输入的命令完全一致。

命令文件可以使用任何扩展名。RUN命令在脚本中提供了一种流控制等级。

练习:创建并运行命令文件

--练习:创建并运行命令文件

--1. 创建RMAN命令文件/home/oracle/CommandFile.txt,内容如下

CONNECT TARGET /

BACKUP DATABASE PLUS ARCHIVELOG;

LIST BACKUP;

EXIT;

 

--2. 启动RMAN之后运行命令文件,或在启动时直接指定要运行的命令文件(rman @CommandFile.txt)

oracle@Redhat55.cuug.net:/home/oracle> rman

 

Recovery Manager: Release 11.2.0.3.0 - Production on Sat Jul 6 20:21:20 2013

 

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

 

RMAN> @CommandFile.txt

--2.1 连接

RMAN> CONNECT TARGET *

connected to target database: TESTDB12 (DBID=2811829300)

--2.2 备份

RMAN> BACKUP DATABASE PLUS ARCHIVELOG;

 

Starting backup at 06-JUL-13

current log archived

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=44 device type=DISK

channel ORA_DISK_1: starting archived log backup set

channel ORA_DISK_1: specifying archived log(s) in backup set

input archived log thread=1 sequence=9 RECID=1 STAMP=820095695

channel ORA_DISK_1: starting piece 1 at 06-JUL-13

channel ORA_DISK_1: finished piece 1 at 06-JUL-13

piece handle=/u01/app/oracle/fast_recovery_area/TESTDB12/backupset/2013_07_06/o1_mf_annnn_TAG20130706T202136_8xkf4jno_.bkp tag=TAG20130706T202136 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Finished backup at 06-JUL-13

 

Starting backup at 06-JUL-13

using channel ORA_DISK_1

channel ORA_DISK_1: starting full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

input datafile file number=00001 name=/u01/app/oracle/oradata/TestDB12/system01.dbf

input datafile file number=00002 name=/u01/app/oracle/oradata/TestDB12/sysaux01.dbf

input datafile file number=00005 name=/u01/app/oracle/oradata/TestDB12/example01.dbf

input datafile file number=00003 name=/u01/app/oracle/oradata/TestDB12/undotbs01.dbf

input datafile file number=00004 name=/u01/app/oracle/oradata/TestDB12/users01.dbf

channel ORA_DISK_1: starting piece 1 at 06-JUL-13

channel ORA_DISK_1: finished piece 1 at 06-JUL-13

piece handle=/u01/app/oracle/fast_recovery_area/TESTDB12/backupset/2013_07_06/o1_mf_nnndf_TAG20130706T202137_8xkf4l36_.bkp tag=TAG20130706T202137 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:03:56

channel ORA_DISK_1: starting full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

including current control file in backup set

including current SPFILE in backup set

channel ORA_DISK_1: starting piece 1 at 06-JUL-13

channel ORA_DISK_1: finished piece 1 at 06-JUL-13

piece handle=/u01/app/oracle/fast_recovery_area/TESTDB12/backupset/2013_07_06/o1_mf_ncsnf_TAG20130706T202137_8xkfd4fb_.bkp tag=TAG20130706T202137 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Finished backup at 06-JUL-13

 

Starting backup at 06-JUL-13

current log archived

using channel ORA_DISK_1

channel ORA_DISK_1: starting archived log backup set

channel ORA_DISK_1: specifying archived log(s) in backup set

input archived log thread=1 sequence=10 RECID=2 STAMP=820095941

channel ORA_DISK_1: starting piece 1 at 06-JUL-13

channel ORA_DISK_1: finished piece 1 at 06-JUL-13

piece handle=/u01/app/oracle/fast_recovery_area/TESTDB12/backupset/2013_07_06/o1_mf_annnn_TAG20130706T202541_8xkfd5tj_.bkp tag=TAG20130706T202541 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Finished backup at 06-JUL-13

 

--2.3 查看脚本运行后的结果

RMAN> LIST BACKUP;

 

List of Backup Sets

===================

 

 

BS Key  Type LV Size       Device Type Elapsed Time Completion Time

------- ---- -- ---------- ----------- ------------ ---------------

1       Full    1.08G      DISK        00:01:49     06-JUL-13     

        BP Key: 1 &n

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

转载于:http://blog.itpub.net/17013648/viewspace-1080535/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值