数据库

批量删除用户的所有表、视图、sequence
select 'drop table ' || table_name ||'cascade constraints;'||chr(13)||chr(10) from user_tables; --delete tables 
select 'drop view ' || view_name||' cascade constraints;'||chr(13)||chr(10) from user_views; --delete views 
select 'drop sequence ' || sequence_name||' cascade constraints;'||chr(13)||chr(10) from user_sequences;--delete seqs 
select 'drop function ' || object_name||' cascade constraints;'||chr(13)||chr(10) from user_objects where object_type='FUNCTION';--delete functions 
select 'drop procedure ' || object_name||' cascade constraints;'||chr(13)||chr(10) from user_objects where object_type='PROCEDURE';--DELETE PROCEDURE 
select 'drop package ' || object_name||' cascade constraints;'||chr(13)||chr(10) from user_objects where object_type='PACKAGE';--delete pags


oracle死锁解锁


登陆plsql,打开SQL_windows 运行 select * from v$locked_object

查询出的结果为,所有此用户表的死锁的会话,记录session_id。

Tools →Sessions 打开Sessions窗口

查询出的session_id对应Sessions窗口里的Sid,在Status 列 右键

Kill,杀掉所有select * from v$locked_object查询出的session_id 直到

select * from v$locked_object查询结果为空,死锁问题解决!!!!!


SEQUENCE

DROP SEQUENCE SEQ_USERGROUP;
DROP SEQUENCE SEQ_ACT;

create sequence SEQ_USERGROUP
minvalue 1
maxvalue 999999999999999999999999999
start with 2030
increment by 1
cache 20;





create sequence SEQ_ACT
minvalue 1
maxvalue 999999999999999999999999999
start with 2030
increment by 1
cache 20;

你可能感兴趣的:(数据库)