Tuesday, 24 June 2014

Which User is Locking the table

SELECT c.owner,
       c.object_name,
       c.object_type,
       fu.user_name locking_fnd_user_name,
       fl.start_time locking_fnd_user_login_time,
       vs.module,
       vs.machine,
       vs.osuser,
       vlocked.oracle_username,
       vs.sid,
       vp.pid,
       vp.spid AS os_process,
       vs.serial#,
       vs.status,
       vs.saddr,
       vs.audsid,
       vs.process
FROM fnd_logins fl,
     fnd_user fu,
     v$locked_object vlocked,
     v$process vp,
     v$session vs,
     dba_objects c
WHERE     vs.sid = vlocked.session_id
      AND vlocked.object_id = c.object_id
      AND vs.paddr = vp.addr
      AND vp.spid = fl.process_spid(+)
      AND vp.pid = fl.pid(+)
      AND fl.user_id = fu.user_id(+)
      AND c.object_name LIKE '%' || UPPER ('&tabname_blank4all') || '%'
      AND NVL (vs.status, 'XX') != 'KILLED';

2 comments:

  1. virtualnuggets offering oracle dba online training
    ,corporate training services.
    We can use following commands to manage users:
    Views:
    Sql>desc dba_users;
    Sql>select username, account_status from dba_users;
    To create user:
    Create user username identified by password; “or”
    Grant connect to username identified by password;
    Grant permissions:
    Without connect and resource user cannot connect to the database:--
    Sql>grant connect, resource to u1;
    To create a user with default permanent and temporary tablespaces:
    Create user username identified by password default tablespace tablespacename temporary tablespac temporarytablespacename;
    select default_tablespace, temporary_tablespace from dba_users where username='username’;

    ReplyDelete
  2. virtualnuggets offering oracle dba online training,corporate training services.

    We can use following commands to manage users:

    To lock and unlock user account:

    Alter user username account lock;
    Alter user username account unlock;

    To expire the password of a user;
    Alter user username password expire;

    To drop user account:
    Drop user username;
    Drop user username cascade;

    ReplyDelete