SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


The DBA Whoops


The DBA Whoops

Author
Message
Steve Jones
Steve Jones
SSC Guru
SSC Guru (146K reputation)SSC Guru (146K reputation)SSC Guru (146K reputation)SSC Guru (146K reputation)SSC Guru (146K reputation)SSC Guru (146K reputation)SSC Guru (146K reputation)SSC Guru (146K reputation)

Group: Administrators
Points: 146617 Visits: 19432
Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/sjones/thedbawhoops.asp

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
Ninja's_RGR'us
Ninja's_RGR'us
SSC Guru
SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)

Group: General Forum Members
Points: 67601 Visits: 9671
Whoops indeed. Aren't you glad you didn't wipe out the post table .

Nice article.
Steve Jones
Steve Jones
SSC Guru
SSC Guru (146K reputation)SSC Guru (146K reputation)SSC Guru (146K reputation)SSC Guru (146K reputation)SSC Guru (146K reputation)SSC Guru (146K reputation)SSC Guru (146K reputation)SSC Guru (146K reputation)

Group: Administrators
Points: 146617 Visits: 19432
Thanks and I am glad. That one wouldn't have been quite as fun to fix

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
Ninja's_RGR'us
Ninja's_RGR'us
SSC Guru
SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)

Group: General Forum Members
Points: 67601 Visits: 9671
why not?? it's only 190k rows... and the heart of the site .
chopeen
chopeen
Right there with Babe
Right there with Babe (731 reputation)Right there with Babe (731 reputation)Right there with Babe (731 reputation)Right there with Babe (731 reputation)Right there with Babe (731 reputation)Right there with Babe (731 reputation)Right there with Babe (731 reputation)Right there with Babe (731 reputation)

Group: General Forum Members
Points: 731 Visits: 57
Sometime ago I created a Query Analyzer template like this:

BEGIN TRAN

/* queries go here */

-- ROLLBACK TRAN
-- COMMIT TRAN
--
-- SELECT @@TRANCOUNT
-- DBCC OPENTRAN

If I make any ad hoc changes, I always use it.



Peter Wright
Peter Wright
SSChasing Mays
SSChasing Mays (606 reputation)SSChasing Mays (606 reputation)SSChasing Mays (606 reputation)SSChasing Mays (606 reputation)SSChasing Mays (606 reputation)SSChasing Mays (606 reputation)SSChasing Mays (606 reputation)SSChasing Mays (606 reputation)

Group: General Forum Members
Points: 606 Visits: 96

There must have been something in the air yesterday, I did exactly the same thing! Working quickly under pressure on a production system I ran an update but..... didn't highlight the last line of the where clause.....849 lines updated instead of 2...aaargh! Fortunately I preceded the update with a 'begin tran' so I rolled back and tried again!

I just reckon this kind of human error is inevitable. Steps to minimise it are (i) implement good change control procedures and adhere to them (what I did, needless to say, contravened all my employer's procedures which made it even worse for me) (ii) get into the habit of preceding all DML statements with 'begin tran' or (iii) set implicit transactions on your session or at a Server level or (iv) use the Enterprise Manager grid display to update individual attributes.

Option (ii) - get into the habit of preceding DMLs with 'begin tran' - is the easiest and most hassle free IMHO.


Dave Poole
Dave Poole
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16788 Visits: 3403
Been there, done that.

To be honest, when I have a single record update I open up the table in Enterprise Manager and edit the record manually. You can't accidentally update umpteen rows accidentally!

For changes to a live environment I tend to script absolutely everything and test on a development database. I run the script from the command prompt. Not perfect but there you go.

I like the idea of the COMMIT / ROLLBACK template.

LinkedIn Profile
www.simple-talk.com
mark baekdal-145375
mark baekdal-145375
SSC-Addicted
SSC-Addicted (424 reputation)SSC-Addicted (424 reputation)SSC-Addicted (424 reputation)SSC-Addicted (424 reputation)SSC-Addicted (424 reputation)SSC-Addicted (424 reputation)SSC-Addicted (424 reputation)SSC-Addicted (424 reputation)

Group: General Forum Members
Points: 424 Visits: 6

question? Why don't you have a test platform where changes are made and tested then the changes are uploaded to your production system through reliable change management? It means this sort of thing very hard to happen as the mistake is most often picked up before it makes it into production. The size of your database you could fit a test one on your lap-top. The table you talk about could be termed static data which you script out the data into insert statements and add to your source control where changes could be made in a very controlled manner so rolling back would be very simple and totally auditable. Why don't you use our software to do all of this for you? It is after all free to you (Steve Jones)...


regards,
Mark Baekdal
http://www.dbghost.com

http://www.innovartis.co.uk

+44 (0)208 241 1762
Build, Comparison and Synchronization from Source Control = Database change management for SQL Server


Kumaran Govender
Kumaran Govender
SSC Veteran
SSC Veteran (209 reputation)SSC Veteran (209 reputation)SSC Veteran (209 reputation)SSC Veteran (209 reputation)SSC Veteran (209 reputation)SSC Veteran (209 reputation)SSC Veteran (209 reputation)SSC Veteran (209 reputation)

Group: General Forum Members
Points: 209 Visits: 17

Mate,

I really feel for you, but at least every DBA has done this sometime or the other. I have learn't a lesson from this and I ensure that every thing that I could possibly wrapper in a transaction, I will...

This really helps...


Andy Butland
Andy Butland
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 1

Great article - think a lot of us have been there. Now if only Ctrl Z would work in Query Analyzer...

Andy


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search