重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1636|回复: 0
打印 上一主题 下一主题

[Oracle] oracle控制文件的备份方法

[复制链接]
跳转到指定楼层
楼主
发表于 2020-11-8 16:51:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
[oracle@orcl11 ~]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Sun Nov 8 16:00:58 2020
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
connected to target database: ORCL (DBID=1605446691)


修改控制文件备份方式为自动备份
RMAN> configure controlfile autobackup on;
using target database control file instead of recovery catalog
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored

查看控制文件备份策略:
RMAN> show all;
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 ON;
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/dbhome_1/dbs/snapcf_orcl.f'; # default

创建备份路径
[root@orcl11 /]# mkdir oractlbak

设置控制文件自动备份文件的存放位置
RMAN> configure controlfile autobackup format for device type disk to '/oractlbak/%F';

new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/oractlbak/%F';
new RMAN configuration parameters are successfully stored

验证:
RMAN> show all;
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 ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/oractlbak/%F';
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/dbhome_1/dbs/snapcf_orcl.f'; # default


在RMAN中使用“backup current controlfile”可完成控制文件的备份
RMAN> backup current controlfile;

Starting backup at 08-Nov-20
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 08-Nov-20
channel ORA_DISK_1: finished piece 1 at 08-Nov-20
piece handle=/u01/app/oracle/fast_recovery_area/ORCL/backupset/2020_11_08/o1_mf_ncnnf_TAG20201108T160544_h8cfcp2g_.bkp tag=TAG20201108T160544 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 08-Nov-20

Starting Control File and SPFILE Autobackup at 08-Nov-20
piece handle=/oractlbak/c-1605446691-20201108-02 comment=NONE
Finished Control File and SPFILE Autobackup at 08-Nov-20

在RMAN中得到曾经备份过的控制文件信息
RMAN> list backup of controlfile;


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


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
3       Full    9.36M      DISK        00:00:01     08-Nov-20      
        BP Key: 3   Status: AVAILABLE  Compressed: NO  Tag: TAG20200402T171451
        Piece Name: /oractlbak/c-1605446691-20201108-01
  Control File Included: Ckp SCN: 1014182      Ckp time: 08-Nov-20

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
4       Full    9.33M      DISK        00:00:02     08-Nov-20      
        BP Key: 4   Status: AVAILABLE  Compressed: NO  Tag: TAG20201108T160544
        Piece Name: /u01/app/oracle/fast_recovery_area/ORCL/backupset/2020_11_08/o1_mf_ncnnf_TAG20201108T160544_h8cfcp2g_.bkp
  Control File Included: Ckp SCN: 1014371      Ckp time: 08-Nov-20

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
5       Full    9.36M      DISK        00:00:00     08-Nov-20      
        BP Key: 5   Status: AVAILABLE  Compressed: NO  Tag: TAG20200402T175047
        Piece Name: /oractlbak/c-1605446691-20201108-02
  Control File Included: Ckp SCN: 1014378      Ckp time: 08-Nov-20


使用RMAN的copy命令亦完成可对控制文件的备份任务
RMAN> copy current controlfile to '/oractlbak/rman_copy_controlfile.ctl';

Starting backup at 08-Nov-20
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
copying current control file
output file name=/oractlbak/rman_copy_controlfile.ctl tag=TAG20200402T181727 RECID=1 STAMP=1036693048
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 08-Nov-20

Starting Control File and SPFILE Autobackup at 08-Nov-20
piece handle=/oractlbak/c-1605446691-20201108-03 comment=NONE
Finished Control File and SPFILE Autobackup at 08-Nov-20

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-11-26 17:27 , Processed in 0.092085 second(s), 21 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表