Extracting DDLs from Oracle

DBMS_METADATA


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

set pagesize 0    ---Doesnot display column names.

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

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

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

spool scott_schema.sql --Spool to a file

connect scott/tiger@orcl;   --Connectingas 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;
spooloff;           --Turn offspool


exp

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.

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.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值