Home All Groups Group Topic Archive Search About

Rollback an ad-hoc query from QA?

Author
19 Aug 2005 2:53 PM
Mnemonic
Just curious how could one rollback an ad-hoc query executed from Query
Analyzer? The analyst did not use any BEGIN TRANSACTIONS statements,
just a simple Update statement with too broad criteria. Does this mean
the query is committed as soon as it completes and we would have to
restore the database from the previous night's backup and then restore
the transaction log to a time just before the erroneous SQL query?


The database is set to full Recover Model.

Author
19 Aug 2005 3:24 PM
Tibor Karaszi
You are correct in your assumptions. But before the first restore, do a backup of the transaction
log (else you will only be able to restore until your last transaction log backup).

Or use a log reader tool.

Some more info at: http://www.karaszi.com/SQLServer/info_restore_log_several_times.asp

Show quote
"Mnemonic" <MICHAEL_SUN***@COUNTRYWIDE.COM> wrote in message
news:1124463238.770683.153960@g44g2000cwa.googlegroups.com...
> Just curious how could one rollback an ad-hoc query executed from Query
> Analyzer? The analyst did not use any BEGIN TRANSACTIONS statements,
> just a simple Update statement with too broad criteria. Does this mean
> the query is committed as soon as it completes and we would have to
> restore the database from the previous night's backup and then restore
> the transaction log to a time just before the erroneous SQL query?
>
>
> The database is set to full Recover Model.
>
Author
19 Aug 2005 3:26 PM
Andrew J. Kelly
That's about it.  If they didn't include it in a transaction it was
committed when it finished.  You can also use one of the third party tools
that let you manipulate the logs.


--
Andrew J. Kelly  SQL MVP


Show quote
"Mnemonic" <MICHAEL_SUN***@COUNTRYWIDE.COM> wrote in message
news:1124463238.770683.153960@g44g2000cwa.googlegroups.com...
> Just curious how could one rollback an ad-hoc query executed from Query
> Analyzer? The analyst did not use any BEGIN TRANSACTIONS statements,
> just a simple Update statement with too broad criteria. Does this mean
> the query is committed as soon as it completes and we would have to
> restore the database from the previous night's backup and then restore
> the transaction log to a time just before the erroneous SQL query?
>
>
> The database is set to full Recover Model.
>
Author
19 Aug 2005 5:37 PM
Mnemonic
Thank you both!
Author
19 Aug 2005 8:23 PM
Hugo Kornelis
On Fri, 19 Aug 2005 11:26:11 -0400, Andrew J. Kelly wrote:

>That's about it.  If they didn't include it in a transaction it was
>committed when it finished. 

Hi Andrew,

Unless the analyst had the setting for IMPLICIT_TRANSACTION set to ON.

(Does anyone actually ever use that set option?)

Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)
Author
20 Aug 2005 7:22 AM
Tibor Karaszi
Hi Hugo,

> (Does anyone actually ever use that set option?)

I recall tracing either RDO or ADO about VB4 release timeframe (there was a bug in the transaction
handling so you couldn't do rollback). Either one or both of those API's used the setting (back
then).

Show quote
"Hugo Kornelis" <hugo@pe_NO_rFact.in_SPAM_fo> wrote in message
news:brfcg11r29vosqhj1l2acgodg3rhs5r3b2@4ax.com...
> On Fri, 19 Aug 2005 11:26:11 -0400, Andrew J. Kelly wrote:
>
>>That's about it.  If they didn't include it in a transaction it was
>>committed when it finished.
>
> Hi Andrew,
>
> Unless the analyst had the setting for IMPLICIT_TRANSACTION set to ON.
>
> (Does anyone actually ever use that set option?)
>
> Best, Hugo
> --
>
> (Remove _NO_ and _SPAM_ to get my e-mail address)
Author
20 Aug 2005 3:14 PM
Andrew J. Kelly
Well true, but I figured if no one was screaming about being blocked by now
they didn't have that option set<g>.

--
Andrew J. Kelly  SQL MVP


Show quote
"Hugo Kornelis" <hugo@pe_NO_rFact.in_SPAM_fo> wrote in message
news:brfcg11r29vosqhj1l2acgodg3rhs5r3b2@4ax.com...
> On Fri, 19 Aug 2005 11:26:11 -0400, Andrew J. Kelly wrote:
>
>>That's about it.  If they didn't include it in a transaction it was
>>committed when it finished.
>
> Hi Andrew,
>
> Unless the analyst had the setting for IMPLICIT_TRANSACTION set to ON.
>
> (Does anyone actually ever use that set option?)
>
> Best, Hugo
> --
>
> (Remove _NO_ and _SPAM_ to get my e-mail address)

AddThis Social Bookmark Button