DB Mirroring - Moving MDF and LDF files

  • Ed7

    SSCrazy Eights

    Points: 8352

    I have two VM that setup and configure with databasemirroring.

    • Principal and Mirror

    There are SQL Server 2012 SP2 that running on O/S WindowsServer 2012 R2.

    When I was assigned to troubleshooting the performanceissues.  My first initial research, Ifound the MDF and LDF files are located in C drive.

    Then, I am planning to move MDF and LDF files from C driveto  P and L drives.

    I have setup a test lab with Two VM and SQL 2012 mirroring.Then I tried to move the MDF and LDF files.

    But ran into issues and the databases mirroring promptedwarning and error messages when I moved MDF and LDF files.

    Questions:

    • Will Database Mirroring allow to move MDF andLDF files?

    Thank you in advance for your help.

    -Edwin

  • Arsh

    SSCertifiable

    Points: 6031

    Ed7 - Monday, September 18, 2017 10:10 AM

    I have two VM that setup and configure with databasemirroring.

    • Principal and Mirror

    There are SQL Server 2012 SP2 that running on O/S WindowsServer 2012 R2.

    When I was assigned to troubleshooting the performanceissues.  My first initial research, Ifound the MDF and LDF files are located in C drive.

    Then, I am planning to move MDF and LDF files from C driveto  P and L drives.

    I have setup a test lab with Two VM and SQL 2012 mirroring.Then I tried to move the MDF and LDF files.

    But ran into issues and the databases mirroring promptedwarning and error messages when I moved MDF and LDF files.

    Questions:

    • Will Database Mirroring allow to move MDF andLDF files?

    Thank you in advance for your help.

    -Edwin

    What does the error message say ? I believe you can't move the database files without breaking the mirror.

  • Perry Whittle

    SSC Guru

    Points: 233784

    Ed7 - Monday, September 18, 2017 10:10 AM

    I have two VM that setup and configure with databasemirroring.

    • Principal and Mirror

    There are SQL Server 2012 SP2 that running on O/S WindowsServer 2012 R2.

    When I was assigned to troubleshooting the performanceissues.  My first initial research, Ifound the MDF and LDF files are located in C drive.

    Then, I am planning to move MDF and LDF files from C driveto  P and L drives.

    I have setup a test lab with Two VM and SQL 2012 mirroring.Then I tried to move the MDF and LDF files.

    But ran into issues and the databases mirroring promptedwarning and error messages when I moved MDF and LDF files.

    Questions:

    • Will Database Mirroring allow to move MDF andLDF files?

    Thank you in advance for your help.

    -Edwin

    Break the mirror, move the files on the primary, then take a new backup and use to re intialise the new mirror.
    Will save yourself a whole load of time

    -----------------------------------------------------------------------------------------------------------

    [font="Tahoma"]"Ya can't make an omelette without breaking just a few eggs"[/font] 😉

  • Ed7

    SSCrazy Eights

    Points: 8352

    Thank you, All for your input.  The feedback answered my questions.

  • gerald72

    SSC Enthusiast

    Points: 185

    Hi,
    with minimum downtime I would have done it this way (same solution testet with alwayson ag's)
    1 break mirror and restore mirror partner DB with norecovery moving the files to the new location. restore DIFF and/or log backups with norecovery.
    2 set up mirror again
    3 fail over to the newly restored DB
    4 restore the former primary DB using step 1
    5 set up mirror again
    6 failback or leave it on the other side

    voila - DB moved with minimal downtime.

    BR
    Gerald

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply