SQL Server Q&A

As a software engineer, I focus on .NET, especially asp.net, C#, WCF and so on, and I am also very interested in Search Engine Optimization.

Entries Tagged ‘destination server’

FIX: Merge System Tables not Dropped When Restoring Merge-Published DB Over Non-published DB Across Servers

Symptoms
When restoring the backup of a database, which is enabled for Transactional and Merge Replication (Sysdatabases.Category = 5), to a non-published database on a different server, the merge replication system tables are not dropped and the user tables on the destination server’s database cannot be dropped. If the backup is restored on the same server (different database), then the restore works fine and the replication information is removed.
Also, the restore works fine across servers when the source database is enabled either for Transactional or Merge Replication only (Sysdatabases.Category = 1 OR 4).
Resolution
To work around this problem, you can either:Enable the source database for Transactional or Merge Replication alone (Sysdatabases.Category = 1 OR 4).
-or-Drop the merge system tables using the DROP TABLE syntax.NOTE: Contact Microsoft Product Support Services if you need to drop the user tables and are unable to do so.

How to fix permission issues when moving MSDB database between different instances

Symptoms
Consider the following scenario:
You move msdb database from one instance to another either using the backup and restore process or by copying over the database files (mdf and ldf). Then, on the destination server, a user who is not part of Sysadmin fixed role in SQL Server tries to do either of the following operations:View a job in SQL Server management studioCall SQL agent related stored procedures (for example xp_sqlagent_enum_jobs or sp_get_composite_job_info) directly using T-SQL.
In this scenario, the user will get anerror message similar to the following:
 An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
 
The EXECUTE permission was denied on the object ‘xp_sqlagent_enum_jobs’, database ‘mssqlsystemresource’, schema ’sys’. (Microsoft SQL Server, Error: 229)
 
Resolution
This issue occurs because the SQL Agent certificate is different on different instances.