During database migration, SSMs is used to perform view operations. However, after the view migration is complete, configure peer-to-peer replication. In the last step, an error is reported, and the subscribed part is not created successfully.
For example:
There is no way to delete the peering replication and recreate it, but an error is returned when deleting it:Cannot Execute as the Database Principal because the principal "DBO" does not exist, this type of principal cannot be impersonated, or you do not have permission.
I checked the information on the Internet and consulted my colleagues and found it was Microsoft's bug: http://social.msdn.microsoft.com/forums/en-US/sqltools/thread/91a27e23-c760-4ac1-80f4-0fac220c1adb/
This is a known issue when attaching a database through SSMs using a login which is not SysAdmin, one hits this error.
The workaround for this currently is to use T-SQL to attach database.
Create Database [databasename] On
(Filename = n'c: \ Program Files \ Microsoft SQL Server \ mssql10.mssqlserver \ MSSQL \ data \ databasename. MDF '),
(Filename = n'c: \ Program Files \ Microsoft SQL Server \ mssql10.mssqlserver \ MSSQL \ data \ databasename_log.ldf ')
For attach
After executing the following script, you can delete it:
Use [xxxx]
Go
Exec DBO. sp_changedbowner @ loginame = n 'sa ', @ map = false
Go
You can use a view or the following script to delete a copy:
Eclare @ publication as sysname
Declare @ publicationdb as sysname
Set @ publication = n' topusa'
Set @ publicationdb = n' topusa'
-- Remove the publication.
Use [topusa]
Exec sp_droppublication @ publication = @ publication;
-- Remove replication objects from the database.
Use master
Exec sp_droppublication
@ Dbname = @ publicationdb,
@ Optname = n'publish ',
@ Value = n' false'
Go
For detailed steps for peering replication deletion, see the link: http://msdn.microsoft.com/en-us/ms151256 (SQL .90). aspx.