php sql语句传参数值,如何给一个.sql文件传参数,如何在文件中引用这个参数呢?...

我要运行的文件如下:

inserts.sql

set verify off

@ins_all LINK_CAM.SVCC

@ins_all CC1

analyze table files compute statistics;

analyze table spaces compute statistics;

analyze table extents compute statistics;

@space_watcher

@extent_watcher

另一个文件:

ins_all.sql

insert into files

(db_nm,ts,check_date,file_nm,blocks)

select upper('&1'),tablespace_name,trunc(sysdate),file_name,blocks

from sys.dba_data_files@&1

/

commit;

rem

insert into spaces

(db_nm,check_date,ts,count_free_blocks,sum_free_blocks,max_free_blocks)

select upper('&1'),

trunc(sysdate),tablespace_name,count(blocks),sum(blocks),max(blocks)

from sys.dba_free_space@&1

group by tablespace_name

/

commit;

rem

insert into extents

(db_nm,ts,seg_owner,seg_name,seg_type,extents,blocks,check_date)

select upper('&1'),tablespace_name,owner,segment_name,segment_type,extents,blocks,trunc(sysdate) from sys.dba_segments@&1

where extents>9 or segment_type = 'ROLLBACK'

/

commit;

rem

undefine 1

其中:LINK_CAM.SVCC为DATABASE LINK,我在Sqlplus下已经试验成功了:

select * from dba_data_files@LINK_CAM.SVCC;

得到正确结果,我在操作系统下调用的错误信息如下:

[oracle@localhost create_script]$ sh ins_cc1

ORACLE_SID = [CC1] ?

Oracle Server Manager Release 3.1.7.0.0 - Production

Copyright (c) 1997, 1999, Oracle Corporation.  All Rights Reserved.

Oracle8i Enterprise Edition Release 8.1.7.0.1 - Production

With the Partitioning option

JServer Release 8.1.7.0.1 - Production

SVRMGR> Connected.

SVRMGR> MGR-00110: illegal SET option

from sys.dba_data_files@&1

*

ORA-01729: database link name expected

Statement processed.

from sys.dba_free_space@&1

*

ORA-01729: database link name expected

Statement processed.

select upper('&1'),tablespace_name,owner,segment_name,segment_type,extents,blocks,trunc(sysdate) from sys.dba_segments@&1

*

ORA-01729: database link name expected

Statement processed.

undefine 1

*

ORA-00900: invalid SQL statement

from sys.dba_data_files@&1

*

ORA-01729: database link name expected

Statement processed.

from sys.dba_free_space@&1

*

ORA-01729: database link name expected

Statement processed.

select upper('&1'),tablespace_name,owner,segment_name,segment_type,extents,blocks,trunc(sysdate) from sys.dba_segments@&1

*

ORA-01729: database link name expected

Statement processed.

undefine 1

*

ORA-00900: invalid SQL statement

analyze table files compute statistics

*

ORA-00942: table or view does not exist

analyze table spaces compute statistics

*

ORA-00942: table or view does not exist

analyze table extents compute statistics

*

ORA-00942: table or view does not exist

column db_nm foramt A8

*

ORA-00900: invalid SQL statement

MGR-00308: no spool file opened

MGR-01507: unable to open file "extent_watcher.sql"

SVRMGR>

Server Manager complete.

是什么原因呢????

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值