Monday, 15 March 2010

Why does deleted data persist in SQL Server backup file? -


I want to back up my SQL server database so that I can send it to my vendor to help with diagnosis. However, I do not want to include data from tables with customer information.

Here's what I tried: Copy the database, delete all the tables with customer notifications, then take a backup result.

However, when I see a backup in the text editor, I see many private data sitting in the backup file. Any ideas why?

When you delete data in a SQL Server database, it marks pages as SQL Server Is free, but does not overwrite the data, such that any modern file system does not actually remove files, but instead replaces disc blocks as free.

I will try the following to clean my database:

  1. Rebuild all possible indices and piles (do not rebuild, restructuring)
  2. Repeat each data file with the restructuring of pages at the minimum possible size
  3. Repeat 2
  4. Perform a checkpoint
  5. Separate and rename the logfile
  6. Rebuild the database to a new empty log file
  7. To make sure
  8. Backup

    To ensure this now DBCC CHECKDB Run is a very destructive process, so make sure that never you want to use a database yourself, but it should remove all deleted data.

    It is necessary to rebuild the indexes, because otherwise any deleted row can survive between non-deleted lines within a single page. Reorganization and shrinkage remove unused pages, though sometimes it is not completely clean, so you need to repeat steps 2 and 3. 4, 5 and 6 make sure that there is no trace of the data present in the log file based on your recovery model, still the deleted data is potentially included multiple times.

No comments:

Post a Comment