It needs to be changed using the Linux configuration utility of SQL Server, i.e. In the above screenshot, you can see the default file location is ‘ /var/opt/mssql/data‘. Let us go to the default path ( /var/opt/mssql/data). Here we can view the content using the ‘ ls -lrt‘ command. You can find all database file in this path, i.e. data files, log files and the backup files. Once we create any database, it goes to this default location only. We do not need to specify the locations of the database file so that it will create all the files in that folder. Now we want to change this default path for both the data files and the log files. Therefore, we will create a new directory with mkdir command in the desired location having sufficient free space. Run the command with the administrative permission. In below command, we are creating a directory ‘ /DefaultDBPath‘. We can go to this directory and can see there are no files in it currently. If we look at the group owner and the directory permissions, currently it is set to root. We need to change the group and the owner of this directory to mssql. Without this, SQL Server cannot access this path. In the below screenshot, you can see the group and owner for / DefaultDBPath is set to mssql. Now, we are ready to change the default file location to this directory. We will change the default file locations using the mssql-conf utility. We can find the mssql-conf utility under the /opt/mssql/bin. We can get the list of configuration available under mssql-conf utility, run the below command. In the above screenshot, you can see the various configuration options available with mssql-conf utility. Modify default directory for the log file Modify the default directory for the data file In this article, we will focus just on the modifying default locations for the database files and the backup files.īelow are the configurations available to modify the default file locations. opt/mssql/bin/mssql-conf set faultdatadir /DefaultDBPath Modify default data file path: Run the below command to change default data file path. opt/mssql/bin/mssql-conf set faultlogdir /DefaultDBPath Modify default log file path: Run the below command to change default log file path. These configurations will be enabled once we restart the SQL Server services in Linux. We do not get any success or failure message here. Now, connect to SQL Server using SSMS again and verify the default file locations. We can verify this setting by creating a new database also.
0 Comments
Leave a Reply. |