How to move SQL Server databases to a new drive.

5 pts.
Tags:
SQL Server 2000
SQL Server 2005
SQL Server Database Migration
SQL Server databases
I have installed all my databases (nice_cls and nice_audit) in D:/ drive and need to move them to E:/ drive.

Answer Wiki

Thanks. We'll let you know when a new response is added.

First, backup your databases in case something goes wrong.

Then, use the sp_detach_db and sp_attach_db system procedures to detach and then attach your databases. If users are trying to connect it may help to set single user mode on the databases.

After you detach the database with sp_detach_db you can move the files, then use sp_attach_db to attach them back to the SQL Server.

If you want to move the system databases it is a bit more tricky, involving setting a trace flag, moving the mdf and ldf files, stopping and starting the server, and finally changing the location of the master database. There are some gotchas possible in doing this.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following