Exchange 2010 – How to move edb file (Move-DatabasePath)


21.1.2013

I had to change storage for one database in DAG (two nodes). I wanted to also keep the path for database file and log folder same like before.

I got a new storage available as mounted point F:\DB1 on both nodes (it needs to be on both nodes because of DAG) and had following configuration:

Get-MailboxDatabase | ft Name,LogFolderPath, EdbFilePath
Name    LogFolderPath EdbFilePath
----    ------------- -----------
DB01    F:\DB01       F:\DB01\DB01.edb

We can change/move database quite simple via EMC or EMS. I like PowerShell so I used Exchange Management Shell and build-in cmdlet Move-DatabasePath:

  • This cmdlet fails if it’s run while the database is being backed up.
  • If the specified database is mounted when this cmdlet is run, the database is automatically dismounted and then remounted, and is unavailable to users while it’s dismounted.
  • This cmdlet normally can be run on the affected Mailbox server only. An exception is that this cmdlet can be run on an administrator’s workstation when using the ConfigurationOnly parameter with a value of $true.
  • This cmdlet can’t be run against replicated mailbox databases. To move the path of a replicated database, you must first remove all replicated copies, and then you can perform the move operation. After the move operation is complete, you can add copies of the mailbox database.

Well, I performed following steps:

  • Move active mailbox database on server with ActivationPreference number 1. It prevents to lose information about the preference because of two nodes (If you have more nodes, you should save original declaration of ActivationPreference).
Get-MailboxDatabase DB01 | fl name, ActivationPreference 
Name : DB01
ActivationPreference : {[ServerA, 1], [ServerB, 2]}

Move-ActiveMailboxDatabase DB01 -ActivateOnServer ServerA –MountDialOverride lossless
  • Remove mailbox database copy
Remove-MailboxDatabaseCopy -Identity DB01\ServerB
  • Move database file and log folder (database will be dismounted, moved and mounted itself). I also manually copied database file (DB01.edb) from F:\DB01 to F:\DB1 on ServerB (passive node) because it prevents to do the seeding (the process in which a copy of a mailbox database is added to another Mailbox server in a database availability group (DAG)).
Move-DatabasePath -Identity DB01 -EdbFilePath F:\DB1\DB01.edb -LogFolderPath F:\DB1
  • After the moving (Move-DatabasePath passed ok/ the database was mounted + copy process was also done on passive node). I dismounted the database manually (Dismount-Database DB01) and renamed mounted points on both nodes (F:\DB01 → F:\DB01OLD, F:\DB1 → F:\DB01) and used cmdlet Move-DatabasePath with parameter ConfigurationOnly (The ConfigurationOnly switch specifies whether the configuration of the database changes without moving any files. A value of $true changes the configuration. A value of $false changes the configuration and moves the files. The default value is $false.).
Move-DatabasePath -Identity DB01 -EdbFilePath F:\DB01\DB01.edb -LogFolderPath F:\DB01 -ConfigurationOnly:$true
  • After that, I mounted the database manually (Mount-Database DB01) and create database copy on ServerB (parameter ActivationPreference was not needed at this point, but could be useful for you and more copies)
Add-MailboxDatabaseCopy -Identity DB01 -MailboxServer ServerB -ActivationPreference 2
  • Index Catalog rebuilding for the database was needed (old index related folder can be removed new one is consequently created)
Get-Service MSExchangeSearch | Stop-Service
Get-Service MSExchangeSearch | Start-Service
  • Check
get-mailboxserver|Get-MailboxDatabaseCopyStatus| ft -a
Name Status CopyQueueLength ReplayQueueLength LastInspectedLogTime ContentIndexState
---- ------ --------------- ----------------- -------------------- -----------------
DB01\ServerA Mounted 0 0 Crawling
DB03\ServerB Mounted 0 0 Crawling
  • The database had about 200 GB so the ContentIndexState was in “Crawling” state many hours but it was changed to “Healthy” state itself. Good to know that: If we do not have “Healthy” ContentIndexState, we cannot do failover process (Move-ActiveMailboxDatabase) and end-users are not able to search mailbox content.

Technet.microsoft.com: Move the Database Path

Social.technet.microsoft.com: Edb.irs.raw file

Cannot Activate Database Copy: Content Index Catalog Files in Failed State

ContentIndexState STILL CRAWLING?

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s