SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Moving Mirror mdf and ldf files to another drive


Moving Mirror mdf and ldf files to another drive

Author
Message
jeffkretz
jeffkretz
SSC Journeyman
SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)

Group: General Forum Members
Points: 76 Visits: 219
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?



JeremyE
JeremyE
SSCarpal Tunnel
SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)

Group: General Forum Members
Points: 4256 Visits: 4057
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
jeffkretz
jeffkretz
SSC Journeyman
SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)

Group: General Forum Members
Points: 76 Visits: 219
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.



jeffkretz
jeffkretz
SSC Journeyman
SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)SSC Journeyman (76 reputation)

Group: General Forum Members
Points: 76 Visits: 219
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 <dbname> MODIFY FILE (NAME = <file>, FILENAME = '<newpath>')


I get a notification:
The file "<file>" 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.



Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search