Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12345»»»

The DBA Whoops Expand / Collapse
Author
Message
Posted Tuesday, June 14, 2005 10:24 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: 2 days ago @ 3:11 PM
Points: 31,368, Visits: 15,837
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
Post #190466
Posted Tuesday, June 14, 2005 11:41 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Thursday, November 27, 2014 4:23 AM
Points: 20,584, Visits: 9,624
Whoops indeed. Aren't you glad you didn't wipe out the post table .

Nice article.
Post #190499
Posted Wednesday, June 15, 2005 4:07 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: 2 days ago @ 3:11 PM
Points: 31,368, Visits: 15,837
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
Post #191082
Posted Wednesday, June 15, 2005 11:55 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Thursday, November 27, 2014 4:23 AM
Points: 20,584, Visits: 9,624
why not?? it's only 190k rows... and the heart of the site .
Post #191135
Posted Thursday, June 16, 2005 1:16 AM
SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Monday, September 3, 2012 11:06 AM
Points: 659, Visits: 56
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.



Post #191148
Posted Thursday, June 16, 2005 1:46 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Tuesday, December 4, 2012 10:37 AM
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.

Post #191159
Posted Thursday, June 16, 2005 2:13 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 6:20 AM
Points: 2,923, Visits: 1,874
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
Post #191170
Posted Thursday, June 16, 2005 2:17 AM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, December 17, 2008 8:34 AM
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

 

 

 

Post #191174
Posted Thursday, June 16, 2005 2:17 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Monday, January 25, 2010 12:24 PM
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...

Post #191175
Posted Thursday, June 16, 2005 2:28 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, November 17, 2006 4:44 AM
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

Post #191178
« Prev Topic | Next Topic »

Add to briefcase 12345»»»

Permissions Expand / Collapse