mysql query browser: is it possible to undo change? - sql

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!

Related

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

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.

SQLite Database locked in sqlite admin

I need help with an SQLite process. It crashed while doing a create query and as a result now will not add a anything to the database as it is "locked"; how can I unlock it?
Other questions answers I don't understand. I need simple as possible please. The database it called "KCD.s3db" I'm working in vb.net.
Try copying the database to a different location and opening it. Also see How do I unlock a SQLite database?
Basically i forgot to dispose of a query before i ran another query and this caused a reserved lock to be place on the database. Simple fix was to dispose sql command.

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.

SQL Server - Checkout system for database objects?

I was wondering if anyone knows any 3rd party tools or existing functionality in SQL Server 2008 so that when someone is working on a table or procedure, it is locked out to that individual. I have searched the net extensively and can't seem to find anything relating to this. We are facing a problem where two people may be working on the same stored procedures and whoever executes last gets the code change! This kind of functionality would come in handy. I think that a lock or check in/check out system would be benefit a project, any ideas?
I am already hooked up to Redgate source control, which does not provide this functionality.
Thanks
Try and have a look at this SO discussion: How do I version my SQL Server database in SVN?
It might not lock things like you want, but it would help to ensure code is recoverable. You could also consider using DDL triggers as some kind of a checking mechanism.
you could try this: http://www.apexsql.com/sql_tools_version.aspx
Alternatively, try this: http://www.red-gate.com/products/sql-development/sql-source-control/entrypage/5-minutes?utm_source=google&utm_medium=cpc&utm_content=unmet_need&utm_campaign=sqlsourcecontrol&gclid=CK_qsPC5prUCFe7MtAodzC8ACA

How to undo SQL changes using installer

I have installer to install procedures, scripts, views, etc in SQL server 2005/2008.
Now I want to add a condition in the installer like if there is any error while installing, I want to undo all the changes done in SQL server.
I tried to store the procedures, views, etc which I am changing while installing and reverting them back if I get any error. But am not able to do it the way I want.
Can someone guide me if he had done the same thing?
To specify I am using WIX installer.
Also if someone has tried SMO, it will be of great help.
The simplest and most robust way to handle this is not to use the installer at all. Rather wrap all your SQL into a transaction block. Using this means that if anything fails for any reasons (as part of the SQL) then the transaction will gracefully roll back and all your DB changes will be reverted without you having to implement any more than defining the transaction block on your SQL statement.
Assuming MS SQL more information regarding transactions can be found here:
http://msdn.microsoft.com/en-us/library/ms188929.aspx
Most other mainstream SQL implementation follow a very similar model, but obviously refer to their docs instead.
If you need to trigger "rollback" of the SQL component of your install if some other component of your install fails. Then unfortunately you can't use transactions in this manner. However in this case you could simply call a rollback script that deletes any SP's / tables etc you have added. That said in .NET you can being the SQL transaction handling into the code (i.e. C#) if that is available to you you could use this to wrap up everything.
It can be difficult to rollback an SQL upgrade script, particularly if that script could fail at any point. The problem is that the built-in rollback machinery cannot handle, for example, most DDL statements. Therefore, you would have to implement such rollbacks manually with compensating scripts that undo the changes.
It might be simpler to back-up the database at the outset of the installation and restore it should the installation fail.