简体   繁体   English

如何通过* .sql文件集在Oracle DB中创建表

[英]How to create tables in Oracle DB from the set of *.sql files

I have the set of *.sql files (>200) which contains scripts of tables creation. 我有一组* .sql文件(> 200),其中包含表创建的脚本。 How can I apply all of them automatically to Oracle DB? 如何将所有这些自动应用到Oracle DB?

I use Oracle SQL Developer environment 我使用Oracle SQL Developer环境

Just create a "driver" sql file, and call that from sqlplus - example, if you have script1.sql, script2.sql, create a file, "driver.sql" and include: 只需创建一个“驱动程序” sql文件,然后从sqlplus进行调用-例如,如果您具有script1.sql,script2.sql,则创建一个文件“ driver.sql”并包括:

@script1.sql
@script2.sql
...etc...

In which enviroment are you working? 您在哪个环境中工作? Give a bit more information please. 请提供更多信息。

If u use SQLPLUS try this 如果您使用SQLPLUS,请尝试

SQL > @{path}{file}

For Example 例如

SQL > @/usr/bin/script.sql

Executing them with SQL*Plus. 使用SQL * Plus执行它们。

From command line: 从命令行:

sqlplus @script1.sql @script2.sql sqlplus @ script1.sql @ script2.sql

Since you are using SQL Developer, just open the script file and run it as a script (F5). 由于您正在使用SQL Developer,因此只需打开脚本文件并将其作为脚本运行(F5)。

Or in a SQL Worksheet use an at reference to the script file: 或在SQL工作表中,使用at引用脚本文件:

@[drive:]\path\to\script1.sql
@[drive:]\path\to\script2.sql
...
@[drive:]\path\to\scriptn.sql

then just run that line (F9) or the entire SQL Worksheet as a script (F5). 然后只需将该行(F9)或整个SQL工作表作为脚本运行(F5)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM