OCM_Session3_2_UsingRMAN
程序员文章站
2022-05-13 13:25:31
...
2. Using RMAN 2.1 Configure RMAN options for the PROD database 2.1.1 Turn backup optimization on 2.1.2 Set your default channel to write to /home/oracle/backup (you may have to create this directory ) 2.1.3 Turn on controlfile autobackups
2. Using RMAN 2.1 Configure RMAN options for the PROD database 2.1.1 Turn backup optimization on 2.1.2 Set your default channel to write to /home/oracle/backup (you may have to create this directory ) 2.1.3 Turn on controlfile autobackups to write to /home/oracle/backup/control (you may have to create this directory) 2.1.4 Configure a retention window of 7 days.首先创建两个文件夹 [oracle@ocm1 ~]$ mkdir /home/oracle/backup [oracle@ocm1 ~]$ mkdir /home/oracle/backup/control
按以下操作: 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/oracle/product/10.2.0/db_1/dbs/snapcf_PROD.f'; # default
RMAN> CONFIGURE BACKUP OPTIMIZATION ON;
new RMAN configuration parameters: CONFIGURE BACKUP OPTIMIZATION ON; new RMAN configuration parameters are successfully stored
RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/home/oracle/backup/PROD_%U.bak';
new RMAN configuration parameters: CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/home/oracle/backup/PROD_%U.bak'; new RMAN configuration parameters are successfully stored
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
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 '/home/oracle/backup/control/PROD_%F.ctl';
new RMAN configuration parameters: CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/home/oracle/backup/control/PROD_%F.ctl'; new RMAN configuration parameters are successfully stored
RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
new RMAN configuration parameters: CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS; new RMAN configuration parameters are successfully stored
RMAN> show all;
RMAN configuration parameters are: CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS; CONFIGURE BACKUP OPTIMIZATION ON; CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default CONFIGURE CONTROLFILE AUTOBACKUP ON; CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/home/oracle/backup/control/PROD_%F.ctl'; 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 CHANNEL DEVICE TYPE DISK FORMAT '/home/oracle/backup/PROD_%U.bak'; 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/oracle/product/10.2.0/db_1/dbs/snapcf_PROD.f'; # default
RMAN>
2.2 Perform a backup 2.2.1 Perform a backup using your default channel with compression 2.2.2 Include all datafiles in the backup 2.2.3 Include your current control file and spfile 2.2.4 Include all archive logs, then remove the originals. 备份,使用缺省通道,压缩备份,包括所有文件,包括当前的控制文件的spfile文件,包括所有的归档日志,并将原来的归档日志移除。
RMAN> backup as compressed backupset database include current controlfile plus archivelog delete all input;
Starting backup at 21-MAR-14 current log archived allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=268 devtype=DISK skipping archive log file /u01/app/oracle/oradata/PROD/Disk2/arch/1_6_842523531.dbf; already backed up 1 time(s) skipping archive log file /u01/app/oracle/oradata/PROD/Disk2/arch/1_7_842523531.dbf; already backed up 1 time(s) channel ORA_DISK_1: starting compressed archive log backupset channel ORA_DISK_1: specifying archive log(s) in backup set input archive log thread=1 sequence=8 recid=3 stamp=842717159 input archive log thread=1 sequence=9 recid=4 stamp=842790340 input archive log thread=1 sequence=10 recid=5 stamp=842796122 channel ORA_DISK_1: starting piece 1 at 21-MAR-14 channel ORA_DISK_1: finished piece 1 at 21-MAR-14 piece handle=/home/oracle/backup/PROD_06p3o334_1_1.bak tag=TAG20140321T140208 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:17 channel ORA_DISK_1: deleting archive log(s) archive log filename=/u01/app/oracle/oradata/PROD/Disk2/arch/1_8_842523531.dbf recid=3 stamp=842717159 archive log filename=/u01/app/oracle/oradata/PROD/Disk2/arch/1_9_842523531.dbf recid=4 stamp=842790340 archive log filename=/u01/app/oracle/oradata/PROD/Disk2/arch/1_10_842523531.dbf recid=5 stamp=842796122 channel ORA_DISK_1: deleting archive log(s) archive log filename=/u01/app/oracle/oradata/PROD/Disk2/arch/1_6_842523531.dbf recid=1 stamp=842627911 archive log filename=/u01/app/oracle/oradata/PROD/Disk2/arch/1_7_842523531.dbf recid=2 stamp=842644301 Finished backup at 21-MAR-14
Starting backup at 21-MAR-14 using channel ORA_DISK_1 channel ORA_DISK_1: starting compressed full datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset input datafile fno=00004 name=/u01/app/oracle/oradata/PROD/Disk1/example01.dbf input datafile fno=00001 name=/u01/app/oracle/oradata/PROD/Disk1/system01.dbf input datafile fno=00003 name=/u01/app/oracle/oradata/PROD/Disk1/sysaux01.dbf input datafile fno=00002 name=/u01/app/oracle/oradata/PROD/Disk1/undotbs01.dbf input datafile fno=00007 name=/u01/app/oracle/oradata/PROD/Disk1/users01.dbf input datafile fno=00008 name=/u01/app/oracle/oradata/PROD/Disk1/oltp01.dbf input datafile fno=00005 name=/u01/app/oracle/oradata/PROD/Disk1/indx01.dbf input datafile fno=00006 name=/u01/app/oracle/oradata/PROD/Disk1/tools01.dbf channel ORA_DISK_1: starting piece 1 at 21-MAR-14 channel ORA_DISK_1: finished piece 1 at 21-MAR-14 piece handle=/home/oracle/backup/PROD_07p3o33u_1_1.bak tag=TAG20140321T140235 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:03:39 channel ORA_DISK_1: starting compressed full datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset including current control file in backupset channel ORA_DISK_1: starting piece 1 at 21-MAR-14 channel ORA_DISK_1: finished piece 1 at 21-MAR-14 piece handle=/home/oracle/backup/PROD_08p3o3aq_1_1.bak tag=TAG20140321T140235 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 21-MAR-14
Starting backup at 21-MAR-14 current log archived using channel ORA_DISK_1 channel ORA_DISK_1: starting compressed archive log backupset channel ORA_DISK_1: specifying archive log(s) in backup set input archive log thread=1 sequence=11 recid=6 stamp=842796380 channel ORA_DISK_1: starting piece 1 at 21-MAR-14 channel ORA_DISK_1: finished piece 1 at 21-MAR-14 piece handle=/home/oracle/backup/PROD_09p3o3av_1_1.bak tag=TAG20140321T140620 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:05 channel ORA_DISK_1: deleting archive log(s) archive log filename=/u01/app/oracle/oradata/PROD/Disk2/arch/1_11_842523531.dbf recid=6 stamp=842796380 Finished backup at 21-MAR-14
Starting Control File and SPFILE Autobackup at 21-MAR-14 piece handle=/home/oracle/backup/control/PROD_c-254361867-20140321-00.ctl comment=NONE Finished Control File and SPFILE Autobackup at 21-MAR-14
RMAN>