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

Thread: schema clean up

  1. #1
    Join Date
    Oct 2003
    Posts
    27

    schema clean up

    I want to find out what objects have been created in a schema and drop all the objects. How to do that, assuming that I cannot delete the user?

  2. #2
    Join Date
    Sep 2002
    Location
    England
    Posts
    7,334
    select object_name, object_type from user_objects

    then something like

    spool drop.sql

    select 'drop ' ||object_type|| ' '||object_name|| ';' from user_object where object_type in ('VIEW','TABLE','TRIGGER','PACKAGE','PACKAGE BODY','SEQUENCE','PROCEDURE');

    My syntax is probably wrong and I have probbaly missed out object type, but you get the idea
    Last edited by davey23uk; 11-19-2003 at 06:59 PM.

  3. #3
    Join Date
    Jun 2000
    Posts
    295
    write your owner script. Something like:

    spool drop_all_object.sql

    select 'drop ' || object_type
    || ' &&owner..' ||object_name
    || decode(object_type, 'TABLE', ' CASCADE constraint') ||';'
    from dba_objects where owner = '&&owner'
    /

    spool off
    @drop_all_object.sql

  4. #4
    Join Date
    Sep 2002
    Location
    England
    Posts
    7,334
    chances are if he cannot drop a user, he wont have access to the dba_* views

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