Purpose
This statement is used to modify the tablespace encryption method.
Privilege requirements
To execute the ALTER TABLESPACE statement, the current user must have the CREATE TABLESPACE privilege. For more information about OceanBase AI Database privileges, see Permission classification.
Syntax
Modify 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 tablespaces.
ALTER TABLESPACE tablespace_name {ADD | DROP} DATAFILE 'file_name' [INITIAL_SIZE [=] size] [WAIT] ENGINE [=] engine_nameNotice
Only this keyword syntax is supported; the feature does not take effect. This syntax keyword cannot be executed together with
ENCRYPTION, otherwise a syntax error will occur.
Parameters
Parameter |
Description |
|---|---|
| tablespace_name | Specifies the name of the tablespaces object to be modified. |
| tablespace_encryption_option | Specifies the encryption algorithm used for encrypting the specified tablespace object. For more information about encryption algorithms, see tablespace_encryption_option. |
tablespace_encryption_option
N: Indicates that no encryption is performed.Y: If you useY, the defaultAES-256algorithm is used.AES-256: Uses a 256-bit key for encryption and decryption.AES-256-GCM: Uses the GCM mode with a 256-bit key.AES-128: Uses a 128-bit key for encryption and decryption.AES-128-GCM: GCM mode using a 128-bit key.AES-192: Uses a 192-bit key for encryption and decryption.AES-192-GCM: GCM mode using a 192-bit key.SM4-CBC: The SM4 algorithm is used in CBC mode, where each data block is encrypted by performing an XOR operation with the encrypted output of the previous block.SM4-GCM: The SM4 algorithm in GCM mode, which provides both data encryption and authentication.
Note
- AES (Advanced Encryption Standard) is a symmetric encryption algorithm, which means the same key is used for both encrypting and decrypting data. The AES algorithm itself is based on block encryption and typically encrypts data in 128-bit blocks.
- AES-GCM (Galois/Counter Mode) is a mode of operation used to process block encryption algorithms such as AES, providing both encryption and data authentication (also known as a message authentication code).
- The SM4 algorithm uses 128-bit blocks and 128-bit keys.
Examples
Modify the unencrypted tablespaces to use the SM4-GCM encryption algorithm.
ALTER TABLESPACE tablespace001 ENCRYPTION = 'SM4-GCM';