Wednesday, March 7, 2012

New Install, But I Need to Move Data Files

I could really use some help on this one. I know virtually nothing about SQL Server. We installed this because our database for the application we're running (Lexis Nexis Time Matters) had gotten too large for the Express 2005 version. We've also installed a new version of the software, and on a new server.

The new server has the drive partitioned into two partitions. When installing the application, I selected drive D (545 gb) as the data drive, but when I installed SQL server, it was installed on drive C (12 gb). I did not realize that the the application data was simply configuration information, and the data for the program is actually being installed on the C drive (\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data).

Is there a simple procedure to move this data, including the SQL instance (TIMEMATTERS) to the D drive? Or should I uninstall and start over?

If possible it would be better to uninstall SQL Server and reinstall it.

When installing SQL Server when you get to the page which asks you what services you want to install (the screen has 5 or 6 check boxes on it) you have to click on the Advanced Button to change the drive that SQL Server installs to.

If you can't uninstall the SQL Server you can detach the database (right click on the database and select "Tasks", then "Detach").

Then go move the physical MDF and LDF files for the database to the D drive (I recommend to a folder name D:\MSSQL\MSSQL.1\MSSQL\Data\).

Then in the SQL Management Studio right click on Databases, and select "Attach". Browse to the folder that you moved the MDF and LDF to and select the MDF file. Validate that the LDF is shown with the correct path (you may need to change it) then click OK (or what ever the correct name for the button is).

This will reattach the database so that users can access it and your application will begin working again.

Please keep in mind that your users will NOT be able to access the application while you are doing this, so it should be done after hours to minimize the impact.

No comments:

Post a Comment