📄 456.html
字号:
exit -1<br>
fi<br>
fi<br>
<br>
if [ -x $ORACLE_HOME/bin/tnsping ]; then<br>
#$ORACLE_HOME/bin/tnsping $MY_ALIAS > $TEMP<br>
tnsping $MY_ALIAS > $TEMP<br>
ME=`cat $TEMP | grep "OK" | awk '{print $1}'`<br>
if [ "$ME" != "OK" ]; then<br>
echo "<<can not to connect oracle by tnsping:"$MY_ALIAS"..............!>>" | $LOGME<br>
rm -f $TEMP<br>
exit $?<br>
else<br>
echo "<<connect oracle is ok!...............................!>>" | $LOGME<br>
fi<br>
fi<br>
<br>
rm -f $TEMP<br>
<br>
if [ -x $ORACLE_HOME/bin/exp ]; then<br>
#MY_ALIAS<br>
#cd $ORACLE_HOME/bin<br>
#if [ ! $? -eq 0 ]; then<br>
#echo "error "<br>
#exit 0<br>
#fi<br>
<br>
trap "" 1 2 3 15<br>
<br>
#如果不用策略备份,则采用倒用户的方式,到出!!!!<br>
#echo $TACTIC<br>
#<br>
#if [ "$TACTIC" = "Y" ]; then<br>
#if [ -x $ORACLE_HOME/bin/svrmgrl ]; then<br>
#svrmgrl <<EOF<br>
#connect $USERNAME/$SYSTEMPASS@$MY_ALIAS<br>
#exit<br>
#EOF<br>
#if test $? -ne 0 ; then<br>
#echo "<<SYSTEM user password is error!.................>>" | $LOGME<br>
#exit $?<br>
#fi<br>
#fi<br>
#fi<br>
#<br>
<br>
if [ "$TACTIC" != "Y" -o "$TACTIC" != "y" ]; then<br>
echo "<<系统将按倒出用户方式进行!..............................>>" | $LOGME<br>
$ORACLE_HOME/bin/exp $USERNAME/$PASSWORD@$MY_ALIAS buffer=40960 file=$DUMP_DIR/$DUMP_FILE.dmp owner=$USERNAME grants=Y rows=Y compress=Y indexes=Y log=$DUMP_DIR/$DUMP_FILE.log<br>
<br>
#采用策略备份,则对整个数据库进行策略备份!<br>
<br>
else<br>
echo "<<系统将按策略备份用户方式进行!..............................>>" | $LOGME<br>
MYWEEK=`date | awk '{print $1}'`<br>
case $MYWEEK in<br>
#星期一完全导出<br>
Mon)exp system/$SYSTEMPASS@$MY_ALIAS inctype=complete buffer=40960 file=$DUMP_DIR/$DUMP_FILE.dmp grants=Y rows=Y compress=Y indexes=Y log=$DUMP_DIR/$DUMP_FILE.log<br>
echo "<<Mon is complete dump the db,file:"$DUMP_FILE.dmp"...............!>>" | $LOGME<br>
;;<br>
#星期二增量导出<br>
Tue)exp system/$SYSTEMPASS@$MY_ALIAS inctype=incremental buffer=40960 file=$DUMP_DIR/$DUMP_FILE.dmp grants=Y rows=Y compress=Y indexes=Y log=$DUMP_DIR/$DUMP_FILE.log<br>
echo "<<Tue is incremental dump the db,file:"$DUMP_FILE.dmp"...............!>>" | $LOGME<br>
;;<br>
#星期三增量导出<br>
Wed)exp system/$SYSTEMPASS@$MY_ALIAS inctype=incremental buffer=40960 file=$DUMP_DIR/$DUMP_FILE.dmp grants=Y rows=Y compress=Y indexes=Y log=$DUMP_DIR/$DUMP_FILE.log<br>
echo "<<Wed is incremental dump the db,file:"$DUMP_FILE.dmp"...............!>>" | $LOGME<br>
;;<br>
#星期四增量导出<br>
Thu)exp system/$SYSTEMPASS@$MY_ALIAS inctype=incremental buffer=40960 file=$DUMP_DIR/$DUMP_FILE.dmp grants=Y rows=Y compress=Y indexes=Y log=$DUMP_DIR/$DUMP_FILE.log<br>
echo "<<Thu is incremental dump the db,file:"$DUMP_FILE.dmp"...............!>>" | $LOGME<br>
;;<br>
#星期五累计导出<br>
Fri)exp system/$SYSTEMPASS@$MY_ALIAS inctype=cumulative buffer=40960 file=$DUMP_DIR/$DUMP_FILE.dmp grants=Y rows=Y compress=Y indexes=Y log=$DUMP_DIR/$DUMP_FILE.log<br>
echo "<<Fri is cumulative dump the db,file:"$DUMP_FILE.dmp"...............!>>" | $LOGME<br>
;;<br>
#星期六增量导出<br>
Sat)exp system/$SYSTEMPASS@$MY_ALIAS inctype=incremental buffer=40960 file=$DUMP_DIR/$DUMP_FILE.dmp grants=Y rows=Y compress=Y indexes=Y log=$DUMP_DIR/$DUMP_FILE.log<br>
echo "<<Sat is incremental dump the db,file:"$DUMP_FILE.dmp"...............!>>" | $LOGME<br>
;;<br>
#星期日增量导出<br>
Sun)exp system/$SYSTEMPASS@$MY_ALIAS inctype=incremental buffer=40960 file=$DUMP_DIR/$DUMP_FILE.dmp grants=Y rows=Y compress=Y indexes=Y log=$DUMP_DIR/$DUMP_FILE.log<br>
echo "<<Sun is incremental dump the db,file:"$DUMP_FILE.dmp"...............!>>" | $LOGME<br>
;;<br>
*)<br>
;;<br>
esac <br>
fi<br>
<br>
if test $? -eq 0 -a -s $DUMP_DIR/$DUMP_FILE.dmp<br>
then<br>
echo "<<dump the oracle database success at: "$DUMP_FILE"..............!>>" | $LOGME<br>
else<br>
echo "<<dump the oracle database fail at: "$DUMP_FILE"..............!>>" | $LOGME<br>
exit $?<br>
fi<br>
else<br>
echo "<<sorry!,the exp not to find or not execute,please check it..............!>>" | $LOGME<br>
exit $?<br>
fi<br>
<br>
#其实可以用find . -atime -days -exec rm {} 删除前DAYS天的备份文件,但查找不是很精确!<br>
#if define the days then to execute delete the dump file $DAYS ago!<br>
if [ -n $DAYS -a $DAYS -gt 0 ]; then<br>
echo "<<system will to remove the dump file $DAYS days ago..............!>>" | $LOGME<br>
if [ -x $ORACLE_HOME/bin/svrmgrl ]; then<br>
svrmgrl <<EOF<br>
connect $USERNAME/$PASSWORD@$MY_ALIAS<br>
spool $TEMP<br>
select to_char(sysdate-$DAYS,'yyyymmdd') mydate from dual;<br>
spool off<br>
exit<br>
EOF<br>
if test $? -eq 0 -a -f $TEMP -a -s $TEMP ; then<br>
echo "<<get the $DAYS days ago's date is ok..............!>>" | $LOGME<br>
else<br>
echo "<<to get $DAYS days ago's date is fail(connect oracle is fail---------)..............!>>" | $LOGME<br>
#exit $?<br>
fi<br>
else<br>
echo "<<not find the oracle's svrmgrl program or cant not execute and get the days is fail..............!>>" | $LOGME<br>
exit $?<br>
fi<br>
<br>
#####################<br>
##<br>
## Gegin to remove the dump file<br>
##<br>
#####################<br>
<br>
#TEMPDATE=`cat $TEMP | sed '1d' | sed '$d' | grep -v '^--*'`<br>
TEMPDATE=`cat $TEMP | sed '1d' | sed '$d' | sed '/^--*/d'`<br>
#echo "$TEMPDATE"<br>
rm -f $TEMP<br>
if test ! $? -eq 0 ; then<br>
echo "<<can not to remove the temp file:"$TEMP"..............!>>" | $LOGME<br>
fi<br>
#echo "${DUMP_DIR}/${TEMPDATE}.dmp"<br>
if test -e $DUMP_DIR/$TEMPDATE.dmp -a -f $DUMP_DIR/$TEMPDATE.dmp -a -n $TEMPDATE; then<br>
rm -f $DUMP_DIR/$TEMPDATE.dmp<br>
rm -f $DUMP_DIR/$TEMPDATE.log<br>
rm -f $DUMP_DIR/$TEMPDATE.tar.Z<br>
if test $? -eq 0 ; then<br>
echo "<<remove the "$DUMP_DIR/$TEMPDATE.dmp" is ok..............!>>" | $LOGME<br>
else<br>
echo "<<remove the "$DUMP_DIR/$TEMPDATE.dmp" is fail..............!>>" | $LOGME<br>
#exit $?<br>
fi<br>
else<br>
echo "<<can not to find the file: "$DUMP_DIR/$TEMPDATE.dmp" ..............!>>" |<br>
$LOGME<br>
#exit $?<br>
fi<br>
fi<br>
<br>
####################################################<br>
#<br>
#to transfer the dump file to other's host user ftp<br>
#<br>
####################################################<br>
<br>
if [ -e $DUMP_DIR/$DUMP_FILE.dmp -a -e $DUMP_DIR/$DUMP_FILE.log ]; then<br>
tar -cvf $DUMP_DIR/$DUMP_FILE.tar $DUMP_DIR/$DUMP_FILE.dmp $DUMP_DIR/$DUMP_FILE.log && compress $DUMP_DIR/$DUMP_FILE.tar | $LOGME<br>
if test $? -eq 0 -a -e $DUMP_DIR/$DUMP_FILE.tar.Z ; then<br>
echo "<<the dump file "$DUMP_FILE.tar.Z" is archive ok.........!>>" | $LOGME<br>
rm -f $DUMP_DIR/$DUMP_FILE.tar<br>
rm -f $DUMP_DIR/$DUMP_FILE.log<br>
rm -f $DUMP_DIR/$DUMP_FILE.dmp<br>
if test ! $? -eq 0 ; then<br>
echo "<<delete the dump file is fail!.........................!>>" | $LOGME<br>
else<br>
echo "<<delete the dump file is ok!.........................!>>" | $LOGME<br>
fi<br>
else<br>
echo "<<the dump file "$DUMP_FILE.tar.Z" is archive fail..........!>>" | $LOGME<br>
exit $?<br>
fi<br>
fi<br>
<br>
echo "<<system now is transfering file to ${BACKHOST_IP}..............!>>" | $LOGME<br>
<br>
ftp -n $BACKHOST_IP <<! | $LOGME<br>
user $BACKHOST_USERNAME $BACKHOST_PASSWORD<br>
bin<br>
prompt<br>
put $DUMP_DIR/$DUMP_FILE.tar.Z $BACKUP_DIR/$DUMP_FILE.tar.Z<br>
close<br>
bye<br>
!<br>
<br>
if test $? -eq 0 ; then<br>
echo "<<Transfer the file:"$DUMP_DIR/$DUMP_FILE.tar.Z" to "$BACKHOST_IP"$BACKUP_DIR is OK.................! >>" | $LOGME<br>
else<br>
echo "<<Transfer the file:"$DUMP_DIR/$DUMP_FILE.tar.Z" to "$BACKHOST_IP"$BACKUP_DIR is fail..................! >>" | $LOGME<br>
exit $?<br>
fi<br>
<br>
if test $? -eq 0 ; then<br>
echo "<<the script is execute finish!,please check it!.......................................!>>" | $LOGME<br>
echo "-----------------------------------------------------------------" | $LOGME<br>
exit 0<br>
fi<br>
<br>
</FONT><br>
</TD>
</TR>
<TR>
<TD colSpan=2><FONT
class=middlefont></FONT><BR>
<FONT
class=normalfont>全文结束</FONT> </TD>
</TR>
<TR>
<TD background="images/dot.gif" tppabs="http://www.linuxhero.com/docs/images/dot.gif" colSpan=2
height=10></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></DIV></TD>
<TD vAlign=top width="20%"
background="images/line.gif" tppabs="http://www.linuxhero.com/docs/images/line.gif" rowSpan=2>
<DIV align=center>
<table class=tableoutline cellspacing=1 cellpadding=4
width="100%" align=center border=0>
<tr class=firstalt>
<td noWrap background="images/bgline.gif" tppabs="http://www.linuxhero.com/docs/images/bgline.gif" colspan=2 height=21>
<font class=normalfont><b>所有分类</b></font></td>
</tr>
<tr class=secondalt> <td noWrap width=27%> <font class=normalfont>1:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type1.html" tppabs="http://www.linuxhero.com/docs/type1.html">非技术类</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>2:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type2.html" tppabs="http://www.linuxhero.com/docs/type2.html">基础知识</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>3:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type3.html" tppabs="http://www.linuxhero.com/docs/type3.html">指令大全</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>4:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type4.html" tppabs="http://www.linuxhero.com/docs/type4.html">shell</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>5:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type5.html" tppabs="http://www.linuxhero.com/docs/type5.html">安装启动</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>6:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type6.html" tppabs="http://www.linuxhero.com/docs/type6.html">xwindow</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>7:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type7.html" tppabs="http://www.linuxhero.com/docs/type7.html">kde</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>8:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type8.html" tppabs="http://www.linuxhero.com/docs/type8.html">gnome</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>9:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type9.html" tppabs="http://www.linuxhero.com/docs/type9.html">输入法类</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>10:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type10.html" tppabs="http://www.linuxhero.com/docs/type10.html">美化汉化</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>11:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type11.html" tppabs="http://www.linuxhero.com/docs/type11.html">网络配置</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>12:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type12.html" tppabs="http://www.linuxhero.com/docs/type12.html">存储备份</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>13:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type13.html" tppabs="http://www.linuxhero.com/docs/type13.html">杂项工具</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>14:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type14.html" tppabs="http://www.linuxhero.com/docs/type14.html">编程技术</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>15:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type15.html" tppabs="http://www.linuxhero.com/docs/type15.html">网络安全</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>16:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type16.html" tppabs="http://www.linuxhero.com/docs/type16.html">内核技术</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>17:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type17.html" tppabs="http://www.linuxhero.com/docs/type17.html">速度优化</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>18:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type18.html" tppabs="http://www.linuxhero.com/docs/type18.html">apache</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>19:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type19.html" tppabs="http://www.linuxhero.com/docs/type19.html">email</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>20:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type20.html" tppabs="http://www.linuxhero.com/docs/type20.html">ftp服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>21:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type21.html" tppabs="http://www.linuxhero.com/docs/type21.html">cvs服务</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>22:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type22.html" tppabs="http://www.linuxhero.com/docs/type22.html">代理服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>23:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type23.html" tppabs="http://www.linuxhero.com/docs/type23.html">samba</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>24:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type24.html" tppabs="http://www.linuxhero.com/docs/type24.html">域名服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>25:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type25.html" tppabs="http://www.linuxhero.com/docs/type25.html">网络过滤</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>26:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type26.html" tppabs="http://www.linuxhero.com/docs/type26.html">其他服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>27:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type27.html" tppabs="http://www.linuxhero.com/docs/type27.html">nfs</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>28:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type28.html" tppabs="http://www.linuxhero.com/docs/type28.html">oracle</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>29:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type29.html" tppabs="http://www.linuxhero.com/docs/type29.html">dhcp</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>30:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type30.html" tppabs="http://www.linuxhero.com/docs/type30.html">mysql</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>31:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type31.html" tppabs="http://www.linuxhero.com/docs/type31.html">php</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>32:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type32.html" tppabs="http://www.linuxhero.com/docs/type32.html">ldap</a></font></td> </tr> </table></td></tr> </table>
</DIV></TD></TR>
<TR vAlign=top>
<TD width="80%">
<DIV align=center><BR>
</DIV>
</TD></TR></TBODY></TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE>
<TABLE cellSpacing=0 cellPadding=4 width="100%" bgColor=#eeeeee
border=0><TBODY>
<TR>
<TD width="50%">
<P><FONT class=middlefont>版权所有 © 2004 <A
href="mailto:bjchenxu@sina.com">linux知识宝库</A><BR>
违者必究. </FONT></P>
</TD>
<TD width="50%">
<DIV align=right><FONT class=middlefont>Powered by: <A
href="mailto:bjchenxu@sina.com">Linux知识宝库</A> Version 0.9.0 </FONT></DIV>
</TD></TR></TBODY></TABLE>
<CENTER></CENTER></TD></TR>
</TABLE></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -