简体   繁体   English

脚本出Oracle对象

[英]Scripting out Oracle objects

I have recently been given an existing oracle database that i want to script out the various objects and its static data so that i can place the objects under source code control and when necessary rebuild the database from scratch. 最近,我获得了一个现有的oracle数据库,该脚本要脚本化各种对象及其静态数据,以便可以将这些对象置于源代码控制之下,并在必要时从头开始重建数据库。

Does any one have any scripts or tools that i could look at to assist me. 有没有人可以帮助我的脚本或工具?

I'd look at something like: select dbms_metadata.get_ddl(object_type, object_name, owner) from dba_objects. 我看一下类似的东西:从dba_objects中选择dbms_metadata.get_ddl(object_type,object_name,所有者)。 Stick it in a PL/SQL procedure to write each object's DDL to its own file with UTL_FILE. 将其粘贴在PL / SQL过程中,以使用UTL_FILE将每个对象的DDL写入其自己的文件中。

对于工具,我建议使用Oracle的SQL Developer ,它不仅具有针对对象的自动脚本编写功能,而且还支持某些源代码控制实用程序(特别是CVS和Subversion)。

I would be inclined to use either EXPORT/IMPORT (if any version up to and including 11g) or DATA PUMP (if 11g and maybe 10G) 我倾向于使用EXPORT / IMPORT(如果是11g及以下的任何版本)或DATA PUMP(如果是11g甚至是10G)

At command line on the server enter 'exp help=Y' and you should get enough detail on parameters. 在服务器上的命令行中输入“ exp help = Y”,您应该获得足够的参数详细信息。 Decide if you want the whole DB or one schema, data or not, etc. 确定是要整个数据库还是一个模式,是否需要数据等。

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

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