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=scottCreates 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.