We have recently restored a database from a backup. We are seeing in some of our tables the following error "Exception occurred while inserting data. (SQL State: 23000, Error Code: 2627) . Cannot insert duplicate key in object '' Are there steps that should be taken when a database is restored to ensure that the unique id is sequenced correctly? Caused by: com.mendix.systemwideinterfaces.connectionbus.ConnectionBusException: Exception occurred while inserting data. (SQL State: 23000, Error Code: 2627) at com.mendix.connectionbus.connections.jdbc.JDBCDataStore.getCorrectException(JDBCDataStore.java:1197) Caused by: java.sql.BatchUpdateException: Violation of PRIMARY KEY constraint 'PK__quoteand__3213E83F3508D0F3'. Cannot insert duplicate key in object 'db_owner.questions$questions'. The duplicate key value is (81909218223128993). at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeBatch(SQLServerPreparedStatement.java:1239) at org.apache.commons.dbcp2.DelegatingStatement.executeBatch(DelegatingStatement.java:345) at org.apache.commons.dbcp2.DelegatingStatement.executeBatch(DelegatingStatement.java:345)
Perhaps a longshot, but if you are performing a full database then you might just first delete the database , create a new empty one and then restore it?