データベース全体のバックアップと部分バックアップの作成

バックアップセット形式の全体バックアップ

最も単純な形式で全体バックアップ

RMAN構成済設定(バックアップセット形式)を使用してバックアップを取る。

-- データベース全体のバックアップを取得
RMAN> BACKUP DATABASE;
-- このバックアップでアーカイブ・ログの完全なセットができる。これによって、このバックアップのリストア後にメディア・リカバリを実行できる。
RMAN> SQL 'ALTER SYSTEM ARCHIVE LOG CURRENT';
データベース全体の圧縮バックアップ
RMAN> BACKUP AS COMPRESSED BACKUPSET DATABASE;
RMAN> SQL 'ALTER SYSTEM ARCHIVE LOG CURRENT';
データベース全体のバックアップにアーカイブログを同時にバックアップ
-- RMANの構成済設定を上書きして、手動チャネルを割り当てる。
データベース全体のバックアップにアーカイブログをバックアップし、アーカイブログがバックアップされた後、全てのアーカイブ先から削除される。
RMAN> RUN {
2> ALLOCATE CHANNEL c1 DEVICE TYPE DISK FORMAT   '/u04/oradata/PROD/backup/%d_%U_%T.bak';
3> BACKUP DATABASE PLUS ARCHIVELOG DELETE ALL INPUT;
4> }

イメージコピー形式の全体バックアップ

イメージコピー形式で全体バックアップ
RMAN> BACKUP AS COPY DATABASE FORMAT '/u04/app/oracle/oradata/PROD/rman/%U';
 
Starting backup at 09-04-05
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile fno=00007 name=/u02/app/oracle/oradata/PROD/example_01.dbf
output filename=/u04/app/oracle/oradata/PROD/rman/data_D-PROD_I-93443355_TS-EXAMPLE_FNO-7_5vkbls4h tag=TAG20090405T003841 recid=30 stamp=683340020
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:48
channel ORA_DISK_1: starting datafile copy
input datafile fno=00001 name=/u01/app/oracle/oradata/PROD/system01.dbf
output filename=/u04/app/oracle/oradata/PROD/rman/data_D-PROD_I-93443355_TS-SYSTEM_FNO-1_60kbls7t tag=TAG20090405T003841 recid=31 stamp=683340042
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile fno=00003 name=/u01/app/oracle/oradata/PROD/sysaux01.dbf
output filename=/u04/app/oracle/oradata/PROD/rman/data_D-PROD_I-93443355_TS-SYSAUX_FNO-3_61kbls8d tag=TAG20090405T003841 recid=32 stamp=683340053
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile fno=00002 name=/u01/app/oracle/oradata/PROD/undotbs01.dbf
output filename=/u04/app/oracle/oradata/PROD/rman/data_D-PROD_I-93443355_TS-UNDOTBS_FNO-2_62kbls8s tag=TAG20090405T003841 recid=33 stamp=683340065
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile fno=00005 name=/u02/app/oracle/oradata/PROD/batch_01.dbf
output filename=/u04/app/oracle/oradata/PROD/rman/data_D-PROD_I-93443355_TS-BATCH_FNO-5_63kbls93 tag=TAG20090405T003841 recid=34 stamp=683340070
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile fno=00004 name=/u01/app/oracle/oradata/PROD/users01.dbf
output filename=/u04/app/oracle/oradata/PROD/rman/data_D-PROD_I-93443355_TS-USERS_FNO-4_64kbls9a tag=TAG20090405T003841 recid=35 stamp=683340076
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile fno=00008 name=/u02/app/oracle/oradata/PROD/oltp_01.dbf
output filename=/u04/app/oracle/oradata/PROD/rman/data_D-PROD_I-93443355_TS-OLTP_FNO-8_65kbls9d tag=TAG20090405T003841 recid=36 stamp=683340079
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile fno=00006 name=/u02/app/oracle/oradata/PROD/indx_01.dbf
output filename=/u04/app/oracle/oradata/PROD/rman/data_D-PROD_I-93443355_TS-INDX_FNO-6_66kbls9g tag=TAG20090405T003841 recid=37 stamp=683340081
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 09-04-05
 
Starting Control File and SPFILE Autobackup at 09-04-05
piece handle=/u04/app/oracle/oradata/PROD/rman/ctl_c-93443355-20090405-01 comment=NONE
Finished Control File and SPFILE Autobackup at 09-04-05
 
RMAN>
全体バックアップとアーカイブログのイメージコピー
RMAN> BACKUP AS COPY DATABASE FORMAT '/u04/app/oracle/oradata/PROD/rman/%U' PLUS ARCHIVELOG DELETE ALL INPUT;
 
Starting backup at 09-04-05
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive copy
input archive log thread=1 sequence=75 recid=142 stamp=683340365
output filename=/u04/app/oracle/oradata/PROD/rman/PROD_arch_D-PROD_id-93443355_S-75_T-1_A-681605019_68kblsif_20090405.bak recid=143 stamp=683340368
channel ORA_DISK_1: archivelog copy complete, elapsed time: 00:00:02
channel ORA_DISK_1: deleting archive log(s)
archive log filename=/u04/app/oracle/oradata/PROD/arch2/PROD_1_75_681605019.arc recid=142 stamp=683340365
archive log filename=/u04/app/oracle/oradata/PROD/arch1/PROD_1_75_681605019.arc recid=141 stamp=683340365
Finished backup at 09-04-05
 
Starting backup at 09-04-05
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile fno=00007 name=/u02/app/oracle/oradata/PROD/example_01.dbf
output filename=/u04/app/oracle/oradata/PROD/rman/data_D-PROD_I-93443355_TS-EXAMPLE_FNO-7_69kblsih tag=TAG20090405T004609 recid=38 stamp=683340384
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile fno=00001 name=/u01/app/oracle/oradata/PROD/system01.dbf
output filename=/u04/app/oracle/oradata/PROD/rman/data_D-PROD_I-93443355_TS-SYSTEM_FNO-1_6akblsj0 tag=TAG20090405T004609 recid=39 stamp=683340397
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile fno=00003 name=/u01/app/oracle/oradata/PROD/sysaux01.dbf
output filename=/u04/app/oracle/oradata/PROD/rman/data_D-PROD_I-93443355_TS-SYSAUX_FNO-3_6bkblsjf tag=TAG20090405T004609 recid=40 stamp=683340409
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile fno=00002 name=/u01/app/oracle/oradata/PROD/undotbs01.dbf
output filename=/u04/app/oracle/oradata/PROD/rman/data_D-PROD_I-93443355_TS-UNDOTBS_FNO-2_6ckblsjv tag=TAG20090405T004609 recid=41 stamp=683340420
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile fno=00005 name=/u02/app/oracle/oradata/PROD/batch_01.dbf
output filename=/u04/app/oracle/oradata/PROD/rman/data_D-PROD_I-93443355_TS-BATCH_FNO-5_6dkblsk6 tag=TAG20090405T004609 recid=42 stamp=683340426
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile fno=00004 name=/u01/app/oracle/oradata/PROD/users01.dbf
output filename=/u04/app/oracle/oradata/PROD/rman/data_D-PROD_I-93443355_TS-USERS_FNO-4_6ekblskd tag=TAG20090405T004609 recid=43 stamp=683340431
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile fno=00008 name=/u02/app/oracle/oradata/PROD/oltp_01.dbf
output filename=/u04/app/oracle/oradata/PROD/rman/data_D-PROD_I-93443355_TS-OLTP_FNO-8_6fkblskg tag=TAG20090405T004609 recid=44 stamp=683340434
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile fno=00006 name=/u02/app/oracle/oradata/PROD/indx_01.dbf
output filename=/u04/app/oracle/oradata/PROD/rman/data_D-PROD_I-93443355_TS-INDX_FNO-6_6gkblskj tag=TAG20090405T004609 recid=45 stamp=683340436
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 09-04-05
 
Starting backup at 09-04-05
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive copy
input archive log thread=1 sequence=76 recid=145 stamp=683340436
output filename=/u04/app/oracle/oradata/PROD/rman/PROD_arch_D-PROD_id-93443355_S-76_T-1_A-681605019_6hkblskm_20090405.bak recid=146 stamp=683340439
channel ORA_DISK_1: archivelog copy complete, elapsed time: 00:00:02
channel ORA_DISK_1: deleting archive log(s)
archive log filename=/u04/app/oracle/oradata/PROD/arch2/PROD_1_76_681605019.arc recid=145 stamp=683340436
archive log filename=/u04/app/oracle/oradata/PROD/arch1/PROD_1_76_681605019.arc recid=144 stamp=683340436
Finished backup at 09-04-05
 
