ITPub博客

首页 > 数据库 > 数据库开发技术 > 分析表的crontab脚本

分析表的crontab脚本

原创 数据库开发技术 作者:cnhtm 时间:2009-11-26 23:05:18 0 删除 编辑

将分析表的语句写入一个sh脚本中,然后在crontab中执行这个sh脚本,脚本内容如下:

year=`date +%Y`
month=`date +%m`
day=`date +%d`
now=$year-$month-$day

export ORACLE_SID=orcl

sqlplus '/as sysdba' < /dev/null
set echo off;
set heading off;
set pagesize 0;
set linesize 1000;
set numwidth 12;
set termout off;
set trimspool on;
spool ${now}.log;

exec dbms_stats.GATHER_TABLE_STATS('scott','emp',cascade=>true,force=>true);

spool off;

exit;
EOF

[@more@]

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/22049049/viewspace-1029104/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2009-07-06

  • 博文量
    104
  • 访问量
    812116