top of page
  • Twitter Social Icon
  • Facebook Social Icon
  • LinkedIn Social Icon
Obrázek autoraFilip Holub

Change SQL Server collation on Linux

I will try write a couple of steps how correctly change collation for SQL Server Instance on Linux. The following command set-collation is available for all Linux distribution, such as Ubuntu, RHEL and SUSE.


"First of all, you have to connect as root user on your Linux machine!"

1) If you have some User Databases on instance, I would recommend backup them.

  • For backup one user database use sqlcmd command below:

We can see that backup is done:


PigeonSQL_Full.bak
PigeonSQL_Full.bak

For backup many user database, open management Studio and run following T-SQL Query which will backup all user database, in my case three databases AML, FRK and TOM:

As you can see below, backup databases was successfully processed!



2) Now, we can provide detach all user database by following commands:

Result should looks like this:


Execute sp_detach_db
Execute sp_detach_db

3) Finally we can provide set new collation, first of all, we will display current collation by the following command:

Set new collation for SQL Server Instance:

After that, we have to restart SQL Server service:

New collation was changed successfully:


New collation
New collation

If you get some error, the change will be rollback to the previous value!


4) Last step is provide restore databases.


Restore Databases!
Restore Databases!

And that's all! I hope that you learned something new ;)

907 zobrazení0 komentářů

Nejnovější příspěvky

Zobrazit vše
SIGN UP AND STAY UPDATED!
  • Grey Twitter Icon
  • Grey Facebook Icon
  • Grey LinkedIn Icon

© 2020 All rights reserved. MSSQLONLINUX.com | Filip Holub

bottom of page