如何通过批处理执行多个ddl字
当我部署我的asp.net应用程序时,我必须创建一些表空间/用户,我使用pqsql,但是我想知道有什么方法可以通过批处理创建它们吗?
例如,我可以执行这个ddl:
create tablespace TSA.....
然后我可以执行:
create user a ... default tablespace TSA...
但是当我同时执行它们时:
create tablespace TSA.....
create user a ... default tablespace TSA...
我会得到一个错误。
反正?
更新
错误是这样的:
ORA-02180: invalid CREATE TABLESPACE words
顺便说一句,我在 pl/sql 开发人员的 sql 窗口中运行 sql 批处理。
现在,我只想知道是否有任何方法可以运行整个 ddl sql 文件?
假设这是init.sql
的内容:
create smallfile tablespace "DEV" datafile 'f:\app\administrator\oradata\orcl\dev01.dbf' size 100m autoextend on next 10m maxsize unlimited logging extent management local segment space management auto default nocompress
-- Create the user
create user dev_sa
identified by "000000"
default tablespace DEV
temporary tablespace TEMP;
-- Grant/Revoke role privileges
grant connect to dev_sa;
grant dba to dev_sa;
--create another tablespace
--.....
如何在批处理模型中执行它?
When I deploy my asp.net application,I have to create some tablesapces/users,I use the pqsql,however I want to know is there any way I can create them with batch processing?
For example,I can execute this ddl:
create tablespace TSA.....
Then I can execute:
create user a ... default tablespace TSA...
But when I execute them at the same time:
create tablespace TSA.....
create user a ... default tablespace TSA...
I will get an error.
ANy way?
update
Error is something like this:
ORA-02180: invalid CREATE TABLESPACE words
BTW,I run the sql batches in the sql window of the pl/sql developer.
Now,I just want to know if there is any way I can run a whole ddl sql file?
Suppose this is the content of the init.sql
:
create smallfile tablespace "DEV" datafile 'f:\app\administrator\oradata\orcl\dev01.dbf' size 100m autoextend on next 10m maxsize unlimited logging extent management local segment space management auto default nocompress
-- Create the user
create user dev_sa
identified by "000000"
default tablespace DEV
temporary tablespace TEMP;
-- Grant/Revoke role privileges
grant connect to dev_sa;
grant dba to dev_sa;
--create another tablespace
--.....
How to execute it in the batch process model?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果从 SQL*Plus 运行的文件中有两条语句,则需要使用
/
字符分隔语句,这也会导致执行每条语句(这是一个相当大的 'if ',当然按照 @APC 的评论;但是之前已经出现过 SQL Developer 中运行事物的不同方式,但实际上只是根据给出的最少信息进行的猜测......)
If you have the two statements in a file you're running from SQL*Plus, you need to separate the statements with the
/
character, which also causes each to be executed(That's quite a big 'if', of course as per @APC's comment; but is something that's come up before. As has different ways of running things in SQL Developer, among other things. But really no more than a guess from the minimal info given...)
您的第一个
CREATE TABLE
末尾缺少分号;
You have a semi-colon
;
missing off the end of your firstCREATE TABLE