Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to move entire MSSQL7 Directory to another drive?

Status
Not open for further replies.

JohnBeals

Programmer
Feb 26, 2002
49
US
I need to move the entire installation of MS SQL 7 to another drive. It was installed on C:\MSSQL7, and now of course we're out of space on C: drive.

Can I back up the databases, uninstall SQL 7, install SQL 7 on the other drive and then restore the databases?

Thanks,
JB
 
You would find it easier to just move the databases and leave the installation on C:

Use the sp_detach_db and sp_attach_db calls to detach and attach the database files. For example, In Query Analyzer, use:

exec sp_detach_db 'MyDBName'

Then, move the files to their new location (say, D:\MyData)

Then use:
exec sp_attach_db @dbname=N'MyDBName',
@filename1=N'D:\MyData\MyDBName_Data.MDF',
@filename2=N'D:\MyData\MyDBName_Log.LDF'


 
Thanks Vanc,

I realize it would be easier, but not what I'm looking for. I need to physically move the directory structure (or backup, uninstall, reinstall and restore).

I'm looking for pitfalls to this, or the BKM for doing this move.

Thanks,
JB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top