ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Extracting DDLs from Oracle

Extracting DDLs from Oracle

原创 Linux操作系统 作者:chncaesar 时间:2013-08-20 16:08:49 0 删除 编辑

1. DBMS_METADATA

This example extracts DDLs of every table and index from scott, run it in sqlplus:

 set pagesize 0    ---Does not display column names.

set long 90000    ---9000 bytes of cache in local machine for LONG datatype

set feedback off  --Does not display messages like "PL/SQL procedure successfully completed"

set echo off         --START command does not list each command in a script. as       --the command is executed.

spool scott_schema.sql --Spool to a file

connect scott/tiger@orcl;   --Connecting as scott

SELECT DBMS_METADATA.GET_DDL('TABLE',u.table_name) FROM USER_TABLES u;

SELECT DBMS_METADATA.GET_DDL('INDEX',u.index_name) FROM USER_INDEXES u;

spool off;           --Turn off spool

2. exp command.
exp scott/123456@pdborcl grants=N indexes=Y triggers=N record=N Statistics=None wner=scott 

Creates expdat.dmp in current directory, you need to manually edit the file to eliminate useless content.

3. Database Export of SQL Developer.
Select "Tools" --> "Database Export", and a wizard will guide you through the whole process. It gives you the choice to :
1. Export the storage parameters
2. Export the data
3. Select the objects (tables, indexes, views, MVs, db links, packages, procedures) to export.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/638844/viewspace-768902/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2013-07-30

  • 博文量
    102
  • 访问量
    899784