Exchange 2007–Using LCR to perform an online offline database seed.
When using continuous replication in Exchange 2007, an operation that sometimes needs to be performed is a database seed. This operation is first performed as part of enabling replication, and thereafter it is performed infrequently as part of the process for recovering from divergence.
There are a few ways to perform a database seed, but seeding is most often performed by using the Update-StorageGroupCopy cmdlet. With this cmdlet, an ESE streaming backup is performed on the source database and the backup copy is then copied to the target.
Another way to seed a database copy is to perform a manual offline seeding. In this operation, the source database is dismounted, verified to be in a clean shutdown state, and then manually copied offline to the target. This can obviously be inconvenient, since the source database has to be down while the copy procedure is being performed.
A third method is to use a VSS backup of the database to seed the database copy, which I discuss in my previous post, Exchange 2007 – Using VSS to perform an online offline database seed.
Finally, yet another method is to utilize LCR as an SCR seeding source. In this blog post, I’ll show you how to do that.
====================================
The first step is to enable LCR for the source database by using the Enable-DatabaseCopy and Enable-StorageGroupCopy cmdlets.
(LCR)
Enable-DatabaseCopy –Identity <ServerName\DatabaseName> –CopyEdbFilePath “path\database.edb”
If you have already enabled continuous replication for the storage group, proceed to the second step.
====================================
The second step is to enable standby continuous replication on the storage groups by using the Enable-StorageGroupCopy cmdlet.
(SCR)
Enable-StorageGroupCopy –Identity <ServerName\StorageGroupName> –StandbyMachine <SCRTargetName> –SeedingPostponed
For more information on enabling SCR, please see my blog post at https://blogs.technet.com/timmcmic/archive/2009/01/22/inconsistent-results-when-enabling-standby-continuous-replication-scr-in-exchange-2007-sp1.aspx
If you have already enabled continuous replication for the storage group, proceed to the third step.
====================================
The third step is to suspend the storage group copy. Storage group copies can be suspended either in bulk or one at a time. The following are example commands:
(All Storage Groups)
Get-StorageGroup –Server <SourceServerName> | Suspend-StorageGroupCopy –StandbyMachine <TargetMachineName>
(Single Storage Group)
Suspend-StorageGroupCopy –Identity <ServerName\StorageGroupName> –StandbyMachine <TargetMachineName>
It is important that in the SCR environment these commands are run on both the source and target servers. All servers should indicate a suspended status, reflecting that both Active Directory replication and the Microsoft Exchange Replication service configuration updates occurred successfully.
====================================
The fourth step is to note the important paths that are necessary to complete the rest of these steps. Specifically, we are interested in the storage group log file path, the system folder path and copy system folder path, and the log file prefix. For the mailbox database we are interested in the database file path and copy database file paths.
To get all paths for all storage groups on the source, use the following command:
Get-StorageGroup –Server <ServerName> | fl Name,LogFolderPath,SystemFolderPath,CopyLogFolderPath,CopySystemFolderPath,LogFilePrefix
This will give you a formatted list of storage group names, log paths, and system paths.
To get the paths for all mailbox databases, use the following command:
Get-MailboxDatabase –Server <ServerName> | fl Name,EdbFilePath,CopyEdbFilePath
This will give you a formatted list of mailbox database names and mailbox database paths.
Here is an example of the output you can expect to see (copy path attributes will only be populated if you are utilizing LCR):
Name : Mailbox Database LCR
EdbFilePath : d:\SG1\DB1.edb
CopyEdbFilePath : d:\SG1-LCR\DB1.edb
Name : Mailbox Database CCR or SCR
EdbFilePath : d:\SG2\DB2.edb
CopyEdbFilePath :
Name : Storage Group LCR
LogFolderPath : d:\SG1
SystemFolderPath : d:\SG1
CopyLogFolderPath : d:\SG1-LCR
CopySystemFolderPath : d:\SG1-LCR
LogFilePrefix : E00
Name : Storage Group CCR or SCR
LogFolderPath : d:\SG2
SystemFolderPath : d:\SG2
CopyLogFolderPath :
CopySystemFolderPath :
LogFilePrefix : E01
====================================
The fifth step is to verify that the source log file sequence is in order. If the source log file sequence has been manually manipulated, and if any log file gaps are present, this results in a failure of the seed operation. This step ensures that log files are in sequence on the source machine.
To ensure that the log sequence on the source machine is in the correct order, perform the following operations:
1. Open a command prompt and navigate to the log directory of the storage group. This path can be found from the output gathered in step 3 above.
2. Run the following eseutil command:
eseutil /ml <LogFilePrefix>
The log file prefix can be found from the output gathered in step 3.
When you run this command it will scan every log file found in the source directory. If any gaps or errors are identified, you cannot continue with these steps. If the command completes and errors on the last log file in the series this is expected, as the Exx.log is currently open for writing and cannot be scanned. The following is sample output that you should receive for a storage group that is online.
Extensible Storage Engine Utilities for Microsoft(R) Exchange Server
Version 08.02
Copyright (C) Microsoft Corporation. All Rights Reserved.
Initiating FILE DUMP mode...
Verifying log files...
Base name: e00
Log file: d:\SG1\E0000001353.log - OK
Log file: d:\SG1\E0000001354.log - OK
Log file: d:\SG1\E0000001355.log - OK
Log file: d:\SG1\E0000001356.log - OK
Log file: d:\SG1\E0000001357.log - OK
Log file: d:\SG1\E0000001358.log - OK
Log file: d:\SG1\E0000001359.log - OK
Log file: d:\SG1\E000000135A.log - OK
Log file: d:\SG1\E000000135B.log - OK
Log file: d:\SG1\E000000135C.log - OK
Log file: d:\SG1\E000000135D.log - OK
Log file: d:\SG1\E000000135E.log - OK
Log file: d:\SG1\E000000135F.log - OK
Log file: d:\SG1\E0000001360.log - OK
Log file: d:\SG1\E0000001361.log - OK
Log file: d:\SG1\E0000001362.log - OK
Log file: d:\SG1\E0000001363.log - OK
Log file: d:\SG1\E0000001364.log - OK
Log file: d:\SG1\E0000001365.log - OK
Log file: d:\SG1\E0000001366.log - OK
Log file: d:\SG1\E0000001367.log - OK
Log file: d:\SG1\E0000001368.log - OK
Log file: d:\SG1\E0000001369.log - OK
Log file: d:\SG1\E00.log
ERROR: Cannot open log file (d:\SG1\E00.log). Error -1032.
Operation terminated with error -1032 (JET_errFileAccessDenied, Cannot access file, the file is locked or in use) after 368.625 seconds.
====================================
The sixth step is to prepare the LCR copies for use in the SCR seeding process. This starts by verifying the health of the LCR copies.
To verify the health of the LCR copies, on the server hosting the LCR databases run get-storagegroupcopystatus. If any database shows a status of other than healthy this will need to be corrected before continuing with these instructions.
Get-StorageGroupCopyStatus
Name SummaryCopySt CopyQueueLeng ReplayQueueL LastInspecte
atus th ength dLogTime
---- ------------- ------------- ------------ ------------
MBX-1-SG1 Healthy 0 0 3/6/2011 ...
====================================
The seventh step is to ensure that the target paths are ready to have the database moved in place. The paths referenced in these steps can be obtained from the output gathered in step 3.
For SCR – ensure that the logFolderPath, systemFolderPath, and edbFilePath are empty on the SCR target.
At this point the destination paths are empty and ready for the database to be moved.
We now need to create the directory structure where logs, system, and database files will be copied.
For SCR - create the log, system, and database folder. In our example logs, system, and database files are located at d:\SG1. Therefore on the SCR target or CCR passive node I would create the directory structure d:\SG1.
If you are using nested folders you need to create the entire directory structure.
====================================
The eighth step is to move the restored database to the target directory. This can be accomplished a few different ways, but I will make a recommendation below.
To being the LCR database copies need to be suspended. This can be performed in bulk
get-storagegroup –server <LCRHost> | suspend-storagegroupcopy
The success of this command can be verified using get-storagegroupcopystatus.
Get-StorageGroupCopyStatus
Name SummaryCopySt CopyQueueLeng ReplayQueueL LastInspecte
atus th ength dLogTime
---- ------------- ------------- ------------ ------------
MBX-1-SG1 Suspended 0 0 3/6/2011 ...
The LCR database file can be located at the CopyEdbFile path noted in step four. Using a command prompt navigate to this location.
The SCR target location can be mapped as a network drive. We will assume for this example that the network drive Y is utilized.
Use eseutil to copy the database from the source directory to the target directory. The command using our example is:
eseutil /y SG1-DB1.edb /d y:\SG1-DB1.edb
Here is the expected output from this command:
Extensible Storage Engine Utilities for Microsoft(R) Exchange Server
Version 08.02
Copyright (C) Microsoft Corporation. All Rights Reserved.
Initiating COPY FILE mode...
Source File: SG1-DB1.edb
Destination File: y:\SG1-DB1.edb
Copy Progress (% complete)
0 10 20 30 40 50 60 70 80 90 100
|----|----|----|----|----|----|----|----|----|----|
...................................................
Operation completed successfully in 13.281 seconds.
At this point the copy has been seeded on the target server.
When the copy is completed the LCR replication can be resumed using
get-storagegroup –server <LCRHost> | resume-storagegroupcopy
Information on the usage of Eseutil can be found here. https://technet.microsoft.com/en-us/library/aa998249(EXCHG.80).aspx
====================================
The ninth step is to verify the health of the copied database. We need to ensure that the database was not damaged as a part of the copy process.
Log on locally to the SCR target, open a command prompt, and navigate to the database directory. In our example this would be d:\SG1.
Use Eseutil /k to perform a checksum of the database:
eseutil /k SG1-DB1.edb
The following output will be observed when the command completes:
Extensible Storage Engine Utilities for Microsoft(R) Exchange Server
Version 08.02
Copyright (C) Microsoft Corporation. All Rights Reserved.
Initiating CHECKSUM mode...
Database: SG1-DB1.edb
Temp. Database: TEMPCHKSUM3888.EDB
File: SG1-DB1.edb
Checksum Status (% complete)
0 10 20 30 40 50 60 70 80 90 100
|----|----|----|----|----|----|----|----|----|----|
...................................................
514 pages seen0 bad checksums
0 correctable checksums
129 uninitialized pages
0 wrong page numbers
0x4676 highest dbtime (pgno 0x86)
65 reads performed
4 MB read
1 seconds taken
4 MB/second
2755 milliseconds used
42 milliseconds per read
78 milliseconds for the slowest read
15 milliseconds for the fastest read
Operation completed successfully in 0.140 seconds.
We are interested in ensuring that there are 0 bad checksums (bolded line above).
====================================
The last step in the process is to resume the storage group copy:
Get-StorageGroup –Server <SourceServerName> | Resume-StorageGroupCopy –StandbyMachne <SCRTargetName>
(Note: This command resumes storage group copy for all storage groups. If you have a storage group that is suspended for another reason it may be necessary to resume storage groups individually).
When replication has resumed successfully, you can note the following events in the Application event log indicating that replication began copying log files.
Event Type: Information
Event Source: MSExchangeRepl
Event Category: Action
Event ID: 2084
Date: 3/16/2010
Time: 10:12:50 AM
User: N/A
Computer: SERVER
Description: Replication for storage group SERVER\Storage Group SCR or CCR has been resumed.
For more information, see Help and Support Center at https://go.microsoft.com/fwlink/events.asp.
Event Type: Information
Event Source: MSExchangeRepl
Event Category: Service
Event ID: 2114
Date: 3/16/2010
Time: 10:13:19 AM
User: N/A
Computer: SERVER
Description: The replication instance for storage group SERVER\Storage Group SCR or CCR has started copying transaction log files. The first log file successfully copied was generation 31201.
For more information, see Help and Support Center at https://go.microsoft.com/fwlink/events.asp.
====================================
The following are links to references from this post.
· Enable-StorageGroupCopy (https://technet.microsoft.com/en-us/library/aa996389(EXCHG.80).aspx)
· Enable-DatabaseCopy (https://technet.microsoft.com/en-us/library/aa996389(EXCHG.80).aspx)
· Suspend-StorageGroupCopy (https://technet.microsoft.com/en-us/library/aa998182(EXCHG.80).aspx)
· Get-StorageGroup (https://technet.microsoft.com/en-us/library/aa998331(EXCHG.80).aspx)
· Get-MailboxDatabase (https://technet.microsoft.com/en-us/library/bb124924(EXCHG.80).aspx)
· ESEUTIL (https://technet.microsoft.com/en-us/library/aa998249(EXCHG.80).aspx)
· Resume-StorageGroupCopy (https://technet.microsoft.com/en-us/library/bb124529(EXCHG.80).aspx)
====================================
Updates
6/26/11 – removed LCR enable step in step 1 that included seedingPostponed. This was not necessary.
====================================
Comments
Anonymous
January 01, 2003
Hello , one question If I may ? When you enbale LCR with Seeding postpone in steps 1) when you actually seed the DB in the LCR target and when you copy looks like I miss sthing Thanks TIMMCMIC lorenzAnonymous
January 01, 2003
@LorenzoG Good catch - I removed this stop as it does not apply and uploaded the changes. TIMMCMICAnonymous
January 01, 2003
@Anand Kumar Deva: Thanks! TIMMCMICAnonymous
May 06, 2011
Tim, Well explained and I really liked it. Thanks.