51.企业中如何解决RMAN的永久性设置
1.配置RMAN的永久设置
[oracle@yuanzj.com:/home/oracle]$ rman target / catalog catau/catau123
Recovery Manager: Release 10.2.0.5.0 - Production on Sun Mar 5 18:16:51 2023
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: ORCL10G (DBID=1313046744)
connected to recovery catalog database
RMAN> show all;
RMAN configuration parameters 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 ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/ora10g/product/10.2.0/db_1/dbs/snapcf_orcl10g.f'; # default
RMAN> quit
Recovery Manager complete.
[oracle@yuanzj.com:/home/oracle]$ sas
SQL*Plus: Release 10.2.0.5.0 - Production on Sun Mar 5 18:16:57 2023
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining Scoring Engine
and Real Application Testing options
sys@ORCL10G 2023-03-05 18:16:57> select * from v$rman_configuration;
no rows selected
Elapsed: 00:00:00.00
sys@ORCL10G 2023-03-05 18:16:59>
控制文件自动备份
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP on;
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored
RMAN> backup database;
Starting backup at 2023-03-05 18:19:15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=141 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/oradata/orcl10g/system01.dbf
input datafile fno=00003 name=/oradata/orcl10g/sysaux01.dbf
input datafile fno=00005 name=/oradata/orcl10g/example01.dbf
input datafile fno=00006 name=/oradata/orcl10g/catadb01.dbf
input datafile fno=00002 name=/oradata/orcl10g/undotbs01.dbf
input datafile fno=00004 name=/oradata/orcl10g/users01.dbf
channel ORA_DISK_1: starting piece 1 at 2023-03-05 18:19:15
channel ORA_DISK_1: finished piece 1 at 2023-03-05 18:19:22
piece handle=/u01/app/ora10g/flash_recovery_area/ORCL10G/backupset/2023_03_05/o1_mf_nnndf_TAG20230305T181915_l08v53cx_.bkp tag=TAG20230305T181915 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
Finished backup at 2023-03-05 18:19:22
Starting Control File and SPFILE Autobackup at 2023-03-05 18:19:22
piece handle=/u01/app/ora10g/flash_recovery_area/ORCL10G/autobackup/2023_03_05/o1_mf_s_1130696362_l08v5bff_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 2023-03-05 18:19:23
参数详解
--备份一份就有效
CONFIGURE RETENTION POLICY TO REDUNDANCY 1
--备份10天内都有效
CONFIGURE RETENTION POLICY TO recovery window of 10 days;
--取消,还原默认值
CONFIGURE RETENTION POLICY clear;
--数据文件的sca没有变化,之前备份过,本次可以不备份
CONFIGURE BACKUP OPTIMIZATION on;
--备份到磁盘上
CONFIGURE DEFAULT DEVICE TYPE TO DISK
--备份到磁带机上
CONFIGURE DEFAULT DEVICE TYPE TO sbt;
--控制文件自动备份
CONFIGURE CONTROLFILE AUTOBACKUP ON;
--控制文件和备份路径---在使用db_recovery_file_dest参数后无效的设置,控制文件备份路径由db_recovery_file_dest控制
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F';
--备份文件到磁盘上,使用并行个数,压缩备份等设置
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET;
--取消压缩备份
CONFIGURE DEVICE TYPE DISK clear;
--定义归档删除策略
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE;