Change SQL Collation without rebuilding system databases
How many of you want to change the SQL Server Collation without rebuilding the system databases?
In this post, I will explain a method using which the server collation can be easily changed and is through a undocumentedstart up parameter.
Since this is undocumented, I highly recommend to use this with extra care and with your own risk.
These method uses -q startup parameter while starting theSQL Server service .
Method 1:
Method 2:
In this post, I will explain a method using which the server collation can be easily changed and is through a undocumented
Since this is undocumented, I highly recommend to use this with extra care and with your own risk.
These method uses -q startup parameter while starting the
Method 1:
- Detach all user databases
- Make backup of all other required
database and server objects - Stop SQL Server Service
- Start the SQL Server Service using command Prompt
net start "SQL Server (<Instance Name>)" /m /T4022 /T3659 /q"<New Collation Name>" - Re-start (Stop and Start) the SQL Services Normally without any startup parameters
- Check for the change in Server Collation
- Attach the user databases back
Method 2:
- Detach all user databases
- Make backup of all other required database and server objects
- Stop SQL Server Service
- Start the SQL Server Service using command Prompt
sqlservr -m -T4022 -T3659 -q"<New Collation Name>" - Now check for the message "Recovery is completed" and then press CTRL+C to Stop the SQL Server service
- Start the SQL Services Normally without any startup parameters
- Check for the change in Server Collation
- Attach the user databases back
Note:
- If you do not detach the user databases before changing the server collation then the process will change the collation for all the databases.
- Trace flag 3659 allows logging all errors to sql server logs
- Trace flag 4022 forces SQL Server to skip startup stored procedures (if any)
- Startup Parameter “-m” forces single user mode.
- Startup Parameter -q” rebuilds all databases and objects to the specified collation, without reinstalling the instance or rebuilding system databases.