Category Archives: Uncategorized

Have you tried restarting your computer SQL Server?

Everyone at one point or another has had this experience – you have to call technical support for assistance with your operating system or an application and get posed with the question “Have you tried restarting your computer?”

“Ummm…yeah. I did that. I also power-cycled my modem, searched the internet, hacked the registry and walked counter clockwise around my chair three times. I just thought I would call you to chat.”

Anyways…

Occasionally, the same logic is what is needed to resolve issues with SQL Server – restarting the SQL Server service. While we want to think that being on a fairly up-to-date version of SQL Server means things like this don’t happen, this is still software written by humans and every possible situation cannot be accounted for in testing. Sometimes you might find documentation that this is needed. Other times, the solution to the issue you are trying to solve is not as clear.

A couple of examples of a documented situation would be when updates to the server require a reboot or when a known issue in SQL Server is able to be immediately resolved by a restart of the service. Undocumented situations that can arise from different situations can range from changes to server settings that are not taking effect to changes in database mail. I have seen both of these situations in the past year – a server setting change was affecting replication (resolved by a restart) and database mail changes not taking effect, causing mail not to be sent and the mail queue to become backed up (another lesson learned here – after the restart of the service all those messages in the queue will be sent; if you don’t want this to happen the queue needs to be cleared out prior to restart).

Unlike rebooting a computer, restarting this service (or the server itself) is typically something that is done only where the circumstances dictate that it is required. Outside of this, restarting SQL Server is typically done as a last resort and is the last thing that the DBA might think to do. Depending on the server and the processes that communicate with the SQL Server instance, the business other resources may need to be not only notified of the restart, but also why it is needed in the first place. This is made more difficult by the fact that it may be unclear whether or not the restart will solve the problem at hand.

While it might not be documented that certain changes may require a service restart, that doesn’t mean that they don’t, and those situations can be difficult to identify. In these cases, all reasonable measures had been taken without yielding the desired results. Both cases involved changes to a SQL Server instance. Making the decision to restart in cases like this is not something that should be done flippantly, but where do you draw the line at time and effort spent before pulling the trigger? My experience with these issues will dictate how I handle similar cases going forward, but as for resolving issues that I have not had experience in dealing with yet, there very well may be more painful times…followed by sound of my head hitting the desk over and over out of frustration that the solution was something so simple.

#Summit14 Recap…and other things

I just got back from another amazing SQL PASS Summit – this time in Seattle. This year was different in that I knew people going into Summit. Last year I only knew some folks from Dallas and the alumni I was paired up with, Bill Fellows. I met a ton of new people last year and got to reconnect with them this year, and make new friends as well.

This past year also gave me the opportunity to make new friends from all the SQL Saturday events I attended and had the privilege to speak at – Las Vegas, Houston, Oklahoma City, Baton Rouge, Kansas City, Denver, and next month, Washington DC. Never have I traveled so much before but it has been worth it. I have learned so much – not just about SQL Server, but also about speaking and sharing knowledge and experience with others.

One thing that I am still in awe of is the amount of “nerd celebrity” you will meet at SQL PASS Summit and the SQL Saturday events. I am one of those people who could care less about the idea of meeting the typical Hollywood celebs, but put me in front some of the people at PASS Summit and I am starstruck. All that brain power in one location is something awesome to behold. And the sessions aren’t bad either.

A few things to note…

Thanks to Matthew Brimer for the opportunity to attend the Brent Ozar pre-con with him. It was awesome!

Thanks to the Midnight DBA’s. They never fail to impress.

Thanks to all the sponsors that threw all the amazing parties. My liver also thanks you.

To Denny Cherry and the invention of Speaker Idol – what an opportunity for those presenting as well as those of us who were just there to watch. Great idea! Thanks for making this happen.

To all those that belted some tunes at the various #sqlkaraoke events – you were awesome but it is good you have your SQL Server careers to fall back on. 🙂

Finally, to my #sqlbitches – you know who you are. Keep it real, yo <insert secret hand gesture here>.

See y’all next year…if not before.

SQL Saturday #309 – Oklahoma City

It is my second time at the SQL Saturday in OKC and my first time speaking at it. For the people who attended my session on Beginning Automation with Powershell, thanks again for coming. I hope everyone enjoyed the session as much as I enjoyed giving it.

As promised, the code is available for download below. If you have any questions, leave a comment here or reach out to me on twitter.

 

SQLSat#324 – Session Noms

Thanks to everyone who attended my sessions at SQL Satruday #324 in Baton Rouge. This was really a awesome event – thanks also to all the people that helped put it on and all the sponsors who helped make it happen.

I had a great time presenting and I think my demos went ok (for the first time ever doing demos). I also really appreciate the feedback since I want to keep on presenting. If you were in one of the sessions and have any further comments or questions feel free to leave a comment here and I will get back to you.

Also, I have gotten the scripts posted here and the download appears to be working now. Let me know if you have any questions about those. Enter the password below to access and download the scripts from Beginning Automation with Powershell.

Thanks again and see everyone next year!

SQL Saturday #324 – I’m headed South!

