Share via


Exchange 2016 Microsoft.Exchange.Server.Storage.Common.DuplicateKeyException

Question

Monday, April 10, 2017 8:09 AM

Hi all,

I have upgraded our exchange server from 2010 to 2016 and then I'm receiving a lot of event Id 1002 error. description is below:

Unhandled exception (Microsoft.Exchange.Server.Storage.Common.DuplicateKeyException: JetTableOperator.Insert > Microsoft.Isam.Esent.Interop.EsentKeyDuplicateException: Illegal duplicate key
   at Microsoft.Isam.Esent.Interop.Api.Check(Int32 err)
   at Microsoft.Isam.Esent.Interop.Server2003.Server2003Api.JetUpdate2(JET_SESID sesid, JET_TABLEID tableid, Byte[] bookmark, Int32 bookmarkSize, Int32& actualBookmarkSize, UpdateGrbit grbit)
   at Microsoft.Exchange.Server.Storage.PhysicalAccessJet.JetTableOperator.Insert(IList`1 columns, IList`1 values, Column identityColumnToFetch, Boolean unversioned, Boolean ignoreDuplicateKey, Object& identityValue)
   End of inner exception stack trace
   at Microsoft.Exchange.Server.Storage.PhysicalAccessJet.JetTableOperator.Insert(IList`1 columns, IList`1 values, Column identityColumnToFetch, Boolean unversioned, Boolean ignoreDuplicateKey, Object& identityValue)
   at Microsoft.Exchange.Server.Storage.PhysicalAccessJet.JetInsertOperator.ExecuteScalar()
   at Microsoft.Exchange.Server.Storage.PhysicalAccess.DataRow.Insert(IConnectionProvider connectionProvider, Boolean flushLargeDirtyStreams)
   at Microsoft.Exchange.Server.Storage.StoreCommonServices.ObjectPropertyBag.Flush(Context context, Boolean flushLargeDirtyStreams)
   at Microsoft.Exchange.Server.Storage.LogicalDataModel.Item.Flush(Context context, Boolean flushLargeDirtyStreams)
   at Microsoft.Exchange.Server.Storage.LogicalDataModel.Message.Flush(Context context, Boolean flushLargeDirtyStreams)
   at Microsoft.Exchange.Server.Storage.LogicalDataModel.Item.SaveChanges(Context context)
   at Microsoft.Exchange.Server.Storage.LogicalDataModel.Message.SaveChanges(Context context)
   at Microsoft.Exchange.Server.Storage.LogicalDataModel.TopMessage.SaveChanges(Context context, SaveMessageChangesFlags flags)
   at Microsoft.Exchange.Protocols.MAPI.MapiMessage.SaveChangesInternal(MapiContext context, MapiSaveMessageChangesFlags saveFlags, ExchangeId& newMid)
   at Microsoft.Exchange.Protocols.MAPI.MapiMessage.SaveChanges(MapiContext context, MapiSaveMessageChangesFlags saveFlags, ExchangeId& newMid)
   at Microsoft.Exchange.Server.Storage.MapiDisp.RopHandler.SaveChangesMessage(MapiContext context, MapiMessage message, SaveChangesMode saveChangesMode, SaveChangesMessageResultFactory resultFactory)
   at Microsoft.Exchange.Server.Storage.MapiDisp.RopHandlerBase.SaveChangesMessage(IServerObject serverObject, SaveChangesMode saveChangesMode, SaveChangesMessageResultFactory resultFactory)
   at Microsoft.Exchange.RpcClientAccess.Parser.RopSaveChangesMessage.InternalExecute(IServerObject serverObject, IRopHandler ropHandler, ArraySegment`1 outputBuffer)
   at Microsoft.Exchange.RpcClientAccess.Parser.InputRop.Execute(IConnectionInformation connection, IRopDriver ropDriver, ServerObjectHandleTable handleTable, ArraySegment`1 outputBuffer)
   at Microsoft.Exchange.RpcClientAccess.Parser.RopDriver.ExecuteRops(List`1 inputArraySegmentList, ServerObjectHandleTable serverObjectHandleTable, ArraySegment`1 outputBuffer, Int32 outputIndex, Int32 maxOutputSize, Boolean isOutputBufferMaxSize, Int32& outputSize, AuxiliaryData auxiliaryData, Boolean isFake, Byte[]& fakeOut)
   at Microsoft.Exchange.RpcClientAccess.Parser.RopDriver.ExecuteOrBackoff(IList`1 inputBufferArray, ArraySegment`1 outputBuffer, Int32& outputSize, AuxiliaryData auxiliaryData, Boolean isFake, Byte[]& fakeOut)
   at Microsoft.Exchange.Server.Storage.MapiDisp.MapiRpc.<>c__DisplayClass9.<DoRpc>b__6(MapiContext operationContext, MapiSession& session, Boolean& deregisterSession, AuxiliaryData auxiliaryData)
   at Microsoft.Exchange.Server.Storage.MapiDisp.MapiRpc.Execute(IExecutionDiagnostics executionDiagnostics, MapiContext outerContext, String functionName, Boolean isRpc, IntPtr& contextHandle, Boolean tryLockSession, String userDn, IList`1 dataIn, Int32 sizeInMegabytes, ArraySegment`1 auxIn, ArraySegment`1 auxOut, Int32& sizeAuxOut, ExecuteDelegate executeDelegate)).

All replies (4)

Tuesday, April 11, 2017 4:25 AM ✅Answered

1. Check your System Event logs to ensure you don't have something disk related occurring and if so correct those issues first.

2. Make a copy of the problem database onto another location for safe keeping

3. I would then create a new DB and move all mailboxes into the new DB or at least as many of them as possible

4. Monitor the new database during the moves to ensure the issue is not occurring within the new database

5. After completing the move, IF there are any that did not move you will want to run an eseutil /P against the database and if it completes without issue run an eseutil /d and upon completion remount that DB and move the remaining mailboxes to the new DB. 

6. Once all mailboxes are moved you can delete the old mailbox and monitor the new system.

You should also of course ensure your getting good backups and that the 2016 system is fully patched

Search, Recover, Export Mailboxes, Folders, Email, Contacts, Calendars, Tasks, etc. from Offline Exchange Databases (EDBs), On-Premise Exchange Servers and Office 365. Migrate/Recover direct from any offline EDB into any On-Premises Exchange Server, even cross version i.e. 2003 → 2007 → 2010 →2013 → 2016 → Office 365 with Lucid8's DigiScope


Tuesday, April 11, 2017 9:49 AM ✅Answered

Hi Sadegh,

I met a similar case before, probable cause was database had corrupted. You can refer to the above suggestion to create a new database and move mailboxes into it, then delete the old database.

Best Regards,

Niko Cheng
TechNet Community Support

Please remember to mark the replies as answers.
If you have feedback for TechNet Subscriber Support, contact [email protected].


Thursday, April 13, 2017 4:56 AM

Thank you.


Thursday, April 13, 2017 4:57 AM

Thank you.