Purpose
The MODULE DATA statement has the following two functions:
ALTER SYSTEM LOAD MODULE DATA ...: This statement is used to import a specified feature to a tenant.ALTER SYSTEM CHECK MODULE DATA ...: This statement is used to check whether a specified feature has been imported to a tenant.
Note
The MODULE DATA statement is supported in OceanBase Database V4.2.5 as of V4.2.5 BP2.
Limitations and considerations
- This statement can be executed only in the
sys(system) tenant. - At present, this statement supports importing only the
REDISmodule feature to MySQL tenants. - At present, this statement supports checking (
CHECK MODULE DATA) theREDISmodule feature.
Privilege requirements
The user who executes the statement must have the ALTER SYSTEM privilege. For more information about privileges in OceanBase Database, see Privilege types in MySQL 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 a feature. It can take the following values:
|
| tenant_name | The name of the tenant to operate on. |
| module_value | The feature to operate on. For more information, see module_value. |
| file_path | The path of the SQL file to import.
Notice
|
module_value
REDIS: specifies to operate on theREDISmodule feature.GIS: specifies to operate on theGISmodule feature.TIMEZONE: specifies to operate on theTIMEZONEmodule feature.
Examples
LOAD MODULE DATA example
Import the
REDISmodule feature to themysql001tenant. Currently, theREDISmodule does not support theINFILEparameter, 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 feature to themysql001tenant.ALTER SYSTEM LOAD MODULE DATA MODULE = REDIS TENANT = mysql001;The return result is as follows:
Query OK, 0 rows affectedImport the
GISmodule feature to themysql001tenant. TheINFILEparameter is optional. If it is not specified, the default valueetc/is used. The corresponding file is located in theetcdirectory of the installation 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 feature to themysql001tenant. TheINFILEparameter is optional. If it is not specified, the default valueetc/is used. The corresponding file is located in theetcdirectory of the installation 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
At present, the CHECK MODULE DATA operation supports only the REDIS module.
If no features are imported to a tenant, the
CHECK MODULE DATAstatement will fail. Check whether theREDISmodule is imported to themysql002tenant.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 loadingImport the features of the
REDISmodule to the tenant first, and then check the import status.Import the
REDISmodule to themysql002tenant.ALTER SYSTEM LOAD MODULE DATA MODULE = REDIS TENANT = 'mysql002';The return result is as follows:
Query OK, 0 rows affectedCheck whether the
REDISmodule is imported to themysql002tenant.ALTER SYSTEM CHECK MODULE DATA MODULE = REDIS TENANT = mysql002;The return result is as follows:
Query OK, 0 rows affected