DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: show sql script of a existing object...

  1. #1
    Join Date
    Jan 2003
    Posts
    9

    show sql script of a existing object...

    Hi..

    There are many objects in the dba_objects, like table, trigger, index...

    How can I view the createing sql script of each object by using oracle command ??

    for example:

    table XXX

    show==> create table XXX
    ( id number NOT NULL,
    name varchar2(10) NOT NULL);

  2. #2
    Join Date
    Aug 2002
    Location
    Atlanta
    Posts
    1,187
    9i?

    use dbms_metadata

    EXAMPLE....

    SQL> create table t1 (empid NUMBER, ename VARCHAR2(20));

    Table created.

    SQL> SET LONG 9999

    SQL> select dbms_metadata.get_ddl('TABLE','T1') from dual;


    DBMS_METADATA.GET_DDL('TABLE','T1')
    --------------------------------------------------------------------------------


    CREATE TABLE "SYS"."T1"
    ( "EMPID" NUMBER,
    "ENAME" VARCHAR2(20)
    ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 LOGGING
    STORAGE(INITIAL 16384 NEXT 16384 MINEXTENTS 1 MAXEXTENTS 505 PCTINCREASE 50
    FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "SYSTEM"
    I'm stmontgo and I approve of this message

  3. #3
    Join Date
    Jan 2001
    Posts
    2,828
    Hi

    Before 9i you can use export import utilites...first export the user with rows=N option and then import it with indexfile=my-ddl.sql..this file would contain the ddl for your user..

    regards
    Hrishy

  4. #4
    Join Date
    Dec 2002
    Location
    Bangalore ( India )
    Posts
    2,434
    Use TOAD s/w(exe)....may it be 9i or previous versions......

    It will build the creating script 4 u.


    Abhay.
    funky...

    "I Dont Want To Follow A Path, I would Rather Go Where There Is No Path And Leave A Trail."

    "Ego is the worst thing many have, try to overcome it & you will be the best, if not good, person on this earth"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width