Solved

recovering delete rows in SQL 2005

Posted on 2007-11-30
7
4,788 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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

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

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now