Purpose
The MODULE DATA statement has the following two purposes:
ALTER SYSTEM LOAD MODULE DATA ...: this statement is used to import a specified feature for a specific tenant.ALTER SYSTEM CHECK MODULE DATA ...: this statement is used to check whether a specified feature is imported for a specific tenant.
Note
For V4.3.5, the MODULE DATA statement is supported starting with V4.3.5 BP4.
Limitations and considerations
- This statement can only be executed in the
sys(system) tenant. - The current version only supports importing the
REDISmodule feature to MySQL-compatible tenants. - The current version only supports checking (using the
CHECK MODULE DATAstatement) the importedREDISmodule feature.
Privilege requirements
The user executing this statement must have the ALTER SYSTEM privilege. For more information about OceanBase Database privileges, see Privilege types in MySQL-compatible mode.
Syntax
ALTER SYSTEM {LOAD | CHECK} MODULE DATA
MODULE = module_value
TENANT = tenant_name
[INFILE = file_path];
module_value:
REDIS
| GIS
| TIMEZONE
Parameters
| Parameter | Description |
|---|---|
| LOAD | CHECK | Specifies whether to import or check the feature. The options are described as follows:
|
| tenant_name | Specifies the name of the tenant to operate on. |
| module_value | Specifies the feature to operate on. For more information, see module_value. |
| file_path | Specifies the path of the SQL file to be imported.
Notice
|
module_value
REDIS: specifies to operate on theREDISmodule.GIS: specifies to operate on theGISmodule.TIMEZONE: specifies to operate on theTIMEZONEmodule.
Example
LOAD MODULE DATA example
Import the
REDISmodule to themysql001tenant. Currently, theREDISmodule does not support specifying anINFILEpath, so an error is returned.ALTER SYSTEM LOAD MODULE DATA MODULE = REDIS TENANT = mysql001 INFILE = '/home/admin/test.sql';The return result is as follows:
ERROR 4025 (HY000): loading redis module does not need to specify infileImport the
REDISmodule to themysql001tenant.ALTER SYSTEM LOAD MODULE DATA MODULE = REDIS TENANT = mysql001;The return result is as follows:
Query OK, 0 rows affectedImport the
GISmodule to themysql001tenant. TheINFILEparameter is optional. The default value isetc/, and the corresponding file is located in theetcdirectory under the deployment directory.ALTER SYSTEM LOAD MODULE DATA MODULE = GIS TENANT = mysql001 INFILE = 'etc/';The return result is as follows:
Query OK, 0 rows affectedImport the
TIMEZONEmodule to themysql001tenant. TheINFILEparameter is optional. The default value isetc/, and the corresponding file is located in theetcdirectory under the deployment directory.ALTER SYSTEM LOAD MODULE DATA MODULE = TIMEZONE TENANT = mysql001 INFILE = 'etc/';The return result is as follows:
Query OK, 0 rows affected
CHECK MODULE DATA example
Notice
The current version only supports checking the functionality of the REDIS module imported (by using the CHECK MODULE DATA statement).
If no functionality is imported to the tenant, an error is returned when the
CHECK MODULE DATAstatement is executed. Check whether theREDISmodule functionality is imported to the tenantmysql002.ALTER SYSTEM CHECK MODULE DATA MODULE = REDIS TENANT = mysql002;The return result is as follows:
ERROR 4025 (HY000): redis info is not complete, please retry loadingAfter the functionality is imported to the tenant, check the import status.
Import the
REDISmodule functionality to the tenantmysql002.ALTER SYSTEM LOAD MODULE DATA MODULE = REDIS TENANT = 'mysql002';The return result is as follows:
Query OK, 0 rows affectedCheck whether the
REDISmodule functionality is imported to the tenantmysql002.ALTER SYSTEM CHECK MODULE DATA MODULE = REDIS TENANT = mysql002;The return result is as follows:
Query OK, 0 rows affected