Home >Database >Mysql Tutorial >RHEL每天定时备份Oracle

RHEL每天定时备份Oracle

WBOY
WBOYOriginal
2016-06-07 15:01:511400browse

步骤: (1)创建脚本文件bak_112.sh,内容如下(自动按当前日期备份数据库): #!/bin/shexport ORACLE_BASE=/u01/app/oracle;ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_home1; export ORACLE_HOMEORACLE_SID=XXX; export ORACLE_SIDPATH=$PATH:/bin:/u

步骤:

(1)创建脚本文件bak_112.sh,内容如下(自动按当前日期备份数据库):

#!/bin/sh
export ORACLE_BASE=/u01/app/oracle;
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_home1; export ORACLE_HOME
ORACLE_SID=XXX; export ORACLE_SID
PATH=$PATH:/bin:/usr/bin:/usr/sbin:/root:/opt/bin
PATH=$PATH:/opt/local/bin:$ORACLE_HOME/bin
export PATH
D=$(date +%y%m%d)
export D
exp bcs_dev/h2i3L4v7@bcs full=y file=/u01/app/oracle/${D}.dmp log=/u01/app/oracle/${D}.log


确保此文件可以被执行,

chmod +x bak_112.sh

(2)生成oracle用户的crontab文件,有两种方式:            

一、用oracle用户登录,输入命令crontab -e,进入编辑窗口,输入如下内容,并保存(每天16:10自动执行bak_112.sh)。

10 16 * * * /u01/app/oracle/bak_112.sh
二、用oracle用户登录,在/var/spool/cron/crontabs下创建oracle文件,用以下命令验证:
crontab -l

参考:http://docs.oracle.com/cd/E26926_01/html/E25812/enmwx.html#scrolltoc



助人等于自助!   3w@live.cn


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn