Job Seekers   Employers
dbapool: Authors | Submissions | Contact Us
   Forgot password? | Sign up
  Home   Discussion Forum   Articles   Interview Questions   FAQs   Scripts   Rewards   Analyzer   White Papers   Blog   Certification   Downloads   Tools
 

Topic: Database Administration >> Need to have structure of emp table.

Disclaimer: The purpose of all dbapool forums including OCP and Other Oracle Certification forums is to help each other with specific issues but not to share dump and copyrighted exam content, materials or intellectual property. You may review the entire Oracle Certification Program Candidate Agreement online Here.



  


 Title: Need to have structure of emp table.
 vikhardba  Posted: Feb 06, 2008 05:04:17 AM

 Total Post: 86
 Joined: Apr, 2007






 How do i copy the object structure? For example: having emp table with 8 columns and 14 rows . . So, i need to have replica of emp structure but not the 14 rows. How should i do it? Can anybody help me?

 vikhardba
Posted: Feb 06, 2008 05:11:32 AM  

 Total Post: 86
 Joined: Apr, 2007






 
To copy tables without rows i.e. to just copy the structure following is the command:

create table emp1 as select * from emp where 1=2;

Is there any way to copy indexes, and triggers from emp to emp1 in similar fashion?

Thanks in Advance,


 Murtuja
Posted: Feb 06, 2008 07:24:34 AM  

 Total Post: 814
 Joined: Jan, 2006






 
Simplest way to achive your requirement is export only index and triggers for that table.Then make necessary changes in dump file.

Export Parameter file.

FILE="C:\Documents and Settings\mkhokhar\Desktop\index_trigger.DMP"
LOG="C:\Documents and Settings\mkhokhar\Desktop\index_trigger.log"
TABLES=('COWNER.TABLE_NAME')
ROWS=N
CONSTRAINTS=N
GRANTS=N
STATISTICS=None
FEEDBACK=1000






 Murtuja
Posted: Feb 07, 2008 11:17:47 PM  

 Total Post: 814
 Joined: Jan, 2006






 
Hi,

You can get code of index and trigeer by this way also.

set long 20000

SELECT dbms_metadata.get_ddl('INDEX', 'PK_EMP')
FROM dual

SELECT dbms_metadata.get_ddl('TRIGGER', 'TRIGGER_NAME')
FROM dual



 Time Zone: EDT

  




Forum Rules & Description


Who Can Read The Forum? Any registered user or guest
Who Can Post New Topics? Any registered user
Who Can Post Replies? Any registered user




 








Get FREE Magazines

Top 10 Forum User

  Murtuja Khokhar814
  Mohammed Taj704
  Jayanta Sur479
  positive fanatic416
  Vigyan Kaushik386
  Gitesh Trivedi322
  Gopu Gopi242
  neeraj sharma231
  Ramesh Jois226
  Bishal Khetan196






oracle Mag



  About Us Advertise Terms of Use Privacy Newsletters Contact Us    

Home   Discussion Forum   FAQs  Articles  Jobs   Newsletters  Directory  Downloads 

Our Premium Sponsor
Confio Software