Oracle数据库备份脚本
物理备份脚本
#!/bin/sh
export TMPDIR=$TMP;
export ORACLE_SID=orcl;
export ORACLE_BASE=/u01/app/oracle;
export ORACLE_HOME=/u01/app/oracle/product/12.2.0.1/db_1;
export PATH=/u01/app/oracle/product/12.2.0.1/db_1/bin:$PATH;
export LD_LIBRARY_PATH=/u01/app/oracle/product/12.2.0.1/db_1/lib:/lib:/usr/lib;
export CLASSPATH=/u01/app/oracle/product/12.2.0.1/db_1/JRE:/u01/app/oracle/product/12.2.0.1/db_1/jlib:/u01/app/oracle/product/12.2.0.1/db_1/rdbms/jlib;
export LANG=zh_CN
rman target/ << EOF
run{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
delete noprompt expired archivelog all;
backup incremental level 0 tag 'db0' format
'/home/oracle/rmanbackup/db0_%d_%T_%s' database include current controlfile;
sql 'alter system archive log current';
backup filesperset 5 format '/home/oracle/rmanbackup/cf0_%d_%T_%s' archivelog all delete input;
delete noprompt expired backup;
delete noprompt obsolete;
release channel c1;
release channel c2;
release channel c3;
}
EOF
逻辑备份脚本:
#!/bin/sh
DAY=`date +%Y%m%d`
FILE_TARGET=orcl`date +%Y%m%d`.dmp
FILE_LOG=orcl`date +%Y%m%d`.log
export FILE_TARGET FILE_LOG;
export ORACLE_BASE=/u01/app/oracle;
export ORACLE_HOME=/u01/app/oracle/product/12.2.0.1/db_1;
export ORACLE_SID=orcl;
export PATH=$ORACLE_HOME/bin:$PATH;
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;
export CLASSPATH=/u01/app/oracle/product/12.2.0.1/db_1/JRE:/u01/app/oracle/product/12.2.0.1/db_1/jlib:/u01/app/oracle/product/12.2.0.1/db_1/rdbms/jlib;
expdp system/****** directory=expdir dumpfile=$FILE_TARGET full=y logfile=$FILE_LOG
免责声明:
① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。
② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341