Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1616267
  • 博文数量: 292
  • 博客积分: 10791
  • 博客等级: 上将
  • 技术积分: 2479
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-20 21:06
文章分类

全部博文(292)

文章存档

2011年(31)

2010年(261)

分类: Oracle

2010-05-28 17:03:10

默认情况下,在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, OracleAll 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, OracleAll 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
阅读(2677) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~