rman全備資料庫

sun642514265發表於2013-12-29
1:建立備份

修改備份策略

[oracle@oracle ~]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on 星期二 12月 24 17:39:23 2013

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

connected to target database: ORCL (DBID=1362763236)

RMAN> show all
2> ;

using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name ORCL 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 '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_orcl.f'; # default


RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;      -------設定為ON,表示rman每次備份資料庫時,同時備份controlfile

new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/app/oracle/backup/control/%F'; --路徑

new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/app/oracle/backup/control/%F';
new RMAN configuration parameters are successfully stored

備份資料庫

全備資料庫指令碼

run {

allocate channel c1 device type disk;

allocate channel c2 device type disk;

allocate channel c3 device type disk;

allocate channel c4 device type disk;

allocate channel c5 device type disk;

crosscheck backup;

sql 'alter system archive log current';

backup database format '/u01/app/oracle/backup/data/db_%d_%T_%U';

sql 'alter system archive log current';

backup archivelog all format '/u01/app/oracle/backup/archivelog/arc_%t_%s' delete all input;

crosscheck archivelog all;

delete noprompt expired backup;

delete noprompt obsolete;

release channel c1;

release channel c2;

release channel c3;

release channel c4;

release channel c5;
}

關於通道的設定,本文中設定了5個通道,請根據自己的實際情況進行設定,--通過設定過多會影響系統系能。

此次備份,備份了資料庫的 datafile 、archivelog、controlfile、spfile,關於controlfile和spfile的備份,是有上面的策略決定( CONFIGURE CONTROLFILE AUTOBACKUP ON;),他將controlfile和spfile備份到control備份集中。


檢視備份資訊

RMAN> list backup of database;


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


BS Key  Type LV Size       Device Type Elapsed Time Completion Time   
------- ---- -- ---------- ----------- ------------ -------------------
5       Full    1.03M      DISK        00:00:01     2013-12-24 18:42:58
        BP Key: 5   Status: AVAILABLE  Compressed: NO  Tag: TAG20131224T184256
        Piece Name: /u01/app/oracle/backup/data/db_ORCL_20131224_08osb9ph_1_1
  List of Datafiles in backup set 5
  File LV Type Ckp SCN    Ckp Time            Name
  ---- -- ---- ---------- ------------------- ----
  4       Full 798228     2013-12-24 18:42:57 /u01/app/oracle/oradata/orcl/users01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time   
------- ---- -- ---------- ----------- ------------ -------------------
6       Full    2.41M      DISK        00:00:50     2013-12-24 18:43:47
        BP Key: 6   Status: AVAILABLE  Compressed: NO  Tag: TAG20131224T184256
        Piece Name: /u01/app/oracle/backup/data/db_ORCL_20131224_07osb9ph_1_1
  List of Datafiles in backup set 6
  File LV Type Ckp SCN    Ckp Time            Name
  ---- -- ---- ---------- ------------------- ----
  3       Full 798227     2013-12-24 18:42:57 /u01/app/oracle/oradata/orcl/undotbs01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time   
------- ---- -- ---------- ----------- ------------ -------------------
7       Full    378.75M    DISK        00:01:25     2013-12-24 18:44:21
        BP Key: 7   Status: AVAILABLE  Compressed: NO  Tag: TAG20131224T184256
        Piece Name: /u01/app/oracle/backup/data/db_ORCL_20131224_06osb9pg_1_1
  List of Datafiles in backup set 7
  File LV Type Ckp SCN    Ckp Time            Name
  ---- -- ---- ---------- ------------------- ----
  2       Full 798226     2013-12-24 18:42:57 /u01/app/oracle/oradata/orcl/sysaux01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time   
------- ---- -- ---------- ----------- ------------ -------------------
8       Full    586.55M    DISK        00:01:34     2013-12-24 18:44:30
        BP Key: 8   Status: AVAILABLE  Compressed: NO  Tag: TAG20131224T184256
        Piece Name: /u01/app/oracle/backup/data/db_ORCL_20131224_05osb9pg_1_1
  List of Datafiles in backup set 8
  File LV Type Ckp SCN    Ckp Time            Name
  ---- -- ---- ---------- ------------------- ----
  1       Full 798225     2013-12-24 18:42:56 /u01/app/oracle/oradata/orcl/system01.dbf

RMAN> list backup of archivelog all;


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


BS Key  Size       Device Type Elapsed Time Completion Time   
------- ---------- ----------- ------------ -------------------
11      11.50K     DISK        00:00:00     2013-12-24 18:44:35
        BP Key: 11   Status: AVAILABLE  Compressed: NO  Tag: TAG20131224T184435
        Piece Name: /u01/app/oracle/backup/archivelog/arc_835037075_11

  List of Archived Logs in backup set 11
  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time
  ---- ------- ---------- ------------------- ---------- ---------
  1    75      798218     2013-12-24 18:42:56 798286     2013-12-24 18:44:34

BS Key  Size       Device Type Elapsed Time Completion Time   
------- ---------- ----------- ------------ -------------------
12      2.00K      DISK        00:00:00     2013-12-24 18:44:35
        BP Key: 12   Status: AVAILABLE  Compressed: NO  Tag: TAG20131224T184435
        Piece Name: /u01/app/oracle/backup/archivelog/arc_835037075_12

  List of Archived Logs in backup set 12
  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time
  ---- ------- ---------- ------------------- ---------- ---------
  1    76      798286     2013-12-24 18:44:34 798294     2013-12-24 18:44:34

RMAN> list backup of controlfile;


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


BS Key  Type LV Size       Device Type Elapsed Time Completion Time   
------- ---- -- ---------- ----------- ------------ -------------------
13      Full    9.36M      DISK        00:00:01     2013-12-24 18:44:36
        BP Key: 13   Status: AVAILABLE  Compressed: NO  Tag: TAG20131224T184435
        Piece Name: /u01/app/oracle/backup/control/c-1362763236-20131224-03
  Control File Included: Ckp SCN: 798309       Ckp time: 2013-12-24 18:44:35

RMAN> list backup of spfile;


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


BS Key  Type LV Size       Device Type Elapsed Time Completion Time   
------- ---- -- ---------- ----------- ------------ -------------------
13      Full    9.36M      DISK        00:00:01     2013-12-24 18:44:36
        BP Key: 13   Status: AVAILABLE  Compressed: NO  Tag: TAG20131224T184435
        Piece Name: /u01/app/oracle/backup/control/c-1362763236-20131224-03
  SPFILE Included: Modification time: 2013-12-24 18:35:57
  SPFILE db_unique_name: ORCL


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28698327/viewspace-1065456/,如需轉載,請註明出處,否則將追究法律責任。

相關文章