Solved

recovering delete rows in SQL 2005

Posted on 2007-11-30
7
4,791 Views
Last Modified: 2012-08-13
Is there a way to recover deleted rows in SQL 2005 with myTransaction Log?
0
Comment
Question by:mattphung
  • 3
  • 3
7 Comments
 
LVL 21

Expert Comment

by:mastoo
ID: 20384896
Recover the db and log backups into another database and then insert the records back into the original database.
0
 

Author Comment

by:mattphung
ID: 20384930
where do I get the db and log backups?
I created another db called "tempDB". How do I insert the deleted records back into the original database? Where is the deleted records kept?
0
 
LVL 21

Expert Comment

by:mastoo
ID: 20385018
Sorry, my answer only works if someone is running backups of the database.  You have a dba to ask?  If not you're probably out of luck but right-click the database in Enterprise Manager and do properties then options.  What is the Recovery Model?
0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

Author Comment

by:mattphung
ID: 20385242
My recovery model is FULL
0
 
LVL 21

Accepted Solution

by:
mastoo earned 500 total points
ID: 20385399
Ah, you might be in luck then.  Right click the "databases" node in the Enterprise Manager treeview.  Select All Tasks and then Restore.  Type in some dummy name for the Restore As, such as MyNewDb.  Go to Show backups of and select the original.  Down below hopefully you'll see a list of backups starting with a full backup and then one or more transaction log backups.  Check the last one in the list - it needs to have a date and time later than when the records were deleted.  (Stop following these steps if at any point something isn't as described)  Ok - to restore the backups into the new database name.  Then let's say you're looking for deleted records in TableOne where SomeDate = '11/29/2007'  Run a select in Query Analyzer in the restored database to look at the records and then you can do an insert into the other database to put them back.  BUT, this gets pretty ugly if there is any hierarchy of records deleted (i.e., there is a parent-child relationship and both parent and child got deleted).
0
 

Author Closing Comment

by:mattphung
ID: 31412005
Thanks for all your help! It worked.
0
 
LVL 9

Expert Comment

by:mimran18
ID: 37176116
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL STANDARD CORE 8 38
SQL Log size 3 18
MS SQL Server select from Sub Table 14 26
MS SQL SERVER and ADODB.commands 8 23
Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question