With the gradual launch of multiple systems, as operations personnel, database backup appears to be particularly important, considering the current system resources are limited, the database is in non-archival mode, using the data pump to complete daily , online backup scripts are many, I also refer to some scripts on the Internet to share and modify them according to the existing environment.
Original reference Link: http://www.osyunwei.com/archives/5960.html
Operating system environment: AIX 7.1.0.0
DB version: Oracle database 11g Enterprise Edition Release 11.2.0.4.0-64bit Production
1. Preparatory work
Database Creation Directory
CREATE [OR REPLACE] Directory directory as '/ogg/dumpfile ';
Create a backup path/ogg/dumpfile modify the owning user and user group to Oracle.oinstall
2. Backup Scripts
res_zhejiang_bk.sh
#!/bin/bash
Export Oracle_base=/app/oracle
Export ORACLE_SID=RESDB1
Export Oracle_home= $ORACLE _base/product/11.2.0/db_1
Export Oracle_term=xterm
Export path= $PATH: $ORACLE _home/bin
Export Nls_lang=american_america. Zhs16gbk
#以上代码为oracle用户的系统环境变量设置
#获取系统当前日期时间
Export bakuptime= ' Date +%y%m%d%h%m '
#设置删除7天之前的备份文件
Export delete_days=7
#指定directory路径
Export Bak_dir=/ogg/dumpfile
#备份省份用户
Export Bak_user=res_zhejiang
# Perform Zhejiang stock backup
EXPDP system/systemres directory=dump_dir Schemas=${bak_user} dumpfile=${bak_user}_%u_${bakuptime}.dmp logfile=${ Bak_user}_${bakuptime}.log parallel=4 Cluster=no
#压缩备份文件和日志文件
TAR-CVF ${bak_dir}/${bak_user}_${bakuptime}.dmp.tar ${bak_dir}/${bak_user}_*.dmp ${BAK_DIR}/${BAK_USER}_*.log
#删除7天前的备份文件
Find ${bak_dir}/*-type f-name "${bak_user}*.dmp"-exec rm {} \; #删除备份文件
Find ${bak_dir}/*-type f-name "${bak_user}*.log"-exec rm {} \; #删除日志文件
3. Script gives execute permission
$chood a+x res_zhejiang_bk.sh
4. Add an execution plan
Open execution Plan
Crontab-e
Crontab:you is not authorized to use Cron. Sorry.
Processing:
Root user operation, adding Oracle
Vi/var/adm/cron/cron.allow
Root
Unionmon
Oracle
Specifying an execution plan using CRONTAB-E
* * * */home/oracle/scripts/res_zhejiang_bk.sh
#查看执行计划
Crontab-l
5. Verify the Backup and view the backup log
This article is from the "Secdata Share blog," Please make sure to keep this source http://secdata.blog.51cto.com/11588948/1877664
Oracle performs backups with data pump timing