오라클 RMAN (Recovery MANager)으로 데이타베이스 백업하기

오라클 RMAN(Recovery MANager)으로 데이타베이스 백업하기

1. RMAN 접속하기

$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Wed May 31 16:39:53 2017

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: FOX (DBID=1129132255)

RMAN> 

또는,

$ rman 

Recovery Manager: Release 11.2.0.1.0 - Production on Wed May 31 16:40:42 2017

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

RMAN> connect target /

connected to target database: FOX (DBID=1129132255)

RMAN> 

2. RMAN 기본 파라메터 보기

RMAN> show all;

RMAN configuration parameters for database with db_unique_name FOX 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 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 '/oracle/product/11gr2/dbs/snapcf_fox.f'; # default

RMAN> 

3. 백업셋 확인하기

RMAN> list backupset;


List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1       Full    939.34M    DISK        00:00:51     06-APR-17      
        BP Key: 1   Status: AVAILABLE  Compressed: NO  Tag: TAG20170406T005057
        Piece Name: /oracle/flash_recovery_area/FOX/backupset/2017_04_06/o1_mf_nnndf_TAG20170406T005057_dgb4m22g_.bkp
  List of Datafiles in backup set 1
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 1005969    05-APR-17 /oradata/fox/system01.dbf
  2       Full 1005969    05-APR-17 /oradata/fox/sysaux01.dbf
  3       Full 1005969    05-APR-17 /oradata/fox/undotbs01.dbf
  4       Full 1005969    05-APR-17 /oradata/fox/users01.dbf
  5       Full 1005969    05-APR-17 /oradata/fox/data/fox_data01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2       Full    9.33M      DISK        00:00:01     06-APR-17      
        BP Key: 2   Status: AVAILABLE  Compressed: NO  Tag: TAG20170406T005057
        Piece Name: /oracle/flash_recovery_area/FOX/backupset/2017_04_06/o1_mf_ncnnf_TAG20170406T005057_dgb4nt8g_.bkp
  Control File Included: Ckp SCN: 1005969      Ckp time: 05-APR-17

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
3       Full    939.58M    DISK        00:00:58     31-MAY-17      
        BP Key: 3   Status: AVAILABLE  Compressed: NO  Tag: TAG20170531T162518
        Piece Name: /oracle/flash_recovery_area/FOX/backupset/2017_05_31/o1_mf_nnndf_TAG20170531T162518_dlwvyz99_.bkp
  List of Datafiles in backup set 3
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 1006458    31-MAY-17 /oradata/fox/system01.dbf
  2       Full 1006458    31-MAY-17 /oradata/fox/sysaux01.dbf
  3       Full 1006458    31-MAY-17 /oradata/fox/undotbs01.dbf
  4       Full 1006458    31-MAY-17 /oradata/fox/users01.dbf
  5       Full 1006458    31-MAY-17 /oradata/fox/data/fox_data01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
4       Full    9.36M      DISK        00:00:01     31-MAY-17      
        BP Key: 4   Status: AVAILABLE  Compressed: NO  Tag: TAG20170531T162518
        Piece Name: /oracle/flash_recovery_area/FOX/backupset/2017_05_31/o1_mf_ncsnf_TAG20170531T162518_dlww1180_.bkp
  SPFILE Included: Modification time: 31-MAY-17
  SPFILE db_unique_name: FOX
  Control File Included: Ckp SCN: 1006485      Ckp time: 31-MAY-17

RMAN> 

4. 전체 데이타베이스 백업
– 압축을 하지 않으려면 아래에서, ‘as compressed backupset’을 빼면 됨.

RMAN> backup as compressed backupset database;

Starting backup at 31-MAY-17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=23 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=00001 name=/oradata/fox/system01.dbf
input datafile file number=00005 name=/oradata/fox/data/fox_data01.dbf
input datafile file number=00002 name=/oradata/fox/sysaux01.dbf
input datafile file number=00003 name=/oradata/fox/undotbs01.dbf
input datafile file number=00004 name=/oradata/fox/users01.dbf
channel ORA_DISK_1: starting piece 1 at 31-MAY-17
channel ORA_DISK_1: finished piece 1 at 31-MAY-17
piece handle=/oracle/flash_recovery_area/FOX/backupset/2017_05_31/o1_mf_nnndf_TAG20170531T164956_dlwxf4vz_.bkp tag=TAG20170531T164956 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:15
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 31-MAY-17
channel ORA_DISK_1: finished piece 1 at 31-MAY-17
piece handle=/oracle/flash_recovery_area/FOX/backupset/2017_05_31/o1_mf_ncsnf_TAG20170531T164956_dlwxhjyl_.bkp tag=TAG20170531T164956 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 31-MAY-17

RMAN> 

5. backups 삭제
BS key가 5인 백업셋의 삭제는 아래와 같다. BS key는 list backupset 결과에서 확인 가능하다.

RMAN> delete backupset 5;

allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=15 device type=DISK

List of Backup Pieces
BP Key  BS Key  Pc# Cp# Status      Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
5       5       1   1   AVAILABLE   DISK        /oracle/flash_recovery_area/FOX/backupset/2017_05_31/o1_mf_nnndf_TAG20170531T164956_dlwxf4vz_.bkp

Do you really want to delete the above objects (enter YES or NO)? yes
deleted backup piece
backup piece handle=/oracle/flash_recovery_area/FOX/backupset/2017_05_31/o1_mf_nnndf_TAG20170531T164956_dlwxf4vz_.bkp RECID=5 STAMP=945449396
Deleted 1 objects

답글 남기기

Your email address will not be published.