1. Oracle scheduled task: crontab-e ***** homeoracleworkspacescriptsbk_main.shgt; gt; homeoracleworkspacelogbk
1. Oracle scheduled task: crontab-e *****/home/oracle/workspace/scripts/bk_main.shgt; gt;/home/oracle/workspace/log/bk
Homepage → Database Technology
Background:
Read News
An example of automatic RMAN backup script
[Date:] Source: Linux Author: renfengjun [Font:]
1. Oracle scheduled task:
Crontab-e
* ***/Home/oracle/workspace/scripts/bk_main.sh>/home/oracle/workspace/log/bk_err.log 2> & 1
2. Main Control Program
/Home/oracle/workspace/scripts/bk_main.sh
#! /Bin/bash
Dat = 'date + '% m''
If ($ dat = 0 ))
Then
/Home/oracle/workspace/scripts/bk _. sh 0
Elif ($ dat % 50 = 0 ))
Then
/Home/oracle/workspace/scripts/bk _. sh 2
Elif ($ dat % 40 = 0 ))
Then
/Home/oracle/workspace/scripts/bk _. sh 2
Elif ($ dat % 30 = 0 ))
Then
/Home/oracle/workspace/scripts/bk _. sh 1
Elif ($ dat % 20 = 0 ))
Then
/Home/oracle/workspace/scripts/bk _. sh 2
Elif ($ dat % 10 = 0 ))
Then
/Home/oracle/workspace/scripts/bk _. sh 2
Fi
3. Detailed backup script
Note: 'date + '% Y % m % d % k % m' | awk' {print $1 $2} ''indicates the yyyymmddhh24mi format of the current time.
/Home/oracle/workspace/scripts/bk _. sh
#! /Bin/bash
# This is a import statement.
PATH = $ PATH: $ HOME/bin
Export PATH
Export ORACLE_SID = dex
Export ORACLE_BASE =/u01/apps/oracle
Export ORACLE_HOME = $ ORACLE_BASE/product/11gr2/db_1
Export PATH = $ ORACLE_HOME/bin: $ PATH
# Use awk to cut the space char
Timst = 'date + '% Y % m % d % k % m' | awk' {print $1 $2 }''
# Use for debug
# Echo $ timst
# Create a directory like 201112140112
Mkdir/u01/backup/DEX/backups/$ timst
# Rman backup scripts
Rman target sys/xiaojun @ dex log =/home/oracle/workspace/log/rmanlog/rman _ $ timst <
Run {
Allocate channel dev1 type disk;
Allocate channel dev2 type disk;
Backup incremental level 1 database format'/u01/backup/DEX/backups/$ timst/bk _ % t _ % s' plus archivelog format'/u01/backup/DEX/backups/ $ timst/arc _ % t _ % s' delete all input;
Crosscheck backup;
Delete noprompt obsolete;
Delete noprompt expired backup;
}
EOF
Do not forget to create a directory.
0
In the RAC environment, the creation of spfile causes inconsistent database parameters between nodes.
Remote database recovery using RMAN backup piece Information
Related information RMAN
Image Information
View All comments in this article (0)
Comments
Latest Information
Popular this week
Introduction to Linux community-advertisement service-website map-help Info-contact us
The articles published on this site (LinuxIDC) do not mean that they agree with the statement or description. They only provide more information and do not constitute any suggestions.
Copyright©2006-2014 Linux community All rights reserved Zhejiang ICP backup No. 06018118