揭祕ORACLE備份之----RMAN之二(備份方式)
使用RMAN備份
-- 直接使用命令列
[oracle@rhel5 admin]$ rman target sys/oracle
Recovery Manager: Release 10.2.0.5.0 - Production on Thu Sep 5 03:37:34 2013
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: WAILON (DBID=2747751647)
-- 檢視資料庫的表空間及檔案
RMAN> report schema;
Report of database schema for database with db_unique_name WAILON
List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1 730 SYSTEM *** /u01/app/oracle/oradata/system01.dbf
2 650 SYSAUX *** /u01/app/oracle/oradata/sysaux01.dbf
3 1075 UNDOTBS1 *** /u01/app/oracle/oradata/undotbs01.dbf
4 78 USERS *** /u01/app/oracle/oradata/users01.dbf
5 916 TBS_LRJ *** /u01/app/oracle/oradata/lrj.dbf
6 5 TRANS_TBS *** /home/oracle/trans_tbs.dbf
7 100 WAILON *** /u01/app/oracle/oradata/wailon/WAILON/datafile/o1_mf_wailon_94g6p2k8_.dbf
List of Temporary Files
=======================
File Size(MB) Tablespace Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1 100 TEMP01 500 /u01/app/oracle/oradata/wailon/temp01.dbf
-- 檢視1天未備份的檔案
RMAN> report need backup days 1;
Report of files whose recovery needs more than 1 days of archived logs
File Days Name
---- ----- -----------------------------------------------------
-- COPY備份當前控制檔案
RMAN> copy current controlfile to '/home/oracle/wailon-controlfile.ctl';
Starting backup at 29-SEP-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
copying current control file
output file name=/home/oracle/wailon-controlfile.ctl tag=TAG20130929T085014 RECID=29 STAMP=827398215
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 29-SEP-13
-- COPY備份6號資料檔案
RMAN> copy datafile 6 to '/home/oracle/rmanbk/trans_tbs.dbf';
Starting backup at 29-SEP-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00006 name=/home/oracle/trans_tbs.dbf
output file name=/home/oracle/rmanbk/trans_tbs.dbf tag=TAG20130929T085255 RECID=30 STAMP=827398375
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 29-SEP-13
-- SPFILE備份
RMAN> backup spfile;
Starting backup at 29-SEP-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
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 29-SEP-13
channel ORA_DISK_1: finished piece 1 at 29-SEP-13
piece handle=/u01/app/oracle/flash_recovery_area/WAILON/backupset/2013_09_29/o1_mf_nnsnf_TAG20130929T085412_94gyknkk_.bkp tag=TAG20130929T085412 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 29-SEP-13
--控制檔案備份
RMAN> backup current controlfile;
Starting backup at 29-SEP-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
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 29-SEP-13
channel ORA_DISK_1: finished piece 1 at 29-SEP-13
piece handle=/u01/app/oracle/flash_recovery_area/WAILON/backupset/2013_09_29/o1_mf_ncnnf_TAG20130929T085429_94gyl6hr_.bkp tag=TAG20130929T085429 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 29-SEP-13
-- 歸檔日誌檔案備份
RMAN> backup archivelog sequence 232;
Starting backup at 29-SEP-13
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=232 RECID=65 STAMP=827386069
channel ORA_DISK_1: starting piece 1 at 29-SEP-13
channel ORA_DISK_1: finished piece 1 at 29-SEP-13
piece handle=/u01/app/oracle/flash_recovery_area/WAILON/backupset/2013_09_29/o1_mf_annnn_TAG20130929T085642_94gypbvl_.bkp tag=TAG20130929T085642 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 29-SEP-13
RMAN> backup archivelog sequence between 232 and 235;
Starting backup at 29-SEP-13
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=232 RECID=65 STAMP=827386069
input archived log thread=1 sequence=233 RECID=66 STAMP=827386766
input archived log thread=1 sequence=234 RECID=67 STAMP=827386766
input archived log thread=1 sequence=235 RECID=68 STAMP=827386766
channel ORA_DISK_1: starting piece 1 at 29-SEP-13
channel ORA_DISK_1: finished piece 1 at 29-SEP-13
piece handle=/u01/app/oracle/flash_recovery_area/WAILON/backupset/2013_09_29/o1_mf_annnn_TAG20130929T085729_94gyqskl_.bkp tag=TAG20130929T085729 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 29-SEP-13
-- 備份所有的歸檔日誌檔案,然後刪除
RMAN> backup archivelog all delete input;
Starting backup at 29-SEP-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=232 RECID=65 STAMP=827386069
input archived log thread=1 sequence=233 RECID=66 STAMP=827386766
input archived log thread=1 sequence=234 RECID=67 STAMP=827386766
input archived log thread=1 sequence=235 RECID=68 STAMP=827386766
input archived log thread=1 sequence=236 RECID=69 STAMP=827398661
input archived log thread=1 sequence=237 RECID=70 STAMP=827398694
input archived log thread=1 sequence=238 RECID=71 STAMP=827398873
channel ORA_DISK_1: starting piece 1 at 29-SEP-13
channel ORA_DISK_1: finished piece 1 at 29-SEP-13
piece handle=/u01/app/oracle/flash_recovery_area/WAILON/backupset/2013_09_29/o1_mf_annnn_TAG20130929T090114_94gyytvd_.bkp tag=TAG20130929T090114 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:25
channel ORA_DISK_1: deleting archived log(s)
archived log file name=/u01/app/oracle/flash_recovery_area/1_232_817379463.dbf RECID=65 STAMP=827386069
archived log file name=/u01/app/oracle/flash_recovery_area/WAILON/archivelog/2013_09_29/o1_mf_1_233_94gm4g6q_.arc RECID=66 STAMP=827386766
archived log file name=/u01/app/oracle/flash_recovery_area/WAILON/archivelog/2013_09_29/o1_mf_1_234_94gm4gc0_.arc RECID=67 STAMP=827386766
archived log file name=/u01/app/oracle/flash_recovery_area/WAILON/archivelog/2013_09_29/o1_mf_1_235_94gm4gdr_.arc RECID=68 STAMP=827386766
archived log file name=/u01/app/oracle/flash_recovery_area/WAILON/archivelog/2013_09_29/o1_mf_1_236_94gyr4x0_.arc RECID=69 STAMP=827398661
archived log file name=/u01/app/oracle/flash_recovery_area/WAILON/archivelog/2013_09_29/o1_mf_1_237_94gys6kc_.arc RECID=70 STAMP=827398694
archived log file name=/u01/app/oracle/flash_recovery_area/WAILON/archivelog/2013_09_29/o1_mf_1_238_94gyystz_.arc RECID=71 STAMP=827398873
Finished backup at 29-SEP-13
-- 全庫備份
RMAN> backup database;
Starting backup at 29-SEP-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=00003 name=/u01/app/oracle/oradata/undotbs01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/lrj.dbf
input datafile file number=00001 name=/u01/app/oracle/oradata/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/sysaux01.dbf
input datafile file number=00007 name=/u01/app/oracle/oradata/wailon/WAILON/datafile/o1_mf_wailon_94g6p2k8_.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/users01.dbf
input datafile file number=00006 name=/home/oracle/trans_tbs.dbf
channel ORA_DISK_1: starting piece 1 at 29-SEP-13
channel ORA_DISK_1: finished piece 1 at 29-SEP-13
piece handle=/u01/app/oracle/flash_recovery_area/WAILON/backupset/2013_09_29/o1_mf_nnndf_TAG20130929T080528_94gvp9fh_.bkp tag=TAG20130929T080528 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:05
Finished backup at 29-SEP-13
Starting Control File and SPFILE Autobackup at 29-SEP-13
piece handle=/u01/app/oracle/flash_recovery_area/WAILON/autobackup/2013_09_29/o1_mf_s_827395594_94gvrc2r_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 29-SEP-13
-- 表空間備份
RMAN> backup tablespace TRANS_TBS;
Starting backup at 29-SEP-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=00006 name=/home/oracle/trans_tbs.dbf
channel ORA_DISK_1: starting piece 1 at 29-SEP-13
channel ORA_DISK_1: finished piece 1 at 29-SEP-13
piece handle=/u01/app/oracle/flash_recovery_area/WAILON/backupset/2013_09_29/o1_mf_nnndf_TAG20130929T081008_94gvz10b_.bkp tag=TAG20130929T081008 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 29-SEP-13
-- 資料檔案備份
RMAN> backup datafile '/home/oracle/trans_tbs.dbf';
Starting backup at 29-SEP-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=00006 name=/home/oracle/trans_tbs.dbf
channel ORA_DISK_1: starting piece 1 at 29-SEP-13
channel ORA_DISK_1: finished piece 1 at 29-SEP-13
piece handle=/u01/app/oracle/flash_recovery_area/WAILON/backupset/2013_09_29/o1_mf_nnndf_TAG20130929T081030_94gvzpz4_.bkp tag=TAG20130929T081030 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 29-SEP-13
-- 備份表空間,型別為IMAGE COPY
RMAN> backup as copy tablespace TRANS_TBS;
Starting backup at 29-SEP-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00006 name=/home/oracle/trans_tbs.dbf
output file name=/u01/app/oracle/flash_recovery_area/WAILON/datafile/o1_mf_trans_tb_94gw1bsp_.dbf tag=TAG20130929T081122 RECID=28 STAMP=827395883
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 29-SEP-13
-- 壓縮備份集
RMAN> backup as compressed backupset datafile 6;
Starting backup at 29-SEP-13
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=00006 name=/home/oracle/trans_tbs.dbf
channel ORA_DISK_1: starting piece 1 at 29-SEP-13
channel ORA_DISK_1: finished piece 1 at 29-SEP-13
piece handle=/u01/app/oracle/flash_recovery_area/WAILON/backupset/2013_09_29/o1_mf_nnndf_TAG20130929T091126_94gzkyyk_.bkp tag=TAG20130929T091126 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 29-SEP-13
RMAN> exit
Recovery Manager complete.
--使用RMAN呼叫指令碼備份
[oracle@rhel5 ~]$ vi backup.rcv
run{
backup as copy database;
delete obsolete;
}
"backup.rcv" [New] 3L, 32C written
[oracle@rhel5 ~]$ rman target sys/oracle@wailon cmdfile=backup.rcv log=backup.log
RMAN> 2> 3> 4>
-- 檢視指令碼的備份結果
[oracle@rhel5 ~]$ rman target /
Recovery Manager: Release 10.2.0.5.0 - Production on Thu Sep 5 03:42:33 2013
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: WAILON (DBID=2747751647)
RMAN> list copy;
List of Datafile Copies
Key File S Completion Time Ckp SCN Ckp Time Name
------- ---- - --------------- ---------- --------------- ----
26 1 A 05-SEP-13 611470 05-SEP-13 /u01/app/flash_recovery_area/WAILON/datafile/o1_mf_system_92h345rj_.dbf
28 2 A 05-SEP-13 611495 05-SEP-13 /u01/app/flash_recovery_area/WAILON/datafile/o1_mf_undotbs0_92h35rbf_.dbf
27 3 A 05-SEP-13 611483 05-SEP-13 /u01/app/flash_recovery_area/WAILON/datafile/o1_mf_sysaux_92h34xk5_.dbf
29 4 A 05-SEP-13 611501 05-SEP-13 /u01/app/flash_recovery_area/WAILON/datafile/o1_mf_user01_92h35xpt_.dbf
List of Archived Log Copies
Key Thrd Seq S Low Time Name
------- ---- ------- - --------- ----
1 1 24 A 13-JUN-13 /u01/app/flash_recovery_area/WAILON/archivelog/2013_06_13/o1_mf_1_24_8vl39g8x_.arc
2 1 25 A 13-JUN-13 /u01/app/flash_recovery_area/WAILON/archivelog/2013_07_29/o1_mf_1_25_8zdsm54w_.arc
3 1 26 A 29-JUL-13 /u01/app/flash_recovery_area/WAILON/archivelog/2013_09_04/o1_mf_1_26_92fpv7qd_.arc
4 1 27 A 04-SEP-13 /u01/app/flash_recovery_area/WAILON/archivelog/2013_09_04/o1_mf_1_27_92g32mh3_.arc
5 1 28 A 04-SEP-13 /u01/app/flash_recovery_area/WAILON/archivelog/2013_09_04/o1_mf_1_28_92gmd5qq_.arc
6 1 29 A 04-SEP-13 /u01/app/flash_recovery_area/WAILON/archivelog/2013_09_05/o1_mf_1_29_92gwghv0_.arc
7 1 30 A 05-SEP-13 /u01/app/flash_recovery_area/WAILON/archivelog/2013_09_05/o1_mf_1_30_92gyqqy1_.arc
-- 在RMAN建立備份指令碼,需要使用CATALOG管理
RMAN> create script full_backup
2> {
3> backup database plus archivelog;
4> delete obsolete;
5> }
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of create script command at 09/05/2013 03:43:59
RMAN-06002: command not allowed when not connected to a recovery catalog
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/429786/viewspace-776764/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 揭秘ORACLE備份之----RMAN之五(CATALOG)Oracle
- Oracle RMAN備份實戰Oracle
- Oracle OCP(60):RMAN 備份Oracle
- Oracle 備份恢復篇之RMAN catalogOracle
- RMAN加密備份的三種方式加密
- oracle 12c rman備份pdbOracle
- 分享Oracle Rman的備份指令碼Oracle指令碼
- 【RMAN】Oracle中如何備份控制檔案?備份控制檔案的方式有哪幾種?Oracle
- RMAN備份概述
- 【RMAN】RMAN備份至ASMASM
- ORACLE DG從庫 Rman備份恢復Oracle
- Oracle RMAN備份以及壓縮原理分析Oracle
- oracle10g RMAN增量備份策略Oracle
- RMAN備份恢復典型案例——RMAN備份&系統變慢
- oracle資料庫備份之exp增量備份Oracle資料庫
- RMAN備份進度
- rman 備份指令碼指令碼
- RMAN的備份原理
- 【RMAN】RMAN的備份保留策略
- oracle資料庫使用rman備份指令碼Oracle資料庫指令碼
- Oracle ADG環境下的RMAN備份策略Oracle
- 【RMAN】同時建立多個備份(建立多重備份)
- rman 增量備份恢復
- RMAN備份恢復技巧
- 【rman備份策略】實驗
- 【RMAN】Oracle12c之後,rman備份Dataguard備端恢復可能出現邏輯錯誤Oracle
- Oracle Rman Catalog的建立方法和備份原理Oracle
- Oracle 備份恢復之 FlashbackOracle
- 【備份】RMAN中對控制檔案的幾種備份方法
- RMAN備份詳解(轉載)
- [20190522]rman備份問題.txt
- RMAN 備份相關的概念
- 使用RMAN備份資料庫資料庫
- RMAN備份異機恢復
- ORACLE 備份表Oracle
- 【RMAN】Oracle12c以後rman 備份恢復命令參考Oracle
- 群暉NAS備份建議及備份方式
- rman開啟備份優化對備份歸檔的影響優化
- 【BAK_ORACLE】Oracle 12c之CDB與PDB的備份與恢復(三)CDB與PDB的備份方式Oracle