Solved

How to recover the records which were deleted accidently

Posted on 2014-02-25
3
176 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When writing XML code a very difficult part is when we like to remove all the elements or attributes from the XML that have no data. I would like to share a set of recursive MSSQL stored procedures that I have made to remove those elements from …
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 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

12 Experts available now in Live!

Get 1:1 Help Now