quarta-feira, 3 de outubro de 2007

Oracle - Limpeza da Tablespace Temptabs

Execute no SQLPLUS com usuário LOGIX:

SET pagesize 0

SET feedback OFF

spool E:\Documentos\Logix\Oracle\tt-prd.sql

select 'drop table '||ttr_realname||';'

from temptabreg where ttr_session not in (select audsid from v$session)

union all

select 'drop table '||table_name||';'

from user_tables where tablespace_name = 'TEMPTABS'

and table_name not in (select ttr_realname from temptabreg);

spool OFF

SET pagesize 20

SET feedback ON

O comando anterior gera um script (no dir. corrente) chamado tt.sql.

Execute no SQLPLUS com usuário LOGIX:

delete from temptabreg

where trim(upper(ttr_realname)) not in (select table_name from user_tables);

commit;

Nenhum comentário: