我的实行sqlplus的Shell脚本有什么问题?
我需要在UNIX下让ORACLE定时执行*.sql文件,做成了如下脚本test.sh
#!/sbin/sh
ORACLE_BASE=/usr2/oracle;export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/app/oracle/product/9.0.1;export ORACLE_HOME
PATH=$ORACLE_HOME/bin:/usr/ccs/bin:/usr/bin:/etc:/usr/openwin/bin:/usr/local/bin:/$ORACLE_HOME/batch;export PATH
ORACLE_SID=necwl;export ORACLE_SID
ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data;export ORA_NLS33
NLS_LANG=AMERICAN_AMERICA.ZHS16GBK;export NLS_LANG
su -l oracle -c "sqlplus necwl/necwl@necwl"</dev/null
spool tables.txt;
@test.sql;
spool off;
exit;
其中test.SQL文件的内容如下
select * from sql;
在命令行实行sh test.sh时,系统提示如下错误信息
$ sh test.sh
Password:
Sun Microsystems Inc. SunOS 5.6 Generic August 1997
mail: Invalid permissions on /var/mail/oracle
SQL*Plus: Release 9.0.1.0.0 - Production on Thu Aug 21 18:56:23 2003
(c) Copyright 2001 Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.0.1.0.0 - Production
With the Partitioning option
JServer Release 9.0.1.0.0 - Production
SQL> Disconnected from Oracle9i Enterprise Edition Release 9.0.1.0.0 - Production
With the Partitioning option
JServer Release 9.0.1.0.0 - Production
test.sh: spool: not found
test.sh: @test.sql: not found
test.sh: spool: not found
请帮忙看看是什么问题,谢谢了。