首页 > 系统服务 > 详细

shell脚本之全库热备份

时间:2018-02-23 10:41:21      阅读:325      评论:0      收藏:0      [点我收藏+]
#!/bin/bash backup_dir=/oracle/backup log_file=$ORACLE_BASE/admin/$ORACLE_SID/hold_backup_$ORACLE_SID.log echo "Backuping cold backup..." >$log_file data>>$log_file sqlplus -s / as sysdba <<EOF >>$log_file alter database backup controlfile to '$backup_dir/backup_controlfile.ctl'; set pagesize 0 linesize 1000 feedback off heading off column tablespace_name noprin column sortorder noprin column textout format a120 spool hold_backup_$ORACLE_SID.sql select tablespace_name,'1' sortorder,'alter tablespace '||tablespace_name||' begin backup ;' textout from dba_data_files union select tablespace_name ,'2' sortorder,'host cp'||file_name||' '||' $backup_dir' textout from dba_data_files union select tablespace_name,'3' sortorder,'alter tablespace '|| tablespace_name ||' end backup ;' textout from dba_data_files order by tablespace_name,sortorder,textout; select 'alter system archive log current;' from dual; spool off; @hold_backup_$ORACLE_SID.sql exit EOF rm -f hold_backup_$ORACLE_SID.sql echo "Hot backup finished.">>$log_file



PS:同全库冷备份

shell脚本之全库热备份

原文:http://blog.51cto.com/10579005/2072275

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!