Rocky Pulley
Rocky Pulley

Reputation: 23321

Copy an Oracle table with indexes but without data

I want to make a copy of a table in Oracle and include indexes but I don't want to copy the data. What's the best way?

Upvotes: 2

Views: 5527

Answers (3)

Dimitre Radoulov
Dimitre Radoulov

Reputation: 28000

You could use expdp:

expdp tables=table1,table2 content=metadata_only ...

bit.ly/pnLPNz

Upvotes: 4

Greg Reynolds
Greg Reynolds

Reputation: 10216

You can use the exp command with the ROWS parameter set to N.

Something like

exp scott/tiger ROWS=N

will do all the tables for that user, you can narrow it down with the TABLES option. Use

exp help=yes

for all the options.

Upvotes: 4

schurik
schurik

Reputation: 7928

you can use DBMS_METADATA.GET_DDL to extract the create statements for tables and indexes: http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_metada.htm

Upvotes: 4

Related Questions