Question

Environment: SQL 2016 SP1, AG with 2 replicas, sync commit, no readable secondary. 1 file in the PRIMARY FG, 1 for the index FG. Problem: How to move the files for a database in this AG, from the current disk to a new disk, with no downtime, not taking it out of AG ?

I'd try to add a file to each file group, on the new disk, run shhrinkfile emptyfile, remove the empty files from the old disk, all on the primary. Log file will stay on the old disk. Not sure how to do it on the secondary.

Can someone please confirm I'm on the correct path, or improve on it, please ? Thank you.

Was it helpful?

Solution

Took me some time to test it but this actually works.

Step 1

Add the new disks to both nodes of the SQL Server Availability group

Step 2

Stop the SQL Server service of your passive node

Step 3

Move the SQL Server database files from the old disk to the new disk

Step 4

Adjust the drive letter of the original disk to another letter using f.e. diskpart

Step 5

Rename the disk where you move the database files to to the drive letter of the original disk

For Example= Old disk D: --> renamed to F: New Disk E: --> renamed to D:

Step 6

Restart SQL Service on Passive node and wait untill everything is back into sync.

Step 7

Failover to the passive node & do the exact same process on your previously active node.

Downtime?

If you follow this process you will have no downtime, except for the failover of your availability group.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top