请教:使用批处理文件连接ORACLE并且执行相关命令问题?

lvjunyu 2008-06-25 01:19:57
我写了个pb.bat批处理文件,如下
sqlplus sys/manager as sysdba;
drop user water CASCADE;
drop tablespace water;
在执行时,他只执行第一条语句,执行结果如下:
C:\>sqlplus sys/manager as sysdba;

SQL*Plus: Release 10.2.0.1.0 - Production on 星期三 6月 25 13:18:46 2008

Copyright (c) 1982, 2005, Oracle. All rights reserved.


连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL>


然后就无法执行第二条sql语句了,请问如何解决?





...全文
147 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
airport0928 2008-06-25
  • 打赏
  • 举报
回复
%cd% 代表当前路径
lvjunyu 2008-06-25
  • 打赏
  • 举报
回复
成功!谢谢!
请问命令符下,使用什么命令取得当前路径呢?
qiyousyc 2008-06-25
  • 打赏
  • 举报
回复
不能一个文件就实现的。
写一个txt或者sql文件,执行具体的代码
写个批处理,调用具体的文件 sqlplus scott/tiger @cmd.txt
airport0928 2008-06-25
  • 打赏
  • 举报
回复

1、将要执行的命令
drop user water CASCADE;
drop tablespace water;
写到一个文本文件里面,如cmd.txt

2、执行时这样
sqlplus sys/manager as sysdba @cmd.txt

即可。

17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