Solved

recovering delete rows in SQL 2005

Posted on 2007-11-30
7
4,793 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Turn Insights into Action

Communication across every corner of your business is essential to increase the velocity of your application delivery and support pipeline. Automate, standardize, and contextualize your communication processes with xMatters.

 

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

Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

Question has a verified solution.

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

In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
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
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

695 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