[20190522]rman備份問題.txt

lfree發表於2019-05-22

[20190522]rman備份問題.txt


--//連結http://www.itpub.net/thread-2116768-1-1.html,提到的一個問題,主要指令碼里面出現2次database.

--//導致備份出現2次,1次備份到閃回區,導致閃回區空間不足的情況.


backup as compressed backupset incremental level= 1  skip inaccessible filesperset 5 Database format='/home/oracle/ora_bak/orcl_lev1_%U_%T'  tag='orcl_lev1_0520' database   

include current controlfile ; 

--//注意看可以發現出現2次database.我認為應該刪除第2個database,zergduan指出


不對, 標準的Backup 語法是

Backup + Backup_Operand + Backup_Spec

format 子句屬於 operand

database 屬於 spec

所以應該是 backup format=xxx database, 這樣才標準~

具體可以參考 rman 的官方文件 reference那本


--//我個人喜歡放在最後,例子:

http://blog.itpub.net/267265/viewspace-2089074/=>[20160427]rman tag format標識.txt


--//我還是測試看看:


1.環境:

SCOTT@book> @ ver1

PORT_STRING                    VERSION        BANNER

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

x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production


--//CONFIGURE CHANNEL DEVICE TYPE SBT_TAPE clear;

--//CONFIGURE DEFAULT DEVICE TYPE TO DISK;

--//CONFIGURE CHANNEL 1 DEVICE TYPE DISK clear;


2.測試:


RMAN> backup as compressed backupset datafile 9 tag='file 9' format '/home/oracle/backup/datafile9_%U' datafile 9 tag='filex 9' format '/home/oracle/backup/datafile9x_%U';


Starting backup at 2019-05-22 09:35:43

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=1 device type=DISK

channel ORA_DISK_1: starting compressed full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

input datafile file number=00009 name=/mnt/ramdisk/book/T01.dbf

channel ORA_DISK_1: starting piece 1 at 2019-05-22 09:35:44

channel ORA_DISK_1: finished piece 1 at 2019-05-22 09:35:45

piece handle=/home/oracle/backup/datafile9_2vu260jg_1_1 tag=FILE 9 comment=NONE

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

channel ORA_DISK_1: starting compressed full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

input datafile file number=00009 name=/mnt/ramdisk/book/T01.dbf

channel ORA_DISK_1: starting piece 1 at 2019-05-22 09:35:45

channel ORA_DISK_1: finished piece 1 at 2019-05-22 09:35:46

piece handle=/home/oracle/backup/datafile9x_30u260jh_1_1 tag=FILEX 9 comment=NONE

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

Finished backup at 2019-05-22 09:35:46


$ ls -l /home/oracle/backup/datafile9*

-rw-r----- 1 oracle oinstall 3284992 2019-05-22 09:35:44 /home/oracle/backup/datafile9_2vu260jg_1_1

-rw-r----- 1 oracle oinstall 3284992 2019-05-22 09:35:46 /home/oracle/backup/datafile9x_30u260jh_1_1


--//感覺我寫的是對的.修改如下:


RMAN> backup as compressed backupset datafile 9 tag='file 9' format '/home/oracle/backup/datafile9_%U' datafile 9 ;

Starting backup at 2019-05-22 09:41:25

using channel ORA_DISK_1

channel ORA_DISK_1: starting compressed full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

input datafile file number=00009 name=/mnt/ramdisk/book/T01.dbf

channel ORA_DISK_1: starting piece 1 at 2019-05-22 09:41:25

channel ORA_DISK_1: finished piece 1 at 2019-05-22 09:41:26

piece handle=/home/oracle/backup/datafile9_31u260u5_1_1 tag=FILE 9 comment=NONE

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

channel ORA_DISK_1: starting compressed full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

input datafile file number=00009 name=/mnt/ramdisk/book/T01.dbf

channel ORA_DISK_1: starting piece 1 at 2019-05-22 09:41:26

channel ORA_DISK_1: finished piece 1 at 2019-05-22 09:41:27

piece handle=/u01/app/oracle/fast_recovery_area/BOOK/backupset/2019_05_22/o1_mf_nnndf_TAG20190522T094125_gg9b66j0_.bkp tag=TAG20190522T094125 comment=NONE

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

Finished backup at 2019-05-22 09:41:27


RMAN> backup as compressed backupset  tag='file 9' format '/home/oracle/backup/datafile9_%U' datafile 9 ;

Starting backup at 2019-05-22 09:42:51

using channel ORA_DISK_1

channel ORA_DISK_1: starting compressed full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

input datafile file number=00009 name=/mnt/ramdisk/book/T01.dbf

channel ORA_DISK_1: starting piece 1 at 2019-05-22 09:42:51

channel ORA_DISK_1: finished piece 1 at 2019-05-22 09:42:52

piece handle=/home/oracle/backup/datafile9_33u2610r_1_1 tag=FILE 9 comment=NONE

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

Finished backup at 2019-05-22 09:42:52


--//感覺前面沒有什麼區別,這樣看來前後沒有什麼區別,只不過oracle自動"分組".


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2645146/,如需轉載,請註明出處,否則將追究法律責任。

相關文章