标签:rman
[root@king01 ~]# su - oracle [oracle@king01 ~]$ rman target / Recovery Manager: Release 11.2.0.4.0 - Production on Mon Mar 26 13:48:45 2018 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. connected to target database: KING (DBID=1072562510) RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON; new RMAN configuration parameters: CONFIGURE CONTROLFILE AUTOBACKUP ON; new RMAN configuration parameters are successfully stored RMAN> CONFIGURE BACKUP OPTIMIZATION ON; new RMAN configuration parameters: CONFIGURE BACKUP OPTIMIZATION ON; new RMAN configuration parameters are successfully stored RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/app/oracle/backup/%F'; new RMAN configuration parameters: CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/app/oracle/backup/%F'; new RMAN configuration parameters are successfully stored RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 3 BACKUP TYPE TO COMPRESSED BACKUPSET; new RMAN configuration parameters: CONFIGURE DEVICE TYPE DISK PARALLELISM 3 BACKUP TYPE TO COMPRESSED BACKUPSET; new RMAN configuration parameters are successfully stored RMAN> show all; RMAN configuration parameters for database with db_unique_name KING are: CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default CONFIGURE BACKUP OPTIMIZATION ON; CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default CONFIGURE CONTROLFILE AUTOBACKUP ON; CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/app/oracle/backup/%F'; CONFIGURE DEVICE TYPE DISK PARALLELISM 3 BACKUP TYPE TO COMPRESSED BACKUPSET; 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_king.f'; # default[oracle@king01 ~]$ vi full_backup.sql RUN { BACKUP INCREMENTAL LEVEL=0 TAG 'soe_full_backup' DATABASE FORMAT '/u01/app/oracle/backup/soe_full_backup_%s_%p_%T' PLUS ARCHIVELOG FORMAT '/u01/app/oracle/backup/soe_arch_backup_%s_%p_%T' delete all input; DELETE NOPROMPT OBSOLETE; CROSSCHECK BACKUP; DELETE EXPIRED BACKUP; }
[oracle@king01 ~]$ vi incr_backup.sql RUN { BACKUP INCREMENTAL LEVEL=1 TAG 'soe_incr_backup' DATABASE FORMAT '/u01/app/oracle/backup/soe_incr_backup_%s_%p_%T' PLUS ARCHIVELOG FORMAT '/u01/app/oracle/backup/soe_arch_backup_%s_%p_%T' delete all input; DELETE NOPROMPT OBSOLETE; CROSSCHECK BACKUP; DELETE EXPIRED BACKUP; }
[oracle@king01 ~]$ vi oracle_backup.sh #!/bin/bash if [ -f ~/.bash_profile ]; then . ~/.bash_profile fi export SH_HOME=/home/oracle DATE=`date '+%Y%m%d%H'` WEEK=`date '+%A'` if [ "$WEEK" = "Saturday" ] then rman target / @$SH_HOME/full_backup.sql log=$SH_HOME/logs/full_backup_${DATE}.log else rman target / @$SH_HOME/incr_backup.sql log=$SH_HOME/logs/incr_backup_${DATE}.log fi [oracle@king01 ~]$ chmod a+x oracle_backup.sh
[oracle@king01 ~]$ mkdir -p /u01/app/oracle/backup [oracle@king01 ~]$ mkdir logs
[oracle@king01 ~]$ crontab -e 0 3 * * * /home/oracle/oracle_backup.sh [oracle@king01 ~]$ crontab -l 0 3 * * * /home/oracle/oracle_backup.sh
标签:rman
原文地址:http://blog.51cto.com/13598811/2091375