Question : SQL2005 lost 5000 records ? Possible to recover (file to download)

Hello,

I have a customer who has lost about 5000 records (not by a human error) in the database werkbon table werkbon.

In table werkbon the lost records are from
werkbonid : 9203 22/12/2008  to werkbonid : 14006 14/08/2009

http://rapidshare.com/files/329197319/backup_20091229.zip

I have tried already six different programs to recover the records, but no program does find the lost records.
The file is with the SQL2005 database and the complete LDF-file.

Thanks in advance

Johan Pyfferoen
Belgium

Answer : SQL2005 lost 5000 records ? Possible to recover (file to download)

Alright, so you have to restore that and then apply the log backup that you just took today while chatting with me..

-- restore the full
-- no recovery specified

RESTORE DATABASE [test1] FROM  
DISK = N'C:\Documents and settings\mike.walsh\desktop\backupEeklo20081112'
WITH  FILE = 1,  
MOVE N'werkbon_Data'
TO N'C:\Documents and Settings\mike.walsh\Desktop\WerkBon_Full.MDF',  
MOVE N'werkbon_Log'
TO N'C:\Documents and Settings\mike.walsh\Desktop\WerkBon_Full_log.LDF',  
NORECOVERY,  NOUNLOAD,  STATS = 10
GO

--restore the log backup
-- recovery to the time before the deletes
-- experiment with times
RESTORE LOG [test1] FROM  DISK = N'C:\Werkbon_log.trn'
WITH  FILE = 1,  NOUNLOAD,  STATS = 10,  STOPAT = N'2009-01-06T12:51:00'
,RECOVERY
GO


-- then the below select shows you the rows
-- in one database that aren't in the other.
-- you'll notice there are only 254 so
-- you might want to try an earlier stopat, etc.
select * from test1.dbo.werkbon
where werkbon_id not in(select werkbon_id from werkbon.dbo.werkbon)


I would try the above.. Change paths and file/db names as appropriate. Also look at the log reader undo or rollback feature in the Quest Log Reader tool..

Just keep the following in mind:

1.) Restore to a NEW database, don't overwrite your existing DB
2.) Try and stop at the time that has the data there before the first of the deletes started on that day
3.) you'll then have to generate some scripts to insert the missing rows.. looking at the above SQL statement you should be able to figure one out.. Do an insert select from the test database where it doesn't yet exist.
4.) this is just this one table, any data quality issues that may arise because of other deletes aren't fixed here, you'll have to go back to other tables as well.
5.) You may undo deletes that were true deletes

But this at least gets some of the data recovered and you'll know make sure the maintenance job for backups is working properly each day ;-)
Random Solutions  
 
programming4us programming4us