undo the delete sql in MS Server

I accidentally execute a sql and delete some rows of records !
is there any method that can restore the rows of records ?? it is very urgent !!
Thanks !
mmccyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

William ElliottSr Tech GuruCommented:
this is why you test in a 'test' environment or backup first.

If you don´t have a transaction scope defined around the command:
BEGIN TRANSACTOON
DELETE FROM SomeTable
ROLLBACK --THis does a rollback
...you can´t. You will need to restore your data from a backup.

or
Two options:

1) Use a third-party tool that is able to read the transaction log
and construct undo batches from it. Two such products are
Lumigent Log Explorer and Log PI.

2) a) Make a note of when the fatal error occurred. b) Backup the
transaction log. c) Restore the last full backup with norecovery.
d) Apply transaction log dumps with a STOPAT just before the
fatal DELETE was done.
0
William ElliottSr Tech GuruCommented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
debuggerauCommented:
yes, there is, it will depend on how your backups are being done though...

Check your maintenance plans and see if any regular backups are scheduled.
Then load the backup into another DB and recover the rows on the relative table.

Your transaction logs, may have a clue, but I doubt it would be of any help since the row updates could have occurred anytime in the past...
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Aneesh RetnakaranDatabase AdministratorCommented:
Hello mmccy,
u need to use third party tools like Lumigent Log explorer or Red-gate log rescue



Aneesh R
0
jogosCommented:
It could be very simple if you know for certain that all the deleted rows are in your last backup.
- restore backup with other name
- test if you can find the exact missing records   between both production and restored db
  select ..... where not exists ....
- do the 'row-recovery'
insert into .... select ..... where not exists ....
when a Identity-column you will need the 'set identity_insert  tablename ON'

Don't forget to check if any cascading delete may have deleted rows in depending tables
0
jogosCommented:
Both suggestions are good
- But the 'verry urgent' part off the question could be a problem with the third party tools.
- restore a backup and roll-forward to the last good transactionlog backup , you will have recovered the carelessly deleted records, but do you know wath you trow away on modifications afther that restored backup? Only if you're the only user you can be sure.

So I think my suggestion was also worthwile (even when I won't get any points out of it)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.