首页 > Linux操作系统 > Linux操作系统 > 自動定時備份及分析統計腳本
crontab -l
15 0 * * * sh /data/run/autodel 1>>/data/run/log/autodel.log 2>>/data/run/log/autodel.bad
20 0 * * * sh /data/run/autoexp 1>/data/run/log/autoexp.log 2>/data/run/log/autoexp.bad
30 0 * * 6 sh /data/run/rmanfull.sh 1>/data/run/log/rmanfull.log 2>/data/run/log/rmanfull.bad
30 7 * * 6 sh /data/run/autostats 1>/data/run/log/autostats.log 2>/data/run/log/autostats.bad
cat /data/run/autostats
#!/bin/sh
source /home/oracle/.bash_profile
echo 'start datetime --> ' `date`
################################################
sqlplus -S '/as sysdba' <
dbms_stats.gather_schema_stats(ownname=> 'EB_WEB' , estimate_percent=> 15 , cascade=> TRUE );
dbms_stats.gather_schema_stats(ownname=> 'SFIS1' , estimate_percent=> 15 , cascade=> TRUE );
dbms_stats.gather_schema_stats(ownname=> 'SFISM4' , estimate_percent=> 15 , cascade=> TRUE );
end;
/
exit
EOFarch1
#################################################
echo 'finish datetime --> ' `date`
cat /data/run/autoexp
#!/bin/sh
find /data/expdata/imbsmt* -mmin -1440 -exec rm -f {} \;
ORACLE_HOME=/opt/oracle/product/9.2.0;export ORACLE_HOME
ORACLE_SID=smt2;export ORACLE_SID
localdate=`date +%Y%m%d%H`
echo '----------> begin exp at ' ` date ` '<--------------'
$ORACLE_HOME/bin/exp 'system/"imbl6"' file=/data/expdata/imbsmt_$localdate.dmp log=/data/expdata/imbsmt_$localdate.log full=y rows=y buffer=204800 statistics=none
echo '----------> end exp at ' ` date ` '<--------------'
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/25198367/viewspace-706180/ ,如需转载,请注明出处,否则将追究法律责任。