sqlplus小窍门:脚本搜索路径
时间:2010-05-28 来源:dbconf
默认情况下,在sqlplus中通过start或者@调用脚本时,只会在系统当前工作路径中搜索脚本,例如下面的例子中,必须将脚本t.sql 放到d:\目录下,否则将报错。
D:\>sqlplus ning/ning@orclSQL*Plus: Release 10.2.0.3.0 - Production on Tue Jul 24 13:35:21 2007
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
NING@orcl>@t
I
----------
1
NING@orcl>@tt
SP2-0310: unable to open file "tt.sql"
如果要将脚本放置到其他目录,并且可以在sqlplus中直接调用,而不用输入绝对路径,则可以通过设置环境变量(或者注册表值)SQLPATH(Unix/Linux 中也可以设置ORACLE_PATH环境变量)来实现。
D:\soft>set SQLPATH=D:\
D:\soft>sqlplus ning/ning@orcl
SQL*Plus: Release 10.2.0.3.0 - Production on Tue Jul 24 13:39:05 2007
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
NING@orcl>@t
I
----------
1
相关阅读 更多 +