Starting Control File and SPFILE Autobackup at 09-04-05
piece handle=/u04/app/oracle/oradata/PROD/rman/ctl_c-93443355-20090405-02 comment=NONE
Finished Control File and SPFILE Autobackup at 09-04-05
 
RMAN>

表領域とデータファイルのバックアップ

表領域のバックアップ
RMAN> BACKUP AS BACKUPSET TABLESPACE USERS,INDX,OLTP;
 
Starting backup at 09-04-05
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00004 name=/u01/app/oracle/oradata/PROD/users01.dbf
input datafile fno=00008 name=/u02/app/oracle/oradata/PROD/oltp_01.dbf
input datafile fno=00006 name=/u02/app/oracle/oradata/PROD/indx_01.dbf
channel ORA_DISK_1: starting piece 1 at 09-04-05
channel ORA_DISK_1: finished piece 1 at 09-04-05
piece handle=/u04/app/oracle/oradata/PROD/rman/PROD_6nkblutq_1_1_20090405.bak tag=TAG20090405T012618 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 09-04-05
 
Starting Control File and SPFILE Autobackup at 09-04-05
piece handle=/u04/app/oracle/oradata/PROD/rman/ctl_c-93443355-20090405-04 comment=NONE
Finished Control File and SPFILE Autobackup at 09-04-05
 
RMAN>
データファイルのバックアップ

番号でデータファイルを指定する

-- SQL*PLUSでデータファイル番号を確認する
SQL>  select file#,name from v$datafile;
 
     FILE# NAME
---------- --------------------------------------------------------------------------------
         1 /u01/app/oracle/oradata/PROD/system01.dbf
         2 /u01/app/oracle/oradata/PROD/undotbs01.dbf
         3 /u01/app/oracle/oradata/PROD/sysaux01.dbf
         4 /u01/app/oracle/oradata/PROD/users01.dbf
         5 /u02/app/oracle/oradata/PROD/batch_01.dbf
         6 /u02/app/oracle/oradata/PROD/indx_01.dbf
         7 /u02/app/oracle/oradata/PROD/example_01.dbf
         8 /u02/app/oracle/oradata/PROD/oltp_01.dbf
 
8 rows selected.
 
SQL>
-- RMAN接続し、データファイル番号でターゲットファイルをバックアップ
RMAN> BACKUP AS BACKUPSET DATAFILE 1,2,3,4;
 
Starting backup at 09-04-05
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/u01/app/oracle/oradata/PROD/system01.dbf
input datafile fno=00003 name=/u01/app/oracle/oradata/PROD/sysaux01.dbf
input datafile fno=00002 name=/u01/app/oracle/oradata/PROD/undotbs01.dbf
input datafile fno=00004 name=/u01/app/oracle/oradata/PROD/users01.dbf
channel ORA_DISK_1: starting piece 1 at 09-04-05
channel ORA_DISK_1: finished piece 1 at 09-04-05
piece handle=/u04/app/oracle/oradata/PROD/rman/PROD_6pkblv9g_1_1_20090405.bak tag=TAG20090405T013232 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:16
Finished backup at 09-04-05
 
Starting Control File and SPFILE Autobackup at 09-04-05
piece handle=/u04/app/oracle/oradata/PROD/rman/ctl_c-93443355-20090405-05 comment=NONE
Finished Control File and SPFILE Autobackup at 09-04-05
 
RMAN>

ファイル名を指定してバックアップする。
RMAN> BACKUP AS BACKUPSET DATAFILE '/u01/app/oracle/oradata/PROD/users01.dbf';
 
Starting backup at 09-04-05
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00004 name=/u01/app/oracle/oradata/PROD/users01.dbf
channel ORA_DISK_1: starting piece 1 at 09-04-05
channel ORA_DISK_1: finished piece 1 at 09-04-05
piece handle=/u04/app/oracle/oradata/PROD/rman/PROD_6rkblvcf_1_1_20090405.bak tag=TAG20090405T013407 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 09-04-05
 
Starting Control File and SPFILE Autobackup at 09-04-05
piece handle=/u04/app/oracle/oradata/PROD/rman/ctl_c-93443355-20090405-06 comment=NONE
Finished Control File and SPFILE Autobackup at 09-04-05
 
RMAN>
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License