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

Thread: USER OBJECTS

  1. #1
    Join Date
    Mar 2001
    Posts
    131

    Question

    Hi,

    I have hundreads of users crated in the database, are not active (locked) and want to drop all those users. My question is,

    1). What query i should write so it will get output as bleow username, status (locked) and objects, subobjects of those users.

    Thanks in advance.

    Upesh

  2. #2
    Join Date
    Jul 2002
    Location
    California
    Posts
    128
    Upeshp,

    Use the view DBA_OBJECTS. It contains:

    Name Null? Type
    ----------------------------------------- -------- ----------------------------
    OWNER VARCHAR2(30)
    OBJECT_NAME VARCHAR2(128)
    SUBOBJECT_NAME VARCHAR2(30)
    OBJECT_ID NUMBER
    DATA_OBJECT_ID NUMBER
    OBJECT_TYPE VARCHAR2(18)
    CREATED DATE
    LAST_DDL_TIME DATE
    TIMESTAMP VARCHAR2(19)
    STATUS VARCHAR2(7)
    TEMPORARY VARCHAR2(1)
    GENERATED VARCHAR2(1)
    SECONDARY VARCHAR2(1)



  3. #3
    Join Date
    May 2002
    Posts
    2,645
    Create a spool file to capture the SQL statements created by the following SQL statement:

    select 'drop user '||username||' cascade;' from dba_users
    where account_status != 'OPEN';

    or

    select 'drop user '||username||' cascade;' from dba_users
    where account_status = 'LOCKED';


    [Edited by stecal on 07-11-2002 at 12:37 PM]

  4. #4
    Join Date
    Mar 2001
    Posts
    131
    Thanks for reply,

    I think both of you did not understand my question,

    I already have list of Locked users from dba_objects but now i want their object names and sub object names. Meaning Locked users' object name.

    Please can anyone give me query for the same.


  5. #5
    Join Date
    May 2002
    Posts
    2,645
    If you are dropping the users, why do you care what their objects were?

    "I have hundreads of users crated in the database, are not active (locked) and want to drop all those users."

    select username, object_name from dba_objects a, dba_users b where b.account_status = 'LOCKED'
    and a.owner=b.username
    order by b.username;


  6. #6
    Join Date
    Mar 2001
    Posts
    131
    Thanks stecal for prompt reply.


    My developer wants to make sure that there should not be any object which is in use now. B'cos in the list of LOCKED users, there are some earlier DBAs also who worked and their objects might be in use by application.

    Again Thanks,

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