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:
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.
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.
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.