Created
December 9, 2019 14:10
-
-
Save BrunoCaimar/1001c6e8f533a365228e923d3d81a7d6 to your computer and use it in GitHub Desktop.
SDE limpa_conexoes_nao_ativas.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select USERNAME, MACHINE, OSUSER, PROGRAM from v$session where audsid | |
in (select audsid from SDE.PROCESS_INFORMATION); | |
-- Identifica os usuários que estão na process information e não possuem conexão ativa no oracle | |
select * from sde.process_information | |
where audsid not in (select audsid from v$session); | |
-- Limpa as conexões orfãs | |
delete from sde.process_information | |
where audsid not in (select audsid from v$session); | |
-- Limpa as conexões orfãs da LAYER_LOCKS | |
delete from sde.LAYER_LOCKS | |
where sde_id not in (select sde_id from sde.process_information); | |
-- Limpa as conexões orfãs da OBJECT_LOCKS | |
delete from sde.OBJECT_LOCKS | |
where sde_id not in (select sde_id from sde.process_information); | |
-- Limpa as conexões orfãs da STATE_LOCKS | |
delete from sde.STATE_LOCKS | |
where sde_id not in (select sde_id from sde.process_information); | |
-- Limpa as conexões orfãs da TABLE_LOCKS | |
delete from sde.TABLE_LOCKS | |
where sde_id not in (select sde_id from sde.process_information); | |
commit; | |
/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment