What certificate is being used to encrypt each of the databases on the instances.
I can get the data using the following but how do I write the queries
USE master
GO
-- this provides the list of certificates
SELECT * FROM sys.certificates
-- this provides the list of databases (encryption_state = 3) is encrypted
SELECT * FROM sys.dm_database_encryption_keys
WHERE encryption_state = 3;
I noticed that columns sys.certifcates.thumbprint and sys.dm_database_encryption_keys.encryptor_thumbprint contain the same data.
encryptor_typefield is only available on SQL 2012+. – LowlyDBA - John M Jan 22 '18 at 16:21SELECT d.name AS database_name, dek.encryptor_type, c.name AS cert_name FROM sys.databases AS d LEFT OUTER JOIN sys.dm_database_encryption_keys AS dek ON dek.database_id = d.database_id LEFT OUTER JOIN sys.certificates AS c ON dek.encryptor_thumbprint = c.thumbprint– CJBS Feb 02 '21 at 23:41