Compartilhando conhecimento com o mundo

Com tecnologia do Blogger.

Pesquisa

Download

Blogger Tricks

Blogger Themes

Visitas

Assuntos

1/27/2014

Sistema Travado - Tabela em Lock - Informix


Os usuários começaram a reclamar dizendo que o sistema estava travado, para descobrir não tem outro jeito tem que sair procurando pra ver o que esta acontecendo;

Primeiro vou checar a performance - ok normal;
[s275:informix]$/export/home/informix> sar 1 5
Linux 2.6.18-128.1.10.el5 (s105.fazenda.ms)     05/12/2011

12:15:22 PM       CPU     %user     %nice   %system   %iowait    %steal     %idle
12:15:23 PM       all     16.88      0.00      7.50      8.38      0.00     67.25
12:15:24 PM       all     12.98      0.00      7.24      5.62      0.00     74.16
12:15:25 PM       all     14.86      0.00      7.49     10.74      0.00     66.92
12:15:26 PM       all     12.86      0.00      8.49      6.74      0.00     71.91
12:15:27 PM       all     14.75      0.00      8.25     10.75      0.00     66.25
Average:          all     14.46      0.00      7.79      8.44      0.00     69.30
Checando as mensagens de log (onstat -m) e não tinha nenhuma mensagem estranha - ok normal;
[s275:informix]$/export/home/informix> onstat -m

IBM Informix Dynamic Server Version 11.70.FC2 -- On-Line -- Up 59 days 21:28:28 -- 1575104 Kbytes

Message Log File: /export/home/informix/online.log

01/27/12 12:00:02  Attempting to free unused operating system segments.  This
operation may take several minutes.
01/27/12 12:15:01  Attempting to free unused operating system segments.  This
operation may take several minutes.
01/27/12 12:30:01  Attempting to free unused operating system segments.  This
operation may take several minutes.
01/27/12 12:45:02  Attempting to free unused operating system segments.  This
operation may take several minutes.
01/27/12 13:00:01  Attempting to free unused operating system segments.  This
operation may take several minutes.
01/27/12 13:15:02  Attempting to free unused operating system segments.  This
operation may take several minutes.
Checando as logical logs - ok normal;
[s275:informix]$/export/home/informix> onstat -l

IBM Informix Dynamic Server Version 11.70.FC2 -- On-Line -- Up 59 days 21:50:45 -- 1575104 Kbytes

Physical Logging
Buffer bufused  bufsize  numpages   numwrits   pages/io
  P-1  60       64       2813842    44025      63.91
      phybegin         physize    phypos     phyused    %used   
      1:263            524288     419611     7900       1.51    

Logical Logging
Buffer bufused  bufsize  numrecs    numpages   numwrits   recs/pages pages/io
  L-3  0        64       21847576   2295707    1206287    9.5        1.9     
        Subsystem    numrecs    Log Space used
        OLDRSAM      21847540   2995372876    
        HA           36         1584          

address          number   flags    uniqid   begin                size     used    %used
4f126fa8         3        U-B----  349      1:555271            15360    15360   100.00
4f275f50         9        U-B----  350      6:53                51200    51200   100.00
4f275fb8         10       U-B----  351      6:51253             51200    51200   100.00
4f127838         11       U-B----  352      6:102453            51200    51200   100.00
4f1278a0         1        U-B----  353      1:570631            33280    33280   100.00
4f127908         2        U-B----  354      1:603911            33280    33280   100.00
4f127970         4        U-B----  355      1:654905            33280    33280   100.00
4f1279d8         12       U-B----  356      6:153653            51200    51200   100.00
4f127a40         13       U-B----  357      6:204853            51200    51200   100.00
4f127aa8         14       U-B----  358      6:256053            51200    51200   100.00
4f127b10         15       U-B----  359      6:307253            51200    51200   100.00
4f127b78         16       U-B----  360      6:358453            51200    51200   100.00
4f127be0         17       U-B---L  361      6:409653            51200    51200   100.00
4f127c48         18       U---C--  362      6:460853            51200    11239    21.95
 14 active, 14 total
Criei um script em shell para descobrir se tem alguma tabela em lock;
-------------------------------------------------------------------------------------------------
27/01/2012                      ***** INFORMIX BASIC SERVICES *****                      12:15:59
-------------------------------------------------------------------------------------------------


        Code  Function                                    
        ----  ------------------------------------------- 
         1    Tabelas em Lock - Simples                   
         2    Tabelas em Lock - Completo                  
         3    Tabelas em Lock - Resumido                  
         4    Tabelas em Lock - Banco                     
         5    Tabelas em Lock - Banco e Usuario           
         6    Usuarios com Maiores Locks                  
         0    Sair da Aplicacao                           
        ----  ------------------------------------------- 

     Digite um Codigo - 
Usando a opção 1 - Tabelas em Lock - Aparece 5 processos com lock - 4 com o mesmo processo 2368206;
-------------------------------------------------------------------------------------------------
27/02/2012                      ***** INFORMIX BASIC SERVICES *****                      12:16:38
-------------------------------------------------------------------------------------------------


dbsname    publicacao
tabname    ultima_notific_tra
type       IX
owner      2368206
ownername  emorisantos
waitname   mjesus

dbsname    publicacao
tabname    pacote
type       X
owner      2368206
ownername  emorisantos
waitname   emorisantos

dbsname    publicacao
tabname    ultimo_tvf
type       X
owner      2378509
ownername  emorisantos
waitname   wdias

dbsname    publicacao
tabname     167_455
type       X
owner      2368206
ownername  emorisantos
waitname   emorisantos

dbsname    publicacao
tabname    pendencia_nf
type       X
owner      2368206
ownername  emorisantos
waitname   emorisantos

Pressione qualquer tecla para continuar...
Só para ter certeza vou tentar dar acessar a tabela (pacote) ela em lock por muito tempo ninguém consegue fazer nada;
[s275:informix]$/export/home/informix> echo "select count(*) from  pacote          ; " | dbaccess publicacao ;

Database selected.

      (count(*))

  252: Cannot get system information for table.

  113: ISAM error:  the file is locked.
Error in line 1
Near character position 31

Database closed.
Matando o processo 2368206 (que tem mais processo preso);
[s275:informix]$/export/home/informix> onmode -z 2368206
Checando para ver se tem algum processo preso - não tem - conversando com o usuário o sistema agora esta ok;
-------------------------------------------------------------------------------------------------
27/02/2012                      ***** INFORMIX BASIC SERVICES *****                      12:16:38
-------------------------------------------------------------------------------------------------


               +-----------------------------------------------------------------+
               |                                                                 |
               |                   NAO TEM TABELA PRESA NO BANCO                 |
               |                                                                 |
               +-----------------------------------------------------------------+


Pressione qualquer tecla para continuar...
Script completo para descobrir quem esta dando lock em uma tabela - Clique Aqui

1 comentário:

  1. Olá, muito legal o artigo! Tentei usar o script e está dando o erro abaixo! Meu OS é Linux Suse 11


    : command not foundine 7:
    '/teste.lock.txt: line 34: syntax error near unexpected token `in
    '/teste.lock.txt: line 34: `case $OPCAO3 in

    ResponderEliminar