第一个文件:INIT.TXT这是脚本INI初始化文件:
##################################################################
#This is a system ini file :
# CopyRight By WangZuXiang 2002
# the '#' is ingnor :
#the format style is xxxx=value
#
##################################################################
#the recode the system execute's log!
[systemlog]
sys_log=/home/oracle/wzx/x.log
#end
第二个文件:主程序文件:MY.SH:
#!/bin/sh
#############################################################################
#
#Get the all ini file config
#CopyRight By WangZuXiang 2002-2005?
#版权所有(C) 2002-2005? WangZuXiang .
#All Rights Reserved.
#program date 2002-10-22
#usage: main
#This script is used to start oracle dump database .
#It should ONLY be executed as part of the crontabs.
#function content is:
#1:自动检查是否能连上Oracle!
#2:通过初始化文本来解析各种需要的参数!
#3:自动完全到出ORACLE数据库(每天)!,以后将增加相关的增量备份等!
#4:自动删除配置文件中规定的前X天的备份文件!
#5:自动将到出文件打包并转存到其他的备份机器上!
#6:自动记录程序执行过程中的所有日期信息!
#if you find some bugs please send it to my mailpost :
#e-mail:wzxherry@sina.com !
#new function:增加了对ORACLE数据库备份策略的方法!2002-10-31
##############################################################################
mypwd=`pwd`
inifile=/home/oracle/wzx/init.txt
oratab=/etc/oratab
TEMP=temp.$$
DUMP_FILE=`date +'%Y%m%d`
#WHOAMI=`id | awk '/uid=[0-9]*(oracle)/ {print $1}'`
#WHOAMI=`id | awk '{print $1}' | sed 's/uid=[0-9]*(.*).*/1/'`
WHOAMI=`id | sed 's/uid=[0-9]*(.*) gid.*/1/'`
#if test "$WHOAMI" = "" ; then
if test "$WHOAMI" != "(oracle)" ; then
echo "
"
echo "=============================================================="
echo "=========you must use oracle user to run this script!========="
echo "=============================================================="
echo "
"
exit 0
fi
#run the init parameter
test ! -e $inifile && echo "not find the init file:"$inifile"!" && exit 0
initme
if [ -z $LOGS ]; then
echo ""
fi
#LOG = ${LOGS:-"x.log"}
LOGME="tee -a ${LOGS:-"x.log"}"
if [ -e $LOGS -a -f $LOGS ]; then
if test ! -w $LOGS; then
echo ""
exit
fi
fi