Encryption Conversions for Tablespaces and Databases
You can perform encryption operations on both offline and online tablespaces and databases.
-
About Encryption Conversion for Tablespaces and Databases
The
CREATE TABLESPACESQL statement can be used to create a new, encrypted tablespace.ALTER TABLESPACEcan encrypt existing tablespaces. -
Impact of a Closed TDE Keystore on Encrypted Tablespaces
A TDE keystore can be closed or migrated when an Oracle-managed tablespace is encrypted, and the database system itself must be shut down to disallow operations on an Oracle-managed tablespace.
-
Restrictions on Using Transparent Data Encryption Tablespace Encryption
You should be aware of restrictions on using Transparent Data Encryption when you encrypt a tablespace.
-
Creating an Encrypted New Tablespace
When you create a new tablespace, you can configure its encryption settings during the creation process.
-
Setting the Tablespace Encryption Default Algorithm
The
TABLESPACE_ENCRYPTION_DEFAULT_ALGORITHMapplies to specific encryption scenarios. -
You can configure Oracle Database to automatically encrypt future tablespaces that you will create.
-
Encrypted Sensitive Credential Data in the Data Dictionary
You can encrypt sensitive credential data in the
SYS.LINK$andSYS.SCHEDULER$_CREDENTIALsystem tables. -
Offline Encryption of Existing Tablespaces
You can perform offline encryption by using the
ALTER TABLESPACEorALTER DATABASE DATAFILE SQLstatements with theENCRYPTorDECRYPTclauses. -
Encryption Conversions for Existing Online Tablespaces
You can encrypt and decrypt an online existing tablespace by using the
ALTER TABLESPACESQL statement with theONLINEandENCRYPTorDECRYPTclauses. -
Rekeying an Encrypted Tablespace
Rekying an already encrypted tablespace enables you to change the data encryption keys from one algorithm to another, for example from
AES128toAES256. -
Creating an Encrypted Database Using DBCA
You can use DBCA to create an encrypted database in both single instance multitenant and Oracle Data Guard environments.
-
Encryption Conversions for Existing Databases
You can encrypt both offline and online databases.
About Encryption Conversion for Tablespaces and Databases
The CREATE TABLESPACE SQL statement can be used to create a new, encrypted tablespace. ALTER TABLESPACE can encrypt existing tablespaces.
In addition to encrypting new and existing tablespaces, you can encrypt full databases, which entails the encryption of the Oracle-managed tablespaces (in this release, the SYSTEM, SYSAUX, TEMP, and UNDO tablespaces). An Oracle-supplied tablespace contains information necessary for the correct functioning (confidentiality, integrity, and availability) of the database system. This information includes the system’s data dictionary, the system’s temporary sort area, the system’s undo segment, and the system’s auxiliary data. This information is only expected to be updated internally by the Oracle database server itself, and does not normally be updated directly by users.
To encrypt a full database, you use the ALTER TABLESPACE statement, not ALTER DATABASE, to encrypt the Oracle-managed tablespaces.
The following table compares the differences between an offline and an online encryption conversion of tablespaces and databases.
| Functionality | Offline Conversion | Online Conversion |
|---|---|---|
| Release with minimum conversion capability | Oracle Database 11g release 2 (11.2) | Oracle Database 12c release 2 (12.2) and later |
| What can be backported? | The ability to encrypt or decrypt a data file with the AES128 algorithm (using ALTER DATABASE DATAFILE data_file ENCRYPT or DECRYPT) can be used in Oracle Database releases 12.1.0.2 and 11.2.0.4. |
No |
| Algorithms supported | All symmetric encryption algorithms that TDE supports. | All symmetric encryption algorithm that TDE supports. |
| When can the conversion be run? | When the tablespace is offline or the database is in the mount stage. | When the tablespace is online and database is open in read/write mode. |
| Is auxiliary space required for the conversion? | No | Yes. |
| Oracle Data Guard conversion guidelines | Convert both the primary and standby manually. Convert the standby first and then switch over to minimum downtime | After you convert the primary, the standby conversion takes place automatically. You cannot perform an online conversion directly on the standby. |
Encrypt the SYSTEM, SYSAUX, and UNDO tablespaces (database conversion) |
Oracle Database 12c release 2 (12.2) and later only. You must set COMPATIBILITY to 12.2.0.0. Only auto-login keystores are supported. |
Oracle Database 12c release 2 (12.2) and later only. You must set COMPATIBILITY to 12.2.0.0. |
Can an existing TEMP tablespace be converted? |
No, but you can create an encrypted TEMP tablespace in Oracle Database 12c release 2 (12.2) and later, make it the default temporary tablespace, and then drop the original TEMP tablespace. |
No, but you can create an encrypted TEMP tablespace in Oracle Database 12c release 2 (12.2) and later, make it the default temporary tablespace, and then drop the original TEMP tablespace. |
| Can an existing tablespace be decrypted? | You only can decrypt a tablespace or data file that was previously encrypted by an offline encrypt operation. Oracle does not recommend that you decrypt the UNDO tablespace once it is encrypted. |
Yes, but Oracle does not recommend that you decrypt the UNDO tablespace once it is encrypted. |
| Can encryption keys be rekeyed? | No, but after the tablespace is encrypted, you can then use online conversion to rekey in Oracle Database 12c release 2 (12.2) compatibility. | Yes |
| Can encryption operations be run in parallel? | You can run parallel encryption conversions at the data file level with multiple user sessions running. | You can run parallel encryption conversions at the tablespace level with multiple user sessions running. |
| What to do if an encryption conversion SQL statement fails to complete? | Re-issue the encryption or decryption SQL statement to ensure that all the data files within the tablespace are consistently either encrypted or decrypted. | Rerun the SQL statement but use the FINISH clause. |
Related Topics
Impact of a Closed TDE Keystore on Encrypted Tablespaces
A TDE keystore can be closed or migrated when an Oracle-managed tablespace is encrypted, and the database system itself must be shut down to disallow operations on an Oracle-managed tablespace.
A closed TDE keystore has no impact on operations that involve an encrypted Oracle-managed tablespace (in this release, the SYSTEM, SYSAUX, TEMP, and UNDO tablespaces). This enables operations that are performed by background processes (for example, the log writer) to continue to work on these tablespaces while the TDE keystore is closed. If you want to disallow operations on an encrypted Oracle-managed tablespace, then you must shut down the database.
With regard to user-created tablespaces, a closed TDE keystore causes operations such as rotating a key or decrypting the tablespace to fail with an ORA-28365 wallet is not open error, just as it did in earlier releases. If you want to disallow operations on the user-created tablespace, then close the TDE keystore (or shut down the database).
User-created data can be copied into an encrypted Oracle-managed tablespace (for example, by an internal process such as DBMS_STATS statistics gathering) from a user-created tablespace while the TDE keystore is open. Closing the keystore does not prevent a user from viewing this data afterward, when the TDE keystore is in the CLOSED state at the time that you query the V$ENCRYPTION_WALLET view. Access to the original data by attempting to query an encrypted user-created tablespace will fail, resulting in an ORA-28365 wallet is not open error.
The commands depend on whether the encrypted data is in a user-created or Oracle-managed tablespace. If data in one of these categories is not encrypted, commands for that category are not applicable (N/A). You can operate on non-encrypted data unless the instance is shut down.
When you open a database with an encrypted Oracle-managed tablespace, start the database in mount mode, open the TDE keystore, and then open the database. The system may need the TDE master encryption key to decrypt the bootstrap dictionary tables in the encrypted Oracle-managed tablespace.
In the commands below, replace password with the TDE keystore password.
Encrypted user-created tablespace data
Use these commands whether or not an Oracle-managed tablespace is encrypted.
To disallow operations on encrypted user-created tablespace data, run:
ADMINISTER KEY MANAGEMENT SET KEYSTORE CLOSE IDENTIFIED BY password;SHUTDOWN
To allow operations on encrypted user-created tablespace data, run:
STARTUP MOUNT;ADMINISTER KEY MANAGEMENT SET KEYSTORE OPEN IDENTIFIED BY password;ALTER DATABASE OPEN
If no user-created tablespace is encrypted, commands for user-created tablespace data are not applicable.
Encrypted Oracle-managed tablespace data
Use these commands whether or not a user-created tablespace is encrypted.
To disallow operations on encrypted Oracle-managed tablespace data, run:
SHUTDOWN
To allow operations on encrypted Oracle-managed tablespace data, run:
STARTUP MOUNT;ADMINISTER KEY MANAGEMENT SET KEYSTORE OPEN IDENTIFIED BY password;ALTER DATABASE OPEN
If no Oracle-managed tablespace is encrypted, commands for Oracle-managed tablespace data are not applicable.
Restrictions on Using Transparent Data Encryption Tablespace Encryption
You should be aware of restrictions on using Transparent Data Encryption when you encrypt a tablespace.
Note the following restrictions:
-
Transparent Data Encryption (TDE) tablespace encryption encrypts or decrypts data during read and write operations, as opposed to TDE column encryption, which encrypts and decrypts data at the SQL layer. This means that most restrictions that apply to TDE column encryption, such as data type restrictions and index type restrictions, do not apply to TDE tablespace encryption.
-
To perform import and export operations, use Oracle Data Pump.
Related Topics
Creating an Encrypted New Tablespace
When you create a new tablespace, you can configure its encryption settings during the creation process.
-
Step 1: Set the COMPATIBLE Initialization Parameter for Tablespace Encryption
You must set the
COMPATIBLEinitialization parameter before creating an encrypted tablespace. -
Step 2: Set the TDE Master Encryption Key
You must ensure that you have configured TDE by setting the
WALLET_ROOTandTDE_CONFIGURATIONparameters. -
Step 3: Create the Encrypted Tablespace
After you have set the
COMPATIBLEinitialization parameter, you are ready to create the encrypted tablespace.
Step 1: Set the COMPATIBLE Initialization Parameter for Tablespace Encryption
You must set the COMPATIBLE initialization parameter before creating an encrypted tablespace.
-
About Setting the COMPATIBLE Initialization Parameter for Tablespace Encryption
A minimum
COMPATIBLEinitialization parameter setting of11.2.0.0enables the full set of tablespace encryption features. -
Setting the COMPATIBLE Initialization Parameter for Tablespace Encryption
To set the
COMPATIBLEinitialization parameter, you must edit the initialization parameter file for the database instance.
About Setting the COMPATIBLE Initialization Parameter for Tablespace Encryption
A minimum COMPATIBLE initialization parameter setting of 11.2.0.0 enables the full set of tablespace encryption features.
Setting the compatibility to 11.2.0.0 enables the following functionality:
-
The
11.2.0.0setting enables the database to use any of the four supported algorithms for data encryption (3DES168,AES128,AES192, andAES256). -
The
11.2.0.0setting enables the migration of a key from a TDE wallet to an external keystore (ensure that the TDE master encryption key was configured for the external keystore) -
The
11.2.0.0setting enables rekeying the TDE master encryption keyBe aware that once you set the
COMPATIBLEparameter to11.2.0.0, the change is irreversible. To use tablespace encryption, ensure that the compatibility setting is at the minimum, which is11.2.0.0.
Related Topics
Setting the COMPATIBLE Initialization Parameter for Tablespace Encryption
To set the COMPATIBLE initialization parameter, you must edit the initialization parameter file for the database instance.
-
Connect to the united mode CDB root or isolated mode PDB as a user who has been granted administrative privileges.
-
Check the current setting of the
COMPATIBLEparameter.For example:
SHOW PARAMETER COMPATIBLE NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ compatible string 12.2.0.0 noncdbcompatible BOOLEAN FALSE -
If you must change the
COMPATIBLEparameter, then complete the remaining steps in this procedure.The value should be 11.2.0.0 or later.
-
From the command line, locate the initialization parameter file for the database instance.
-
UNIX systems: This file is in the ORACLE_HOME
/dbsdirectory and is namedinitORACLE_SID.ora(for example,initmydb.ora). -
Windows systems: This file is in the ORACLE_HOME
\databasedirectory and is namedinitORACLE_SID.ora(for example,initmydb.ora).
-
-
Edit the initialization parameter file to use the new
COMPATIBLEsetting.For example:
COMPATIBLE=20.1.0.0 -
Connect as a user who has the
SYSDBAadministrative privilege, and then restart the database.-
From the CDB root:
SHUTDOWN IMMEDIATE STARTUP -
From a PDB:
ALTER PLUGGABLE DATABASE pdb_name CLOSE IMMEDIATE; ALTER PLUGGABLE DATABASE pdb_name OPEN;
-
-
If tablespace encryption is in use, then open the keystore at the database mount. The keystore must be open before you can access data in an encrypted tablespace.
For example:
STARTUP MOUNT; ADMINISTER KEY MANAGEMENT SET KEYSTORE OPEN IDENTIFIED BY keystore_password|EXTERNAL STORE; ALTER DATABASE OPEN;
Step 2: Set the TDE Master Encryption Key
You must ensure that you have configured TDE by setting the WALLET_ROOT and TDE_CONFIGURATION parameters.
Set the TDE master encryption key either in the Oracle wallet, or in Oracle Key Vault. The commands for united and isolated PDBs are the same.
Step 3: Create the Encrypted Tablespace
After you have set the COMPATIBLE initialization parameter, you are ready to create the encrypted tablespace.
-
About Creating Encrypted Tablespaces
To create an encrypted tablespace, you can use the
CREATE TABLESPACESQL statement. -
Creating an Encrypted Tablespace
To create an encrypted tablespace, you must use the
CREATE TABLESPACEstatement with theENCRYPTION USINGclause. -
Example: Creating an Encrypted Tablespace That Uses AES192
You can use the
CREATE TABLESPACESQL statement to create an encrypted tablespace. -
Example: Creating an Encrypted Tablespace That Uses the Default Algorithm
You can use the
CREATE TABLESPACESQL statement to create an encrypted tablespace that uses the default algorithm.
About Creating Encrypted Tablespaces
To create an encrypted tablespace, you can use the CREATE TABLESPACE SQL statement.
You must have the CREATE TABLESPACE system privilege to create an encrypted tablespace.
You can query the ENCRYPTED column of the DBA_TABLESPACES and USER_TABLESPACES data dictionary views to verify if a tablespace was encrypted.
Creating an Encrypted Tablespace
To create an encrypted tablespace, you must use the CREATE TABLESPACE statement with the ENCRYPTION USING clause.
Run the CREATE TABLESPACE statement, using its encryption clauses.
For example:
CREATE TABLESPACE encrypt_ts
DATAFILE '$ORACLE_HOME/dbs/encrypt_df.dbf' SIZE 1M
'ENCRYPTION ENCRYPT';
In this specification:
-
'ENCRYPTION ENCRYPT'uses the default for encryption algorithm (AES256) and cipher mode (XTS), unless specified otherwise. TheENCRYPTclause encrypts the tablespace. Enclose this setting in single quotation marks (‘ ‘). The key lengths are included in the names of the algorithms. -
If
TABLESPACE_ENCRYPTIONis set toAUTO_ENABLE, the'ENCRYPTION [using algorithm] ENCRYPT'keywords can be omitted.
Related Topics
Example: Creating an Encrypted Tablespace That Uses AES192
You can use the CREATE TABLESPACE SQL statement to create an encrypted tablespace.
Creating an Encrypted Tablespace That Uses AES192 creates a tablespace called securespace_1 that is encrypted using the AES192 algorithm.
CREATE TABLESPACE securespace_1
DATAFILE '/home/user/oradata/secure01.dbf'
SIZE 150M
ENCRYPTION USING 'AES192' ENCRYPT;
Example: Creating an Encrypted Tablespace That Uses the Default Algorithm
You can use the CREATE TABLESPACE SQL statement to create an encrypted tablespace that uses the default algorithm.
Creating an Encrypted Tablespace That Uses the Default Algorithm creates a tablespace called securespace_2. Because no encryption algorithm is specified, the default encryption algorithm (AES256) is used.
CREATE TABLESPACE securespace_2
DATAFILE '/home/user/oradata/secure01.dbf'
SIZE 150M
ENCRYPTION ENCRYPT;
Setting the Tablespace Encryption Default Algorithm
The TABLESPACE_ENCRYPTION_DEFAULT_ALGORITHM applies to specific encryption scenarios.
These scenarios are as follows:
-
In Oracle AI Database 26ai,
AES256(with XTS cipher mode) is the default because it has the highest resistance against post-quantum attacks. It is not recommended to use shorter data encryption keys. -
Encryption commands that do not allow to specify the encryption algorithm
-
New tablespaces that are created without the encryption syntax
-
The encryption algorithm for the
SYSTEMtablespaceTABLESPACE_ENCRYPTION_DEFAULT_ALGORITHMonly becomes effective if it is set before the firstSET KEYoperation with Oracle Key Vault, or theCREATE KEYSTOREcommand for wallet-based TDE configuration.TABLESPACE_ENCRYPTION_DEFAULT_ALGORITHMapplies to both offline and online tablespace encryption operations. It also applies to future encrypted tablespaces, ifTABLESPACE_ENCRYPTIONhas been set appropriately. In a multitenant environment, you can setTABLESPACE_ENCRYPTION_DEFAULT_ALGORITHMin the CDB root or in individual PDBs.
Enter the following ALTER SYSTEM statement:
ALTER SYSTEM SET TABLESPACE_ENCRYPTION_DEFAULT_ALGORITHM = value SCOPE=BOTH;
In this specification, value can be one of the following encryption algorithms: AES128, AES192, AES256, 3DES168, ARIA128, ARIA192, or ARIA256. The default encryption algorithm is AES256. In FIPS mode, this parameter can take only AES128, AES192, and AES256.
Oracle will offer support for FIPS 140-3 in 2026 for both Oracle AI Database 26ai and Oracle Database 19c. You may need to alter your encryption algorithm following the steps in Ensuring Encryption Algorithms are FIPS 140-3 Compliant.
Note: Starting with Oracle AI Database 26ai, the Transparent Data Encryption (TDE) encryption libraries for the GOST and SEED algorithms are desupported and removed. The GOST and SEED decryption libraries are deprecated. Both are removed on HP Itanium platforms.GOST 28147-89 has been deprecated by the Russian government, and SEED has been deprecated by the South Korean government. If you need South Korean government-approved TDE cryptography, then use ARIA instead. If you are using GOST 28147-89, then you must decrypt and encrypt with another supported TDE algorithm. The decryption algorithms for GOST 28147-89 and SEED are included with Oracle AI Database 26ai, but are deprecated, and the GOST encryption algorithm is desupported with Oracle AI Database 26ai. If you are using GOST or SEED for TDE encryption, then Oracle recommends that you perform an online rekey operation before upgrading to Oracle AI Database 26ai. However, with the exception of the HP Itanium platform, the GOST and SEED decryption libraries are available with Oracle AI Database 26ai, so you can also decrypt after upgrading.
Related Topics
Encrypting Future Tablespaces
You can configure Oracle Database to automatically encrypt future tablespaces that you will create.
-
About Encrypting Future Tablespaces
The
ENCRYPT_NEW_TABLESPACESdynamic database initialization parameter controls if future tablespaces are encrypted. -
Setting Future Tablespaces to be Encrypted
You can set the
TABLESPACE_ENCRYPTIONdatabase initialization parameter to automatically encrypt new tablespaces.
About Encrypting Future Tablespaces
The ENCRYPT_NEW_TABLESPACES dynamic database initialization parameter controls if future tablespaces are encrypted.
By default, all Oracle Cloud databases are encrypted. If you install an off-the-shelf application into such a database, its installation scripts most likely do not have the encryption syntax. In this case, because ENCRYPT_NEW_TABLESPACES is set to CLOUD_ONLY, those tablespaces would be created encrypted regardless.
Note: Starting with Oracle AI Database 26ai, the ENCRYPT_NEW_TABLESPACES initialization parameter is deprecated. Oracle recommends that you use the initialization parameter TABLESPACE_ENCRYPTION.
In an Oracle Cloud environment, the following scenarios may occur when you create encrypted tablespaces in Oracle Cloud and on-premises environments:
-
You create a database in Oracle Cloud; the tablespaces are encrypted because the
TABLESPACE_ENCRYPTIONparameter is set toAUTO_ENABLE. However, you may not have the intention or even an Advanced Security Option license to bring the encrypted database back on premises. For this use case, Oracle Recovery Manager (Oracle RMAN) provides the option to duplicate or restoreAS DECRYPTED. -
You create a hybrid environment where the primary database is on premises and the standby database is on Oracle Cloud. If a switchover operation takes place, then the new primary is on Oracle Cloud. For example, suppose you do not have an Advanced Security Option (ASO) license, and you have an automatically encrypted tablespace in the Oracle Cloud. The standby database on premises is also automatically encrypted, then the standby database on premises can set
TABLESPACE_ENCRYPTIONtoDECRYPT_ONLY. See the Hybrid Oracle Data Guard without Transparent Data Encryption (TDE) License Oracle Database Product Management Youtube video.
Related Topics
Setting Future Tablespaces to be Encrypted
You can set the TABLESPACE_ENCRYPTION database initialization parameter to automatically encrypt new tablespaces.
Starting with Oracle Database
19.17, the ENCRYPT_NEW_TABLESPACES has been deprecated.
Oracle recommends that you use the initialization parameter TABLESPACE_ENCRYPTION, which is new for Oracle AI Database 26ai.
If you upgraded from an older database release to 26ai, unset the ENCRYPT_NEW_TABLESPACES parameter before setting TABLESPACE_ENCRYPTION:
alter system RESET "encrypt_new_tablespaces" scope = both SID = '*';
Enter the following ALTER SYSTEM statement:
ALTER SYSTEM SET TABLESPACE_ENCRYPTION = value SCOPE = SPFILE SID = '*';
In this specification, value can be:
-
AUTO_ENABLEautomatically encrypts the tablespace using the tablespace encryption default algorithm and cipher mode (XTS ifcompatibleis set to 23 or higher) if you do not specify theENCRYPTIONclause of theCREATE TABLESPACESQL statement, or to the algorithm specified by theTABLESPACE_ENCRYPTION_DEFAULT_ALGORITHMdynamic parameter. -
MANUAL_ENABLEencrypts the tablespace using the specified setting of theENCRYPTIONclause ofCREATE TABLESPACE, for on-premises environments.
Related Topics
Encrypted Sensitive Credential Data in the Data Dictionary
You can encrypt sensitive credential data in the SYS.LINK$ and SYS.SCHEDULER$_CREDENTIAL system tables.
By default, the credential data in the SYS.LINK$ and SYS.SCHEDULER$_CREDENTIAL system tables is obfuscated. However, because of the availability of many types of de-obfuscation algorithms, Oracle recommends that you encrypt this sensitive credential data. To check the status the data dictionary credentials, you can query the DICTIONARY_CREDENTIALS_ENCRYPT data dictionary view.
The encryption of sensitive credential data in these two system tables uses Transparent Data Encryption. To encrypt credential data, you do not need an Oracle Advanced Security Option license, but you must be granted the SYSKM administrative privilege and the database must have a fully functional Transparent Data Encryption setup. Encryption of credential data uses the AES256 algorithm.
Related Topics
Offline Encryption of Existing Tablespaces
You can perform offline encryption by using the ALTER TABLESPACE or ALTER DATABASE DATAFILE SQL statements with the ENCRYPT or DECRYPT clauses.
-
About Offline Encryption of Existing Tablespaces
You can encrypt or decrypt an existing data file of a user tablespace when the tablespace is offline or when the database is not open.
-
Encrypting an Existing User-Defined Tablespace with Offline Conversion
To encrypt an existing tablespace with offline conversion, you can use the
ALTER TABLESPACESQL statement with theOFFLINEandENCRYPTclauses. -
Decrypting an Existing Tablespace with Offline Conversion
To decrypt an existing tablespace with offline conversion, you can use the
ALTER TABLESPACESQL statement with theOFFLINEandDECRYPTclauses.
About Offline Encryption of Existing Tablespaces
You can encrypt or decrypt an existing data file of a user tablespace when the tablespace is offline or when the database is not open.
There are two options for performing the encryption or decryption:
-
Offline encryption of the data file level: This type does not have the option to specify an encryption algorithm. It uses the default encryption algorithm. For example:
ALTER DATABASE DATAFILE 'path_to_data_file.dbf' ENCRYPT; -
Offline encrypting a tablespace: Use the following syntax. If you omit the
[USING 'algorithm'], then the default encryption algorithm is used.ALTER TABLESPACE tablespace_name ENCRYPTION OFFLINE [USING 'algorithm'] ENCRYPT;Use the offline encryption method if you do not plan to change the compatibility of your databases from Oracle Database 11c release 2 (11.2) or Oracle Database 12c release 1 (12.1) to release 19c, which is irreversible. The offline encryption method is also useful if you want to quickly make use of Transparent Data Encryption before you upgrade this database to release 19c. You can both encrypt and decrypt offline tablespaces.
Note the following:
-
If you want to encrypt the Oracle Database-supplied tablespaces (
SYSTEM,SYSAUX, andUNDO) using the offline conversion method, then you must use the method that is recommended when you encrypt an existing database with offline conversion. -
You can use the online method to rekey, change the encryption algorithm, or decrypt a tablespace that was previously encrypted with the offline method.
-
If you have configured Oracle Data Guard, then you can minimize downtime by encrypting the tablespaces on the standby first, switching over to the primary, and then performing an offline encryption the tablespaces on the new standby database. Offline encryption (both on the data file and tablespace level) are is performed on the standby first. Online encryption is an Oracle Data Guard transaction, and as such, it is replayed on the standby database.
-
You can use the
USING ... ENCRYPTclause to specify an encryption algorithm. Supported algorithms are AES and ARIA with 128, 192, and 256 bits key length. To check the encryption key, query theENCRYPTIONALGcolumn in theV$DATABASE_KEY_INFOview.Note: Starting with Oracle AI Database 26ai, the Transparent Data Encryption (TDE) decryption libraries for the GOST and SEED algorithms are deprecated, and encryption to GOST and SEED are desupported. Starting with Oracle AI Database 26ai, the Transparent Data Encryption (TDE) encryption libraries for the GOST and SEED algorithms are desupported and removed. The GOST and SEED decryption libraries are deprecated. Both are removed on HP Itanium platforms.GOST 28147-89 has been deprecated by the Russian government, and SEED has been deprecated by the South Korean government. If you need South Korean government-approved TDE cryptography, then use ARIA instead. If you are using GOST 28147-89, then you must decrypt and encrypt with another supported TDE algorithm. The decryption algorithms for GOST 28147-89 and SEED are included with Oracle AI Database 26ai, but are deprecated, and the GOST encryption algorithm is desupported with Oracle AI Database 26ai. If you are using GOST or SEED for TDE encryption, then Oracle recommends that you perform an online rekey operation before upgrading to Oracle AI Database 26ai. However, with the exception of the HP Itanium platform, the GOST and SEED decryption libraries are available with Oracle AI Database 26ai, so you can also decrypt after upgrading.
-
To set the default encryption algorithm for future offline tablespace encryption operations, set the
TABLESPACE_ENCRYPTION_DEFAULT_ALGORITHMdynamic parameter. -
You can use the
ALTER TABLESPACEstatement to convert offline tablespaces in parallel by using multiple foreground sessions to encrypt different data files. -
If you are using Oracle Data Guard, you can minimize the downtime by encrypting the tablespaces on the standby first, switching over, and then encrypting the tablespaces on the original primary next.
-
For Oracle Database 11g release 2 ( 11.2.0.4) and Oracle Database 12c release 1 (12.1.0.2), you cannot perform an offline encryption of the
SYSTEMandSYSAUXtablespaces. For releases earlier than Oracle Database 19c, you cannot encrypt theSYSTEM,SYSAUX,TEMP, andUNDOtablespaces. Also, Oracle does not recommend encrypting offline theUNDOtablespace in these releases. Doing so prevents the keystore from being closed, and this prevents the database from functioning. In addition, encrypting theUNDOtablespace while the database is offline is not necessary because all undo records that are associated with any encrypted tablespaces are already automatically encrypted in theUNDOtablespace. If you want to encrypt theTEMPtablespace, you must drop and then recreate it as encrypted.
Related Topics
Encrypting an Existing User-Defined Tablespace with Offline Conversion
To encrypt an existing tablespace with offline conversion, you can use the ALTER TABLESPACE SQL statement with the OFFLINE and ENCRYPT clauses.
The procedure that is described in this section applies to the case where you want to encrypt individual user-created tablespaces within a database. These tablespaces can be encrypted offline. However, the Oracle Database-supplied SYSTEM and UNDO tablespaces cannot be brought offline. If you want to encrypt the tablespaces offline, then you must use the method that is described in Encrypting an Existing Database with Offline Conversion.
-
Connect to the united mode CDB root or isolated mode PDB as a user who has been granted administrative privileges.
You must have the
SYSDBAadministrative privilege to work with theSYSTEMandSYSAUXtablespaces. Otherwise, connect with theSYSKMadministrative privilege. -
Bring the tablespace offline.
ALTER TABLESPACE users OFFLINE NORMAL; -
Back up the tablespace.
The offline conversion method does not use auxiliary disk space or files, and it operates directly in-place to the data files. Therefore, you should perform a full backup of the user tablespace before converting it offline.
-
As a user who has been granted the
ADMINISTER KEY MANAGEMENTorSYSKMprivilege, open the TDE wallet.For example:
ADMINISTER KEY MANAGEMENT SET KEYSTORE OPEN IDENTIFIED BY TDEk_wallet_password; -
Encrypt the tablespace.
For example, to encrypt an entire tablespace, include its data files:
ALTER TABLESPACE users1 ENCRYPTION OFFLINE ENCRYPT;This example encrypts the tablespace with the default encryption algorithm,
AES256. To use a different encryption algorithm, enter a statement similar to the following:ALTER TABLESPACE users2 ENCRYPTION OFFLINE USING 'AES128' ENCRYPT;To encrypt individual data files within a tablespace, use the
ALTER DATABASE DATAFILESQL statement. For example, to encrypt the data filesuser_01.dbfanduser_02.dbf:ALTER DATABASE DATAFILE 'user_01.dbf' ENCRYPT; ALTER DATABASE DATAFILE 'user_02.dbf' ENCRYPT;In the same database session, these statements encrypt each of the data files in sequence, one after another. If you run each statement in its own database session, then they will be run in parallel.
If the encryption process is interrupted, then rerun the
ALTER TABLESPACEstatement. The kinds of errors that you can expect in an interruption are general errors, such as file system or storage file system errors. The data files within the tablespace should be consistently encrypted. For example, suppose you offline a tablespace that has 10 files but for some reason, the encryption only completes for nine of the files, leaving one decrypted. Although it is possible to bring the tablespace back online with such inconsistent encryption if theCOMPATIBLEparameter is set to12.2.0.0or later, then it is not recommended to leave the tablespace in this state. IfCOMPATIBLEis less than12.2.0.0, then it is not possible to bring the tablespace online if the encryption property is inconsistent across the data files. -
Bring the tablespace back online or open the database.
-
To bring the tablespace back online:
ALTER TABLESPACE users ONLINE; -
To open a database in a non-multitenant environment:
ALTER DATABASE OPEN -
In a multitenant environment, you can encrypt a data file or tablespace with the offline method if the root is open and the PDB is not open. For example, for a PDB named
hr_pdb:ALTER PLUGGABLE DATABASE hr_pdb OPEN
-
-
Perform a full backup of the converted tablespace.
Related Topics
Decrypting an Existing Tablespace with Offline Conversion
To decrypt an existing tablespace with offline conversion, you can use the ALTER TABLESPACE SQL statement with the OFFLINE and DECRYPT clauses.
-
Connect to the united mode CDB root or isolated mode PDB as a user who has been granted the
SYSDBAadministrative privilege.You must have the
SYSDBAadministrative privilege to work with theSYSTEMandSYSAUXtablespaces. Otherwise, connect with theSYSKMadministrative privilege. -
Bring the tablespace offline.
ALTER TABLESPACE users OFFLINE NORMAL; -
As a user who has been granted the
ADMINISTER KEY MANAGEMENTorSYSKMprivilege, open the keystore.For example:
ADMINISTER KEY MANAGEMENT SET KEYSTORE OPEN IDENTIFIED BY TDE_wallet_password; -
Run the
ALTER TABLESPACESQL statement to perform the decryption.For example, for a tablespace called
users:ALTER TABLESPACE users ENCRYPTION OFFLINE DECRYPT;If the decryption process is interrupted, then rerun the
ALTER TABLESPACEstatement. The kinds of errors that you can expect in an interruption are general errors, such as file system or storage file system errors. The data files within the tablespace should be consistently decrypted. For example, suppose you offline a tablespace that has 10 files but for some reason, the decryption only completes for nine of the files, leaving one encrypted. Although it is possible to bring the tablespace back online with such inconsistent decryption if theCOMPATIBLEparameter is set to12.2.0.0or later, then it is not recommended to leave the tablespace in this state. IfCOMPATIBLEis less than12.2.0.0, then it is not possible to bring the tablespace online if the encryption property is inconsistent across the data files. -
Bring the tablespace online.
ALTER TABLESPACE users ONLINE;
Encryption Conversions for Existing Online Tablespaces
You can encrypt and decrypt an online existing tablespace by using the ALTER TABLESPACE SQL statement with the ONLINE and ENCRYPT or DECRYPT clauses.
-
About Encryption Conversions for Existing Online Tablespaces
You can encrypt, decrypt, or rekey existing user tablespaces, and the
SYSTEM,SYSAUX, andUNDOtablespace when they are online. -
Encrypting an Existing Tablespace with Online Conversion
To encrypt an existing tablespace with online conversion, use
ALTER TABLESPACEwith theONLINEandENCRYPTclauses. -
Rekeying an Existing Tablespace with Online Conversion
To rekey an existing tablespace that is online, you can use the
REKEYclause of theALTER TABLESPACESQL statement. -
Rekeying the SYSAUX and UNDO Tablespaces with Online Conversion
To rekey the
SYSAUXandUNDOonlne tablespaces, you can use theREKEYclause of theALTER TABLESPACESQL statement. -
Decrypting an Existing Tablespace with Online Conversion
To decrypt an existing tablespace with online conversion, you can use the
ALTER TABLESPACESQL statement withDECRYPTclause. -
Finishing an Interrupted Online Encryption Conversion
If an online encryption process is interrupted, then you can complete the conversion by rerunning the
ALTER TABLESPACEstatement using theFINISHclause.
About Encryption Conversions for Existing Online Tablespaces
You can encrypt, decrypt, or rekey existing user tablespaces, and the SYSTEM, SYSAUX, and UNDO tablespace when they are online.
However, you cannot encrypt, decrypt, or rekey a temporary tablespace online.
An online tablespace can be created by using the ONLINE clause of the CREATE TABLESPACE SQL statement. When you encrypt or rekey a tablespace online, the tablespace will have its own independent encryption keys and algorithms.
Note the following:
-
If an offline tablespace has been encrypted, then you can rekey it online to use a different algorithm.
-
You can encrypt multiple tablespaces online in parallel by using multiple foreground sessions to encrypt different tablespaces. Within each tablespace, the data files are encrypted sequentially.
-
To set the default encryption algorithm for future online tablespace encryption operations, set the
TABLESPACE_ENCRYPTION_DEFAULT_ALGORITHMdynamic parameter. -
If the conversion is interrupted, then you can resume the process by issuing the
FINISHclause of theALTER TABLESPACESQL statement. -
A redo log is generated for each online tablespace conversion.
-
Do not encrypt the
SYSTEMandUNDOtablespaces concurrently with other tablespaces. -
You cannot use the transportable tablespace feature with Oracle Data Pump while you are encrypting a tablespace.
-
You cannot run the
ALTER TABLESPACEstatement concurrently with the following features:-
ADMINISTER KEY MANAGEMENT SET KEYSQL statement -
FLASHBACK DATABASESQL statement
-
-
If you are using Oracle-managed files for the data files, then the encryption process rekeys the data files that are associated with the tablespace and then copies or moves them to the default Oracle-managed files location.
-
You can add new files to the tablespace after you have encrypted it. Oracle Database reformats the new file with the new encryption key. Blocks will be encrypted using the new key.
-
Previous operations that took place in the root or the PDB may require the control files to be cross-checked against the data dictionary before you can begin the online conversion process. An
ORA-241 operation disallowed: control file is not yet checked against data dictionaryerror may occur. To resolve this problem, restart the root or PDB, and then try issuing the online conversion commands again. -
For security reasons, once online conversion processes a data file, Oracle will zero out the original data file before deletion. This prevents the database from leaving ghost data on disk sectors. However, there is a known limitation that can occur if you are performing an online tablespace conversion at the same time that Oracle Recovery Manager (Oracle RMAN) is validating files. The online tablespace conversion processes each file one at a time. If Oracle RMAN is validating a file at the same time that it is being processed by the online tablespace conversion, then Oracle RMAN could report a corruption problem (
ORA-01578: ORACLE data block corrupted (file # , block # )). It does this because it sees the blocks that comprise the file as zero. This is a false alarm and you can ignore the error. If this occurs, then try running the Oracle RMAN validation process again.
Related Topics
Encrypting an Existing Tablespace with Online Conversion
To encrypt an existing tablespace with online conversion, use ALTER TABLESPACE with the ONLINE and ENCRYPT clauses.
-
Connect to the united mode CDB root or isolated mode PDB as a user who has been granted the
SYSDBAadministrative privilege.You must have the
SYSDBAadministrative privilege to work with theSYSTEMandSYSAUXtablespaces. Otherwise, connect with theSYSKMadministrative privilege. -
Ensure that the
COMPATIBLEinitialization parameter is set to 12.2.0.0 or later.You can use the
SHOW PARAMETERcommand to check the current setting of a parameter. -
Ensure that the database is open in read-write mode.
You can query the
STATUScolumn of theV$INSTANCEdynamic view to find if a database is open and theOPEN_MODEcolumn of theV$DATABASEview to find if it in read-write mode. -
If necessary, open the database in read-write mode.
ALTER DATABASE OPEN READ WRITE; -
Ensure that the auxiliary space is at least the same size as the largest data file of this tablespace.
This size requirement is because Oracle Database performs the conversion one file at a time. For example, if the largest data file of the tablespace is 32 GB, then ensure that you have 32 GB of auxiliary space. To find the space used by a data file, query the
BYTESorBLOCKScolumn of theV$DATAFILEdynamic performance view. -
As a user who has been granted the
ADMINISTER KEY MANAGEMENTorSYSKMprivilege, create and open a master encryption key.For example:
ADMINISTER KEY MANAGEMENT CREATE KEYSTORE 'TDE_wallet_location' IDENTIFIED BY TDE_wallet_password; ADMINISTER KEY MANAGEMENT SET KEYSTORE OPEN IDENTIFIED BY TDE_wallet_password; ADMINISTER KEY MANAGEMENT SET KEY IDENTIFIED BY TDE_wallet_password WITH BACKUP; -
Run the
ALTER TABLESPACEstatement using theENCRYPTIONandENCRYPTclauses to perform the encryption.Note: For the
SYSTEMtablespace, you can use theENCRYPTclause to encrypt the tablespace, but you cannot specify an encryption algorithm because it is encrypted with the existing database key the first time. After encrypting theSYSTEMtablespace, use theREKEYclause to specify the algorithm. See Rekeying an Existing Tablespace with Online Conversion for more information.For example, for a non-Oracle managed files tablespace named
users:ALTER TABLESPACE users ENCRYPTION ONLINE USING 'AES256' ENCRYPT FILE_NAME_CONVERT = ('users.dbf', 'users_enc.dbf');In this example:
-
ENCRYPTION ONLINE USING 'AES256' ENCRYPTsets the statement to encrypt the tablespaceuserswhile it is online and assigns it theAES256encryption algorithm. If you omit theUSINGalgorithmclause, then the default algorithm,AES256, is used. -
FILE_NAME_CONVERTspecifies one or more pairs of data files that are associated with the tablespace. The first name in the pair is an existing data file, and the second name is for the encrypted version of this data file, which will be created after theALTER TABLESPACEstatement successfully runs. If the tablespace has more than one data file, then you must process them all in this statement. Note the following:-
Separate each file name with a comma, including multiple pairs of files. For example:
FILE_NAME_CONVERT = ('users 1.dbf', 'users1_enc.dbf', 'users2.dbf', 'users2_enc.dbf') -
You can specify directory paths in the
FILE_NAME_CONVERTclause. For example, the following clause converts and moves the matching files of the tablespace from thedbsdirectory to thedbs/encdirectory:FILE_NAME_CONVERT = ('dbs', 'dbs/enc') -
The
FILE_NAME_CONVERTclause recognizes patterns. The following example converts the data filesusers_1.dbfandusers_2.dbftousers_enc1.dbfandusers_enc2.dbf:FILE_NAME_CONVERT = ('users', 'users_enc') -
In an Oracle Data Guard environment, include the name of the standby database data file in the
FILE_NAME_CONVERTsettings. -
If you are using Oracle-managed file mode, then the new file name is internally assigned, so this file name should not affect your site’s file-naming standards. If you are using non-Oracle-managed file mode and if you omit the
FILE_NAME_CONVERTclause, then Oracle Database internally assigns an auxiliary file name, and then later renames it back to the original name. This enables the encryption process to use the name that you had originally given the file to be encrypted. The renaming operation is effectively creating another copy of the file, hence it is slower than explicitly including theFILE_NAME_CONVERTclause. For better performance, include theFILE_NAME_CONVERTclause. -
You can find the data files for a tablespace by querying the
V$DATAFILEorV$DATAFILE_HEADERdynamic views.By default, data files are in the
$ORACLE_HOME/dbsdirectory. If the data files are located there, then you do not have to specify a path.After you complete the conversion, you can check the encryption status by querying the
STATUScolumn of theV$ENCRYPTED_TABLESPACESdynamic view. TheENCRYPTIONALGcolumn of this view shows the encryption algorithm that is used. If the conversion process was interrupted, then you can resume it by runningALTER TABLESPACEwith theFINISHclause. For example, if the primary data file converts but the standby data file does not, then you can runALTER TABLESPACE ... FINISHon the standby database for the standby data files.
-
-
Related Topics
Rekeying an Existing Tablespace with Online Conversion
To rekey an existing tablespace that is online, you can use the REKEY clause of the ALTER TABLESPACE SQL statement.
Before you perform a rekey operation, be aware of the following:
-
You cannot rekey the
TEMPtablespace. If you want to assign a different encryption algorithm to aTEMPtablespace, then dropTEMPand recreate it with the correct encryption algorithm. -
Do not perform an online tablespace rekey operation with a master key operation concurrently. To find if any tablespaces are currently being rekeyed, issue the following query to find the rekey status of encrypted tablespaces:
SELECT TS#,ENCRYPTIONALG,STATUS FROM V$ENCRYPTED_TABLESPACES;A status of
REKEYINGmeans that the corresponding tablespace is still being rekeyed. Do not rekey the master key while this status is in effect.To rekey an existing tablespace with online conversion:
-
Connect to the united mode CDB root or isolated mode PDB as a user who has been granted the
SYSDBAadministrative privilege.You must have the
SYSDBAadministrative privilege to work with theSYSTEMandSYSAUXtablespaces. Otherwise, connect with theSYSKMadministrative privilege. -
Ensure that the following requirements are met:
-
The
COMPATIBLEinitialization parameter is set to 12.2.0.0 or later. -
The database is open and in read-write mode.
-
A master encryption key has been created and is open.
-
-
Query the
KEY_VERSIONandSTATUScolumns of theV$ENCRYPTED_TABLESPACESdynamic view to find the current status of the encryption algorithm used by the master encryption key. -
Perform the rekey operation, based on the status returned by the
V$ENCRYPTED_TABLESPACESdynamic view:-
If the key version status of the tablespace is
NORMAL, then specify the new algorithm of the online tablespace rekey.For example:
ALTER TABLESPACE users ENCRYPTION USING 'AES192' REKEY FILE_NAME_CONVERT = ('users.dbf', 'users_enc.dbf'); -
If the key version status is
ENCRYPTING,DECRYPTING, orREKEYING, then use theFINISHclause.For example:
ALTER TABLESPACE users ENCRYPTION ONLINE FINISH REKEY FILE_NAME_CONVERT = ('users.dbf', 'users_enc.dbf');
-
-
If the
ORA-00241 operation disallowed: control file inconsistent with data dictionaryerror appears, then restart the CDB root and then retry Step 4.If the conversion process was interrupted, then you can resume it by running
ALTER TABLESPACEwith theFINISHclause.
Related Topics
Rekeying the SYSAUX and UNDO Tablespaces with Online Conversion
To rekey the SYSAUX and UNDO onlne tablespaces, you can use the REKEY clause of the ALTER TABLESPACE SQL statement.
-
Connect to the united mode CDB root or isolated mode PDB as a user who has been granted the
SYSDBAadministrative privilege.You must have the
SYSDBAadministrative privilege to work with theSYSTEMandSYSAUXtablespaces. Otherwise, connect with theSYSKMadministrative privilege. -
Ensure that the following requirements are met:
-
The
COMPATIBLEinitialization parameter is set to 12.2.0.0 or later. -
The database is open and in read-write mode.
-
A master encryption key has been created and is open.
-
-
Depending on how the
_TABLESPACE_ENCRYPTION_DEFAULT_ALGORITHMparameter is set, perform the rekey operation as follows:-
If
_TABLESPACE_ENCRYPTION_DEFAULT_ALGORITHMis set to AES256, then you only need theREKEYclause in theALTER TABLESPACEstatement forSYSAUXorUNDO. For example:ALTER TABLESPACE SYSAUX ENCRYPTION REKEY; -
If
_TABLESPACE_ENCRYPTION_DEFAULT_ALGORITHMis not set, then you must manually specify the AES256 algorithm. For example:ALTER TABLESPACE SYSAUX ENCRYPTION USING 'AES256' REKEY;
-
Related Topics
Decrypting an Existing Tablespace with Online Conversion
To decrypt an existing tablespace with online conversion, you can use the ALTER TABLESPACE SQL statement with DECRYPT clause.
-
Connect to the united mode CDB root or isolated mode PDB as a user who has been granted the
SYSDBAadministrative privilege.You must have the
SYSDBAadministrative privilege to work with theSYSTEMandSYSAUXtablespaces. Otherwise, connect with theSYSKMadministrative privilege. -
Ensure that the following requirements are met:
-
The
COMPATIBLEinitialization parameter is set to 12.2.0.0 or later. -
The database is open and in read-write mode.
-
A master encryption key has been created and is open.
-
There is enough auxiliary space to complete the decryption.
-
-
Run the
ALTER TABLESPACESQL statement with theDECRYPTclause.For example:
ALTER TABLESPACE users ENCRYPTION ONLINE DECRYPT FILE_NAME_CONVERT = ('users_enc.dbf', 'users.dbf');In this specification:
-
When you specify the files to decrypt, enter them in the reverse order in which they were originally encrypted. That is, first enter the name of the encrypted file (
users_enc.dbf), followed by the data file (users.dbf). -
Do not provide an algorithm key for the decryption.
If the conversion process was interrupted, then you can resume it by running
ALTER TABLESPACEwith theFINISHclause.
-
Related Topics
Finishing an Interrupted Online Encryption Conversion
If an online encryption process is interrupted, then you can complete the conversion by rerunning the ALTER TABLESPACE statement using the FINISH clause.
An interrupted encryption process (encryption, rekey, or decryption) can be, for example, an ORA-28425: missing a valid FILE_NAME_CONVERT clause error in the FILE_NAME_CONVERT clause of the ALTER TABLESPACE SQL statement. Other examples of interrupted processes are if the conversion skips a data file, which can happen if there is an error when an Oracle DataBase WRiter (DBWR) process offlines a data file, or if there is not enough space for the auxiliary file. The tablespace should be operational even if you do not rerun the ALTER TABLESPACE statement with the FINISH clause.
In addition to interrupted encryption processes, the tablespace encryption process can fail during the period when the status is ENCRYPTING. In this case, you can either decrypt the tablespace back to its original state, or you can resume the encryption by using the ENCRYPTION ONLINE FINISH ENCRYPT clause of ALTER TABLEPSPACE.
-
Connect to the united mode CDB root or isolated mode PDB as a user who has been granted the
SYSDBAorSYSKMadministrative privilege.You must have the
SYSDBAadministrative privilege to work with theSYSTEMandSYSAUXtablespaces. Otherwise, connect with theSYSKMadministrative privilege. -
Query the
V$ENCRYPTED_TABLESPACESto check theSTATUScolumn for the tablespace.If the
STATUScolumn reportsENCRYPTING,DECRYPTING, orREKEYING, then re-run theALTER TABLESPACEstatement with theFINISHclause, as described in this procedure. If theSTATUSreportsNORMAL, then you can rerunALTER TABLESPACEwithout theFINISHclause.You can find the tablespace name that matches the
TS#andTABLESPACE_NAMEcolumns by querying theV$DATAFILE_HEADERview. -
If necessary query the following additional views to find information about the tablespace whose online conversion was interrupted:
-
DBA_TABLESPACESto find if theSTATUSof the tablespace indicates if it is online or offline. -
V$ENCRYPTED_TABLESPACESto find if theSTATUSof the tablespace indicates if it is encrypted, and what theKEY_VERSIONof the encryption key is. -
V$DATAFILEandV$DATAFILE_HEADERto find the data files that are associated with a tablespace.
-
-
Run the
ALTER TABLESPACEstatement using theFINISHclause.Examples are as follows:
-
For an encryption operation:
ALTER TABLESPACE users ENCRYPTION ONLINE FINISH ENCRYPT FILE_NAME_CONVERT = ('users.dbf', 'users_enc.dbf'); -
For a decryption operation:
ALTER TABLESPACE users ENCRYPTION ONLINE FINISH DECRYPT FILE_NAME_CONVERT = ('users_enc.dbf', 'users.dbf');Note the order in which the files are specified: first, the name of the encrypted file, and then the name of the data file. (In the encryption operation, the name of the data file is specified first, followed by the name of the encrypted file.)
-
For a rekey operation:
ALTER TABLESPACE users ENCRYPTION ONLINE FINISH REKEY FILE_NAME_CONVERT = ('users.dbf', 'users_enc.dbf');You cannot specify an algorithm when you use the
FINISHclause in anALTER TABLESPACEstatement.
-
-
To check the conversion, query the
STATUScolumn of theV$ENCRYPTED_TABLESPACESview.The status should be
NORMAL. In an Oracle Data Guard environment, if the database does not haveNORMALas theSTATUS, then run theALTER TABLESPACE ... FINISHstatement on the primary or the standby data file that did not successfully convert.
Rekeying an Encrypted Tablespace
Rekying an already encrypted tablespace enables you to change the data encryption keys from one algorithm to another, for example from AES128 to AES256.
-
Find the tablespaces that use the earlier algorithm.
For example, to find tablespaces that use the
AES128:SELECT TSVIEW.CON_ID, TSVIEW.NAME AS TS_NAME, ETSVIEW.ENCRYPTIONALG AS ENCRYPTION_ALG FROM V$TABLESPACE TSVIEW , V$ENCRYPTED_TABLESPACES ETSVIEW WHERE TSVIEW.TS# = ETSVIEW.TS# AND ETSVIEW.ENCRYPTEDTS = 'YES' AND ETSVIEW.ENCRYPTIONALG = 'AES128';Output similar to the following appears:
CON_ID TS_NAME ENCRYPTION_ALG ------ ---------------- ------------------------ 1 ENCRYPTED_TS_CDB AES128 -
Re-encrypt each tablepace that is listed in the output.
For example, to migrate the
ENCRYPTED_TS_CDBtablespace to use the latest supported algorithm, which isAES256:ALTER TABLESPACE ENCRYPTED_TS_CDB ENCRYPTION REKEY; -
To verify the re-encryption:
SELECT C.NAME AS PDB_NAME, T.NAME AS TBS_NAME, E.ENCRYPTIONALG AS ALG, E.CIPHERMODE AS "MODE", E.STATUS FROM V$TABLESPACE T, V$ENCRYPTED_TABLESPACES E, V$CONTAINERS C WHERE E.TS# = T.TS# AND E.CON_ID = T.CON_ID AND E.CON_ID = C.CON_ID ORDER BY E.CON_ID, T.NAME;
Related Topics
Creating an Encrypted Database Using DBCA
You can use DBCA to create an encrypted database in both single instance multitenant and Oracle Data Guard environments.
-
Using DBCA to Create an Encrypted Database
Before you run DBCA to create an encrypted database, you must create the
WALLET_ROOTdirectory. -
Using DBCA to Create an Oracle Data Guard Standby Database from an Encrypted Primary Database
Before you run DBCA to create the encrypted database in an Oracle Data Guard environment, you must copy the wallet from the primary to the standby database, and then create the
WALLET_ROOTdirectory. -
Best Practice after DBCA Creates an Encrypted Database
After DBCA has created an encrypted stand-alone or Oracle Data Guard primary and standby database, you can implement Transparent Data Encryption (TDE) best practices.
Using DBCA to Create an Encrypted Database
Before you run DBCA to create an encrypted database, you must create the WALLET_ROOT directory.
-
Log into the host where DBCA will create the database with the united mode PDBs.
DBCA cannot create PDBs in isolated mode.
-
Create the
WALLET_ROOTdirectory.For example:
mkdir -pvm700 /etc/ORACLE/KEYSTORES/financeWhen you run DBCA in the next step, DBCA will create the
WALLET_ROOT/tdesub-directory. -
Run the
dbca -createDatabasecommand to create the encrypted database, and include the appropriate TDE-related parameters.For example:
-configureTDE TRUE -tdeKeystoreConfigType FILE -tdeWalletRoot /etc/ORACLE/KEYSTORES/finance -tdeWalletLoginType LOCAL_AUTO_LOGIN -createTDESepsWallet -TdeWalletPassword ${SYS_PASSWORD}If you omit the following values, then DBCA uses their defaults, as follows:
-
tdeAlgorithm: The default is AES256 with XTS cipher mode. -
encryptTablespaces:SYSTEM,SYSAUXandUSERStablespaces are encrypted. TheTEMPandUNDOtablespaces remain unencrypted. TheALLsetting encrypts all tablespaces inCDB$ROOT. -
encryptPDBTablespaces: TheSYSTEM,SYSAUXandUSERStablespaces are encrypted. TheTEMPandUNDOtablespaces remain unencrypted. TheALLsetting encrypts all tablespaces in the PDB.
-
Related Topics
Using DBCA to Create an Oracle Data Guard Standby Database from an Encrypted Primary Database
Before you run DBCA to create the encrypted database in an Oracle Data Guard environment, you must copy the wallet from the primary to the standby database, and then create the WALLET_ROOT directory.
-
Log into the server where DBCA will create the standby database from an encrypted primary database.
DBCA cannot create a standby database from an encrypted primary database if the
REDO_TRANSPORT_USERinitialization parameter is set to a common user. -
Copy the TDE wallet from the primary host to the standby host.
When you run DBCA, you will specify this wallet location when you set the
primaryDBTdeWalletparameter. -
Create the
WALLET_ROOTdirectory.For example:
mkdir -pvm700 /etc/ORACLE/KEYSTORES/financeWhen you run DBCA in the next step, DBCA will create the
WALLET_ROOT/tdesub-directory. -
Run the
dbca -createDuplicateDBcommand to create the encrypted standby database, and include the appropriate TDE-related parameters.For example:
dbca -silent -createDuplicateDB -createAsStandby -configureTDE TRUE -tdeWalletRoot /etc/ORACLE/KEYSTORES/finance -primaryDBTdeWallet /tmp -tdeWalletLoginType LOCAL_AUTO_LOGIN -sourceTdeWalletPassword tde_password -TdeWalletPassword tde_password
Related Topics
Best Practice after DBCA Creates an Encrypted Database
After DBCA has created an encrypted stand-alone or Oracle Data Guard primary and standby database, you can implement Transparent Data Encryption (TDE) best practices.
-
Add the wallet password to another (local) auto-open wallet so that the wallet password on the SQL*Plus command line can be replaced by
EXTERNAL STORE.This helps with separation of duties and automation. In Oracle Data Guard, you should run both commands on the primary and standby databases.
$ mkdir -pvm700 WALLET_ROOT/tde_seps SQL> ADMINISTER KEY MANAGEMENT ADD SECRET 'wallet_password' FOR CLIENT 'TDE_WALLET' TO [LOCAL] AUTO-LOGIN KEYSTORE 'wallet_root/tde_seps'; -
Add a tag to the TDE master key for the PDB.
When DBCA creates a TDE master key for the PDB, it does not add a tag to this key. The following
ADMINISTER KEY MANAGEMENTcommand adds the tag to the PDB. The tag consists of the stringpdb_name date time (IN UTC). The date and time is derived from the time when the key was first activated, not the current time. Run this command in the primary PDB.SELECT ' ADMINISTER KEY MANAGEMENT SET TAG '''||SYS_CONTEXT('USERENV', 'CON_NAME')||' '||TO_CHAR (SYS_EXTRACT_UTC (ACTIVATION_TIME), 'YYYY-MM-DD HH24:MI:SS"Z"')||''' FOR '''||KEY_ID||''' FORCE KEYSTORE IDENTIFIED BY EXTERNAL STORE WITH BACKUP;' AS "SET TAG COMMAND" FROM V$ENCRYPTION_KEYS;For Oracle Data Guard, copy the primary wallet (with the tagged PDB key) to the standby side. If you are using local auto-login wallets, then delete and recreate the local auto-open wallet on the standby database.
-
Encrypt the data dictionary.
This is a Data Guard transaction and as such, it is automatically applied to the standby database. As a user with the
SYSKMadministrative privilege, perform the followingALTER DATABASE DICTIONARYcommand:ALTER DATABASE DICTIONARY ENCRYPT CREDENTIALS CONTAINER = CURRENT; -
Optionally, you can isolate the encrypted PDB with a single command.
-
From within the primary PDB:
ADMINISTER KEY MANAGEMENT FORCE ISOLATE KEYSTORE IDENTIFIED BY "new_pdb_wallet_password" FROM ROOT KEYSTORE FORCE KEYSTORE IDENTIFIED BY EXTERNAL STORE WITH BACKUP;You can run this command without knowing the root wallet password, and the root administrator will not know the new isolated wallet password. This command performs the following actions:
-
Creates the
WALLET_ROOT/pdb_guid/tdedirectrory -
Creates a wallet in the
WALLET_ROOT/pdb_guid/tdedirectory -
Moves the PDB keys from the root wallet to the PDB wallet
-
Sets the
TDE_CONFIGURATIONparameter for the PDB toFILENext, create an isolated (local) auto-open wallet; from within the primary PDB:
ADMINISTER KEY MANAGEMENT CREATE [LOCAL] AUTO_LOGIN KEYSTORE FROM KEYSTORE IDENTIFIED BY "new_pdb_wallet_password";
-
-
From within the isolated PDB, create a directory and another local auto-open wallet that enables you to hide the isolated wallet password from the SQL*Plus command line.
SELECT ' HOST MKDIR -PVM700 '||B.VALUE||'/'||A.GUID||'/TDE_SEPS' AS "CREATE DIRECTORY FOR IDENTIFIED BY EXTERNAL STORE (IBES)" FROM V$PDBS A, V$PARAMETER B WHERE B.NAME = 'WALLET_ROOT'; SELECT 'ADMINISTER KEY MANAGEMENT ADD SECRET ''NEW-PDB-WALLET-PWD'' FOR CLIENT ''TDE_WALLET'' TO LOCAL AUTO_LOGIN KEYSTORE '''||B.VALUE||'/'||A.GUID||'/TDE_SEPS''' AS "CREATE ISOLATED WALLET FOR IBES" FROM V$PDBS A, V$PARAMETER B WHERE B.NAME = 'WALLET_ROOT';
-
Encryption Conversions for Existing Databases
You can encrypt both offline and online databases.
-
About Encryption Conversions for Existing Databases
The encryption conversion of an entire database encrypts all tablespaces, including the Oracle-supplied
SYSTEM,SYSAUX,UNDO, andTEMPtablespaces. -
Encrypting an Existing Database with Offline Conversion
When you encrypt an existing database with offline conversion, for the Oracle-managed tablespaces, you do not specify an encryption algorithm.
-
Encrypting an Existing Database with Online Conversion
When you encrypt an existing database with online conversion, you do not specify an encryption algorithm.
About Encryption Conversions for Existing Databases
The encryption conversion of an entire database encrypts all tablespaces, including the Oracle-supplied SYSTEM, SYSAUX, UNDO, and TEMP tablespaces.
Note the following:
-
If you are using Database Configuration Assistant (DBCA) to create or configure a database, then you can create a TDE wallet in the database as part of the creation or configuration process. When you drop a database by using DBCA, any TDE wallets that are in this database are also removed. Important: Before you drop a database by using DBCA, and if it has any local TDE wallets, then back these wallets up to a secure location. If the database has been migrated to use Oracle Key Vault, then be aware that its TDE encryption keys reside in the Oracle Key Vault server. It is the responsibility of the Oracle Key Vault administrator to back up Oracle Key Vault.
-
To perform the encryption, you can use the offline and online functionality of the tablespace encryption conversions.
-
You can encrypt any or all of the Oracle-supplied tablespaces, and in any order. The encryption of the Oracle-supplied tablespaces has no impact on the encryption of user-created tablespaces.
-
When you encrypt the Oracle-supplied tablespaces, Oracle Database prevents the keystore from being closed.
-
You cannot encrypt an existing temporary tablespace, but you can create an encrypted temporary tablespace, configure the database to use that new encrypted temporary tablespace as the default temporary tablespace, and then drop the old clear-text temporary tablespace.
-
The
UNDOandTEMPmetadata that is generated from sensitive data in an encrypted tablespace is already automatically encrypted. Therefore, encryptingUNDOandTEMPis optional. -
The performance effect of encrypting all the tablespaces in a database depends on the workload and platform. Many modern CPUs provide built-in hardware acceleration, which results in a minimal performance impact.
-
In a multitenant environment, you can encrypt any tablespaces in any pluggable databases (PDBs), including the Oracle-supplied tablespaces. However, the keystore in the CDB root must be open at all times so that a PDB can open its keystore. You can check the status of whether a keystore is open by querying the
STATUScolumn of theV$ENCRYPTION_WALLETview
Encrypting an Existing Database with Offline Conversion
When you encrypt an existing database with offline conversion, for the Oracle-managed tablespaces, you do not specify an encryption algorithm.
-
Connect to the united mode CDB root or isolated mode PDB as a user who has been granted the
SYSDBAadministrative privilege.You must have the
SYSDBAadministrative privilege to work with theSYSTEMandSYSAUXtablespaces. Otherwise, connect with theSYSKMadministrative privilege. -
Mount the database.
STARTUP MOUNT -
As a user who has been granted the
ADMINISTER KEY MANAGEMENTorSYSKMprivilege, open the keystore.ADMINISTER KEY MANAGEMENT SET KEYSTORE OPEN IDENTIFIED BY keystore_password; -
Run the
ALTER TABLESPACESQL statement to encrypt theSYSTEM,SYSAUX, andUNDOtablespaces. Do not encrypt theSYSTEMtablespace concurrently with the encryption of other tablespaces.For example, to encrypt the
SYSTEMtablespace:ALTER TABLESPACE SYSTEM ENCRYPTION OFFLINE ENCRYPT; -
Open the CDB root or the PDB.
-
For a CDB, to open in read/write mode, for example:
ALTER DATABASE OPEN READ WRITE; -
For a PDB:
ALTER PLUGGABLE DATABASE pdb_name OPEN READ WRITE;
-
-
Run the
ALTER TABLESPACESQL statement to encrypt other user tablespaces.Alternatively, you can proceed to the next step and open the database first, and then perform the steps to encrypt an existing user-defined tablespace with offline conversion.
-
Open the CDB root or the PDB.
-
For a CDB:
ALTER DATABASE OPEN; -
For a PDB:
ALTER PLUGGABLE DATABASE pdb_name OPEN;After you have encrypted the tablespace, if you want to use a different encryption algorithm (change the TDE master encryption key) for the
SYSTEM,SYSAUX, andUNDOtablespaces, then you must use online conversion. In addition toAES128, supported encryption algorithms areAES192andAES256, in addition to other algorithms such asARIAandGOST.Note: Starting with Oracle AI Database 26ai, the Transparent Data Encryption (TDE) decryption libraries for the GOST and SEED algorithms are deprecated, and encryption to GOST and SEED are desupported. Starting with Oracle AI Database 26ai, the Transparent Data Encryption (TDE) encryption libraries for the GOST and SEED algorithms are desupported and removed. The GOST and SEED decryption libraries are deprecated. Both are removed on HP Itanium platforms.GOST 28147-89 has been deprecated by the Russian government, and SEED has been deprecated by the South Korean government. If you need South Korean government-approved TDE cryptography, then use ARIA instead. If you are using GOST 28147-89, then you must decrypt and encrypt with another supported TDE algorithm. The decryption algorithms for GOST 28147-89 and SEED are included with Oracle AI Database 26ai, but are deprecated, and the GOST encryption algorithm is desupported with Oracle AI Database 26ai. If you are using GOST or SEED for TDE encryption, then Oracle recommends that you perform an online rekey operation before upgrading to Oracle AI Database 26ai. However, with the exception of the HP Itanium platform, the GOST and SEED decryption libraries are available with Oracle AI Database 26ai, so you can also decrypt after upgrading.
-
Related Topics
Encrypting an Existing Database with Online Conversion
When you encrypt an existing database with online conversion, you do not specify an encryption algorithm.
The reason that you do not need to specify an encryption algorithm the first time you perform the encryption is that the tablespaces that you must use to encrypt the database are automatically encrypted with the database key. If you want to change the algorithm, then you can issue the ALTER TABLESPACE ENCRYPTION REKEY SQL statement after the initial encryption.
-
Perform the following tasks, which are performed when encrypting an existing tablespace with online conversion:
-
Connect as a user who has been granted the
SYSDBAadministrative privilege. -
Ensure that the
COMPATIBLEparameter is set to12.2.0.0or later. -
Ensure that the database is open in read-write mode.
-
Ensure that you have enough auxiliary space to complete the encryption.
-
Back up the tablespaces that you must encrypt.
-
Open the keystore.
-
-
Run the
ALTER TABLESPACESQL statement to encrypt theSYSTEM,SYSAUX, andUNDOtablespaces. Do not specify an algorithm, and do not encrypt theSYSTEMtablespace concurrently with the encryption of other tablespaces.For example, to encrypt the
SYSTEMtablespace:ALTER TABLESPACE SYSTEM ENCRYPTION ONLINE ENCRYPT FILE_NAME_CONVERT=('system01.dbf','system01_enc.dbf'); -
Create a temporary tablespace.
-
Create a new (encrypted)
TEMPtablespace with the identical characteristics as the originalTEMPtablespace, as follows:SELECT ' CREATE TEMPORARY TABLESPACE ' ||tablespace_name||'_ENC tempfile ''' ||substr(file_name,1,length(file_name)-4) ||'_enc.dbf'' size ' ||bytes||' ENCRYPTION USING ''AES256'' ENCRYPT;' AS " Create new encrypted TEMP tablespace" FROM DBA_TEMP_FILES;Alternatively, you could extract the original parameters by running
DBMS_METADATA.GET_DDL. If you omit theUSING algorithmclause, then Oracle Database applies the default algorithm. -
Run the command (that is, the output of the
SELECTstatement). -
Change the database default temporary tablespace to the new encrypted
TEMPtablespace.ALTER DATABASE DEFAULT TEMPORARY TABLESPACE temp_enc; -
Drop the original
TEMPtablespace.DROP TABLESPACE TEMP INCLUDING CONTENTS AND DATAFILES;Optionally, you can rename
temp_enctoTEMP.
-
Related Topics