Friday, November 19, 2010

How to change SQL DB collation after setup

In some cases, you may need to change the DB collation (rebuild the DB) after setup (in my case I was installing SP 2010 and I choose a wrong collation, it needs an instance that performs case-insensitive & non-binary comparisons).


To rebuild system databases for an instance of SQL Server:


  1. Insert the SQL Server 2008 R2 installation media into the disk drive, or, from a command prompt, change directories to the location of the setup.exe file on the local server. The default location on the server is C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Release.

  2. From a command prompt window, enter the following command. Square brackets are used to indicate optional parameters. Do not enter the brackets. When using the Windows Vista operating system with User Account Control (UAC) enabled, running Setup requires elevated privileges. The command prompt must be run as Administrator.

Setup /QUIET /ACTION=REBUILDDATABASE /INSTANCENAME=InstanceName 
/SQLSYSADMINACCOUNTS=accounts /[ SAPWD= StrongPassword ] 
/SQLCOLLATION=CollationName

For example:
Setup /QUIET /ACTION=REBUILDDATABASE /INSTANCENAME=MSSQLSERVER 
/SQLSYSADMINACCOUNTS=domain\user /SQLCOLLATION=SQL_Latin1_General_CP1_CI_AS

Source: Rebuilding System Databases

No comments:

Post a Comment