Wednesday, 18 September 2019

Drop user ddl

connect / as sysdba
set time on  timing on  echo on pagesize 200 linesize 200 feed on
show user
select to_char(sysdate, 'YYYYMMDD HH24:MI:SS') from dual;
select name from v$database;

select object_type, count(1) from dba_objects where owner = 'ODSADMIN' group by object_type order by 1;

select 'drop table '||owner||'.'||table_name||' cascade constraints purge;'
from dba_tables
where owner = 'SADMIN'
union all
select 'drop '||object_type||' '||owner||'.'||object_name||';'
from dba_objects
where object_type not in ('TABLE','INDEX','PACKAGE BODY','TRIGGER','LOB')
and object_type not like '%LINK%'
and object_type not like '%PARTITION%'
and owner = 'SADMIN'
order by 1;

quit;

No comments:

Post a Comment

Featured post

duplicate db from standy to other server

 Duplicate Testuat   $ export ORACLE_SID=Testuat3 $ sqlplus '/as sysdba' Testuat3 SQL> alter system set cluster_database=FALSE sc...