Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


The DBA Whoops


The DBA Whoops

Author
Message
Steve Jones
Steve Jones
SSC-Dedicated
SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)

Group: Administrators
Points: 36164 Visits: 18751
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-Insane
SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)

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

Nice article.
Steve Jones
Steve Jones
SSC-Dedicated
SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)

Group: Administrators
Points: 36164 Visits: 18751
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-Insane
SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)

Group: General Forum Members
Points: 20931 Visits: 9671
why not?? it's only 190k rows... and the heart of the site .
chopeen
chopeen
SSChasing Mays
SSChasing Mays (659 reputation)SSChasing Mays (659 reputation)SSChasing Mays (659 reputation)SSChasing Mays (659 reputation)SSChasing Mays (659 reputation)SSChasing Mays (659 reputation)SSChasing Mays (659 reputation)SSChasing Mays (659 reputation)

Group: General Forum Members
Points: 659 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
SSC Veteran
SSC Veteran (274 reputation)SSC Veteran (274 reputation)SSC Veteran (274 reputation)SSC Veteran (274 reputation)SSC Veteran (274 reputation)SSC Veteran (274 reputation)SSC Veteran (274 reputation)SSC Veteran (274 reputation)

Group: General Forum Members
Points: 274 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.


David.Poole
David.Poole
Hall of Fame
Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)

Group: General Forum Members
Points: 3684 Visits: 3118
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

Newbie on www.simple-talk.com
mark baekdal-145375
mark baekdal-145375
SSC-Enthusiastic
SSC-Enthusiastic (108 reputation)SSC-Enthusiastic (108 reputation)SSC-Enthusiastic (108 reputation)SSC-Enthusiastic (108 reputation)SSC-Enthusiastic (108 reputation)SSC-Enthusiastic (108 reputation)SSC-Enthusiastic (108 reputation)SSC-Enthusiastic (108 reputation)

Group: General Forum Members
Points: 108 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 Journeyman
SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)SSC Journeyman (79 reputation)

Group: General Forum Members
Points: 79 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