As <\/font>Kimberly blogged about earlier this year<\/font><\/a>, SQLskills has an ongoing initiative to blog about basic topics, which we\u2019re calling SQL101. We\u2019re all blogging about things that we often see done incorrectly, technologies used the wrong way, or where there are many misunderstandings that lead to serious problems. If you want to find all of our SQLskills SQL101<\/strong> blog posts, check out <\/font>SQLskills.com\/help\/SQL101<\/font><\/a>.<\/font><\/p>\n One reason that it is relatively difficult to get your first job as a DBA (compared to other positions, such as a developer) is that it is very easy for a DBA with Production access to cause an enormous amount of havoc with a single momentary mistake. <\/font><\/p>\n As a Developer,<\/font> many of your most common mistakes are only seen by yourself. If you write some code with a syntax error that doesn\u2019t compile, or you write some code that fails your unit tests, usually nobody sees those problems but you, and you have the opportunity to fix your mistakes before you check-in your code, with no one being any the wiser.<\/font><\/p>\n A DBA doing something like running an UPDATE or DELETE statement without a WHERE clause, running a query against a Production instance database when you thought you were running it against a Development instance database, or making a schema change in Production that is a size of data operation (that locks up a table for a long period) are just a few examples of common DBA mistakes that can have huge consequences for an organization.<\/font><\/p>\n A split-second, careless DBA mistake can cause a long outage that can be difficult or even impossible to recover from. In SQL Server, Cntl-Z (the undo action) does not work, so you need to be detail-oriented and careful as a good DBA. As the old saying goes: \u201cmeasure twice and cut once\u201d.<\/font><\/p>\n Here are a few basic tips that can help you avoid some of these common mistakes:<\/font><\/p>\n Using Color-Coded Connections in SSMS<\/strong><\/font><\/p>\n SQL Server Management Studio (SSMS) has long had the ability to set a custom color as a connection property for individual connections to an instance of SQL Server. This option is available in legacy versions of SSMS and in the latest 17.4 version of SSMS<\/a>. You can get even more robust connection coloring capability with third-party tools such as SSMS Tools Pack<\/a>.<\/font><\/p>\n The idea here is to set specific colors, such as red, yellow, or green for specific types of database instances to help remind you when you are connected to a Production instance rather than a non-Production instance. It is fairly common to use red for a Production instance. This can be helpful if you don\u2019t have red green color blindness<\/a>, which affects about 7-10% of men, but is much less common among women.<\/font><\/p>\n Figure 1 shows how you can check the \u201cUse custom color\u201d checkbox, and then select the color you want to use for that connection. After that, as long as you use the exact same connection credentials for that instance from your copy of SSMS, you should<\/strong><\/em> get the color that you set when you open a connection to that instance. <\/font><\/p>\n I would not bet my job on the color always being accurate, because depending on exactly how you open a connection to the instance, you may not always get the custom color that you set for the connection. Still, it is an extra piece of added insurance.<\/font><\/p>\n Figure 1: Setting a custom color for a connection<\/strong><\/font><\/p>\n Figure 2 shows a red bar at the bottom of the query window (which is the default position for the bar) after setting a custom connection color. This would help warn me that I was connected to a Production instance, so I need to be especially careful before doing anything.<\/font><\/p>\n
<\/font><\/p>\n
<\/font><\/p>\n
<\/a><\/p>\n
<\/font><\/p>\n