REPARANDO BANCO DE DADOS COM TABELA CORROMPIDA

Neste post vou demonstrar como reparar um banco de dados com tabela corrompida.

1 – Primeiramente executaremos o comando DBCC CHECKDB (‘BizTalkDTADb’) WITH ALL_ERRORMSGS.

DBCC results for ‘BizTalkDTADb’.
Service Broker Msg 9675, State 1: Message Types analyzed: 14.
Service Broker Msg 9676, State 1: Service Contracts analyzed: 6.
Service Broker Msg 9667, State 1: Services analyzed: 3.
Service Broker Msg 9668, State 1: Service Queues analyzed: 3.
Service Broker Msg 9669, State 1: Conversation Endpoints analyzed: 0.
Service Broker Msg 9674, State 1: Conversation Groups analyzed: 0.
Service Broker Msg 9670, State 1: Remote Service Bindings analyzed: 0.
Service Broker Msg 9605, State 1: Conversation Priorities analyzed: 0.
DBCC results for ‘sys.sysrscols’.
There are 1573 rows in 19 pages for object “sys.sysrscols”.
DBCC results for ‘sys.sysrowsets’.
There are 261 rows in 4 pages for object “sys.sysrowsets”.

There are 3 rows in 1 pages for object “dta_ServiceState”.
Msg 8978, Level 16, State 1, Line 1
Table error: Object ID 469576711, index ID 1, partition ID 72057595638775808, alloc unit ID 72057595657977856 (type In-row data). Page (1:735693) is missing a reference from previous page (1:780581). Possible chain linkage problem.
Msg 8978, Level 16, State 1, Line 1
Table error: Object ID 469576711, index ID 1, partition ID 72057595638775808, alloc unit ID 72057595657977856 (type In-row data). Page (1:735987) is missing a reference from previous page (1:797797). Possible chain linkage problem.
Msg 8939, Level 16, State 98, Line 1
Table error: Object ID 469576711, index ID 1, partition ID 72057595638775808, alloc unit ID 72057595657977856 (type In-row data), page (1:737741). Test (IS_OFF (BUF_IOERR, pBUF->bstat)) failed. Values are 133129 and -6.
Msg 8928, Level 16, State 1, Line 1
Object ID 469576711, index ID 1, partition ID 72057595638775808, alloc unit ID 72057595657977856 (type In-row data): Page (1:737741) could not be processed. See other errors for details.
Msg 8939, Level 16, State 98, Line 1
Table error: Object ID 469576711, index ID 1, partition ID 72057595638775808, alloc unit ID 72057595657977856 (type In-row data), page (1:738831). Test (IS_OFF (BUF_IOERR, pBUF->bstat)) failed. Values are 133129 and -6.
Msg 8928, Level 16, State 1, Line 1
Object ID 469576711, index ID 1, partition ID 72057595638775808, alloc unit ID 72057595657977856 (type In-row data): Page (1:738831) could not be processed. See other errors for details.
Msg 8939, Level 16, State 98, Line 1
Table error: Object ID 469576711, index ID 1, partition ID 72057595638775808, alloc unit ID 72057595657977856 (type In-row data), page (1:740654). Test (IS_OFF (BUF_IOERR, pBUF->bstat)) failed. Values are 133129 and -4.
Msg 8928, Level 16, State 1, Line 1
Object ID 469576711, index ID 1, partition ID 72057595638775808, alloc unit ID 72057595657977856 (type In-row data): Page (1:740654) could not be processed. See other errors for details.
Msg 8976, Level 16, State 1, Line 1
Table error: Object ID 469576711, index ID 1, partition ID 72057595638775808, alloc unit ID 72057595657977856 (type In-row data). Page (1:738831) was not seen in the scan although its parent (1:779016) and previous (1:847346) refer to it. Check any previous errors.
Msg 8978, Level 16, State 1, Line 1
Table error: Object ID 469576711, index ID 1, partition ID 72057595638775808, alloc unit ID 72057595657977856 (type In-row data). Page (1:739486) is missing a reference from previous page (1:865528). Possible chain linkage problem.
Msg 8978, Level 16, State 1, Line 1
Table error: Object ID 469576711, index ID 1, partition ID 72057595638775808, alloc unit ID 72057595657977856 (type In-row data). Page (1:745241) is missing a reference from previous page (1:830415). Possible chain linkage problem.
Msg 8976, Level 16, State 1, Line 1
Table error: Object ID 469576711, index ID 1, partition ID 72057595638775808, alloc unit ID 72057595657977856 (type In-row data). Page (1:745626) was not seen in the scan although its parent (1:734204) and previous (1:745625) refer to it. Check any previous errors.
Msg 8976, Level 16, State 1, Line 1


CHECKDB found 0 allocation errors and 2370 consistency errors in table ‘Tracking_Parts1’ (object ID 2117582582).
DBCC results for ‘Tracking_Spool2’.
There are 0 rows in 0 pages for object “Tracking_Spool2”.
CHECKDB found 0 allocation errors and 2917 consistency errors in database ‘BizTalkDTADb’.
repair_allow_data_loss is the minimum repair level for the errors found by DBCC CHECKDB (BizTalkDTADb).
DBCC execution completed. If DBCC printed error messages, contact your system administrator.

2 – Após a execução vamos alterar o banco de dados SINGLE_USER executando o comando ALTER DATABASE BizTalkDTADb SET SINGLE_USER WITH ROLLBACK IMMEDIATE.

1

3 – Executaremos o comando DBCC CheckDB (‘BizTalkDTADb’, REPAIR_ALLOW_DATA_LOSS) WITH ALL_ERRORMSGS para reparação do banco de dados.

1

4 – Executaremos o comando ALTER DATABASE BizTalkDTADb SET MULTI_USER para voltar a base de dados para multiusuário.

5 – Após a reparação vamos fazer uma checagem para ver se o banco de dados voltou a sua integridade.

Executar novamente o comando: DBCC CHECKDB (‘BizTalkDTADb’) WITH ALL_ERRORMSGS

1

Podemos observar que após os procediementos o banco de dados voltou a sua integridade.

Até mais!!!!

Anúncios