Question : Moving Transaction logs and Preserving File Groups

I have recently set up my nice new SQL 2000 server and I have split the
database files from the transaction log files, so that the log files are on a
different spindle to the datafiles, that I am hoping to get better performance.

I have been using the Knowledge base article KB224071 to move the databases around
and I have managed this fine until I installed the backend for a new piece of software.

Once the installation and datatransfer had completed, I was presented with this monstrosity.


name      fileid filename                           filegroup   usage    
--------- ------ ---------------------------------- ----------- ---------
RE7       1      D:\SQLDataFiles\RE7\re7.mdf        PRIMARY     data only
RE7_log   2      D:\SQLDataFiles\RE7\re7_log.ldf    NULL        log only
re7_bio   3      D:\SQLDataFiles\RE7\re7_bio.mdf    BIO         data only
re7_gift  4      D:\SQLDataFiles\RE7\re7_gift.mdf   GIFT        data only
re7_index 5      D:\SQLDataFiles\RE7\re7_index.mdf  INDEX       data only
re7_temp  6      D:\SQLDataFiles\RE7\re7_temp.mdf   TEMP        data only

Luckily, the installation let me ut the datafiles in the location that I need, my
problem now is to move the transaction log.

How do I change the location of the Transaction Log?

Answer : Moving Transaction logs and Preserving File Groups

there are 2 options, for each you need first to ensure that there are no user connections on the database before starting:
1) use sp_detach_db to detach the database, then move the physical files around, and then use sp_attach_db to reattach the database back, first parameter the database name, then all the files with full path

2) backup the database (to disk), when done (immediately) issue a restore. During the restore, there is a MOVE option to specify where you want to place each individual file

Cheers
Random Solutions  
 
programming4us programming4us