quarta-feira, dezembro 29, 2004

Alterações no Sybase 12. ASE 12, para Evitar DeadLock

A configuração de Lock é por tabela. Com sp_configure, você pode aliterar o tipo de Lock default para todas as tabelas, ou seja, as novas tabelas serão criadas com o novo lock configurado, mais as existentes não são alteradas. Sintax: sp_configure "lock scheme", 0,{allpages datapages datarows} Exemplo: sp_configure "lock scheme", 0,datarows Para alterar o tipo do lock das tabelas existentes, você tem que utilizar o comando alter table, como no exemplo abaixo: alter table titles lock datarows Antes de fazer está alteração, devem ser tomados os seguintes cuidados.
Before you change from allpages locking to data-only locking or vice versa, the following steps are recommended:
Specifying the locking scheme for a table
If the table is partitioned, and update statistics has not been run since major data modifications to the table, run update statistics on the table that you plan to alter. alter table...lock performs better with accurate statistics for partitioned tables.
Changing the locking scheme does not affect the distribution of data on partitions; rows in partition 1 are copied to partition 1 in the copy of the table.
Perform a database dump.
Set any space management properties that should be applied to the copy of the table or its rebuilt indexes.
Determine if there is enough space.
If any of the tables in the database are partitioned and require a parallel sort:
Use sp_dboption to set the database option select into/bulkcopy/pllsortto true and run checkpoint in the database.
Set your configuration for optimum parallel sort performance.
After alter table completes
Run dbcc checktable on the table and dbcc checkalloc on the database to insure database consistency.
Perform a database dump.Note After you have changed the locking scheme from allpages locking to data-only locking or vice versa, you cannot use the dump transaction to back up the transaction log. You must first perform a full database dump.
Quando uma certa quantidade de registros são bloqueados, o SGBD promove o lock para um lock de tabela. Este parâmetro pode ser configurado através do comando sp_setrowlockpromote e pode ser configurado para o Servidor e/ou Banco de Dados e/ou tabela. Abaixo está um exemplo desse comando: sp_setrowlockpromote "server", null, 300, 500, 50 Mais informações podem ser obtidas no documento em anexo, nas páginas: 36 : Sugestão para evitar Locks 48 : Promoção de Lock´s 63 : Informações importantes antes e depois de mudar o tipo do lock 86 : Evitando DeadLocks


Para resolvermos o problema da FRG, teríamos que altera o tipo de lock defaul das tabelas, para que as novas tabelas já sejam criadas corretamente e alterar as tabelas existentes. Este processo deve ser executado com cuidado e deve consumir algum tempo, por isso é recomendado seguir as observações acima e executa-lo fora do horário de trabalho.

Nenhum comentário: