Solved

How to recover the records which were deleted accidently

Posted on 2014-02-25
3
177 Views
Last Modified: 2014-04-14
I have an table gtrainers, i deleted it unknowingly. Can i recover rows back.
I used
Begin Transaction
rollback transaction

Did'nt worked.
0
Comment
Question by:searchsanjaysharma
3 Comments
 
LVL 8

Assisted Solution

by:Andrei Fomitchev
Andrei Fomitchev earned 250 total points
ID: 39888060
You should restore from backup using "point in time" just before the rows were deleted.

Usually maintenance plan has
1. FULL BACKUP daily
2. TRANSACTION LOG backup every 15 minutes.

Right click on DB
Tasks
Restore
Point in time - set Date/Time
Restore under different name (just in case if something goes wrong).
0
 
LVL 22

Accepted Solution

by:
Steve Wales earned 250 total points
ID: 39888962
fomand is correct, you can't use rollback to recover from a dropped table.

For further information, usually SQL Server Management Studio (if that's what you're using) does a commit after each and every statement by default - meaning that unless you enclose the statements you're actually running in a BEGIN TRANSACTION / COMMIT TRANSACTION - or BEGIN TRANSACTION ... execute your statements ... COMMIT or ROLLBACK depending upon results then there's nothing you can do.

However, one thing you should always be aware of - any time you issue DDL statements on database objects (CREATE, DROP etc), there is an implicit commit performed on the database after the statement is issued.

So even if you have your DROP TABLE inside a BEGIN TRANSACTION, you can't rollback a dropped table - the DROP statement implicitly commits.  DDL just isn't able to be rolled back from.

Sorry, but you need to restore from backup.
0
 

Author Closing Comment

by:searchsanjaysharma
ID: 39999616
tx
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

There are some very powerful Data Management Views (DMV's) introduced with SQL 2005. The two in particular that we are going to discuss are sys.dm_db_index_usage_stats and sys.dm_db_index_operational_stats.   Recently, I was involved in a discu…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

895 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

11 Experts available now in Live!

Get 1:1 Help Now