Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Moving Mirror mdf and ldf files to another drive Expand / Collapse
Author
Message
Posted Monday, April 08, 2013 12:49 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, January 14, 2014 5:10 PM
Points: 20, Visits: 166
I'm currently running SQL Server 2008 R2 Enterprise with 3 servers in an active / passive / witness high availability mirror.

As a part of planned maintenance, I've added new storage space to my mirror server. I now need to move the files to those new hard drives. Note that the primary database server will be untouched, this maintenance is only needed for the mirror server.

At first, I had thought I could remove the mirroring, detach the mirror database, and re-attach it in the new location. However, as the mirror database is still in NORECOVERY, detach isn't available.

If I restore the mirror WITH RECOVERY, it starts a new recovery fork and I will not be able to restart mirroring.

I could fail the database over to the mirror, detach / reattach / restart mirroring but this will take the database offline, which I need to avoid.

I could also do a FULL restore from backup to the mirror database, but it is quite large and this will take quite some time. I was hoping for an faster option.

Can anyone point me in the right direction?



Post #1439982
Posted Monday, April 08, 2013 1:53 PM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Yesterday @ 2:13 PM
Points: 2,748, Visits: 2,957
Here's an idea from the SQLCAT team. I assume it would work with data files as well. I would test this thoroughly in a test environment first.

http://sqlcat.com/sqlcat/b/msdnmirror/archive/2010/04/05/moving-the-transaction-log-file-of-the-mirror-database.aspx
Post #1440011
Posted Monday, April 08, 2013 3:34 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, January 14, 2014 5:10 PM
Points: 20, Visits: 166
Thank you very very very much for that article.

I'll be testing that on my dev server and if it goes we'll I'll run it on the real one tonight.



Post #1440037
Posted Tuesday, April 09, 2013 12:53 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, January 14, 2014 5:10 PM
Points: 20, Visits: 166
Just to update, that worked perfectly. And to reiterate, here's what I did:

1. Connect to the Mirror DB Server, open SSMS
2. Execute this script to find the file names:
USE master 
SELECT name, physical_name
FROM sys.master_files
WHERE database_id = DB_ID('<dbname>');

3. Execute this script on the Mirror DB
ALTER DATABASE &lt;dbname&gt; MODIFY FILE (NAME = &lt;file&gt;, FILENAME = '&lt;newpath&gt;')

I get a notification:
The file "&lt;file&gt;" has been modified in the system catalog. The new path will be used the next time the database is started.

4. Stop the Mirror Server services.
5. Copy the files to the new locations.
6. Start the Mirror Server services.
7. Wait for everything to sync up again.
8. Delete the old files.



Post #1440171
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse