Backup And Recovery User's Guide-從RMAN開始-指令碼化RMAN操作

LuiseDalian發表於2014-02-13

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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章