Sunday, February 24, 2008

Exchange2007: LCR--Storage Group and its databases

Local Continuous Replication

LCR supports direct-attached storage as well as storage connected by Fibre Channel or iSCSI.

Create a storage group: Kinko Storage Group
[PS] C:\>new-StorageGroup -Server 'W2008' -Name 'Kinko Storage Group' -LogFolderPath 'C:\Program Files\Microsoft\Exchange Server\Mailbox\Kinko Storage Group' -SystemFolderPath 'C:\Program Files\Microsoft\Exchange Server\Mailbox\Kinko Storage Group' -HasLocalCopy $true -CopyLogFolderPath 'G:\LocalCopies\Kinko Storage Group\Logs' -CopySystemFolderPath 'G:\LocalCopies\Kinko Storage Group\Systems'

[PS]C:\>new-mailboxdatabase -StorageGroup 'W2008\Kinko Storage Group' -Name 'Staff' -EdbFilePath 'C:\Program Files\Microsoft\Exchange Server\Mailbox\Kinko Storage Group\Staff.edb' -HasLocalCopy $true -CopyEdbFilePath 'G:\LocalCopies\Kinko Storage Group\Staff.edb'

[PS]C:\>mount-database -Identity 'Kinko Storage Group\Staff'

[PS] C:\>$password =Read-host "Enter password:" -AsSecureString

[PS] C:\>New-Mailbox -Name 'Kim Funny' -Alias 'KFunny' -OrganizationalUnit 'Itsyou.com/Users' -UserPrincipalName 'KFunny@Itsyou.com' -SamAccountName 'KFunny' -FirstName 'Kim' -Initials '' -LastName 'Funny' -Password $password -ResetPasswordOnNextLogon $false -Database 'W2008\Kinko Storage Group\Staff'

[PS] C:\>New-Mailbox -Name 'Albert Tonny' -Alias 'ATonny' -OrganizationalUnit 'Itsyou.com/Users' -UserPrincipalName 'ATonny@Itsyou.com' -SamAccountName 'ATonny' -FirstName 'Albert' -Initials '' -LastName 'Tonny' -Password $password -ResetPasswordOnNextLogon $false -Database 'W2008\Kinko Storage Group\staff'

=====
Suppose the Kinko Storage Group does not have the LCR enabled;

You enable the LCR for the database first and then the Kinko Storage Group.

[PS]C:\>enable-DatabaseCopy -Identity 'W2008\Kinko Storage Group\Staff' -CopyEdbFilePath 'G:\LocalCopies\Kinko Storage Group\Staff.edb'

[PS]C:\>enable-StorageGroupCopy -Identity 'W2008\Kinko Storage Group' -CopyLogFolderPath 'G:\LocalCopies\Kinko Storage Group\Logs' -CopySystemFolderPath 'G:\LocalCopies\Kinko Storage Group\Systems'

====
When you database cannot be mounted, the first defence is to run the Restore-StorageGroupCopy.

Suppose the Kinko Storage Group\Staff.edb cannot be mounted.

[PS] C:\>Dismount-Database -Identity 'Kinko Storage Group\Staff'

[PS] C:\>restore-StorageGroupCopy -Identity 'W2008\Juno Storage Group' -ReplaceLocations

[PS] C:\>Mount-Database -Identity 'Kinko Storage Group\staff'

=====
Seed
Seeding--copying the active mailbox database to the LCR location.
Automatic seeding only occurs during the creation of a new server, creation of a new storage group and database, or on a database that has never been backed up.

Because my default First Storage Group has not been backed up, the Enable-DatabaseCopy and Enable-StorageGroupCopy cmdlets will automatically seed the target LCR directories.

[PS]C:\>enable-DatabaseCopy -Identity 'W2008\First Storage Group\Mailbox Database' -CopyEdbFilePath 'G:\First Storage Group\Mailbox Database.edb'
[PS]C:\>enable-StorageGroupCopy -Identity 'W2008\First Storage Group' -CopyLogFolderPath 'G:\First Storage Group\Logs' -CopySystemFolderPath 'G:\First Storage Group\Systems'

====
How about you want to reseed or resynchronize the LCR copy (passive copy)?
Why do you do that?
You have a corrupt LCR copy and you want to invalidate the passive copy.

suspend-StorageGroupCopy -Identity 'W2008\First Storage Group' -SuspendComment 'Administrator initiated Update-StorageGroupCopy'
update-StorageGroupCopy -Identity 'W2008\First Storage Group' -DeleteExistingFiles

===
Verifying LCR copy

[PS] C:\Windows\System32>suspend-StorageGroupCopy -Identity 'W2008\First Storage Group' -SuspendComment 'Administrator initiated Update-StorageGroupCopy'

[PS] C:\Windows\System32>eseutil /k 'G:\First Storage Group\Mailbox Database.edb'
[PS] C:\Windows\System32>Resume-StorageGroupCopy -Identity 'W2008\First StorageGroup'
====