sqlplus小窍门:脚本搜索路径
NinGoo's blog

sqlplus小窍门:脚本搜索路径

默认情况下,在sqlplus中通过start或者@调用脚本时,只会在系统当前工作路径中搜索脚本,例如下面的例子中,必须将脚本t.sql放到d:\目录下,否则将报错。

D:\>sqlplus ning/ning@orcl

SQL*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:\>cd soft

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

本文网址:http://www.ningoo.net/html/2007/sqlplus_tips_script_search_path.html

订阅到Google | 收藏到Del.icio.us | 推荐到鲜果

上一篇: 下一篇:
相关文章 随机文章

本文Tags: ,

3 条评论


(Required)
(Required, will not be published)