SQL Server: How to enable Transparent Data Encryption (TDE) on a Database?

In the previous post, I have shared basic details about the Transparent Data Encryption (TDE) of the SQL Server.

Whenever we require to encrypt our data or database, we should enable the TDE on a SQL Server Database Level.
After enabling, It will encrypt data files, page files, and backup files of the database.

Below are the basic steps and T-SQL script to enable TDE on a Database.


  • Create a master key.
  • Create or obtain a certificate protected by the master key.
  • Create a database encryption key and protect it by the certificate.
  • Set the database to use encryption.

    Sample script to enable TDE:

    Create the master key in Master Database:

    Create a certificate:

    Use the database to enable TDE:

    Associate the certificate to the Database:

    Enable encryption on the Database:

    Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
    If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

    If you like this post, then please share it with others.
    Please follow dbrnd.com, I will share my experience towards the success of Database Research and Development Activity.

    I put up a post every day, please keep reading and learning.
    Discover Yourself, Happy Blogging !
    Anvesh M. Patel.

    More from dbrnd.com

    Leave a Reply

    Be the First to Comment!

    Notify of