从be还原邮箱数据库文件和日志后,在ecp直接挂载会提示无法挂载,然后使用esentutl命令进行修复,修复完成后,再将用户邮箱关联到该数据库即可。
创建恢复数据库:
New-MailboxDatabase -Recovery -Name RDB1 -Server 0-IDC-S-MAIL003
New-MailboxDatabase -Recovery -Name VIP-bak -Server 0-IDC-S-MAIL003 -EdbFilePath "D:\MailboxDB-Bak\Exchange Server\VIP-DB\File\VIP-DB.edb" -LogFolderPath "D:\MailboxDB-Bak\Exchange Server\VIP-DB\Logs"
#----State:Dirty Shutdownn
esentutl -mh "D:\MailboxDB-Bak\Exchange Server\VIP-DB\File\VIP-DB.edb"
#----Checkpoint:
esentutl -mk D:\MailboxDB\SYSMDB-DB\SYSMDB-DB.edb
#----r
Eseutil -r E03 /l "D:\MailboxDB\EMP-DB\logs" /d "D:\MailboxDB\EMP-DB\EMP-DB.edb"
#----State:Clean Shutdown
eseutil -mh "D:\MailboxDB\SYSMDB-DB\SYSMDB-db.edb"
#----p
Eseutil /p "D:\MailboxDB-Bak\Exchange Server\VIP-DB\File\VIP-DB.edb"
Restart-Service MSExchangeIS
Mount-database SYSMDB-bak
#获取所有用户邮箱信息,会提示找不到数据库
$usersall = Get-Mailbox #-Database emp-db
$usersall.count
$usersall |select samaccountname |sort samaccountname,displyaname |more
#从恢复数据库中查找用户邮箱名称
$bak = Get-MailboxStatistics -Database sysmdb-bak
$bak.displayname
$bak.count
#批量设置用户邮箱到名为“vip-db”的数据库
foreach ($b in $bak[0..300])
{
if ($b.DisplayName -notlike "System*" -and $b.DisplayName -notlike "Health*" -and $b.DisplayName -notlike "就地存档*" -and $b.DisplayName -notlike "ServiceManager*")
{
$b.DisplayName
$usersall | ? {$_.DisplayName -eq $b.DisplayName}|set-mailbox -database "vip-db" -Confirm:$false -Force
}
}
(Get-Mailbox -Database vip-db).count
#恢复名为“zhangsan”的用户邮箱
$usersall | ? {$_.DisplayName -eq "zhangsan"}|set-mailbox -database "SYSMDB-DB" -Confirm:$false -Force
参考:
http://www.13sy.com/m/view.php?aid=1537
标签:edb,DisplayName,灾难,Exchange,恢复,DB,VIP,bak,MailboxDB From: https://blog.51cto.com/u_11508007/5954726