ITPub博客

首页 > 数据库 > Oracle > Backup And Recovery User's Guide-从RMAN开始-脚本化RMAN操作

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

原创 Oracle 作者: luisedalian 时间:2014-02-13 07:57:44 0 删除 编辑

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/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2012-02-06

  • 博文量
    1986
  • 访问量
    5642333