Oracle导出数据库结构的SQL [英] Oracle exporting SQL of the Database structure

查看:199
本文介绍了Oracle导出数据库结构的SQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个SQL脚本,可以重新创建我已经拥有的数据库.我想重新创建内部没有数据的数据库.

I want to create an sql script that can recreate a DB that I already have. I want to recreate the DB without data inside.

那么sqlplus是否可以导出用户的数据库?

So is there anyway with sqlplus of exporting a DB of a user?

推荐答案

有两种基本方法.

第一个是导出转储文件.可以使用Datapump实用程序:

The first is to export a dump file. This can be with the Datapump utility:

$ expdp apc/pw directory=data_dump_dir dumpfile=apc_20100707.dmp content=METADATA_ONLY  

了解详情.

Datapump在Oracle10g中引入.在早期版本的数据库中,我们可以使用EXP实用程序执行相同的操作.

Datapump was introduced in Oracle10g. In earlier versions of the database we could use the EXP utility to do the same thing.

$ exp apc/pw dumpfile=apc_20100707.dmp rows=N

要导入文件,我们使用匹配的impdp(或imp)实用程序.

To import the file we use the matching impdp (or imp) utilities.

这是操作系统方法.为了生成实际的SQL脚本,我们可以使用Oracle 9i中引入的内置DBMS_METADATA包.这需要更多的工作,但是可以更好地控制导出对象的详细信息. 了解详情.

That is the OS approach. To generate actual SQL scripts we can use the built-in DBMS_METADATA package, introduced in Oracle 9i. This is a bit more work but offers much finer control over the details of the exported objects. Find out more.

这篇关于Oracle导出数据库结构的SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