--删除用户
Alter user xxx account lock ;
Shutdown immediate ;
Startup ;
Drop user xxx cascade ;
Drop tablespace xxx including including contents and datafiles CASCADE CONSTRAINTS;
--删除用户下所有对象
prompt --删除约束条件
select 'alter table '||table_name||' drop constraint '||constraint_name||' ;'
from user_constraints where constraint_type='R';
prompt --删除表
select 'drop table '||table_name ||';' from user_tables;
prompt --删除视图
select 'drop view ' ||view_name||';' from user_views;
prompt --删除序列
select 'drop sequence ' ||sequence_name||';' from user_sequences;
prompt --删除函数
select 'drop function ' ||object_name||';' from user_objects
where object_type='FUNCTION';
prompt --删除存储过程
select 'drop procedure '||object_name||';' from user_objects
where object_type='PROCEDURE';
prompt --删除包
prompt --删除包内容
select 'drop package '|| object_name||';' from user_objects
where object_type='PACKAGE';
prompt --删除数据库链接
select 'drop database link '|| object_name||';' from user_objects
where object_type='DATABASE LINK';
prompt --删除隐藏对象
select 'drop synonym '|| object_name||';' from user_objects where object_type='SYNONYM';
prompt --删除物化视图
select 'drop materialized view '|| object_name||';' from user_objects where object_type='MATERIALIZED VIEW';
Oracle之删除用户-删除用户下所有对象
最新推荐文章于 2021-12-13 15:55:44 发布