It is just a few more days until SQL Saturday #324 – Baton Rouge. I will be giving two sessions there – Making the Leap from Developer to DBA and Beginning Automation with Powershell. So looking forward to this event!

The last time I was in southern Louisiana I was barely in my 20’s and on a family vacation. I found that my normal routine for straightening my natural curls was no match for the level of humidity in New Orleans. This memory prompted me to check the weather for this weekend – yeah…this could get interesting.

See everyone there! 🙂

I’m Speaking – SQL Saturday #308

SQLSAT308_SPEAKING

This weekend will be my second time to speak at a SQL Saturday event, and the first time I will be doing it solo. Being a native Texan, I have to admit it is a little strange that I have never been to Houston before, but I cannot think of a more fitting reason to make the drive down there. There is also that whole Dallas vs. Houston thing….but that is an unrelated post that I think other sites have already covered ad nauseam.

My session this weekend will be on Making the Leap from Developer to DBA – a topic I am all too familiar with since I have lived it. Fulfillment of that desire to innovate and create things can be accomplished as a DBA, but that is only a small part of the role. The business depends on you to make sure data is accurate and available in a timely fashion. Developers depend on you for the same thing but also for things like deploying their code…and trying to prevent them from hanging themselves and you when you do it.

It is still not too late to sign up for the event. If you are in Texas or anywhere near Houston you should go…and come to my session. Hope to see you there. 🙂

SQL Saturday #223 – Storage Tuning Deep Dive with Wes Brown Joh Sterrett

Intro to table partitioning

  • Enterprise Edition required
  • LOTS of data – highly transactional tables with 50GB+

How can it help

  • reduce maintenacne tasks – indexing, restores/backups
  • improves purging/archiving

Partition Table -> Partition scheme -> Partition function

Selecting Parition Colums

  • You only get one – pick wisely!
  • Highly used filter – review indexes; review missing indexes/stats; review queries
  • column must be pasrt of clustered index or PK

When partitioning on dates, rounding can affect the date and possibly what patition your data will be in

Improving maintenance tasks

  • backup/restore filegroups based on priority
  • index maintenance by partition
  • new in SQL 2014 – rebuild index by partition; update statistics by partition; can also be done online in 2014

Performance

Partition Elimination – view in execution plan

How does it improve archiving and purging – can reduce the time processes take from hours to minutes by utilizing the sliding window

Meta dataswap – requires schema lock; alter table <blah> switch partition 2 to <blah_staging>

Sliding window goals

  • split and merge emplty partitions
  • switch to do metadata swaps
  • minimize physical data movement

Sliding Window Steps

  1. Create partition swap
  2. Insert partition swap meta data
  3. Create staging table
  4. Meta data swap
  5. Merge partitions 1 and 2
  6. Mark next used
  7. Split to create new partition
  8. Update processed partition swap meta data

http://johnsterrett.com/go/partition

 

SQL Saturday #223 – SQL Security Best Practices and Shrinking Your Attack Surface with Matthew Brimer

How to break into Sql Server in 15 min – he can do it in 3 min

Windows authentication – rename/disable sa

Use GPO or PBM to restrict access times to logins that should not be doing things after hours

Testing permissions – should do but not everyone does

Permissions to backup and data files – if someone can access your backup/data they can create their own instance with the backup or data files

Separating user accounts

Data integrity – data is accurate and reliable; has not been changed or tampered with by an unauthorized person

Common forms of data integrity-

  • hashing/checksums
  • source control locking
  • isolation levels
  • data modeling/types constraints

C2 – just say NO! Only if there is a business reason!

Build your own auditing with sp_trace_create

fn_trace_gettable – auditing reports

Geo clustering – seamless Site2Site failover; one connection string; apps un-aware of failover; $$$$ to implement; SAN level replication or 3rd party too to handle bit level replication.

Always On (SQL Server 2012) – requires availability groups; one/multiple connection strings; can leverage multiple servers at the same time to offset reads/writes on different servers; offload backup overhead to another server on another site; user databases only so permissions managed per instance.

Database Mirroring – user databases with 1 mirror max; synchronous/asynchronous; automatic failover for witness – depending on where can report false positve of failover; permissions on both servers; repairs torn pages and send changes back to principal.

Log Shipping – only as good as your last log backup; requires file shares – permissions?

Replication – “picture” of the database from a point in time; can be applied to multiple servers; snapshot/merge/transactional; no mention of intializing through backup.

Secuity Best Practices

  • change default port – network enumeration/fingerprinting?
  • revoke connect from guest – any database permission can see any other database
  • Disable xp_cmdshell
  • Disable un-needed protocols (VIA,TCP/IP,shared memory, named pipes)
  • Enable Common Criteria Compliance (standard in 2008)
  • Disable SQL Browser – not possible with named instance or cluster
  • Hide instance – will not respond to eneumeration requests but will respond to telnet requests
  • Minimal Service Install – no BIDS in production; separate dev from prod
  • Baselines – Baseline Analyzer; know your sysadmins; SQL permissions/users; databases
  • No DMZ, IIS or Domain Controllers
  • Dev/Test Data – mask sensitive data; MSSQL.DataMask

 

SQLKitten is finally live

Finally got SQLKitten.com set up. More to come shortly.