See below timeline:
1 - 04:58 (Server A) - REORG of PK index on Table1 in DB_XXX started.
2 - 05:00 (Server A) - Create SNAPManager copy of DB_XXX
3 - 05:01 (Server B) - SNAPManager restore of DB_XXX_Copy.
4 - 05:11 (Server A) - REORG of PK index on Table1 in DB_XXX Complete.
Note: SNAP copy taken mid REORG.
5 - 05:25 (Server B) - CREATE NONCLUSTERED INDEX on Table1 failed with the following error: "CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name 'dbo.Table1' and the index name 'NonClusteredIndex'. The duplicate key value is (111, 222)."
- Firstly, The error suggests the index being created is a UNIQUE INDEX, however the error is generated when running a CREATE NONCLUSTERED statement.
- Secondly, The Duplicate Key error references 2 values (111,222), but the PK is on one column and the NON CLUSTERED INDEX is on one column.
The only thing I can think of is that because the SNAP copy was taken in the middle of a REORG, the PK on this table was in an inconsistent state on the copy? Here is a link to a similar issue: https://stackoverflow.com/questions/3398348/unique-index-error-when-creating-non-unique-index-sql-server.
Is anyone able to explain or verify this behaviour?
Thanks
UNIQUEandCLUSTERED/NONCLUSTEREDare two separate dimensions, so I'm not sure why you're thinking theNONCLUSTEREDsomehow automatically implies something about uniqueness.DBCC CHECKTABLEas mentioned in the other question, and did it give your table a clean bill of health?DBCC CHECKTABLEdoes indicate a problem, you've got something that you might want to open a Connect issue for, even if you can work around it. (If there is noCHECKTABLEissue and the SNAP copy is just doing it wrong, that's another matter.)