oracle删除用户和表空间

查询用户的相关信息:
select * from DBA_USERS;

删除用户:
drop user PRECISE_CLIENT cascade;

删除表空间和它的系统文件:
drop tablespace PRECISE_CLIENT including contents and datafiles;

如果发现不能删除用户,应该是用户还有连接,查询用户的连接:
select username,sid,serial# from v$session where username=’ PRECISE_CLIENT’;

查询出他的sid,serial#,然后杀掉:
alter system kill session ‘1505,81’;

再次查询,可以查询它的状态:
select saddr,sid,serial#,paddr,username,status from v$session where username=’ PRECISE_CLIENT’ ;
发现他的状态为KILLD时,已经杀掉,再次执行删除用户即可;

删除用户,再删除表空间,必须保证表空间没有用户使用才能删除!

你可能感兴趣的:(oracle)