Script to automate enabling TDE on any unencypted user databases
I was checking K.encryption_state &lt;&gt; 3 (encrypted) to test whether I should enable encryption.
i should have also checked for encrypted (K.encryption_state &lt;&gt; 2) when testing the status.