Share via


Move .ndf file to a different drive for secondary server

Question

Wednesday, October 16, 2013 4:46 AM

Hello

I have SQL server 2005 and database which one have .ndf file (.ldf and .mdf files are on D Drive and .ndf files is in C Drive- Some reason it is still in C Drive)- We configured log shipping and found that the .ndf files created on the c drive to my secondary server and my server c drive space almost full due to .ndf file.

I want to change drive path for only .ndf file, is it possible ? please suggest (I am assuming, need to stop log shipping for this task-)

Thanks Ranveer Katiyar

All replies (7)

Wednesday, October 16, 2013 9:28 AM ✅Answered

Thanks for your help!!!We missed one step after 7th . Required full backup restore with norecovery mode.

Thanks Ranveer Katiyar


Wednesday, October 16, 2013 4:54 AM

The below would be able to help you. It is great if you can move your ldf to different drive to avoid any IO contentions.

http://blogs.lessthandot.com/index.php/DataMgmt/DBAdmin/MSSQLServerAdmin/how-to-move-datafiles-to-a-new-drive-in

Please use Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful.


Wednesday, October 16, 2013 5:10 AM

Hi Ranveer, 

You need to stop and resume log shipping in order to move the files ! 

It can be done in two two ways .. 
1)Attach & Detach
2) Alter database <Database name) Modify file .....  Refer following link for syntax please 
[http://technet.microsoft.com/en-us/library/ms189133.aspx

](http://technet.microsoft.com/en-us/library/ms189133.aspx)

Thanks,Suhas vallala


Wednesday, October 16, 2013 6:27 AM

Hi Suhas

We will stop log shipping on primary database server and then move files on Secondary Database server for respective drive and again we will resume log shipping files correct ? 

Thanks Ranveer Katiyar


Wednesday, October 16, 2013 6:44 AM

Here is detailed explanation as how to Move SQL Server Log Shipping Secondary Database Files ! My earlier thread was bit incomplete information !

 

http://www.mssqltips.com/sqlservertip/2836/steps-to-move-sql-server-log-shipping-secondary-database-files/

Thanks,Suhas Vallala


Wednesday, October 16, 2013 6:53 AM

Hi Suhas

I did following and stuck please help me

1. Stop the log shipping for  MyDatabase
a. Disable log shipping job for MyDatabase
2. Go to Secondary Database Server
3. Restore database with latest transaction log files
4. Database will be in normal mode
5. Detach the database
6. Copy the database files to respective drive
7. Attach the database and files from respective drives
8. Enable the log shipping job
9. Run Logshipping job manually on Primaryand its work
10. Run Copy job on secondary and its also worked
11. Run restore job manually and its failed "Message
The job failed.  The Job was invoked by User sa.  The last step to run was step 1 (Log shipping restore log job step.)."

Thanks Ranveer Katiyar


Wednesday, October 16, 2013 7:07 AM

The error message you posted is no helpful :( .. Can you please provide me with bit more insight of error details

Thanks,Suhas Vallala