1112catalog copy的資料檔案作為0級備份
[20151112]catalog copy的資料檔案作為0級備份.txt
--使用熱備份模式備份的檔案是否可以作為0級備份呢?
--以前學習rman這部分內容時候有點混亂,無法理解為什麼使用rman backup as copy 的資料檔案與0級備份的資料檔案存在那些不同.
--是否使用熱備份以及backpup as copy備份的資料檔案是否可以作為0級備份.
--透過例子來說明:
1.測試環境:
SYS@book> @ &r/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
SYS@book> alter tablespace users begin backup ;
Tablespace altered.
$ cp /mnt/ramdisk/book/users01.dbf /home/oracle/backup/
SYS@book> alter tablespace users end backup ;
Tablespace altered.
RMAN> list copy of tablespace users;
specification does not match any datafile copy in the repository
RMAN> list copy of datafile 4;
specification does not match any datafile copy in the repository
--可以發現使用熱備份模式的方式控制檔案不會記錄,畢竟這個os命令完成的備份,這也是淘汰熱備份模式主要原因.管理問題.
2.使用catalog註冊.
RMAN> catalog start with '/home/oracle/backup/users01.dbf';
searching for all files that match the pattern /home/oracle/backup/users01.dbf
List of Files Unknown to the Database
=====================================
File Name: /home/oracle/backup/users01.dbf
Do you really want to catalog the above files (enter YES or NO)? yes
cataloging files...
cataloging done
List of Cataloged Files
=======================
File Name: /home/oracle/backup/users01.dbf
RMAN> list copy of tablespace users;
List of Datafile Copies
=======================
Key File S Completion Time Ckp SCN Ckp Time
------- ---- - ------------------- ---------- -------------------
2 4 A 2015-11-12 09:20:23 1558886 2015-11-12 09:14:58
Name: /home/oracle/backup/users01.dbf
--可以發現記錄的備份是按照copy方式做了.
RMAN> backup as copy datafile 4 format '/home/oracle/backup/datafile_4_%N.dbf';
Starting backup at 2015-11-12 09:27:07
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/mnt/ramdisk/book/users01.dbf
output file name=/home/oracle/backup/datafile_4_USERS.dbf tag=TAG20151112T092707 RECID=3 STAMP=895570027
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 2015-11-12 09:27:08
RMAN> list copy of datafile 4;
List of Datafile Copies
=======================
Key File S Completion Time Ckp SCN Ckp Time
------- ---- - ------------------- ---------- -------------------
3 4 A 2015-11-12 09:27:07 1559316 2015-11-12 09:27:07
Name: /home/oracle/backup/datafile_4_USERS.dbf
Tag: TAG20151112T092707
2 4 A 2015-11-12 09:20:23 1558886 2015-11-12 09:14:58
Name: /home/oracle/backup/users01.dbf
3.理論講這些檔案可以作為0級備份:
RMAN> catalog datafilecopy '/home/oracle/backup/users01.dbf' level 0 ;
cataloged datafile copy
RMAN> list copy of datafile 4;
List of Datafile Copies
=======================
Key File S Completion Time Ckp SCN Ckp Time
------- ---- - ------------------- ---------- -------------------
3 4 A 2015-11-12 09:27:07 1559316 2015-11-12 09:27:07
Name: /home/oracle/backup/datafile_4_USERS.dbf
Tag: TAG20151112T092707
5 4 A 2015-11-12 09:30:59 1558886 2015-11-12 09:14:58
Name: /home/oracle/backup/users01.dbf
--注意看key已經變成了5.
RMAN> BACKUP INCREMENTAL LEVEL 1 datafile 4 format '/home/oracle/backup/inc_user01_%U.dbf';
Starting backup at 2015-11-12 09:37:25
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental level 1 datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00004 name=/mnt/ramdisk/book/users01.dbf
channel ORA_DISK_1: starting piece 1 at 2015-11-12 09:37:26
channel ORA_DISK_1: finished piece 1 at 2015-11-12 09:37:27
piece handle=/home/oracle/backup/inc_user01_08qm2kmm_1_1.dbf tag=TAG20151112T093725 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2015-11-12 09:37:27
$ ll /home/oracle/backup/
total 97440
-rw-r----- 1 oracle oinstall 49815552 Nov 12 09:27 datafile_4_USERS.dbf
-rw-r----- 1 oracle oinstall 40960 Nov 12 09:37 inc_user01_08qm2kmm_1_1.dbf
-rw-r----- 1 oracle oinstall 49815552 Nov 12 09:15 users01.dbf
RMAN> list backupset ;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
7 Incr 1 32.00K DISK 00:00:00 2015-11-12 09:37:26
BP Key: 7 Status: AVAILABLE Compressed: NO Tag: TAG20151112T093725
Piece Name: /home/oracle/backup/inc_user01_08qm2kmm_1_1.dbf
List of Datafiles in backup set 7
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- ------------------- ----
4 1 Incr 1560000 2015-11-12 09:37:26 /mnt/ramdisk/book/users01.dbf
--檔案大小也可以說明問題.可以確定熱備份已經作為0級備份.
4.對比看看:
--使用增量0級備份看看:
RMAN> BACKUP INCREMENTAL LEVEL 0 datafile 4 format '/home/oracle/backup/inc0_user01_%U.dbf';
Starting backup at 2015-11-12 09:39:44
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental level 0 datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00004 name=/mnt/ramdisk/book/users01.dbf
channel ORA_DISK_1: starting piece 1 at 2015-11-12 09:39:44
channel ORA_DISK_1: finished piece 1 at 2015-11-12 09:39:45
piece handle=/home/oracle/backup/inc0_user01_09qm2kr0_1_1.dbf tag=TAG20151112T093944 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2015-11-12 09:39:45
RMAN> host "ls -l /home/oracle/backup";
total 142088
-rw-r----- 1 oracle oinstall 49815552 Nov 12 09:27 datafile_4_USERS.dbf
-rw-r----- 1 oracle oinstall 45670400 Nov 12 09:39 inc0_user01_09qm2kr0_1_1.dbf
-rw-r----- 1 oracle oinstall 40960 Nov 12 09:37 inc_user01_08qm2kmm_1_1.dbf
-rw-r----- 1 oracle oinstall 49815552 Nov 12 09:15 users01.dbf
host command complete
RMAN> host "ls -l /mnt/ramdisk/book/users01.dbf";
-rw-r----- 1 oracle oinstall 49815552 Nov 12 09:39 /mnt/ramdisk/book/users01.dbf
host command complete
--注意看檔案大小,實際上0級備份與copy方式兩者存在不同.0級備份也是備份僅僅使用的塊,以這個備份為基礎,做1級備份,或者1級累積
--備份.實際上還可以在備份時選擇壓縮模式.
RMAN> BACKUP as compressed backupset INCREMENTAL LEVEL 0 datafile 4 format '/home/oracle/backup/inc0_user01_%U.dbf';
Starting backup at 2015-11-12 09:49:01
using channel ORA_DISK_1
channel ORA_DISK_1: starting compressed incremental level 0 datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00004 name=/mnt/ramdisk/book/users01.dbf
channel ORA_DISK_1: starting piece 1 at 2015-11-12 09:49:01
channel ORA_DISK_1: finished piece 1 at 2015-11-12 09:49:02
piece handle=/home/oracle/backup/inc0_user01_0aqm2lcd_1_1.dbf tag=TAG20151112T094901 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2015-11-12 09:49:02
RMAN> host "ls -l /home/oracle/backup";
total 143452
-rw-r----- 1 oracle oinstall 49815552 Nov 12 09:27 datafile_4_USERS.dbf
-rw-r----- 1 oracle oinstall 45670400 Nov 12 09:39 inc0_user01_09qm2kr0_1_1.dbf
-rw-r----- 1 oracle oinstall 1392640 Nov 12 09:49 inc0_user01_0aqm2lcd_1_1.dbf
-rw-r----- 1 oracle oinstall 40960 Nov 12 09:37 inc_user01_08qm2kmm_1_1.dbf
-rw-r----- 1 oracle oinstall 49815552 Nov 12 09:15 users01.dbf
host command complete
-- 注意看檔案大小.
5.好了,現在刪除一些備份,僅僅留下as copy方式的備份:
RMAN> delete backupset 7,8,9;
using channel ORA_DISK_1
List of Backup Pieces
BP Key BS Key Pc# Cp# Status Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
7 7 1 1 AVAILABLE DISK /home/oracle/backup/inc_user01_08qm2kmm_1_1.dbf
8 8 1 1 AVAILABLE DISK /home/oracle/backup/inc0_user01_09qm2kr0_1_1.dbf
9 9 1 1 AVAILABLE DISK /home/oracle/backup/inc0_user01_0aqm2lcd_1_1.dbf
Do you really want to delete the above objects (enter YES or NO)? yes
deleted backup piece
backup piece handle=/home/oracle/backup/inc_user01_08qm2kmm_1_1.dbf RECID=7 STAMP=895570646
deleted backup piece
backup piece handle=/home/oracle/backup/inc0_user01_09qm2kr0_1_1.dbf RECID=8 STAMP=895570784
deleted backup piece
backup piece handle=/home/oracle/backup/inc0_user01_0aqm2lcd_1_1.dbf RECID=9 STAMP=895571341
Deleted 3 objects
RMAN> delete copy of datafile 4 completed after '2015-11-12 09:30:59';
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=394 device type=DISK
List of Datafile Copies
=======================
Key File S Completion Time Ckp SCN Ckp Time
------- ---- - ------------------- ---------- -------------------
5 4 A 2015-11-12 09:30:59 1558886 2015-11-12 09:14:58
Name: /home/oracle/backup/users01.dbf
Do you really want to delete the above objects (enter YES or NO)? yes
deleted datafile copy
datafile copy file name=/home/oracle/backup/users01.dbf RECID=5 STAMP=895570259
Deleted 1 objects
RMAN> list copy of database;
List of Datafile Copies
=======================
Key File S Completion Time Ckp SCN Ckp Time
------- ---- - ------------------- ---------- -------------------
3 4 A 2015-11-12 09:27:07 1559316 2015-11-12 09:27:07
Name: /home/oracle/backup/datafile_4_USERS.dbf
Tag: TAG20151112T092707
RMAN> list backupset summary;
specification does not match any backup in the repository
--做1個增量1級備份:
RMAN> BACKUP INCREMENTAL LEVEL 1 datafile 4 format '/home/oracle/backup/inc1_user01_%U.dbf';
Starting backup at 2015-11-12 10:30:44
using channel ORA_DISK_1
no parent backup or copy of datafile 4 found
channel ORA_DISK_1: starting incremental level 0 datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00004 name=/mnt/ramdisk/book/users01.dbf
channel ORA_DISK_1: starting piece 1 at 2015-11-12 10:30:44
channel ORA_DISK_1: finished piece 1 at 2015-11-12 10:30:45
piece handle=/home/oracle/backup/inc1_user01_0bqm2nqk_1_1.dbf tag=TAG20151112T103044 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2015-11-12 10:30:45
RMAN> host "ls -l /home/oracle/backup";
total 93348
-rw-r----- 1 oracle oinstall 49815552 Nov 12 09:27 datafile_4_USERS.dbf
-rw-r----- 1 oracle oinstall 45670400 Nov 12 10:30 inc1_user01_0bqm2nqk_1_1.dbf
host command complete
--可以發現增量備份雖然是1級,因為不存在0級備份,備份檔案實際上是0級.as copy方式的備份沒有作為0級備份.
RMAN> list backupset ;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
10 Incr 0 43.55M DISK 00:00:00 2015-11-12 10:30:44
BP Key: 10 Status: AVAILABLE Compressed: NO Tag: TAG20151112T103044
Piece Name: /home/oracle/backup/inc1_user01_0bqm2nqk_1_1.dbf
List of Datafiles in backup set 10
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- ------------------- ----
4 0 Incr 1562428 2015-11-12 10:30:44 /mnt/ramdisk/book/users01.dbf
--注意看LV=0 , 表示0級備份,說明沒有指定as copy作為0級備份.
RMAN> BACKUP INCREMENTAL LEVEL 1 datafile 4 format '/home/oracle/backup/inc1_user01_%U.dbf';
Starting backup at 2015-11-12 10:34:13
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental level 1 datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00004 name=/mnt/ramdisk/book/users01.dbf
channel ORA_DISK_1: starting piece 1 at 2015-11-12 10:34:13
channel ORA_DISK_1: finished piece 1 at 2015-11-12 10:34:14
piece handle=/home/oracle/backup/inc1_user01_0cqm2o15_1_1.dbf tag=TAG20151112T103413 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2015-11-12 10:34:14
RMAN> host "ls -l /home/oracle/backup";
total 93388
-rw-r----- 1 oracle oinstall 49815552 Nov 12 09:27 datafile_4_USERS.dbf
-rw-r----- 1 oracle oinstall 45670400 Nov 12 10:30 inc1_user01_0bqm2nqk_1_1.dbf
-rw-r----- 1 oracle oinstall 40960 Nov 12 10:34 inc1_user01_0cqm2o15_1_1.dbf
host command complete
RMAN> list backupset summary;
List of Backups
===============
Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- ------------------- ------- ------- ---------- ---
10 B 0 A DISK 2015-11-12 10:30:44 1 1 NO TAG20151112T103044
11 B 1 A DISK 2015-11-12 10:34:13 1 1 NO TAG20151112T103413
--注意看lv,第2次才是1級備份,前面第1次是0級備份(因為0級不存在).再看看這個as copy的備份能否作為0級備份.
RMAN> catalog datafilecopy '/home/oracle/backup/datafile_4_USERS.dbf' level 0 ;
cataloged datafile copy
datafile copy file name=/home/oracle/backup/datafile_4_USERS.dbf RECID=6 STAMP=895574253
RMAN> list datafilecopy all;
List of Datafile Copies
=======================
Key File S Completion Time Ckp SCN Ckp Time
------- ---- - ------------------- ---------- -------------------
6 4 A 2015-11-12 10:37:33 1559316 2015-11-12 09:27:07
Name: /home/oracle/backup/datafile_4_USERS.dbf
Tag: TAG20151112T092707
--key變成了6.不過那裡能看出來這個copy備份作為0級備份呢?
RMAN> catalog datafilecopy '/home/oracle/backup/datafile_4_USERS.dbf' level 1 ;
cataloged datafile copy
datafile copy file name=/home/oracle/backup/datafile_4_USERS.dbf RECID=7 STAMP=895574636
--key變成了7. 還是不知道那裡能看出來這個copy備份作為1級備份呢?不知道那位知道.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-1832475/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 1207catalog copy的資料檔案作為0級備份2
- rman備份-(1) 利用備份級恢復資料檔案和控制檔案
- RMAN關於物理檔案copy的增量備份
- Dedecms備份的資料檔案位置及備份資料庫的方法資料庫
- Java中CMD命令來備份mysql資料庫備份檔案出來為0位元組問題JavaMySql資料庫
- RMAN說,我能備份(4)--RMAN備份資料檔案和控制檔案
- 資料檔案誤刪--但有資料檔案的copy恢復
- 還原sqlserver資料庫備份檔案.bak的檔案SQLServer資料庫
- 雲備份和同步檔案資料
- RMAN備份資料檔案+控制檔案+歸檔日誌
- rman備份但丟失一個資料檔案,但有歸檔備份
- rman不做0級備份,可以直接做其他級別的incremental 備份,其本質還是先做0級備份!REM
- 一次資料檔案COPY
- 0級備份和全備份的本質區別
- RMAN 全庫備份和 0級備份的區別
- oracle uncatalog資料庫備份檔案Oracle資料庫
- 檔案資料同步備份工具:ChronoSync for MacMac
- 遠端備份資料庫和檔案的方法資料庫
- 使用備份的控制檔案恢復資料庫資料庫
- 沒有備份的資料檔案恢復(五)
- Mysql中備份資料檔案中/*!*/的含義MySql
- 歸檔模式,恢復沒有備份的資料檔案模式
- 把資料庫控制檔案備份到跟蹤檔案資料庫
- 不完全恢復(資料檔案備份--新建表空間--控制檔案備份--日誌歸檔檔案)
- SQL SERVER備份資料庫檔案(使用SSMS)SQLServer資料庫SSM
- 備份恢復之資料檔案丟失
- rman恢復資料庫--用備份的控制檔案資料庫
- 無處不在的Oracle資料庫控制檔案備份Oracle資料庫
- 備份之控制檔案備份
- 【備份恢復】無備份線上恢復非關鍵資料檔案
- 2 Day DBA-管理方案物件-執行備份和恢復-備份資料庫-資料檔案增量備份物件資料庫
- Backup And Recovery User's Guide-備份資料庫-使用RMAN備份資料庫檔案GUIIDE資料庫
- Oracle RMAN中全備份與0級備份區別Oracle
- 備份策略 增量備份中的差異備份:週日和週三執行0級備份,其他每天執行1級備份
- ORACLE 只讀資料檔案備份與恢復Oracle
- 0級備份和全備份的本質區別是什麼 ?
- Backup And Recovery User's Guide-備份資料庫-備份歸檔重做日誌檔案GUIIDE資料庫
- RMAN 驗證 資料檔案 和 備份 的有效性