rman多进程并发备份一个数据表空间脚本
2016-11-10 15:27
435 查看
#!/bin/bash export LANG=en_US export ORACLE_HOME=/u01/app/product/10.2.0/db_1 export RMAN=$ORACLE_HOME/bin/rman export ORACLE_SID=dbs1 export ORACLE_USER=oracle export DAY=`date +%Y%m%d` export WEEKS=`date +%U` export BACKUP_DIR=/u01/rman export RMAN_LOG_FILE=$BACKUP_DIR/rman_"$ORACLE_SID"_$DAY.log TODAY=`date` USER=`id|cut -d "(" -f2|cut -d ")" -f1` echo "=================$TODAY===================">$RMAN_LOG_FILE echo "ORACLE_SID: $ORACLE_SID">>$RMAN_LOG_FILE echo "ORACLE_HOME: $ORACLE_HOME">>$RMAN_LOG_FILE echo "ORACLE_USER: $ORACLE_USER">>$RMAN_LOG_FILE echo "================================================================">>$RMAN_LOG_FILE echo " ">>$RMAN_LOG_FILE echo "BACKUP DATABASE BEGIN......">>$RMAN_LOG_FILE echo " ">>$RMAN_LOG_FILE chmod 666 $RMAN_LOG_FILE BAK_LEVEL=0 #export BAK_LEVEL=$BAK_LEVEL echo "Today is : `date +%A` incremental level $BAK_LEVEL">>$RMAN_LOG_FILE echo " ">>$RMAN_LOG_FILE RUN_STR=" export BAK_LEVEL=$BAK_LEVEL export ORACLE_HOME=$ORACLE_HOME export ORACLE_SID=$ORACLE_SID $RMAN nocatalog TARGET / msglog $RMAN_LOG_FILE append <<EOF run{ allocate channel c1 device type disk; allocate channel c2 device type disk; allocate channel c3 device type disk; allocate channel c4 device type disk; allocate channel c5 device type disk; allocate channel c6 device type disk; allocate channel c7 device type disk; allocate channel c8 device type disk; allocate channel c9 device type disk; allocate channel c10 device type disk; backup tag 'tstpcc' format '/u01/rman/tpcc_0_%d_%u' tablespace tpcc100; sql 'alter system archive log current' ; backup format '/u01/rman/archivelog_%d_%u' (archivelog all); release channel c10; release channel c9; release channel c8; release channel c7; release channel c6; release channel c5; release channel c4; release channel c3; release channel c2; release channel c1; } allocate channel for maintenance device type disk; report obsolete; crosscheck backup; delete noprompt expired backup; delete noprompt obsolete; list backup summary; release channel; EOF " # Initiate the command string if [ "$CUSER" = "root" ] then echo "Root Command String: $RUN_STR" >> $RMAN_LOG_FILE su - $ORACLE_USER -c "$RUN_STR" >> $RMAN_LOG_FILE RSTAT=$? else echo "User Command String: $RUN_STR" >> $RMAN_LOG_FILE /bin/sh -c "$RUN_STR" >> $RMAN_LOG_FILE RSTAT=$? fi # --------------------------------------------------------------------------- # Log the completion of this script. # --------------------------------------------------------------------------- if [ "$RSTAT" = "0" ] then LOGMSG="ended successfully" else LOGMSG="ended in error" fi echo >> $RMAN_LOG_FILE echo Script $0 >> $RMAN_LOG_FILE echo ==== $LOGMSG on `date` ==== >> $RMAN_LOG_FILE echo >> $RMAN_LOG_FILE exit $RSTAT
相关文章推荐
- 分享一个SQLSERVER脚本(计算数据库中各个表的数据量和每行记录所占用空间)
- 一个rsync自动备份并发信通知的shell脚本
- 分享一个SQL SERVER脚本(计算数据库中各个表的数据量和每行记录所占用空间)
- [MSSQL]分享一个SQLSERVER脚本(计算数据库中各个表的数据量和每行记录所占用空间)
- 分享一个SQLSERVER脚本(计算数据库中各个表的数据量和每行记录所占用空间)
- 自制的一个自动备份数据文件脚本
- (转)分享一个SQLSERVER脚本(计算数据库中各个表的数据量和每行记录所占用空间)
- 分享一个SQLSERVER脚本(计算数据库中各个表的数据量和每行记录所占用空间)
- 怎样做一个脚本使得访问主空间超时后自动跳转到另一备份网站??
- 怎样做一个脚本使得访问主空间超时后自动跳转到另一备份网站??
- 用shell写一个mysql数据备份脚本
- 程序员(媛)Shell脚本必备技能之中的一个: 在Linux下怎样自己主动备份mysql数据
- 一个归档模式无备份丢失数据文件的恢复
- 写LINUX shell脚本 自动备份ORACLE用户下的表 保留30天数据
- 利用日志传送给你的数据建立一个备份
- 数据库备份时,数据过多,批量脚本整理,查询表所占空间
- cron job的方式定时备份Redis的数据文件,并将备份文件copy到安全的磁盘介质中。创建一个定期任务(cron job)
- 分享一个MySQL分库分表备份脚本(原)
- 备份一个通过拷贝来创建虚拟机镜像的脚本
- 讨论一个并发线程导致的数据保存失败的问题