We have a publication and a subscriber running on 2 SQL 2016 servers. Now the error that we are receiving during subscription initialization is:
Error messages:
The schema script 'vw_BlackList_961.sch' could not be propagated to
the subscriber. (Source: MSSQL_REPL, Error number:
MSSQL_REPL-2147201001) Get help: http://help/MSSQL_REPL-2147201001
Unable to replicate a view or function because the referenced objects
or columns are not present on the Subscriber. (Source: MSSQL_REPL,
Error number: MSSQL_REPL20164) Get help: http://help/MSSQL_REPL20164
Invalid object name 'StaffBlacklistedSites'. (Source: MSSQLServer,
Error number: 208) Get help: http://help/208
Where is quite obvious that SQL server wants first to push VIEW instead first to push TABLE. How that is even possible? How to remedy this issue?
Thanks,
Dejan
Best Answer
I don't know if this apply to your issue, but according MS-DOCS about this error:
Error number: MSSQL_REPL-2147201001
Maybe it is not about trying to replicate a VIEW before the TABLE, but another reasons.
Quoting from docs: (Bold is mine)
Perhaps for some reason it can't enumerate the schema properly, and then it is trying to replicate the view before the table.
You can have a look at errors log in this way: