I have installed new MS SQL Web Edition on C Drive and I have also another D drive on server. Now I want to change database location, like when we make new database it should be make on D drive.
Can you please give me an idea how can I Do this.
I have installed new MS SQL Web Edition on C Drive and I have also another D drive on server. Now I want to change database location, like when we make new database it should be make on D drive.
Can you please give me an idea how can I Do this.
When you don't provide any location,SQL Server by default uses server level settings which are provided during installation.What this means is if you don't provide any location while creating database,SQL uses this location by default..This can be changed at any time and can be found here
Further while creating a database,You also can provide location like below,if you want any database to be created at different location
CREATE DATABASE [sdsd] ON PRIMARY
( NAME = N'sdsd', FILENAME = N'new path ' , SIZE = 2048KB , FILEGROWTH = 1024KB )
LOG ON
( NAME = N'sdsd_log', FILENAME = N'new path' , SIZE = 1024KB , FILEGROWTH = 10%)
GO
If you are looking to change the existing database location,here is an answer which goes in depth ..
At a minimum, every SQL Server database has two operating system files: a data file and a log file. They are usually in this location
c:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\data\
So, you could first find out the current physical address of these two files. secondly, shut down the database. Thirdly copy and paste them into a new location. Last, restart the database, and attach these two files from the chosen new location to you database instance.