温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Oracle数据库备份脚本

发布时间:2020-08-09 05:19:20 来源:ITPUB博客 阅读:151 作者:Mr_刘贵宾 栏目:关系型数据库

物理备份脚本

#!/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

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI