How to recover deleted data from SQL server table? [duplicate] - sql

I accidentaly ran a DELETE command against a table with a wrong WHERE
clause.
I am using SQL Server 2005.
Is there a way that could help me recover the lost data?

It is possible using Apex Recovery Tool,i have successfully recovered my table rows which i accidentally deleted
if you download the trial version it will recover only 10th row
check here http://www.apexsql.com/sql_tools_log.aspx

You have Full data + Transaction log backups, right? You can restore to another Database from backups and then sync the deleted rows back. Lots of work though...
(Have you looked at Redgate's SQL Log Rescue? Update: it's SQL Server 2000 only)
There is Log Explorer

I think thats impossible, sorry.
Thats why whenever running a delete or update you should always use BEGIN TRANSACTION, then COMMIT if successful or ROLLBACK if not.

What is gone is gone. The only protection I know of is regular backup.

Related

SQL Server 2008 transaction log issue

I am learning about SQL Server 2008. I have created a database with full backup mode and made a transaction without commit. In the system database info the log_reuse_wait_desc column is still has the value 'NOTHING'. But the tutorial which I am following shows that the value changes to 'ACTIVE_TRANSACTION'. Am I missing any configuration changes?
Thanks
Prathap
I believe that the log_reuse_wait_desc column is only updated as a response to certain actions such as log backups, checkpoints and attempts of SQL Server to clear old VLFs. Most of the time this column is accurate (or accurate enough to be useful). I once read an article about this behavior from an authoritative community member but I cannot find it right now.
Try performing a CHECKPOINT or a log backup. The column should be updated by that.

Recover SQL code from MAMP's phpmyadmin

So, I'm a total moron as of late and deleted all of my tables from localhost thinking it was my remote server by accident. I was mistakenly in the wrong tab of my browser. Is there anyway to retrieve my old SQL code to rewrite all of the tables?
PHPMyAdmin won't store backups for your data unless there was a new setting for that? If you have deleted the data even mistakenly and there is no backup then chances of finding it back are very very very dim. PhpMyAdmin wont be able to give it back to you, to answer your question.

mysql query browser: is it possible to undo change?

I have updated a table in a database using mysql query browser. is it possible to roll back?
Try using the rollback button on the Mysql Query Browser toobar. If it doesn't work, the change has already been committed and cannot be undone anymore. Try retrieving things from a backup instead.
'Fraid not. If you don't have a backup and the update was not run inside an as yet uncommitted transaction then there isn't much you can do. Using the safe-updates option can help prevent some kinds of mistakes, generally those where the where clause has been forgotten however again is no help retrospectively. Sorry!

MS SQL SERVER BACKUP Issue

In sql server 2008, i have taken Full backup type of my database and database was successfully done.My question is while restoring it how can i check or know that my whole backup was perfect ?
You can use RESTORE VERIFYONLY for that.
See Detecting and Coping with Media Errors During Backup and Restore
The DB won't come on-line if something is wrong most likely.
Although, you can run RESTORE VERIFYONLY, you're more likely to restore the wrong DB or from the wrong backup file to be honest.
If you want you could run DBCC CHECKDB.
I tend to query a known table for the last "updateddatetime" column

Undo changes to SQL Server 2005 database

I've ran some "ALTER" scripts on the database [SQL Server Server 2005], and overwrote some sprocs. Is there any way to undo changes and get my old sprocs back?
Is there a way to get the scripts that were executed out of the .LDf file? That way i can re-run my initial "create" script for my sprocs.
I don't have a backup file with old sprocs.
p.s. i backed the DB up as per #Gulzar's deleted answer, and looks like I'm "hosed".
#Pittsburgh DBA: thanx for the solution, but it doesn't seem to work after the backup.
MORAL: Wait for 10 minutes before trying the suggested answers out
Update from Gulzar: What I meant was a file backup before trying anything (to be safe). Not a SQL Server backup.
FIRST: DO NOT TAKE ANY BACKUPS JUST YET.
There are several tools on the market to do this sort of thing.
You might try this one:
ApexSQL Log
In case anybody else has the same problem - Were you doing transaction log backups every X minutes? If so, you can use Quest LiteSpeed's log reader or Quest Toad for SQL Server's log reader to read the log file backups. It gives undo/redo scripts too for any transaction in the log backups or the ldf.
And after that, look into using ApexSQLScript to script out your databases on a regular basis (and store in version control).
yo do can!!
go to sql server managment studio,connect to your db, left click on your db and go to "tasks".
select restore -> database.
then click the "timeline" button and select 'especific date' and select the day before your mistake.
All programs that have access to your db mus be closed.
It worked for me, i had this very same probelm.