db2 offline backup shell
来源:互联网 发布:传奇霸业数据汇总 编辑:程序博客网 时间:2024/05/01 19:59
#!/bin/sh
usage()
{
echo "usage: $0 <DatabaseName>"
exit 1;
}
log_message()
{
message=$1
timestamp=`date "+%m/%d/%Y %H:%M:%S"`
echo "$timestamp $message" >> $LOG
}
# Database name is the first argument.
if [ $# -eq 0 ]
then
usage
fi
# Set DB2 environment
. $HOME/sqllib/db2profile
DBNAME=$1
BACKUPDIR=/home/db2inst1/db2backup
LOG=/home/db2inst1/db2backup/db2backup.log
log_message "*********************************************************************************************************";
log_message "******************************Begin**********************************************************************";
log_message "*********************************************************************************************************";
# Make sure there are no active applications
if [ `db2 list applications | grep -vc SQL1611W` -gt 0 ]
then
log_message "Active applications found! Terminating in 30 seconds";
sleep 30
db2 force applications all >> $LOG 2>&1
# allow another 30 seconds for the applications to disconnect.
sleep 30
fi
# Connect to database
log_message "Connecting to database $DBNAME"
db2 connect to $DBNAME >> $LOG 2>&1
# Quiesce the database
log_message "Quiescing database $DBNAME"
db2 quiesce database immediate force connections >> $LOG 2>&1
# Close the current connection
log_message "Disconnecting from database $DBNAME"
db2 connect reset >> $LOG 2>&1
# Wait few seconds
sleep 30
# Take Backup
log_message "Backing up database....This will take a while";
db2 backup database $DBNAME to $BACKUPDIR compress without prompting >> $LOG 2>&1
# Unquiesce
log_message "Backup complete..Return code is $?";
# Connect to database
log_message "Connecting to database $DBNAME"
db2 connect to $DBNAME >> $LOG 2>&1
log_message "Unquiescing database $DBNAME";
db2 unquiesce database >> $LOG 2>&1
log_message "*********************************************************************************************************";
log_message "*****************************End*************************************************************************";
log_message "*********************************************************************************************************";
- db2 offline backup shell
- db2 online backup shell
- Oracle Offline Backup
- db2 backup
- Offline Backup/Restore the TDS
- AIX 下 DB2 BACKUP
- DB2 Backup Basics
- DB2 Express backup & restore
- DB2 Backup and Restore
- db2 online backup 设置
- 解决db2 backup pending状态
- db2 表空间backup pending
- [shell]mysql backup脚本
- adb shell提示device offline
- TDS学习文档——Offline Backup/Restore the TDS
- DB2 Backup Basics - Part 1-3
- DB2 Backup and Recovery for LiveCycle ES
- oracle auto backup shell script
- 一个基于封装CSLA框架后,设计业务类的例子:User
- 为GridView删除添加确认对话框
- 理解缓存
- TCP 协议文件传输示例
- VC下ADO访问远程ORACLE数据库
- db2 offline backup shell
- 判断素数问题(C语言实现)
- Server.MapPath
- db2 online backup shell
- C语言实现去除字符串中空格
- 由于sys用户密码于orapwd文件不一致导致的ora-03113错误
- ASP.NET中应用Excel:(3)访问工作表数据
- 关于ajax中文乱码问题
- Begine....