Loading


Add to Google

Tuesday, December 13, 2011

Compact Database Corruption in MS SQL Server

The concept of Database corruption still remains obscure in the minds of many database users and the very idea to deal with it would go in vain, if you do not plan out a perfect strategy at the right time. Most often, SQL database users come across compact database corruption and in majority of cases, the real culprit is not the database itself. 


The procedure described below shows how a page is read from the disk:

1. Initially, read the page from the disk. 

2. Now decrypt the page.

3. Calculate the checksum and verify with the expected value.

4. Determine whether it is the same page, which was expected as per the system pages. 

If steps ‘3’ and ‘4’ fail, you may receive the following errors on your screen: 

“Bad Checksum - idPage: %d, tyPage: %d, iPage: %d”

Or

“Page with valid ordinal not found - idPage: %d, iPage: %d”

 These errors indicate slight corruption in your database. Here are some possible reasons that could have triggered this corruption: 
·      
Improper shutting down of a device or you might have suspended a device and then resumed the operation. 
·      
If there are bugs in the underlying FAT/TFAT file system, you are very likely to face Compact file corruption. Even if you are using SD file for database storage, you may experience a similar thing. 

·       Moreover, SD cards might cause a number of problems during the Suspend/Resume cycles.  

However, it would be wrong to infer that Compact code bugs do not cause corruption. These bugs are more logical in nature. But, it would be right to say that they don't lead to physical corruptions, such as “checksum errors” or “page missing” errors. 

Indeed, compact implements a shadow paging mechanism to prevent corruption. When the Compact is performing a write operation to a file and you reboot the computer, it first writes the shadows of the original user data pages to the disk and then overwrites them with the shadows of the updated system pages. In this manner, the Compact performs a safe transaction write to the disk. Here, the changes are either completely reflected or not.    



About Author: Addision Philip is a technical writer and has written several articles on sql disaster recovery. You can see the articles from sql-server-recovery.blogspot.com.





Enhanced by Zemanta

Here Are Some of My Most Popular Posts Since Day One.

If you like my blog Please Subscribes to my RSS Feed for updates and more

Rydertech

↑ Grab this Headline Animator


Subscribe via email

Enter your email address:

Delivered by FeedBurner
Your Email Will never be shared or Made Public

Related Posts Plugin for WordPress, Blogger...