Labels

Wednesday, February 3, 2010

Dropping user

--check the username,machine which are currently active
select username,machine,program,status from v$session where status='ACTIVE';
--Drop the user
SQL>DROP USER PCPCC_O_0302 CASCADE;

--If it gives the below error

SQL>;DROP USER PCPCC_O_0302 CASCADE;

DROP USER PCPCC_O_0302 CASCADE;
*
ERROR at line 1:
ORA-01940: cannot drop a user that is currently connected
--check the user which session id is active
SQL>select s.sid, s.serial#, s.status, p.spid  from v$session s, v$process p  where s.username = 'PCPCC_O_0302' and p.addr (+) = s.paddr ;
/
SID SERIAL# STATUS SPID
---------- ---------- -------- ------------
276 8395 INACTIVE 7088
314 10521 INACTIVE 7114

SQL>alter system kill session '276,8395';
SQL>alter system kill session '314,10521';

No comments:

Post a Comment