Oracle 11g RMAN備份-基本操作
--rman連線目標資料庫 [oracle@S1011:/export/home/oracle]$ rman target /
Recovery Manager: Release 11.2.0.3.0 - Production on Tue Aug 13 17:15:41 2013
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: TESTDB11 (DBID=2578856066)
RMAN>
--執行例項管理命令 RMAN> shutdown immediate;
using target database control file instead of recovery catalog database closed database dismounted Oracle instance shut down
RMAN> startup mount;
connected to target database (not started) Oracle instance started database mounted
Total System Global Area 855982080 bytes
Fixed Size 2230792 bytes Variable Size 641730040 bytes Database Buffers 209715200 bytes Redo Buffers 2306048 bytes
RMAN> open database;
database opened
--執行SQL語句
RMAN> sql 'alter system switch logfile';
sql statement: alter system switch logfile
--檢視channel的配置 RMAN> show channel;
RMAN configuration parameters for database with db_unique_name TESTDB11 are: RMAN configuration has no stored or default parameters
--配置2個rman通道 RMAN> configure channel 1 device type disk format '/pooldisk02/backup03/%U';
new RMAN configuration parameters: CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT '/pooldisk02/backup03/%U'; new RMAN configuration parameters are successfully stored
RMAN> configure channel 2 device type disk format '/pooldisk02/backup04/%U';
using target database control file instead of recovery catalog new RMAN configuration parameters: CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT '/pooldisk02/backup04/%U'; new RMAN configuration parameters are successfully stored
--檢視配置的通道 RMAN> show channel;
RMAN configuration parameters for database with db_unique_name TESTDB11 are: CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT '/pooldisk02/backup03/%U'; CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT '/pooldisk02/backup04/%U';
--對users表空間進行備份 RMAN> backup tablespace users;
Starting backup at 13-AUG-13 configuration for DISK channel 2 is ignored allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=41 device type=DISK channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00004 name=/oradata/users01.dbf channel ORA_DISK_1: starting piece 1 at 13-AUG-13 channel ORA_DISK_1: finished piece 1 at 13-AUG-13 piece handle=/pooldisk02/backup03/03oh77tu_1_1 tag=TAG20130813T174742 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 13-AUG-13
--為什麼只使用一個channel,這與當前的配置有關 RMAN> show all;
RMAN configuration parameters for database with db_unique_name TESTDB11 are: CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default CONFIGURE BACKUP OPTIMIZATION OFF; # default CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT '/pooldisk02/backup03/%U'; CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT '/pooldisk02/backup04/%U'; CONFIGURE MAXSETSIZE TO UNLIMITED; # default CONFIGURE ENCRYPTION FOR DATABASE OFF; # default CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_TestDB11.f'; # default
--重新配置磁碟裝置的備份並行度 RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
new RMAN configuration parameters: CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET; new RMAN configuration parameters are successfully stored released channel: ORA_DISK_1
--再次對users表空間進行備份 RMAN> backup tablespace users;
Starting backup at 13-AUG-13 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=41 device type=DISK allocated channel: ORA_DISK_2 channel ORA_DISK_2: SID=42 device type=DISK channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00004 name=/oradata/users01.dbf channel ORA_DISK_1: starting piece 1 at 13-AUG-13 channel ORA_DISK_1: finished piece 1 at 13-AUG-13 piece handle=/pooldisk02/backup03/04oh7891_1_1 tag=TAG20130813T175336 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 13-AUG-13 --手工分配channel RMAN> run{ 2> backup datafile 2 channel ORA_DISK_2; 3> backup datafile 4 channel ORA_DISK_1; 4> }
Starting backup at 13-AUG-13 using channel ORA_DISK_1 using channel ORA_DISK_2 channel ORA_DISK_2: starting full datafile backup set channel ORA_DISK_2: specifying datafile(s) in backup set input datafile file number=00002 name=/oradata/sysaux01.dbf channel ORA_DISK_2: starting piece 1 at 13-AUG-13 channel ORA_DISK_2: finished piece 1 at 13-AUG-13 piece handle=/pooldisk02/backup04/05oh78g9_1_1 tag=TAG20130813T175729 comment=NONE channel ORA_DISK_2: backup set complete, elapsed time: 00:00:45 Finished backup at 13-AUG-13
Starting backup at 13-AUG-13 using channel ORA_DISK_1 using channel ORA_DISK_2 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00004 name=/oradata/users01.dbf channel ORA_DISK_1: starting piece 1 at 13-AUG-13 channel ORA_DISK_1: finished piece 1 at 13-AUG-13 piece handle=/pooldisk02/backup03/06oh78hm_1_1 tag=TAG20130813T175814 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 13-AUG-13
--臨時分配一個channel RMAN> run 2> { allocate channel c1 device type disk format '/pooldisk02/backup05/%U'; 3> allocate channel c2 device type disk format '/pooldisk02/backup06/%U'; 4> backup datafile 3 channel c1; 5> backup tablespace users channel c2; 6> release channel c1; 7> release channel c2; 8> }
released channel: ORA_DISK_1 released channel: ORA_DISK_2 allocated channel: c1 channel c1: SID=41 device type=DISK
allocated channel: c2 channel c2: SID=42 device type=DISK
Starting backup at 13-AUG-13 channel c1: starting full datafile backup set channel c1: specifying datafile(s) in backup set input datafile file number=00003 name=/oradata/undotbs01.dbf channel c1: starting piece 1 at 13-AUG-13 channel c1: finished piece 1 at 13-AUG-13 piece handle=/pooldisk02/backup05/07oh792c_1_1 tag=TAG20130813T180708 comment=NONE channel c1: backup set complete, elapsed time: 00:00:07 Finished backup at 13-AUG-13
Starting backup at 13-AUG-13 channel c2: starting full datafile backup set channel c2: specifying datafile(s) in backup set input datafile file number=00004 name=/oradata/users01.dbf channel c2: starting piece 1 at 13-AUG-13 channel c2: finished piece 1 at 13-AUG-13 piece handle=/pooldisk02/backup06/08oh792j_1_1 tag=TAG20130813T180715 comment=NONE channel c2: backup set complete, elapsed time: 00:00:01 Finished backup at 13-AUG-13
released channel: c1
released channel: c2 --檢視錶空間users的備份情況 RMAN> list backup of tablespace users;
List of Backup Sets ===================
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 1 Full 4.23M DISK 00:00:01 13-AUG-13 BP Key: 1 Status: AVAILABLE Compressed: NO Tag: TAG20130813T174742 Piece Name: /pooldisk02/backup03/03oh77tu_1_1 List of Datafiles in backup set 1 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 4 Full 2596084 13-AUG-13 /oradata/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 2 Full 4.23M DISK 00:00:00 13-AUG-13 BP Key: 2 Status: AVAILABLE Compressed: NO Tag: TAG20130813T175336 Piece Name: /pooldisk02/backup03/04oh7891_1_1 List of Datafiles in backup set 2 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 4 Full 2596442 13-AUG-13 /oradata/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 4 Full 4.23M DISK 00:00:00 13-AUG-13 BP Key: 4 Status: AVAILABLE Compressed: NO Tag: TAG20130813T175814 Piece Name: /pooldisk02/backup03/06oh78hm_1_1 List of Datafiles in backup set 4 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 4 Full 2596651 13-AUG-13 /oradata/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 6 Full 4.23M DISK 00:00:00 13-AUG-13 BP Key: 6 Status: AVAILABLE Compressed: NO Tag: TAG20130813T180715 Piece Name: /pooldisk02/backup06/08oh792j_1_1 List of Datafiles in backup set 6 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 4 Full 2597212 13-AUG-13 /oradata/users01.dbf
--修改時間的顯示格式 [oracle@S1011:/export/home/oracle]$ export NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss'
RMAN> list backup of tablespace users;
using target database control file instead of recovery catalog
List of Backup Sets ===================
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ ------------------- 1 Full 4.23M DISK 00:00:01 2013-08-13 17:47:43 BP Key: 1 Status: AVAILABLE Compressed: NO Tag: TAG20130813T174742 Piece Name: /pooldisk02/backup03/03oh77tu_1_1 List of Datafiles in backup set 1 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- ------------------- ---- 4 Full 2596084 2013-08-13 17:47:43 /oradata/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ ------------------- 2 Full 4.23M DISK 00:00:00 2013-08-13 17:53:37 BP Key: 2 Status: AVAILABLE Compressed: NO Tag: TAG20130813T175336 Piece Name: /pooldisk02/backup03/04oh7891_1_1 List of Datafiles in backup set 2 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- ------------------- ---- 4 Full 2596442 2013-08-13 17:53:37 /oradata/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ ------------------- 4 Full 4.23M DISK 00:00:00 2013-08-13 17:58:14 BP Key: 4 Status: AVAILABLE Compressed: NO Tag: TAG20130813T175814 Piece Name: /pooldisk02/backup03/06oh78hm_1_1 List of Datafiles in backup set 4 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- ------------------- ---- 4 Full 2596651 2013-08-13 17:58:14 /oradata/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ ------------------- 6 Full 4.23M DISK 00:00:00 2013-08-13 18:07:15 BP Key: 6 Status: AVAILABLE Compressed: NO Tag: TAG20130813T180715 Piece Name: /pooldisk02/backup06/08oh792j_1_1 List of Datafiles in backup set 6 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- ------------------- ---- 4 Full 2597212 2013-08-13 18:07:15 /oradata/users01.dbf
--檢視引數配置 RMAN> show all;
RMAN configuration parameters for database with db_unique_name TESTDB11 are: CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default CONFIGURE BACKUP OPTIMIZATION OFF; # default CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET; CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT '/pooldisk02/backup03/%U'; CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT '/pooldisk02/backup04/%U'; CONFIGURE MAXSETSIZE TO UNLIMITED; # default CONFIGURE ENCRYPTION FOR DATABASE OFF; # default CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_TestDB11.f'; # default --保留策略1,冗餘度(redundancy) RMAN> show retention policy;
RMAN configuration parameters for database with db_unique_name TESTDB11 are: CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default --檢視需要的備份 RMAN> report need backup;
RMAN retention policy will be applied to the command RMAN retention policy is set to redundancy 1 Report of files with less than 1 redundant backups File #bkps Name ---- ----- ----------------------------------------------------- 1 0 /oradata/system01.dbf 5 0 /oradata/example01.dbf 6 0 /oradata/newts01.dbf 7 0 /oradata/fbtbs01.dbf
RMAN> backup datafile 7;
Starting backup at 2013-08-14 01:38:21 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=47 device type=DISK allocated channel: ORA_DISK_2 channel ORA_DISK_2: SID=52 device type=DISK channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00007 name=/oradata/fbtbs01.dbf channel ORA_DISK_1: starting piece 1 at 2013-08-14 01:38:21 channel ORA_DISK_1: finished piece 1 at 2013-08-14 01:38:23 piece handle=/pooldisk02/backup03/09oh83gd_1_1 tag=TAG20130814T013821 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02 Finished backup at 2013-08-14 01:38:23
RMAN> report need backup;
RMAN retention policy will be applied to the command RMAN retention policy is set to redundancy 1 Report of files with less than 1 redundant backups File #bkps Name ---- ----- ----------------------------------------------------- 1 0 /oradata/system01.dbf 5 0 /oradata/example01.dbf 6 0 /oradata/newts01.dbf
--調整保留策略 RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
new RMAN configuration parameters: CONFIGURE RETENTION POLICY TO REDUNDANCY 2; new RMAN configuration parameters are successfully stored
RMAN> report need backup;
RMAN retention policy will be applied to the command RMAN retention policy is set to redundancy 2 Report of files with less than 2 redundant backups File #bkps Name ---- ----- ----------------------------------------------------- 1 0 /oradata/system01.dbf 2 1 /oradata/sysaux01.dbf 3 1 /oradata/undotbs01.dbf 5 0 /oradata/example01.dbf 6 0 /oradata/newts01.dbf 7 1 /oradata/fbtbs01.dbf
--把檔案7再備份一次 RMAN> backup datafile 7;
Starting backup at 2013-08-14 01:41:06 using channel ORA_DISK_1 using channel ORA_DISK_2 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00007 name=/oradata/fbtbs01.dbf channel ORA_DISK_1: starting piece 1 at 2013-08-14 01:41:06 channel ORA_DISK_1: finished piece 1 at 2013-08-14 01:41:07 piece handle=/pooldisk02/backup03/0aoh83li_1_1 tag=TAG20130814T014106 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 2013-08-14 01:41:07
RMAN> report need backup;
RMAN retention policy will be applied to the command RMAN retention policy is set to redundancy 2 Report of files with less than 2 redundant backups File #bkps Name ---- ----- ----------------------------------------------------- 1 0 /oradata/system01.dbf 2 1 /oradata/sysaux01.dbf 3 1 /oradata/undotbs01.dbf 5 0 /oradata/example01.dbf 6 0 /oradata/newts01.dbf --檢視過期的備份(根據備份策略來決定是否過期) RMAN> report obsolete;
RMAN retention policy will be applied to the command RMAN retention policy is set to redundancy 2 Report of obsolete backups and copies Type Key Completion Time Filename/Handle -------------------- ------ ------------------ -------------------- Backup Set 1 2013-08-13 17:47:43 Backup Piece 1 2013-08-13 17:47:43 /pooldisk02/backup03/03oh77tu_1_1 Backup Set 2 2013-08-13 17:53:37 Backup Piece 2 2013-08-13 17:53:37 /pooldisk02/backup03/04oh7891_1_1
--修改回原來的保留策略 RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 1;
old RMAN configuration parameters: CONFIGURE RETENTION POLICY TO REDUNDANCY 2; new RMAN configuration parameters: CONFIGURE RETENTION POLICY TO REDUNDANCY 1; new RMAN configuration parameters are successfully stored
RMAN> report obsolete;
RMAN retention policy will be applied to the command RMAN retention policy is set to redundancy 1 Report of obsolete backups and copies Type Key Completion Time Filename/Handle -------------------- ------ ------------------ -------------------- Backup Set 1 2013-08-13 17:47:43 Backup Piece 1 2013-08-13 17:47:43 /pooldisk02/backup03/03oh77tu_1_1 Backup Set 2 2013-08-13 17:53:37 Backup Piece 2 2013-08-13 17:53:37 /pooldisk02/backup03/04oh7891_1_1 Backup Set 4 2013-08-13 17:58:14 Backup Piece 4 2013-08-13 17:58:14 /pooldisk02/backup03/06oh78hm_1_1 Backup Set 7 2013-08-14 01:38:22 Backup Piece 7 2013-08-14 01:38:22 /pooldisk02/backup03/09oh83gd_1_1
--保留策略2,恢復視窗,設定恢復視窗為7天 RMAN> CONFIGURE RETENTION POLICY TO recovery window of 7 days;
old RMAN configuration parameters: CONFIGURE RETENTION POLICY TO REDUNDANCY 1; new RMAN configuration parameters: CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS; new RMAN configuration parameters are successfully stored
--清除現有引數的設定,使用預設值 RMAN> CONFIGURE RETENTION POLICY clear;
old RMAN configuration parameters: CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS; RMAN configuration parameters are successfully reset to default value --檢視當前設定 RMAN> show RETENTION POLICY;
RMAN configuration parameters for database with db_unique_name TESTDB11 are: CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
--檢視當前的備份優化的設定,是指資料檔案、歸檔日誌、備份集如果存在相同的就不會再備份 RMAN> show backup optimization;
RMAN configuration parameters for database with db_unique_name TESTDB11 are: CONFIGURE BACKUP OPTIMIZATION OFF; # default
--控制檔案自動備份,如果設定為off,則不會單獨地自動備份控制檔案和初始化引數檔案。 --但當備份集中包含1號資料檔案時,會在同一備份集中包含控制檔案和初始化引數檔案 RMAN> show CONTROLFILE AUTOBACKUP;
RMAN configuration parameters for database with db_unique_name TESTDB11 are: CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default --備份4號資料檔案,沒有備份控制檔案 RMAN> backup datafile 4;
Starting backup at 2013-08-14 02:07:27 using channel ORA_DISK_1 using channel ORA_DISK_2 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00004 name=/oradata/users01.dbf channel ORA_DISK_1: starting piece 1 at 2013-08-14 02:07:28 channel ORA_DISK_1: finished piece 1 at 2013-08-14 02:07:29 piece handle=/pooldisk02/backup03/0boh856v_1_1 tag=TAG20130814T020727 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02 Finished backup at 2013-08-14 02:07:29
--備份1號檔案,包含控制檔案和初始化引數檔案 RMAN> backup datafile 1;
Starting backup at 2013-08-14 02:08:10 using channel ORA_DISK_1 using channel ORA_DISK_2 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=/oradata/system01.dbf channel ORA_DISK_1: starting piece 1 at 2013-08-14 02:08:10 channel ORA_DISK_2: starting full datafile backup set channel ORA_DISK_2: specifying datafile(s) in backup set channel ORA_DISK_1: finished piece 1 at 2013-08-14 02:08:56 piece handle=/pooldisk02/backup03/0coh858a_1_1 tag=TAG20130814T020810 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:46 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 2013-08-14 02:08:56 including current control file in backup set channel ORA_DISK_2: starting piece 1 at 2013-08-14 02:08:56 channel ORA_DISK_1: finished piece 1 at 2013-08-14 02:08:57 piece handle=/pooldisk02/backup03/0eoh859o_1_1 tag=TAG20130814T020810 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 channel ORA_DISK_2: finished piece 1 at 2013-08-14 02:08:57 piece handle=/pooldisk02/backup04/0doh858b_1_1 tag=TAG20130814T020810 comment=NONE channel ORA_DISK_2: backup set complete, elapsed time: 00:00:01 Finished backup at 2013-08-14 02:08:57
--清除備份 RMAN> delete backup;
using channel ORA_DISK_1 using channel ORA_DISK_2
List of Backup Pieces BP Key BS Key Pc# Cp# Status Device Type Piece Name ------- ------- --- --- ----------- ----------- ---------- 1 1 1 1 AVAILABLE DISK /pooldisk02/backup03/03oh77tu_1_1 2 2 1 1 AVAILABLE DISK /pooldisk02/backup03/04oh7891_1_1 3 3 1 1 AVAILABLE DISK /pooldisk02/backup04/05oh78g9_1_1 4 4 1 1 AVAILABLE DISK /pooldisk02/backup03/06oh78hm_1_1 5 5 1 1 AVAILABLE DISK /pooldisk02/backup05/07oh792c_1_1 6 6 1 1 AVAILABLE DISK /pooldisk02/backup06/08oh792j_1_1 7 7 1 1 AVAILABLE DISK /pooldisk02/backup03/09oh83gd_1_1 8 8 1 1 AVAILABLE DISK /pooldisk02/backup03/0aoh83li_1_1 9 9 1 1 AVAILABLE DISK /pooldisk02/backup03/0boh856v_1_1 10 10 1 1 AVAILABLE DISK /pooldisk02/backup03/0coh858a_1_1 11 11 1 1 AVAILABLE DISK /pooldisk02/backup03/0eoh859o_1_1 12 12 1 1 AVAILABLE DISK /pooldisk02/backup04/0doh858b_1_1
--開啟控制檔案自動備份,會在單獨的備份集中建立控制檔案和初始化引數檔案的備份 RMAN> CONFIGURE CONTROLFILE AUTOBACKUP on;
new RMAN configuration parameters: CONFIGURE CONTROLFILE AUTOBACKUP ON; new RMAN configuration parameters are successfully stored
RMAN> backup datafile 4;
Starting backup at 2013-08-14 02:12:00 using channel ORA_DISK_1 using channel ORA_DISK_2 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00004 name=/oradata/users01.dbf channel ORA_DISK_1: starting piece 1 at 2013-08-14 02:12:00 channel ORA_DISK_1: finished piece 1 at 2013-08-14 02:12:01 piece handle=/pooldisk02/backup03/0foh85fg_1_1 tag=TAG20130814T021200 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 2013-08-14 02:12:01
Starting Control File and SPFILE Autobackup at 2013-08-14 02:12:01 piece handle=/u01/app/oracle/fast_recovery_area/TESTDB11/autobackup/2013_08_14/o1_mf_s_823399921_90pcg1ng_.bkp comment=NONE Finished Control File and SPFILE Autobackup at 2013-08-14 02:12:02
--檢視備份的控制檔案的資訊 RMAN> list backup of controlfile;
List of Backup Sets ===================
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ ------------------- 14 Full 9.67M DISK 00:00:01 2013-08-14 02:12:02 BP Key: 14 Status: AVAILABLE Compressed: NO Tag: TAG20130814T021201 Piece Name: /u01/app/oracle/fast_recovery_area/TESTDB11/autobackup/2013_08_14/o1_mf_s_823399921_90pcg1ng_.bkp Control File Included: Ckp SCN: 2633674 Ckp time: 2013-08-14 02:12:01
--自動備份的控制檔案的格式 RMAN> show CONTROLFILE AUTOBACKUP FORMAT;
RMAN configuration parameters for database with db_unique_name TESTDB11 are: CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
--檢視rman所有配置引數,一一加以解釋 RMAN> show all;
RMAN configuration parameters for database with db_unique_name TESTDB11 are: CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default CONFIGURE BACKUP OPTIMIZATION OFF; # default CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default CONFIGURE CONTROLFILE AUTOBACKUP ON; CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET; CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT '/pooldisk02/backup03/%U'; CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT '/pooldisk02/backup04/%U'; CONFIGURE MAXSETSIZE TO UNLIMITED; # default CONFIGURE ENCRYPTION FOR DATABASE OFF; # default CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_TestDB11.f'; # default
--rman備份可以分為映象拷貝和備份集2種 --1.備份拷貝 RMAN> backup as copy datafile 4;
Starting backup at 2013-08-14 02:35:19 using channel ORA_DISK_1 using channel ORA_DISK_2 channel ORA_DISK_1: starting datafile copy input datafile file number=00004 name=/oradata/users01.dbf output file name=/pooldisk02/backup03/data_D-TESTDB11_I-2578856066_TS-USERS_FNO-4_0hoh86r8 tag=TAG20130814T023519 RECID=3 STAMP=823401320 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01 Finished backup at 2013-08-14 02:35:21
Starting Control File and SPFILE Autobackup at 2013-08-14 02:35:21 piece handle=/u01/app/oracle/fast_recovery_area/TESTDB11/autobackup/2013_08_14/o1_mf_s_823401321_90pdssjc_.bkp comment=NONE Finished Control File and SPFILE Autobackup at 2013-08-14 02:35:22 --檢視已經產生的映象拷貝 RMAN> list copy of datafile 4;
List of Datafile Copies =======================
Key File S Completion Time Ckp SCN Ckp Time ------- ---- - ------------------- ---------- ------------------- 3 4 A 2013-08-14 02:35:20 2634778 2013-08-14 02:35:20 Name: /pooldisk02/backup03/data_D-TESTDB11_I-2578856066_TS-USERS_FNO-4_0hoh86r8 Tag: TAG20130814T023519
--映象拷貝保持原大小 [root@S1011:/pooldisk02]# ls -lh /oradata/users01.dbf -rw-r----- 1 oracle oinstall 6.3M Aug 14 02:35 /oradata/users01.dbf [root@S1011:/pooldisk02]# ls -lh ls -lh /pooldisk02/backup03/data_D-TESTDB11_I-2578856066_TS-USERS_FNO-4_0hoh86r8 ls: No such file or directory -lh: No such file or directory -rw-r----- 1 oracle oinstall 6.3M Aug 14 02:35 /pooldisk02/backup03/data_D-TESTDB11_I-2578856066_TS-USERS_FNO-4_0hoh86r8
--映象拷貝也可以自己指定產生的位置和名稱 RMAN> copy datafile 4 to '/pooldisk02/backup01/user01.bak';
Starting backup at 2013-08-14 02:44:44 using channel ORA_DISK_1 using channel ORA_DISK_2 channel ORA_DISK_1: starting datafile copy input datafile file number=00004 name=/oradata/users01.dbf output file name=/pooldisk02/backup01/user01.bak tag=TAG20130814T024444 RECID=4 STAMP=823401885 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01 Finished backup at 2013-08-14 02:44:46
Starting Control File and SPFILE Autobackup at 2013-08-14 02:44:46 piece handle=/u01/app/oracle/fast_recovery_area/TESTDB11/autobackup/2013_08_14/o1_mf_s_823401886_90pfcgf0_.bkp comment=NONE Finished Control File and SPFILE Autobackup at 2013-08-14 02:44:47
--重新將備份並行度設定為1 RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET;
using target database control file instead of recovery catalog old RMAN configuration parameters: CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; new RMAN configuration parameters: CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; new RMAN configuration parameters are successfully stored
--2. 給表空間users新增一個資料檔案 sys@TESTDB11>alter tablespace users add datafile '/oradata/users02.dbf' size 50m;
Tablespace altered.
--生成備份集 RMAN> backup tablespace users;
Starting backup at 2013-08-14 02:52:12 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=00008 name=/oradata/users02.dbf input datafile file number=00004 name=/oradata/users01.dbf channel ORA_DISK_1: starting piece 1 at 2013-08-14 02:52:12 channel ORA_DISK_1: finished piece 1 at 2013-08-14 02:52:13 piece handle=/pooldisk02/backup03/0noh87qs_1_1 tag=TAG20130814T025212 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 2013-08-14 02:52:13
Starting Control File and SPFILE Autobackup at 2013-08-14 02:52:14 piece handle=/u01/app/oracle/fast_recovery_area/TESTDB11/autobackup/2013_08_14/o1_mf_s_823402334_90pfsgb4_.bkp comment=NONE Finished Control File and SPFILE Autobackup at 2013-08-14 02:52:15
RMAN> list backup of tablespace users;
List of Backup Sets ===================
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ ------------------- 19 Full 5.23M DISK 00:00:01 2013-08-14 02:52:13 BP Key: 19 Status: AVAILABLE Compressed: NO Tag: TAG20130814T025212 Piece Name: /pooldisk02/backup03/0noh87qs_1_1 List of Datafiles in backup set 19 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- ------------------- ---- 4 Full 2635901 2013-08-14 02:52:12 /oradata/users01.dbf 8 Full 2635901 2013-08-14 02:52:12 /oradata/users02.dbf
--檢視生成的備份集的大小,比原來資料檔案小多了 [root@S1011:/pooldisk02]# ls -lh /pooldisk02/backup03/0noh87qs_1_1 -rw-r----- 1 oracle oinstall 5.2M Aug 14 02:52 /pooldisk02/backup03/0noh87qs_1_1 |
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/17013648/viewspace-1154705/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Windows oracle 11g rman備份恢復到linux系統WindowsOracleLinux
- Oracle RMAN備份實戰Oracle
- Oracle OCP(60):RMAN 備份Oracle
- oracle 12c rman備份pdbOracle
- 分享Oracle Rman的備份指令碼Oracle指令碼
- Oracle 11G RAC複製備庫RMAN-03002 RMAN-05501 RMAN-03015 RMAN-03009 RMAN-10038Oracle
- Oracle 備份恢復篇之RMAN catalogOracle
- 揭秘ORACLE備份之----RMAN之五(CATALOG)Oracle
- ORACLE DG從庫 Rman備份恢復Oracle
- Oracle RMAN備份以及壓縮原理分析Oracle
- oracle10g RMAN增量備份策略Oracle
- 【RMAN】RMAN備份至ASMASM
- oracle資料庫使用rman備份指令碼Oracle資料庫指令碼
- Oracle ADG環境下的RMAN備份策略Oracle
- RMAN備份概述
- 【RMAN】RMAN的備份保留策略
- 【RMAN】Oracle12c以後rman 備份恢復命令參考Oracle
- Oracle Rman Catalog的建立方法和備份原理Oracle
- RMAN備份恢復典型案例——RMAN備份&系統變慢
- RMAN備份進度
- rman 備份指令碼指令碼
- RMAN的備份原理
- Oracle 11g R2 備份與恢復Oracle
- Oracle9i RMAN 的優缺點及RMAN 備份及恢復步驟Oracle
- rman 增量備份恢復
- RMAN備份恢復技巧
- 【rman備份策略】實驗
- 【RMAN】Oracle12c之後,rman備份Dataguard備端恢復可能出現邏輯錯誤Oracle
- 【RMAN】Oracle中如何備份控制檔案?備份控制檔案的方式有哪幾種?Oracle
- Oracle RMAN備份為什麼會大量使用temp表空間?Oracle
- 【RMAN】同時建立多個備份(建立多重備份)
- 【RMAN】在備庫執行rman備份時報錯RMAN-06820 ORA-17629
- SVN倉庫備份和遷移基本操作
- RMAN備份詳解(轉載)
- [20190522]rman備份問題.txt
- RMAN 備份相關的概念
- 使用RMAN備份資料庫資料庫
- RMAN備份異機恢復
- oracle基本操作Oracle