I have used
DBCC CLONEDATABASE to create a copy of a database without any data. I have now found that some schemas were not created, thus some objects have no schema. Its hard to reproduce this as it is database specific, i.e. I have cloned 9 successfully but 1 with this issue. All the schemas would be owned by dbo.
Because I can't get this reproduced, why were certain schemas not be created in the clone, would anyone have any idea what to check or if there is a way to debug the dbcc command?
I'm using SQL Server 2016 SP2 CU1.
The database was originally created before SQL Server 2005. If I go
select name, schema_id, schema_name(schema_id) SchemaName, * From sys.objects in certain objects the
schema name is
null and the
schema id isn't in
sys.schemas. A few tables and synonyms are effected, and I can't twirl down either the tables node or synonyms node in object explorer of ssms (killed session error!). Also to clarify this is only an issue in the cloned database. I also tried recreating the synonym and transferring ownership of the table but I get an error saying the table can't be found.