rman全备数据库

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/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/28698327/viewspace-1065456/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值