In my recent blog, I discussed about how to move master database to another location. One of the readers requested to blog about renaming the master database files. So, we are going to explore step by step process of renaming the files in this blog.
Change the name of master database files
- Connect to SQL Server instance which is running on Linux machine and check the master database files’ name
- Now, connect to Linux machine as a root user where SQL Server is running
- STOP the SQL Server service by firing the below command
Syntax: systemctl stop mssql-server
- Use the mv command to rename the files from master.mdf to testmaster.mdf and mastlog.ldf to testmastlog.ldf
Syntax: mv /var/opt/mssql/data/master.mdf /var/opt/mssql/data/testmaster.mdf
Syntax: mv /var/opt/mssql/data/mastlog.ldf /var/opt/mssql/data/testmastlog.ldf
- Set the new filenames of master database using mssql-conf
Syntax: /opt/mssql/bin/mssql-conf set filelocation.masterdatafile /var/opt/mssql/data/testmaster.mdf
Syntax: /opt/mssql/bin/mssql-conf set filelocation.masterlogfile /var/opt/mssql/data/testmastlog.ldf
- START the SQL Server service by firing the below command
Syntax: systemctl start mssql-server
- Verify the master database files’ name
Hope, you enjoyed renaming master database files’ name. Happy Learning!