⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 456.html

📁 著名的linux英雄站点的文档打包
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<br>
#the backup machine config<br>
[backuphost]<br>
backhost_ip=10.232.193.5<br>
backhost_username=oracle<br>
backhost_password=oracleydyx<br>
backup_dir=/u2/oracleshaoshanback<br>
<br>
#delete the dump file x days ago?!!!<br>
[deletedumpfile]<br>
delete_days=2<br>
<br>
#the Oracle database's back method<br>
#如果start_tactic=Y 则采用策略备份,否则按每天完全到出<br>
#如果采用策略备份,则必须给SYSTEM用户的口令<br>
[backmethod]<br>
start_tactic=N<br>
system_password=manager11<br>
<br>
#the recode the system execute's log!<br>
[systemlog]<br>
sys_log=/home/oracle/wzx/x.log<br>
#end<br>
<br>
第二个文件:主程序文件:MY.SH:<br>
#!/bin/sh<br>
#############################################################################<br>
#<br>
#Get the all ini file config<br>
#CopyRight By WangZuXiang 2002-2005?<br>
#版权所有(C) 2002-2005? WangZuXiang .<br>
#All Rights Reserved.<br>
#program date 2002-10-22<br>
#usage: main<br>
#This script is used to start oracle dump database .<br>
#It should ONLY be executed as part of the crontabs.<br>
#function content is:<br>
#1:自动检查是否能连上Oracle!<br>
#2:通过初始化文本来解析各种需要的参数!<br>
#3:自动完全到出ORACLE数据库(每天)!,以后将增加相关的增量备份等!<br>
#4:自动删除配置文件中规定的前X天的备份文件!<br>
#5:自动将到出文件打包并转存到其他的备份机器上!<br>
#6:自动记录程序执行过程中的所有日期信息!<br>
#if you find some bugs please send it to my mailpost :<br>
#e-mail:wzxherry@sina.com !<br>
#new function:增加了对ORACLE数据库备份策略的方法!2002-10-31<br>
##############################################################################<br>
mypwd=`pwd`<br>
inifile=/home/oracle/wzx/init.txt<br>
oratab=/etc/oratab<br>
TEMP=temp.$$<br>
DUMP_FILE=`date +'%Y%m%d`<br>
<br>
initme ()<br>
{<br>
#read from the config file 'ini.txt'<br>
<br>
#oracle config<br>
USERNAME=`cat ${inifile:-"init.txt"} | grep -i '^username' | awk -F = '{print $2}'`<br>
PASSWORD=`cat ${inifile:-"init.txt"} | grep -i '^password' | awk -F = '{print $2}'`<br>
MY_ALIAS=`cat ${inifile:-"init.txt"} | grep -i '^con_alias' | awk -F = '{print $2}'`<br>
<br>
#the main host config<br>
MYHOST_IP=`cat ${inifile:-"init.txt"} | grep -i '^myhost_ip' | awk -F = '{print $2}'`<br>
MYHOST_USERNAME=`cat ${inifile:-"init.txt"} | grep -i '^myhost_username' | awk -F = '{print $2}'`<br>
MYHOST_PASSWORD=`cat ${inifile:-"init.txt"} | grep -i '^myhost_password' | awk -F = '{print $2}'`<br>
DUMP_DIR=`cat ${inifile:-"init.txt"} | grep -i '^dump_dir' | awk -F = '{print $2}'`<br>
<br>
#the backup host config<br>
BACKHOST_IP=`cat ${inifile:-"init.txt"} | grep -i '^backhost_ip' | awk -F = '{print $2}'`<br>
BACKHOST_USERNAME=`cat ${inifile:-"init.txt"} | grep -i '^backhost_username' | awk -F = '{print $2}'`<br>
BACKHOST_PASSWORD=`cat ${inifile:-"init.txt"} | grep -i '^backhost_password' | awk -F = '{print $2}'`<br>
BACKUP_DIR=`cat ${inifile:-"init.txt"} | grep -i '^backup_dir' | awk -F = '{print $2}'`<br>
<br>
#the define's delete dump file days!<br>
DAYS=`cat ${inifile:-"init.txt"} | grep -i '^delete_days' | awk -F = '{print $2}'`<br>
#to get the system log<br>
LOGS=`cat ${inifile:-"init.txt"} | grep -i '^sys_log' | awk -F = '{print $2}'`<br>
TACTIC=`cat ${inifile:-"init.txt"} | grep -i '^start_tactic' | awk -F = '{print $2}'`<br>
SYSTEMPASS=`cat ${inifile:-"init.txt"} | grep -i '^system_password' | awk -F = '{print $2}'`<br>
<br>
#read the config file end.<br>
}<br>
<br>
#WHOAMI=`id | awk '/uid=[0-9]*(oracle)/ {print $1}'`<br>
#WHOAMI=`id | awk '{print $1}' | sed 's/uid=[0-9]*(.*).*/1/'`<br>
WHOAMI=`id | sed 's/uid=[0-9]*(.*) gid.*/1/'`<br>
#if test "$WHOAMI" = "" ; then<br>
if test "$WHOAMI" != "(oracle)" ; then<br>
echo ""<br>
echo "=============================================================="<br>
echo "=========you must use oracle user to run this script!========="<br>
echo "=============================================================="<br>
echo ""<br>
exit 0<br>
fi<br>
<br>
#run the init parameter<br>
test ! -e $inifile && echo "not find the init file:"$inifile"!" && exit 0<br>
<br>
initme<br>
<br>
if [ -z $LOGS ]; then<br>
echo "&lt;&lt;can not to find the define of system log...!!!&gt;&gt;"<br>
fi<br>
<br>
#LOG = ${LOGS:-"x.log"}<br>
LOGME="tee -a ${LOGS:-"x.log"}"<br>
<br>
if [ -e $LOGS -a -f $LOGS ]; then<br>
if test ! -w $LOGS; then<br>
echo "&lt;&lt;the log file:"$LOGS" can not to write!....................&gt;&gt;"<br>
exit<br>
fi<br>
fi<br>
<br>
echo "" | $LOGME<br>
echo "-----------------------------------------------------------------" | $LOGME<br>
echo "&lt;&lt;system now is initing ..............!&gt;&gt;" | $LOGME<br>
<br>
#check the parameter value<br>
if [ -z $USERNAME ]; then<br>
echo "&lt;&lt;the oracle database's username is null..............!&gt;&gt;" | $LOGME<br>
exit 1<br>
fi<br>
<br>
if [ -z $PASSWORD ]; then<br>
echo "&lt;&lt;the oracle database's password is null..............!&gt;&gt;" | $LOGME<br>
exit 2<br>
fi<br>
<br>
if [ -z $MY_ALIAS ]; then<br>
echo "&lt;the oracle connect alias is null!..............&gt;&gt;" | $LOGME<br>
exit 0<br>
fi<br>
<br>
if [ -z $MYHOST_IP ]; then<br>
echo "&lt;&lt;the oracle's host ip is null..............!&gt;&gt;" | $LOGME<br>
exit 3<br>
fi<br>
<br>
if [ ! -d $DUMP_DIR ]; then<br>
echo "&lt;the oracle's dump dir is not exist..............!&gt;&gt;" | $LOGME<br>
exit 0<br>
fi<br>
<br>
if [ -z $MYHOST_USERNAME ]; then<br>
echo "&lt;&lt;then oracle host username is null..............!&gt;&gt;" | $LOGME<br>
exit 4<br>
fi<br>
<br>
if [ -z $MYHOST_PASSWORD ]; then<br>
echo "&lt;&lt;the oracle host password is null..............!&gt;&gt;" | $LOGME<br>
exit 5<br>
fi<br>
<br>
if [ -z $BACKHOST_IP ]; then<br>
echo "&lt;&lt;the backup host's ip is null..............!&gt;&gt;" | $LOGME<br>
exit 6<br>
fi<br>
<br>
if [ -z $BACKHOST_USERNAME ]; then<br>
echo "&lt;&lt;the backup host's uesername is null..............!&gt;&gt;" | $LOGME<br>
exit 7<br>
fi<br>
<br>
if [ -z $BACKHOST_PASSWORD ]; then<br>
echo "&lt;&lt;the backup host's password is null..............!&gt;&gt;" | $LOGME<br>
exit 8<br>
fi<br>
<br>
if [ -z $BACKUP_DIR ]; then<br>
echo "&lt;&lt;the backup host's backup dir is null..............!&gt;&gt;" | $LOGME<br>
exit 9<br>
fi<br>
#elif [ ! -e $BACKUP_DIR  -o ! -d $BACKUP_DIR ]; then<br>
#echo "&lt;&lt;the backup dir "$BACKUP_DIR" is not exist or is not directory..............!&gt;&gt;" | $LOGME<br>
#exit 0<br>
#fi<br>
<br>
#if [ ! -O $BACKUP_DIR ]; then<br>
#echo "&lt;&lt;the backup host's backup dir is not owner to oracle..............!&gt;&gt;" | $LOGME<br>
#exit 0<br>
#fi<br>
<br>
if [ -z $DAYS ]; then<br>
echo "&lt;&lt;the delete file define days is null so not to delete...............!&gt;&gt;" | $LOGME<br>
fi<br>
<br>
if test $TACTIC = "Y" ; then<br>
if test -z $SYSTEMPASS ; then<br>
echo "&lt;&lt;if you use TACTIC back,then you must give the oracle system  password!...............!&gt;&gt;" | $LOGME<br>
exit 0<br>
fi<br>
fi<br>
<br>
if test $? -eq 0 ; then<br>
echo "&lt;&lt;system init is OK............................!&gt;&gt;" | $LOGME<br>
fi<br>
<br>
#check end.<br>
#<br>
#main<br>
#<br>
<br>
if [ ! -f $oratab  -o ! -e $oratab ]; then<br>
echo "&lt;&lt;the oracle define's oratab file is not normal file or is not exist..............!&gt;&gt;" | $LOGME<br>
exit 0<br>
fi<br>
<br>
ORACLE_SID=`cat $oratab | grep -v "^#" | grep "Y$" | awk -F : '{print $1}' `<br>
if [ -z $ORACLE_SID ]; then<br>
echo "&lt;&lt;the ORACLE_SID is not find ..............!&gt;&gt;" | $LOGME<br>
exit -1<br>
fi<br>
export ORACLE_SID<br>
ORACLE_HOME=`cat $oratab | grep -v "^#" | grep "Y$" | awk -F : '{print $2}' `<br>
if [ ! -d $ORACLE_HOME ]; then<br>
echo "the oracle's home directory "$ORACLE_HOME" is not exist..............!&gt;&gt;" | $LOGME<br>
exit -1<br>
fi<br>
export ORACLE_HOME<br>
PATH=$PATH:$ORACLE_HOME/bin:/usr/lib:/bin:$HOME/bin:.<br>
ORACLE_BASE=/u1/app/oracle<br>
export ORACLE_BASE<br>
ORACLE_SID=misdb<br>
export ORACLE_SID<br>
ORACLE_HOME=$ORACLE_BASE/product/8.1.6<br>
export ORACLE_HOME<br>
PATH=$PATH:$ORACLE_HOME/bin<br>
export PATH<br>
LIBPATH=$LIBPATH:$ORACLE_HOME/lib<br>
export LIBPATH<br>
ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data<br>
export ORA_NLS33<br>
export PATH<br>
#############################################<br>
## begin to dump the database<br>
#############################################<br>
<br>
#trying to connect oracle .....<br>
if [ -e $TEMP ]; then<br>
rm -f $TEMP<br>
if [ ! $? -eq 0 ]; then<br>
echo "&lt;&lt;delete the file: "$TEMP" is fail..............!!!!&gt;&gt;" | $LOGME<br>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -