Reputation: 23321
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
Reputation: 28000
You could use expdp:
expdp tables=table1,table2 content=metadata_only ...
Upvotes: 4
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
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