oracle_ray.sh这个脚本在我的博客内能找到,如需要请自行寻找

修改项:

1 在crontab中执行不读取profile文件就找不到sqlplus。如果是linux请读取bash_profile文件

2 egrep -v中把temp和undo2个表空间给过滤掉,以防出现错误

题外话:这么简单的脚本改了4个版本,我也是无奈了。其主要原因还是不细心。细心很重要,细心很重要,细心很重要。重要的事情说三遍!!!




#!/bin/bash#byraysuen#v04.~/.profileAddDataFile(){sqlplus-s/nolog<<-RAYconn/assysdba$1RAY}whiletruedosqltring=`/export/home/oracle/scripts/ray/oracle_ray.shtype=tablespace|egrep-v"TABLESPACE_NAME|selected|newmail|UNDOTB|TEMP"|tr"%"""|awk'{if($NF>70)print"altertablespace"$1"adddatafile'\''+data1'\''size128Mautoextendonnext128Mmaxsizeunlimited;"}'|egrep"^alter"`if["${sqltring:-None}"=="None"];thenbreakelseAddDataFile"${sqltring}"#echo${sqltring}fidone