Collation: Correction -> Instance

Leave a comment

April 14, 2014 by Kenneth Fisher

I had a recent run in with collation problems and it got me started reading about them. As I read I started to realize that for a seemingly simple subject there was a lot to it. So I thought I would go over some of what I found out.

You’ve installed your instance, created your database, created your tables even started running your queries. And then you realize that at some level or another you’ve made a mistake and now you need to change your collation. This gets more complicated the farther up the chain you go. In particular changing the collation of an instance is a big pain. In fact it is such a big pain I highly recommend not doing it. Plan ahead carefully so that you never have to mess with this. However, since life happens:

Instance

There is no easy way to do this I’m afraid.

  1. Goes without saying but back up all user and system databases
  2. Detach all of your user databases
  3. Script out all of your server principals (logins, user defined roles, certificates etc) and any jobs.
  4. Back up any DTS packages (hopefully none) and any SSIS packages
  5. List out any configurations
  6. Script out any changes to the model database
  7. Any other changes that you might have made to the original system databases that I might have forgotten. Microsoft has a good list of what to do here: Rebuild System Databases
  8. Rebuild the system databases using setup and the new collation. See the above link
  9. Setup /QUIET /ACTION=REBUILDDATABASE /INSTANCENAME=InstanceName
    /SQLSYSADMINACCOUNTS=accounts [ /SAPWD= StrongPassword ] 
    /SQLCOLLATION=CollationName
  10. Reattach all of the user databases
  11. Use the methods I mentioned in the previous post to change the collation for each of the databases

 


Over a number of different posts I’m going to discuss some of the surprisingly deep subject of collation.

As a start listen to Rob Farley’s hilarious talk on collation
Collation: Definition
Collation: Location
Collation: Expression
Collation: Correction -> Expression, Column, Database
Collation: Temporary objects & variables: Demonstration
Collation: Confusion

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 1,671 other followers

Follow me on Twitter

ToadWorld Pro of the Month November 2013
%d bloggers like this: