Solved

How to recover the records which were deleted accidently

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
CREATE DATABASE ENCRYPTION KEY 1 73
user defined date datatype in SQL Server- can it be overdone.. 6 35
Email Notifications for SQL 2005 9 36
Are triggers slow? 7 13
Introduction This article will provide a solution for an error that might occur installing a new SQL 2005 64-bit cluster. This article will assume that you are fully prepared to complete the installation and describes the error as it occurred durin…
I've encountered valid database schemas that do not have a primary key.  For example, I use LogParser from Microsoft to push IIS logs into a SQL database table for processing and analysis.  However, occasionally due to user error or a scheduled task…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

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