As far as I know, the places where a Certificate will be linked -- whether by id
or thumbprint
-- can be found via the following three queries:
SELECT N'key_encryptions' AS [Where?],
crt.[name], crt.[principal_id], crt.[pvt_key_encryption_type_desc],
N'---' AS [---], ke.*
FROM sys.certificates crt
INNER JOIN sys.key_encryptions ke
ON ke.[thumbprint] = crt.[thumbprint]
SELECT N'database_mirroring_endpoints' AS [Where?],
crt.[name], crt.[principal_id], crt.[pvt_key_encryption_type_desc],
N'---' AS [---], dme.*
FROM sys.certificates crt
INNER JOIN sys.database_mirroring_endpoints dme
ON dme.[certificate_id] = crt.[certificate_id]
SELECT N'service_broker_endpoints' AS [Where?],
crt.[name], crt.[principal_id], crt.[pvt_key_encryption_type_desc],
N'---' AS [---], sbe.*
FROM sys.certificates crt
INNER JOIN sys.service_broker_endpoints sbe
ON sbe.[certificate_id] = crt.[certificate_id]
AND, the query shown in this answer:
Find signed procedures, functions, triggers, assemblies and by which certificates / asymmetric keys
You can migrate the Certificate by backing it (and its private key or the Database Master Key) up to files and then restoring those files into the new Database. Please see the MSDN documentation for the following commands:
And, if any Certificates are ENCRYPTED_BY_MASTER_KEY
(or whatever), then you will likely also need to look at: