如何使用 Oracle SQL Developer 生成 Oracle 数据库导出脚本?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5471429/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 03:10:32  来源:igfitidea点击:

How can I generate Oracle Database export script Using Oracle SQL Developer?

oracleexportoracle-sqldeveloper

提问by BJ Patel

I need to Generate an export script of entire Oracle Database using using SQL Developer.

我需要使用 SQL Developer 生成整个 Oracle 数据库的导出脚本。

How can I do this?

我怎样才能做到这一点?

回答by álvaro González

Tools-> Database Export?

工具-> 数据库导出?

回答by Frank Schmitt

For backing up the entire database, I'd recommend using expdp/impdp from the command line. If you only need the objects and not the data, you can use the METADATA_ONLY setting, see

为了备份整个数据库,我建议从命令行使用 expdp/impdp。如果您只需要对象而不需要数据,则可以使用 METADATA_ONLY 设置,请参阅

http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/dp_export.htm

http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/dp_export.htm

If you really need to generate a SQL script for your complete database and don't want to use a commercial tool like PL/SQL Developer, TOAD etc., you'll probably have to do it yourself - e.g. iterating over all objects and extract their DDL script using dbms_metadata.get_ddl(), something like
foreach user u in all_users
foreach object o in users_u_objects
script += dbms_metadata.get_ddl(u, o)

如果你真的需要为你的完整数据库生成一个 SQL 脚本并且不想使用像 PL/SQL Developer、TOAD 等商业工具,你可能必须自己做 - 例如迭代所有对象并提取他们使用 dbms_metadata.get_ddl() 的 DDL 脚本,类似于
foreach user u in all_users
foreach object o in users_u_objects
script += dbms_metadata.get_ddl(u, o)