in

InfoPath Dev

How To Repair Xref tables in DBXL

Downloads: 62 File Size: 79.5kB
Posted By: ErnestoM Views: 89
Date Added: 07-11-2008

An irreconcilable Xref error will typically resemble the following:

Event Type:         Error
Event Source:     Database Accelerator
Event Category: None
Event ID:              0
Date:                    9/6/2007
Time:                    12:15:54 AM
User:                    N/A
Computer:           AUTONOMY4
Description:
Caught exception deleting an item from the target database encountered a critical error and needs attention:

System.Data.SqlClient.SqlException: Invalid object name 'WorkBlock'.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at Qdabra.Dbxl.Domain.XRefItem.DeleteTargetDBItem(SqlTransaction sqlTrans) in C:\Documents and Settings\v-mattf\Desktop\TFS Root\Cadabra\Infomentum\src\AutonomySystems\Infomentum\Domain\XRefItem.cs:line 219

The stack trace was:    at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at Qdabra.Dbxl.Domain.XRefItem.DeleteTargetDBItem(SqlTransaction sqlTrans) in C:\Documents and Settings\v-mattf\Desktop\TFS Root\Cadabra\Infomentum\src\AutonomySystems\Infomentum\Domain\XRefItem.cs:line 219.

This means that, somehow, the database has become corrupted. Follow these steps to repair the shredding info maintained by DBXL.

1. Turn off shredding. The simplest way of accomplishing this is to remove the connection string.
2. Delete shredded records from your tables.
3. Purge XRef tables using the following script:

USE QdabraDBXL
GO

BEGIN TRANSACTION CleanupXrefs
GO

-- Delete all xref keys for charge sheets
DELETE
FROM XRefKeys
WHERE ItemID IN (
      SELECT ItemID
      FROM XRefItems
      WHERE DocID IN (
            SELECT DocID
            FROM Document d
                  JOIN DocumentType dt ON dt.ID = d.Type
            WHERE dt.Name = 'ChargeSheets'
      )
)
GO

-- Delete all xref items for charge sheets
DELETE
FROM XRefItems
WHERE DocID IN (
      SELECT DocID
      FROM Document d
            JOIN DocumentType dt ON dt.ID = d.Type
      WHERE dt.Name = 'ChargeSheets'
)
GO

COMMIT TRANSACTION CleanupXrefs
GO

-- Verify all Xref entries were deleted for chargesheets
SELECT TOP 10 COUNT(*) As XRefRowCount, XRefItems.DocID
FROM XRefItems
      JOIN Document ON Document.DocID = XRefItems.DocID
      JOIN DocumentType ON DocumentType.ID = Document.Type
WHERE DocumentType.Name = 'ChargeSheets'
GROUP BY XRefItems.DocID
ORDER BY XRefRowCount DESC
GO

4. Turn shredding back on by re-adding the connection string back in DAT.
5. In DAT, reshred all documents.
6. Perform a quick check of Xref counts

USE QdabraDBXL
GO

-- Verify all Xref entries were deleted for chargesheets
SELECT TOP 10 COUNT(*) As XRefRowCount, XRefItems.DocID
FROM XRefItems
      JOIN Document ON Document.DocID = XRefItems.DocID
      JOIN DocumentType ON DocumentType.ID = Document.Type
WHERE DocumentType.Name = 'ChargeSheets'
GROUP BY XRefItems.DocID
ORDER BY XRefRowCount DESC
GO

Filed under: ,

Comments

No comments exist for this file.
Copyright © 2003-2007 Qdabra Software. All rights reserved.
View our Terms of Use.