Purpose
This statement is used to create a TableSpace logical object. Encryption is supported for the TableSpace attribute.
Syntax
CREATE TABLESPACE tablespace_name
[ ENCRYPTION USING 'algorithm' ]
algorithm:
'AES-256' | 'AES-128' | 'AES-192' | 'SM4-CBC'
Parameters
| Parameter | Description |
|---|---|
| tablespace_name | The name of the TableSpace object to be created. |
| ENCRYPTION USING | The keyword for specifying the encryption method. |
| AES-256|AES-128|AES-192|SM4-CBC | The encryption algorithm used. |
Examples
Create a TableSpace object.
obclient> CREATE TABLESPACE tblspace1;Create a TableSpace object with encryption enabled.
-- Step 1: Set the TDE method to internal key management. obclient> ALTER SYSTEM SET TDE_METHOD = 'INTERNAL'; -- Step 2: Create a key store. obclient> ADMINISTER KEY MANAGEMENT CREATE KEYSTORE my_keystore IDENTIFIED BY abcCBAK123; -- Step 3: Open the key store. obclient> ADMINISTER KEY MANAGEMENT SET KEYSTORE OPEN IDENTIFIED BY abcCBAK123; -- Step 4: Create a master key. obclient> ADMINISTER KEY MANAGEMENT SET KEY IDENTIFIED BY abcCBAK123; -- Step 5: Create an encrypted tablespace. obclient> CREATE TABLESPACE tblspace2 ENCRYPTION USING 'SM4-CBC';In the preceding example,
abcCBAK123is used for password examples. Please replace it with a secure password in practice.