Purpose
This statement is used to modify the encryption method of a tablespace.
Privilege requirements
To execute the ALTER TABLESPACE statement, the current user must have the CREATE TABLESPACE management privilege. For more information about OceanBase Database privileges, see Privilege classification in MySQL-compatible mode.
Syntax
Modify the encryption method of an encrypted tablespace.
ALTER TABLESPACE tablespace_name ENCRYPTION [=] 'tablespace_encryption_option'; tablespace_encryption_option: N | Y | AES-256 | AES-256-GCM | AES-128 | AES-128-GCM | AES-192 | AES-192-GCM | SM4-CBC | SM4-GCMModify a tablespace.
ALTER TABLESPACE tablespace_name {ADD | DROP} DATAFILE 'file_name' [INITIAL_SIZE [=] size] [WAIT] ENGINE [=] engine_nameNotice
Only the syntax with the keyword is supported, and the feature is not effective. The keyword cannot be used with
ENCRYPTION. Otherwise, an error will be returned.
Parameters
Parameter |
Description |
|---|---|
| tablespace_name | The name of the tablespace to be modified. |
| tablespace_encryption_option | The encryption algorithm to be used for the tablespace. For more information about the encryption algorithm, see tablespace_encryption_option. |
tablespace_encryption_option
N: No encryption.Y: IfYis specified, the default encryption algorithm isAES-256.AES-256: Uses a 256-bit key for encryption and decryption.AES-256-GCM: Uses a 256-bit key in GCM mode.AES-128: Uses a 128-bit key for encryption and decryption.AES-128-GCM: Uses a 128-bit key in GCM mode.AES-192: Uses a 192-bit key for encryption and decryption.AES-192-GCM: Uses a 192-bit key in GCM mode.SM4-CBC: SM4 algorithm in CBC mode, where each data block is XORed with the output of the previous block before encryption.SM4-GCM: SM4 algorithm in GCM mode, which provides both data encryption and authentication.
Note
- AES (Advanced Encryption Standard) is a symmetric encryption algorithm, meaning the same key is used for both encryption and decryption. AES is a block-based encryption algorithm, typically encrypting data in 128-bit blocks.
- AES-GCM (Galois/Counter Mode) is an operation mode used to process block encryption algorithms (such as AES), providing both encryption and data authentication (also known as message authentication code).
- The block length and key length of the SM4 algorithm are both 128 bits.
Examples
Change the encryption method of the unencrypted tablespace tablespace001 to use the SM4-GCM encryption algorithm.
ALTER TABLESPACE tablespace001 ENCRYPTION = 'SM4-GCM';
