This is an automated email from the ASF dual-hosted git repository.

jianglongtao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new dd16be872a0 Add DistSQL EXPORT/IMPORT METADATA (#24355)
dd16be872a0 is described below

commit dd16be872a0f24d24e147c58041f7f92a34879d9
Author: ChenJiaHao <[email protected]>
AuthorDate: Mon Feb 27 19:02:51 2023 +0800

    Add DistSQL EXPORT/IMPORT METADATA (#24355)
    
    * Add DistSQL EXPORT/IMPORT METADATA
    
    * EXPORT/IMPORT METADATA add storage node info
    
    * Add EXPORT METADATA unit test
    
    * Add IMPORT METADATA unit test
    
    * Add EXPORT/IMPORT METADATA parser test case
    
    * Fix import metadata from json value
    
    * Fix code style
    
    * Fix unit test
    
    * Optimize import metadata
    
    * EXPORT METADATA support export all logic database configuration
    
    * Update Import related test case
    
    * Fix test
    
    * Fix code style
    
    * Fix code style
---
 distsql/parser/src/main/antlr4/imports/BaseRule.g4 |   4 +
 .../parser/src/main/antlr4/imports/RALStatement.g4 |  12 ++
 .../parser/autogen/KernelDistSQLStatement.g4       |   2 +
 .../core/kernel/KernelDistSQLStatementVisitor.java |  18 +++
 .../ral/queryable/ExportMetaDataStatement.java}    |  65 +++------
 .../ral/updatable/ImportMetaDataStatement.java}    |  69 ++++-----
 .../yaml/config/YamlLoggingRuleConfiguration.java  |   4 +-
 .../distsql/export/ExportedClusterInfo.java        |  18 +--
 .../backend/distsql/export/ExportedMetaData.java   |  21 ++-
 .../distsql/export/ExportedStorageNode.java        |  65 +++------
 .../ExportDatabaseConfigurationExecutor.java       | 102 +------------
 .../ral/queryable/ExportMetaDataExecutor.java      | 144 +++++++++++++++++++
 .../ImportDatabaseConfigurationUpdater.java        | 158 +--------------------
 .../ral/updatable/ImportMetaDataUpdater.java       |  89 ++++++++++++
 .../ExportUtils.java}                              |  79 +++++------
 .../ImportUtils.java}                              | 101 +++++++------
 .../proxy/backend/util/JsonUtils.java              |  73 ++++++++++
 ....distsql.handler.ral.query.QueryableRALExecutor |   1 +
 ...ingsphere.distsql.handler.ral.update.RALUpdater |   1 +
 .../ral/queryable/ExportMetaDataExecutorTest.java  | 140 ++++++++++++++++++
 .../ImportDatabaseConfigurationUpdaterTest.java    |  56 +-------
 .../ral/updatable/ImportMetaDataUpdaterTest.java   | 133 +++++++++++++++++
 .../test/resources/conf/import/empty-metadata.json |   1 +
 .../expected/export-metadata-configuration.json    |   1 +
 .../ral/impl/QueryableRALStatementAssert.java      |  27 ++--
 .../ral/impl/UpdatableRALStatementAssert.java      |   5 +
 .../queryable/ExportMetaDataStatementAssert.java   |  47 ++++++
 .../updatable/ImportMetaDataStatementAssert.java   |  51 +++++++
 .../cases/parser/jaxb/RootSQLParserTestCases.java  |   8 ++
 .../ral/ExportMetaDataStatementTestCase.java       |  52 +------
 .../ral/ImportMetaDataStatementTestCase.java       |  59 ++------
 .../src/main/resources/case/ral/queryable.xml      |   1 +
 .../src/main/resources/case/ral/updatable.xml      |   3 +
 .../main/resources/sql/supported/ral/queryable.xml |   1 +
 .../main/resources/sql/supported/ral/updatable.xml |   1 +
 35 files changed, 953 insertions(+), 659 deletions(-)

diff --git a/distsql/parser/src/main/antlr4/imports/BaseRule.g4 
b/distsql/parser/src/main/antlr4/imports/BaseRule.g4
index 95f6357780b..9e699151ed6 100644
--- a/distsql/parser/src/main/antlr4/imports/BaseRule.g4
+++ b/distsql/parser/src/main/antlr4/imports/BaseRule.g4
@@ -62,3 +62,7 @@ resourceName
 storageUnitName
     : IDENTIFIER_
     ;
+
+metadata
+    : STRING_
+    ;
diff --git a/distsql/parser/src/main/antlr4/imports/RALStatement.g4 
b/distsql/parser/src/main/antlr4/imports/RALStatement.g4
index e0053553b62..ba8125ddaad 100644
--- a/distsql/parser/src/main/antlr4/imports/RALStatement.g4
+++ b/distsql/parser/src/main/antlr4/imports/RALStatement.g4
@@ -87,6 +87,14 @@ importDatabaseConfiguration
     : IMPORT DATABASE CONFIGURATION FROM FILE filePath
     ;
 
+exportMetaData
+    : EXPORT METADATA (TO FILE filePath)?
+    ;
+
+importMetaData
+    : IMPORT METADATA (metaDataValue | FROM FILE filePath)
+    ;
+
 convertYamlConfiguration
     : CONVERT YAML CONFIGURATION FROM FILE filePath
     ;
@@ -139,6 +147,10 @@ filePath
     : STRING_
     ;
 
+metaDataValue
+    : STRING_
+    ;
+
 variableName
     : IDENTIFIER_ | STRING_
     ;
diff --git 
a/distsql/parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/KernelDistSQLStatement.g4
 
b/distsql/parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/KernelDistSQLStatement.g4
index 6afc813ed47..e8d8dab1637 100644
--- 
a/distsql/parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/KernelDistSQLStatement.g4
+++ 
b/distsql/parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/KernelDistSQLStatement.g4
@@ -47,6 +47,8 @@ execute
     | showTableMetadata
     | exportDatabaseConfiguration
     | importDatabaseConfiguration
+    | exportMetaData
+    | importMetaData
     | convertYamlConfiguration
     | showMigrationRule
     | alterMigrationRule
diff --git 
a/distsql/parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLStatementVisitor.java
 
b/distsql/parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLStatementVisitor.java
index 512081dfc64..281c4acb097 100644
--- 
a/distsql/parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLStatementVisitor.java
+++ 
b/distsql/parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLStatementVisitor.java
@@ -30,8 +30,10 @@ import 
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementPa
 import 
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.DisableComputeNodeContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.EnableComputeNodeContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ExportDatabaseConfigurationContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ExportMetaDataContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.FromSegmentContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ImportDatabaseConfigurationContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ImportMetaDataContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.InstanceIdContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.InventoryIncrementalRuleContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.LabelComputeNodeContext;
@@ -72,6 +74,7 @@ import 
org.apache.shardingsphere.distsql.parser.segment.ReadOrWriteSegment;
 import 
org.apache.shardingsphere.distsql.parser.segment.URLBasedDataSourceSegment;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ConvertYamlConfigurationStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ExportDatabaseConfigurationStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ExportMetaDataStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowComputeNodeInfoStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowComputeNodeModeStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowComputeNodesStatement;
@@ -82,6 +85,7 @@ import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowTabl
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.updatable.AlterComputeNodeStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.updatable.AlterInventoryIncrementalRuleStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.updatable.ImportDatabaseConfigurationStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.ral.updatable.ImportMetaDataStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.updatable.LabelComputeNodeStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.updatable.RefreshDatabaseMetaDataStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.updatable.RefreshTableMetaDataStatement;
@@ -287,6 +291,11 @@ public final class KernelDistSQLStatementVisitor extends 
KernelDistSQLStatementB
         return new ExportDatabaseConfigurationStatement(null == 
ctx.databaseName() ? null : (DatabaseSegment) visit(ctx.databaseName()), 
getIdentifierValue(ctx.filePath()));
     }
     
+    @Override
+    public ASTNode visitExportMetaData(final ExportMetaDataContext ctx) {
+        return new ExportMetaDataStatement(null == ctx.filePath() ? null : 
getIdentifierValue(ctx.filePath()));
+    }
+    
     @Override
     public ASTNode visitConvertYamlConfiguration(final 
ConvertYamlConfigurationContext ctx) {
         return new 
ConvertYamlConfigurationStatement(getIdentifierValue(ctx.filePath()));
@@ -302,6 +311,11 @@ public final class KernelDistSQLStatementVisitor extends 
KernelDistSQLStatementB
         return new 
ImportDatabaseConfigurationStatement(getIdentifierValue(ctx.filePath()));
     }
     
+    @Override
+    public ASTNode visitImportMetaData(final ImportMetaDataContext ctx) {
+        return new ImportMetaDataStatement(null == ctx.metaDataValue() ? null 
: getQuotedContent(ctx.metaDataValue()), getIdentifierValue(ctx.filePath()));
+    }
+    
     @Override
     public ASTNode visitShowMigrationRule(final ShowMigrationRuleContext ctx) {
         return new ShowMigrationRuleStatement();
@@ -384,4 +398,8 @@ public final class KernelDistSQLStatementVisitor extends 
KernelDistSQLStatementB
     private String getIdentifierValue(final ParseTree context) {
         return null == context ? null : new 
IdentifierValue(context.getText()).getValue();
     }
+    
+    private String getQuotedContent(final ParseTree context) {
+        return IdentifierValue.getQuotedContent(context.getText());
+    }
 }
diff --git a/distsql/parser/src/main/antlr4/imports/BaseRule.g4 
b/distsql/statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ExportMetaDataStatement.java
similarity index 56%
copy from distsql/parser/src/main/antlr4/imports/BaseRule.g4
copy to 
distsql/statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ExportMetaDataStatement.java
index 95f6357780b..8094f031dbb 100644
--- a/distsql/parser/src/main/antlr4/imports/BaseRule.g4
+++ 
b/distsql/statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ExportMetaDataStatement.java
@@ -15,50 +15,27 @@
  * limitations under the License.
  */
 
-grammar BaseRule;
+package org.apache.shardingsphere.distsql.parser.statement.ral.queryable;
 
-import Symbol, Keyword, Literals;
+import lombok.RequiredArgsConstructor;
+import 
org.apache.shardingsphere.distsql.parser.statement.ral.QueryableRALStatement;
 
-literal
-    : STRING_ | (MINUS_)? INT_ | TRUE | FALSE
-    ;
+import java.util.Optional;
 
-algorithmDefinition
-    : TYPE LP_ NAME EQ_ algorithmTypeName (COMMA_ propertiesDefinition)? RP_
-    ;
-
-algorithmTypeName
-    : STRING_
-    ;
-
-propertiesDefinition
-    : PROPERTIES LP_ properties? RP_
-    ;
-
-properties
-    : property (COMMA_ property)*
-    ;
-
-property
-    : key=STRING_ EQ_ value=literal
-    ;
-
-databaseName
-    : IDENTIFIER_
-    ;
-
-schemaName
-    : IDENTIFIER_
-    ;
-
-tableName
-    : IDENTIFIER_
-    ;
-
-resourceName
-    : IDENTIFIER_
-    ;
-
-storageUnitName
-    : IDENTIFIER_
-    ;
+/**
+ * Export metadata statement.
+ */
+@RequiredArgsConstructor
+public final class ExportMetaDataStatement extends QueryableRALStatement {
+    
+    private final String filePath;
+    
+    /**
+     * Get file path.
+     *
+     * @return file path
+     */
+    public Optional<String> getFilePath() {
+        return Optional.ofNullable(filePath);
+    }
+}
diff --git a/distsql/parser/src/main/antlr4/imports/BaseRule.g4 
b/distsql/statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/updatable/ImportMetaDataStatement.java
similarity index 55%
copy from distsql/parser/src/main/antlr4/imports/BaseRule.g4
copy to 
distsql/statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/updatable/ImportMetaDataStatement.java
index 95f6357780b..2f065916e68 100644
--- a/distsql/parser/src/main/antlr4/imports/BaseRule.g4
+++ 
b/distsql/statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/updatable/ImportMetaDataStatement.java
@@ -15,50 +15,31 @@
  * limitations under the License.
  */
 
-grammar BaseRule;
+package org.apache.shardingsphere.distsql.parser.statement.ral.updatable;
 
-import Symbol, Keyword, Literals;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import 
org.apache.shardingsphere.distsql.parser.statement.ral.UpdatableRALStatement;
 
-literal
-    : STRING_ | (MINUS_)? INT_ | TRUE | FALSE
-    ;
+import java.util.Optional;
 
-algorithmDefinition
-    : TYPE LP_ NAME EQ_ algorithmTypeName (COMMA_ propertiesDefinition)? RP_
-    ;
-
-algorithmTypeName
-    : STRING_
-    ;
-
-propertiesDefinition
-    : PROPERTIES LP_ properties? RP_
-    ;
-
-properties
-    : property (COMMA_ property)*
-    ;
-
-property
-    : key=STRING_ EQ_ value=literal
-    ;
-
-databaseName
-    : IDENTIFIER_
-    ;
-
-schemaName
-    : IDENTIFIER_
-    ;
-
-tableName
-    : IDENTIFIER_
-    ;
-
-resourceName
-    : IDENTIFIER_
-    ;
-
-storageUnitName
-    : IDENTIFIER_
-    ;
+/**
+ * Import meta data statement.
+ */
+@RequiredArgsConstructor
+@Getter
+public final class ImportMetaDataStatement extends UpdatableRALStatement {
+    
+    private final String metaDataValue;
+    
+    private final String filePath;
+    
+    /**
+     * Get file path.
+     *
+     * @return file path
+     */
+    public Optional<String> getFilePath() {
+        return Optional.ofNullable(filePath);
+    }
+}
diff --git 
a/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/config/YamlLoggingRuleConfiguration.java
 
b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/config/YamlLoggingRuleConfiguration.java
index b61ab8659da..c47bdb2eeb6 100644
--- 
a/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/config/YamlLoggingRuleConfiguration.java
+++ 
b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/config/YamlLoggingRuleConfiguration.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.logging.yaml.config;
 
 import lombok.Getter;
 import lombok.Setter;
-import 
org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlRuleConfiguration;
+import 
org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlGlobalRuleConfiguration;
 import org.apache.shardingsphere.logging.config.LoggingRuleConfiguration;
 
 import java.util.Collection;
@@ -30,7 +30,7 @@ import java.util.LinkedList;
  */
 @Getter
 @Setter
-public final class YamlLoggingRuleConfiguration implements 
YamlRuleConfiguration {
+public final class YamlLoggingRuleConfiguration implements 
YamlGlobalRuleConfiguration {
     
     private Collection<YamlLoggerConfiguration> loggers = new LinkedList<>();
     
diff --git 
a/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/config/YamlLoggingRuleConfiguration.java
 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/distsql/export/ExportedClusterInfo.java
similarity index 57%
copy from 
kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/config/YamlLoggingRuleConfiguration.java
copy to 
proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/distsql/export/ExportedClusterInfo.java
index b61ab8659da..52013d6e09c 100644
--- 
a/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/config/YamlLoggingRuleConfiguration.java
+++ 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/distsql/export/ExportedClusterInfo.java
@@ -15,29 +15,21 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.logging.yaml.config;
+package org.apache.shardingsphere.proxy.backend.distsql.export;
 
 import lombok.Getter;
 import lombok.Setter;
-import 
org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlRuleConfiguration;
-import org.apache.shardingsphere.logging.config.LoggingRuleConfiguration;
 
 import java.util.Collection;
-import java.util.LinkedList;
 
 /**
- * Logging rule configuration for YAML.
+ * Exported cluster info.
  */
 @Getter
 @Setter
-public final class YamlLoggingRuleConfiguration implements 
YamlRuleConfiguration {
+public class ExportedClusterInfo {
     
-    private Collection<YamlLoggerConfiguration> loggers = new LinkedList<>();
+    private Collection<ExportedStorageNode> storageNodes;
     
-    private Collection<YamlAppenderConfiguration> appenders = new 
LinkedList<>();
-    
-    @Override
-    public Class<LoggingRuleConfiguration> getRuleConfigurationType() {
-        return LoggingRuleConfiguration.class;
-    }
+    private ExportedMetaData metaData;
 }
diff --git 
a/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/config/YamlLoggingRuleConfiguration.java
 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/distsql/export/ExportedMetaData.java
similarity index 58%
copy from 
kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/config/YamlLoggingRuleConfiguration.java
copy to 
proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/distsql/export/ExportedMetaData.java
index b61ab8659da..49046410ba7 100644
--- 
a/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/config/YamlLoggingRuleConfiguration.java
+++ 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/distsql/export/ExportedMetaData.java
@@ -15,29 +15,26 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.logging.yaml.config;
+package org.apache.shardingsphere.proxy.backend.distsql.export;
 
 import lombok.Getter;
 import lombok.Setter;
-import 
org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlRuleConfiguration;
-import org.apache.shardingsphere.logging.config.LoggingRuleConfiguration;
 
 import java.util.Collection;
-import java.util.LinkedList;
+import java.util.Map;
 
 /**
- * Logging rule configuration for YAML.
+ * Exported meta data.
  */
 @Getter
 @Setter
-public final class YamlLoggingRuleConfiguration implements 
YamlRuleConfiguration {
+public class ExportedMetaData {
     
-    private Collection<YamlLoggerConfiguration> loggers = new LinkedList<>();
+    private Collection<ExportedStorageNode> storageNodes;
     
-    private Collection<YamlAppenderConfiguration> appenders = new 
LinkedList<>();
+    private Map<String, String> databases;
     
-    @Override
-    public Class<LoggingRuleConfiguration> getRuleConfigurationType() {
-        return LoggingRuleConfiguration.class;
-    }
+    private String props;
+    
+    private String rules;
 }
diff --git a/distsql/parser/src/main/antlr4/imports/BaseRule.g4 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/distsql/export/ExportedStorageNode.java
similarity index 56%
copy from distsql/parser/src/main/antlr4/imports/BaseRule.g4
copy to 
proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/distsql/export/ExportedStorageNode.java
index 95f6357780b..e1c88953785 100644
--- a/distsql/parser/src/main/antlr4/imports/BaseRule.g4
+++ 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/distsql/export/ExportedStorageNode.java
@@ -15,50 +15,25 @@
  * limitations under the License.
  */
 
-grammar BaseRule;
+package org.apache.shardingsphere.proxy.backend.distsql.export;
 
-import Symbol, Keyword, Literals;
+import lombok.Getter;
+import lombok.Setter;
 
-literal
-    : STRING_ | (MINUS_)? INT_ | TRUE | FALSE
-    ;
-
-algorithmDefinition
-    : TYPE LP_ NAME EQ_ algorithmTypeName (COMMA_ propertiesDefinition)? RP_
-    ;
-
-algorithmTypeName
-    : STRING_
-    ;
-
-propertiesDefinition
-    : PROPERTIES LP_ properties? RP_
-    ;
-
-properties
-    : property (COMMA_ property)*
-    ;
-
-property
-    : key=STRING_ EQ_ value=literal
-    ;
-
-databaseName
-    : IDENTIFIER_
-    ;
-
-schemaName
-    : IDENTIFIER_
-    ;
-
-tableName
-    : IDENTIFIER_
-    ;
-
-resourceName
-    : IDENTIFIER_
-    ;
-
-storageUnitName
-    : IDENTIFIER_
-    ;
+/**
+ * Exported storage node.
+ */
+@Getter
+@Setter
+public class ExportedStorageNode {
+    
+    private String ip;
+    
+    private String port;
+    
+    private String username;
+    
+    private String password;
+    
+    private String database;
+}
diff --git 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportDatabaseConfigurationExecutor.java
 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportDatabaseConfigurationExecutor.java
index d02cffd8b68..af4f5e9a748 100644
--- 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportDatabaseConfigurationExecutor.java
+++ 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportDatabaseConfigurationExecutor.java
@@ -17,32 +17,14 @@
 
 package org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable;
 
-import 
org.apache.shardingsphere.dbdiscovery.api.config.DatabaseDiscoveryRuleConfiguration;
 import 
org.apache.shardingsphere.distsql.handler.ral.query.DatabaseRequiredQueryableRALExecutor;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ExportDatabaseConfigurationStatement;
-import org.apache.shardingsphere.encrypt.api.config.EncryptRuleConfiguration;
-import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
-import org.apache.shardingsphere.infra.datasource.props.DataSourceProperties;
-import 
org.apache.shardingsphere.infra.datasource.props.DataSourcePropertiesCreator;
 import 
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
 import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
-import org.apache.shardingsphere.infra.util.spi.type.ordered.OrderedSPILoader;
-import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
-import 
org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlRuleConfigurationSwapper;
-import org.apache.shardingsphere.mask.api.config.MaskRuleConfiguration;
-import org.apache.shardingsphere.proxy.backend.exception.FileIOException;
-import 
org.apache.shardingsphere.readwritesplitting.api.ReadwriteSplittingRuleConfiguration;
-import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration;
-import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
-import org.apache.shardingsphere.single.api.config.SingleRuleConfiguration;
+import org.apache.shardingsphere.proxy.backend.util.ExportUtils;
 
-import javax.sql.DataSource;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Map.Entry;
 
 /**
  * Export database configuration executor.
@@ -56,93 +38,15 @@ public final class ExportDatabaseConfigurationExecutor 
implements DatabaseRequir
     
     @Override
     public Collection<LocalDataQueryResultRow> getRows(final 
ShardingSphereDatabase database, final ExportDatabaseConfigurationStatement 
sqlStatement) {
-        String exportedData = generateExportData(database);
+        String exportedData = ExportUtils.generateExportDatabaseData(database);
         if (sqlStatement.getFilePath().isPresent()) {
             String filePath = sqlStatement.getFilePath().get();
-            exportToFile(filePath, exportedData);
+            ExportUtils.exportToFile(filePath, exportedData);
             return Collections.singleton(new 
LocalDataQueryResultRow(String.format("Successfully exported to:'%s'", 
filePath)));
         }
         return Collections.singleton(new 
LocalDataQueryResultRow(exportedData));
     }
     
-    private String generateExportData(final ShardingSphereDatabase database) {
-        StringBuilder result = new StringBuilder();
-        appendDatabaseName(database.getName(), result);
-        appendDataSourceConfigurations(database, result);
-        
appendRuleConfigurations(database.getRuleMetaData().getConfigurations(), 
result);
-        return result.toString();
-    }
-    
-    private void appendDatabaseName(final String databaseName, final 
StringBuilder stringBuilder) {
-        stringBuilder.append("databaseName: 
").append(databaseName).append(System.lineSeparator());
-    }
-    
-    private void appendDataSourceConfigurations(final ShardingSphereDatabase 
database, final StringBuilder stringBuilder) {
-        if (database.getResourceMetaData().getDataSources().isEmpty()) {
-            return;
-        }
-        stringBuilder.append("dataSources:").append(System.lineSeparator());
-        for (Entry<String, DataSource> entry : 
database.getResourceMetaData().getDataSources().entrySet()) {
-            appendDataSourceConfiguration(entry.getKey(), entry.getValue(), 
stringBuilder);
-        }
-    }
-    
-    private void appendDataSourceConfiguration(final String name, final 
DataSource dataSource, final StringBuilder stringBuilder) {
-        stringBuilder.append("  
").append(name).append(":").append(System.lineSeparator());
-        DataSourceProperties dataSourceProps = 
DataSourcePropertiesCreator.create(dataSource);
-        dataSourceProps.getConnectionPropertySynonyms().getStandardProperties()
-                .forEach((key, value) -> stringBuilder.append("    
").append(key).append(": ").append(value).append(System.lineSeparator()));
-        
dataSourceProps.getPoolPropertySynonyms().getStandardProperties().forEach((key, 
value) -> stringBuilder.append("    ").append(key).append(": 
").append(value).append(System.lineSeparator()));
-    }
-    
-    @SuppressWarnings({"rawtypes", "unchecked"})
-    private void appendRuleConfigurations(final Collection<RuleConfiguration> 
ruleConfigs, final StringBuilder stringBuilder) {
-        if (ruleConfigs.isEmpty()) {
-            return;
-        }
-        stringBuilder.append("rules:").append(System.lineSeparator());
-        for (Entry<RuleConfiguration, YamlRuleConfigurationSwapper> entry : 
OrderedSPILoader.getServices(YamlRuleConfigurationSwapper.class, 
ruleConfigs).entrySet()) {
-            if (checkRuleConfigIsEmpty(entry.getKey())) {
-                continue;
-            }
-            
stringBuilder.append(YamlEngine.marshal(Collections.singletonList(entry.getValue().swapToYamlConfiguration(entry.getKey()))));
-        }
-    }
-    
-    private boolean checkRuleConfigIsEmpty(final RuleConfiguration ruleConfig) 
{
-        if (ruleConfig instanceof ShardingRuleConfiguration) {
-            ShardingRuleConfiguration shardingRuleConfig = 
(ShardingRuleConfiguration) ruleConfig;
-            return shardingRuleConfig.getTables().isEmpty() && 
shardingRuleConfig.getAutoTables().isEmpty();
-        } else if (ruleConfig instanceof ReadwriteSplittingRuleConfiguration) {
-            return ((ReadwriteSplittingRuleConfiguration) 
ruleConfig).getDataSources().isEmpty();
-        } else if (ruleConfig instanceof DatabaseDiscoveryRuleConfiguration) {
-            return ((DatabaseDiscoveryRuleConfiguration) 
ruleConfig).getDataSources().isEmpty();
-        } else if (ruleConfig instanceof EncryptRuleConfiguration) {
-            return ((EncryptRuleConfiguration) 
ruleConfig).getTables().isEmpty();
-        } else if (ruleConfig instanceof ShadowRuleConfiguration) {
-            return ((ShadowRuleConfiguration) 
ruleConfig).getTables().isEmpty();
-        } else if (ruleConfig instanceof MaskRuleConfiguration) {
-            return ((MaskRuleConfiguration) ruleConfig).getTables().isEmpty();
-        } else if (ruleConfig instanceof SingleRuleConfiguration) {
-            return !((SingleRuleConfiguration) 
ruleConfig).getDefaultDataSource().isPresent();
-        }
-        return false;
-    }
-    
-    @SuppressWarnings("ResultOfMethodCallIgnored")
-    private void exportToFile(final String filePath, final String 
exportedData) {
-        File file = new File(filePath);
-        if (!file.exists()) {
-            file.getParentFile().mkdirs();
-        }
-        try (FileOutputStream output = new FileOutputStream(file)) {
-            output.write(exportedData.getBytes());
-            output.flush();
-        } catch (final IOException ex) {
-            throw new FileIOException(ex);
-        }
-    }
-    
     @Override
     public String getType() {
         return ExportDatabaseConfigurationStatement.class.getName();
diff --git 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportMetaDataExecutor.java
 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportMetaDataExecutor.java
new file mode 100644
index 00000000000..cd7150eeda9
--- /dev/null
+++ 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportMetaDataExecutor.java
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable;
+
+import 
org.apache.shardingsphere.distsql.handler.ral.query.DatabaseRequiredQueryableRALExecutor;
+import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ExportMetaDataStatement;
+import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
+import org.apache.shardingsphere.infra.database.metadata.DataSourceMetaData;
+import org.apache.shardingsphere.infra.datasource.props.DataSourceProperties;
+import 
org.apache.shardingsphere.infra.datasource.props.DataSourcePropertiesCreator;
+import 
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
+import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
+import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
+import org.apache.shardingsphere.infra.util.spi.type.ordered.OrderedSPILoader;
+import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
+import 
org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlRuleConfigurationSwapper;
+import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
+import 
org.apache.shardingsphere.proxy.backend.distsql.export.ExportedClusterInfo;
+import org.apache.shardingsphere.proxy.backend.distsql.export.ExportedMetaData;
+import 
org.apache.shardingsphere.proxy.backend.distsql.export.ExportedStorageNode;
+import org.apache.shardingsphere.proxy.backend.util.ExportUtils;
+import org.apache.shardingsphere.proxy.backend.util.JsonUtils;
+
+import java.time.LocalDateTime;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Properties;
+
+/**
+ * Export metadata executor.
+ */
+public final class ExportMetaDataExecutor implements 
DatabaseRequiredQueryableRALExecutor<ExportMetaDataStatement> {
+    
+    @Override
+    public Collection<String> getColumnNames() {
+        return Arrays.asList("id", "create_time", "cluster_info");
+    }
+    
+    @Override
+    public Collection<LocalDataQueryResultRow> getRows(final 
ShardingSphereDatabase database, final ExportMetaDataStatement sqlStatement) {
+        String exportedData = generateExportData(database);
+        if (sqlStatement.getFilePath().isPresent()) {
+            String filePath = sqlStatement.getFilePath().get();
+            ExportUtils.exportToFile(filePath, exportedData);
+            return Collections.singleton(new 
LocalDataQueryResultRow(ProxyContext.getInstance().getContextManager().getInstanceContext().getInstance().getCurrentInstanceId(),
 LocalDateTime.now(),
+                    String.format("Successfully exported to:'%s'", filePath)));
+        }
+        return Collections.singleton(
+                new 
LocalDataQueryResultRow(ProxyContext.getInstance().getContextManager().getInstanceContext().getInstance().getCurrentInstanceId(),
 LocalDateTime.now(), exportedData));
+    }
+    
+    private String generateExportData(final ShardingSphereDatabase database) {
+        ProxyContext proxyContext = ProxyContext.getInstance();
+        ShardingSphereMetaData metaData = 
proxyContext.getContextManager().getMetaDataContexts().getMetaData();
+        ExportedClusterInfo exportedClusterInfo = new ExportedClusterInfo();
+        
exportedClusterInfo.setStorageNodes(generateExportStorageNodeData(database));
+        ExportedMetaData exportedMetaData = new ExportedMetaData();
+        exportedMetaData.setDatabases(getDatabases(proxyContext));
+        
exportedMetaData.setProps(generatePropsData(metaData.getProps().getProps()));
+        
exportedMetaData.setRules(generateRulesData(metaData.getGlobalRuleMetaData().getConfigurations()));
+        exportedClusterInfo.setMetaData(exportedMetaData);
+        return JsonUtils.toJsonString(exportedClusterInfo);
+    }
+    
+    private Map<String, String> getDatabases(final ProxyContext proxyContext) {
+        Map<String, String> result = new LinkedHashMap<>();
+        proxyContext.getAllDatabaseNames().forEach(each -> {
+            ShardingSphereDatabase database = proxyContext.getDatabase(each);
+            if 
(database.getResourceMetaData().getAllInstanceDataSourceNames().isEmpty()) {
+                return;
+            }
+            result.put(each, ExportUtils.generateExportDatabaseData(database));
+        });
+        return result;
+    }
+    
+    private Collection<ExportedStorageNode> 
generateExportStorageNodeData(final ShardingSphereDatabase database) {
+        Map<String, ExportedStorageNode> storageNodes = new LinkedHashMap<>();
+        database.getResourceMetaData().getDataSources().forEach((key, value) 
-> {
+            DataSourceMetaData dataSourceMetaData = 
database.getResourceMetaData().getDataSourceMetaData(key);
+            String databaseInstanceIp = dataSourceMetaData.getHostname() + ":" 
+ dataSourceMetaData.getPort();
+            if (storageNodes.containsKey(databaseInstanceIp)) {
+                return;
+            }
+            ExportedStorageNode exportedStorageNode = new 
ExportedStorageNode();
+            exportedStorageNode.setIp(dataSourceMetaData.getHostname());
+            
exportedStorageNode.setPort(String.valueOf(dataSourceMetaData.getPort()));
+            exportedStorageNode.setDatabase(dataSourceMetaData.getCatalog());
+            DataSourceProperties dataSourceProps = 
DataSourcePropertiesCreator.create(value);
+            Map<String, Object> standardProperties = 
dataSourceProps.getConnectionPropertySynonyms().getStandardProperties();
+            
exportedStorageNode.setUsername(String.valueOf(standardProperties.get("username")));
+            
exportedStorageNode.setPassword(String.valueOf(standardProperties.get("password")));
+            storageNodes.put(databaseInstanceIp, exportedStorageNode);
+        });
+        return storageNodes.values();
+    }
+    
+    private String generatePropsData(final Properties props) {
+        if (props.isEmpty()) {
+            return "";
+        }
+        StringBuilder result = new StringBuilder();
+        result.append("props:").append(System.lineSeparator());
+        props.forEach((key, value) -> result.append("  
").append(key).append(": ").append(value).append(System.lineSeparator()));
+        return result.toString();
+    }
+    
+    @SuppressWarnings({"rawtypes", "unchecked"})
+    private String generateRulesData(final Collection<RuleConfiguration> 
rules) {
+        if (rules.isEmpty()) {
+            return "";
+        }
+        StringBuilder result = new StringBuilder();
+        result.append("rules:").append(System.lineSeparator());
+        for (Entry<RuleConfiguration, YamlRuleConfigurationSwapper> entry : 
OrderedSPILoader.getServices(YamlRuleConfigurationSwapper.class, 
rules).entrySet()) {
+            
result.append(YamlEngine.marshal(Collections.singletonList(entry.getValue().swapToYamlConfiguration(entry.getKey()))));
+        }
+        return result.toString();
+    }
+    
+    @Override
+    public String getType() {
+        return ExportMetaDataStatement.class.getName();
+    }
+}
diff --git 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportDatabaseConfigurationUpdater.java
 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportDatabaseConfigurationUpdater.java
index 227a5a6770c..2212f724826 100644
--- 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportDatabaseConfigurationUpdater.java
+++ 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportDatabaseConfigurationUpdater.java
@@ -17,89 +17,22 @@
 
 package org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable;
 
-import com.google.common.base.Preconditions;
-import com.zaxxer.hikari.HikariDataSource;
-import 
org.apache.shardingsphere.dbdiscovery.api.config.DatabaseDiscoveryRuleConfiguration;
-import org.apache.shardingsphere.dbdiscovery.rule.DatabaseDiscoveryRule;
-import 
org.apache.shardingsphere.dbdiscovery.yaml.config.YamlDatabaseDiscoveryRuleConfiguration;
-import 
org.apache.shardingsphere.dbdiscovery.yaml.swapper.YamlDatabaseDiscoveryRuleConfigurationSwapper;
-import org.apache.shardingsphere.distsql.handler.exception.DistSQLException;
-import 
org.apache.shardingsphere.distsql.handler.exception.storageunit.InvalidStorageUnitsException;
 import org.apache.shardingsphere.distsql.handler.ral.update.RALUpdater;
-import 
org.apache.shardingsphere.distsql.handler.validate.DataSourcePropertiesValidateHandler;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.updatable.ImportDatabaseConfigurationStatement;
-import org.apache.shardingsphere.encrypt.api.config.EncryptRuleConfiguration;
-import org.apache.shardingsphere.encrypt.rule.EncryptRule;
-import 
org.apache.shardingsphere.encrypt.yaml.config.YamlEncryptRuleConfiguration;
-import 
org.apache.shardingsphere.encrypt.yaml.swapper.YamlEncryptRuleConfigurationSwapper;
-import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
-import org.apache.shardingsphere.infra.datasource.props.DataSourceProperties;
-import 
org.apache.shardingsphere.infra.datasource.props.DataSourcePropertiesCreator;
-import org.apache.shardingsphere.infra.instance.InstanceContext;
-import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
-import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
 import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
-import 
org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlRuleConfiguration;
-import org.apache.shardingsphere.mask.api.config.MaskRuleConfiguration;
-import org.apache.shardingsphere.mask.rule.MaskRule;
-import org.apache.shardingsphere.mask.yaml.config.YamlMaskRuleConfiguration;
-import 
org.apache.shardingsphere.mask.yaml.swapper.YamlMaskRuleConfigurationSwapper;
-import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
-import 
org.apache.shardingsphere.proxy.backend.config.yaml.YamlProxyDataSourceConfiguration;
 import 
org.apache.shardingsphere.proxy.backend.config.yaml.YamlProxyDatabaseConfiguration;
-import 
org.apache.shardingsphere.proxy.backend.config.yaml.swapper.YamlProxyDataSourceConfigurationSwapper;
-import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
 import org.apache.shardingsphere.proxy.backend.exception.FileIOException;
-import 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.checker.DatabaseDiscoveryRuleConfigurationImportChecker;
-import 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.checker.EncryptRuleConfigurationImportChecker;
-import 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.checker.MaskRuleConfigurationImportChecker;
-import 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.checker.ReadwriteSplittingRuleConfigurationImportChecker;
-import 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.checker.ShadowRuleConfigurationImportChecker;
-import 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.checker.ShardingRuleConfigurationImportChecker;
-import 
org.apache.shardingsphere.readwritesplitting.api.ReadwriteSplittingRuleConfiguration;
-import 
org.apache.shardingsphere.readwritesplitting.rule.ReadwriteSplittingRule;
-import 
org.apache.shardingsphere.readwritesplitting.yaml.config.YamlReadwriteSplittingRuleConfiguration;
-import 
org.apache.shardingsphere.readwritesplitting.yaml.swapper.YamlReadwriteSplittingRuleConfigurationSwapper;
-import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration;
-import org.apache.shardingsphere.shadow.rule.ShadowRule;
-import 
org.apache.shardingsphere.shadow.yaml.config.YamlShadowRuleConfiguration;
-import 
org.apache.shardingsphere.shadow.yaml.swapper.YamlShadowRuleConfigurationSwapper;
-import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
-import org.apache.shardingsphere.sharding.rule.ShardingRule;
-import 
org.apache.shardingsphere.sharding.yaml.config.YamlShardingRuleConfiguration;
-import 
org.apache.shardingsphere.sharding.yaml.swapper.YamlShardingRuleConfigurationSwapper;
+import org.apache.shardingsphere.proxy.backend.util.ImportUtils;
 
 import java.io.File;
 import java.io.IOException;
 import java.sql.SQLException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.Map;
-import java.util.Map.Entry;
 
 /**
  * Import database configuration updater.
  */
 public final class ImportDatabaseConfigurationUpdater implements 
RALUpdater<ImportDatabaseConfigurationStatement> {
     
-    private final ShardingRuleConfigurationImportChecker 
shardingRuleConfigurationImportChecker = new 
ShardingRuleConfigurationImportChecker();
-    
-    private final ReadwriteSplittingRuleConfigurationImportChecker 
readwriteSplittingRuleConfigurationImportChecker = new 
ReadwriteSplittingRuleConfigurationImportChecker();
-    
-    private final DatabaseDiscoveryRuleConfigurationImportChecker 
databaseDiscoveryRuleConfigurationImportChecker = new 
DatabaseDiscoveryRuleConfigurationImportChecker();
-    
-    private final EncryptRuleConfigurationImportChecker 
encryptRuleConfigurationImportChecker = new 
EncryptRuleConfigurationImportChecker();
-    
-    private final ShadowRuleConfigurationImportChecker 
shadowRuleConfigurationImportChecker = new 
ShadowRuleConfigurationImportChecker();
-    
-    private final MaskRuleConfigurationImportChecker 
maskRuleConfigurationImportChecker = new MaskRuleConfigurationImportChecker();
-    
-    private final YamlProxyDataSourceConfigurationSwapper 
dataSourceConfigSwapper = new YamlProxyDataSourceConfigurationSwapper();
-    
-    private final DataSourcePropertiesValidateHandler validateHandler = new 
DataSourcePropertiesValidateHandler();
-    
     @Override
     public void executeUpdate(final String databaseName, final 
ImportDatabaseConfigurationStatement sqlStatement) throws SQLException {
         File file = new File(sqlStatement.getFilePath());
@@ -109,94 +42,7 @@ public final class ImportDatabaseConfigurationUpdater 
implements RALUpdater<Impo
         } catch (final IOException ex) {
             throw new FileIOException(ex);
         }
-        String yamlDatabaseName = yamlConfig.getDatabaseName();
-        checkDatabase(yamlDatabaseName, file);
-        checkDataSource(yamlConfig.getDataSources(), file);
-        addDatabase(yamlDatabaseName);
-        addResources(yamlDatabaseName, yamlConfig.getDataSources());
-        try {
-            addRules(yamlDatabaseName, yamlConfig.getRules());
-        } catch (final DistSQLException ex) {
-            dropDatabase(yamlDatabaseName);
-            throw ex;
-        }
-    }
-    
-    private void checkDatabase(final String databaseName, final File file) {
-        Preconditions.checkNotNull(databaseName, "Property `databaseName` in 
file `%s` is required", file.getName());
-        if (ProxyContext.getInstance().databaseExists(databaseName)) {
-            
Preconditions.checkState(ProxyContext.getInstance().getDatabase(databaseName).getResourceMetaData().getDataSources().isEmpty(),
 "Database `%s` exists and is not empty", databaseName);
-        }
-    }
-    
-    private void checkDataSource(final Map<String, 
YamlProxyDataSourceConfiguration> dataSources, final File file) {
-        Preconditions.checkState(!dataSources.isEmpty(), "Data source 
configurations in file `%s` is required", file.getName());
-    }
-    
-    private void addDatabase(final String databaseName) {
-        
ProxyContext.getInstance().getContextManager().getInstanceContext().getModeContextManager().createDatabase(databaseName);
-    }
-    
-    private void addResources(final String databaseName, final Map<String, 
YamlProxyDataSourceConfiguration> yamlDataSourceMap) {
-        Map<String, DataSourceProperties> dataSourcePropsMap = new 
LinkedHashMap<>(yamlDataSourceMap.size(), 1);
-        for (Entry<String, YamlProxyDataSourceConfiguration> entry : 
yamlDataSourceMap.entrySet()) {
-            dataSourcePropsMap.put(entry.getKey(), 
DataSourcePropertiesCreator.create(HikariDataSource.class.getName(), 
dataSourceConfigSwapper.swap(entry.getValue())));
-        }
-        validateHandler.validate(dataSourcePropsMap);
-        try {
-            
ProxyContext.getInstance().getContextManager().getInstanceContext().getModeContextManager().registerStorageUnits(databaseName,
 dataSourcePropsMap);
-        } catch (final SQLException ex) {
-            throw new 
InvalidStorageUnitsException(Collections.singleton(ex.getMessage()));
-        }
-    }
-    
-    private void addRules(final String databaseName, final 
Collection<YamlRuleConfiguration> yamlRuleConfigs) {
-        if (yamlRuleConfigs.isEmpty()) {
-            return;
-        }
-        Collection<RuleConfiguration> ruleConfigs = new LinkedList<>();
-        MetaDataContexts metaDataContexts = 
ProxyContext.getInstance().getContextManager().getMetaDataContexts();
-        InstanceContext instanceContext = 
ProxyContext.getInstance().getContextManager().getInstanceContext();
-        ShardingSphereDatabase database = 
metaDataContexts.getMetaData().getDatabase(databaseName);
-        Collection<ShardingSphereRule> rules = 
database.getRuleMetaData().getRules();
-        for (YamlRuleConfiguration each : yamlRuleConfigs) {
-            if (each instanceof YamlShardingRuleConfiguration) {
-                ShardingRuleConfiguration shardingRuleConfig = new 
YamlShardingRuleConfigurationSwapper().swapToObject((YamlShardingRuleConfiguration)
 each);
-                shardingRuleConfigurationImportChecker.check(database, 
shardingRuleConfig);
-                ruleConfigs.add(shardingRuleConfig);
-                rules.add(new ShardingRule(shardingRuleConfig, 
database.getResourceMetaData().getDataSources().keySet(), instanceContext));
-            } else if (each instanceof 
YamlReadwriteSplittingRuleConfiguration) {
-                ReadwriteSplittingRuleConfiguration 
readwriteSplittingRuleConfig = new 
YamlReadwriteSplittingRuleConfigurationSwapper().swapToObject((YamlReadwriteSplittingRuleConfiguration)
 each);
-                
readwriteSplittingRuleConfigurationImportChecker.check(database, 
readwriteSplittingRuleConfig);
-                ruleConfigs.add(readwriteSplittingRuleConfig);
-                rules.add(new ReadwriteSplittingRule(databaseName, 
readwriteSplittingRuleConfig, rules, instanceContext));
-            } else if (each instanceof YamlDatabaseDiscoveryRuleConfiguration) 
{
-                DatabaseDiscoveryRuleConfiguration databaseDiscoveryRuleConfig 
= new 
YamlDatabaseDiscoveryRuleConfigurationSwapper().swapToObject((YamlDatabaseDiscoveryRuleConfiguration)
 each);
-                
databaseDiscoveryRuleConfigurationImportChecker.check(database, 
databaseDiscoveryRuleConfig);
-                ruleConfigs.add(databaseDiscoveryRuleConfig);
-                rules.add(new DatabaseDiscoveryRule(databaseName, 
database.getResourceMetaData().getDataSources(), databaseDiscoveryRuleConfig, 
instanceContext));
-            } else if (each instanceof YamlEncryptRuleConfiguration) {
-                EncryptRuleConfiguration encryptRuleConfig = new 
YamlEncryptRuleConfigurationSwapper().swapToObject((YamlEncryptRuleConfiguration)
 each);
-                encryptRuleConfigurationImportChecker.check(database, 
encryptRuleConfig);
-                ruleConfigs.add(encryptRuleConfig);
-                rules.add(new EncryptRule(encryptRuleConfig));
-            } else if (each instanceof YamlShadowRuleConfiguration) {
-                ShadowRuleConfiguration shadowRuleConfig = new 
YamlShadowRuleConfigurationSwapper().swapToObject((YamlShadowRuleConfiguration) 
each);
-                shadowRuleConfigurationImportChecker.check(database, 
shadowRuleConfig);
-                ruleConfigs.add(shadowRuleConfig);
-                rules.add(new ShadowRule(shadowRuleConfig));
-            } else if (each instanceof YamlMaskRuleConfiguration) {
-                MaskRuleConfiguration maskRuleConfig = new 
YamlMaskRuleConfigurationSwapper().swapToObject((YamlMaskRuleConfiguration) 
each);
-                maskRuleConfigurationImportChecker.check(database, 
maskRuleConfig);
-                ruleConfigs.add(maskRuleConfig);
-                rules.add(new MaskRule(maskRuleConfig));
-            }
-        }
-        
metaDataContexts.getPersistService().getDatabaseRulePersistService().persist(metaDataContexts.getMetaData().getActualDatabaseName(databaseName),
 ruleConfigs);
-    }
-    
-    private void dropDatabase(final String databaseName) {
-        
ProxyContext.getInstance().getContextManager().getInstanceContext().getModeContextManager().dropDatabase(databaseName);
+        ImportUtils.importDatabaseConfig(yamlConfig);
     }
     
     @Override
diff --git 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportMetaDataUpdater.java
 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportMetaDataUpdater.java
new file mode 100644
index 00000000000..d3e5b531f38
--- /dev/null
+++ 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportMetaDataUpdater.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.shardingsphere.distsql.handler.ral.update.RALUpdater;
+import 
org.apache.shardingsphere.distsql.parser.statement.ral.updatable.ImportMetaDataStatement;
+import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
+import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
+import 
org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlRuleConfigurationSwapperEngine;
+import 
org.apache.shardingsphere.proxy.backend.config.yaml.YamlProxyDatabaseConfiguration;
+import 
org.apache.shardingsphere.proxy.backend.config.yaml.YamlProxyServerConfiguration;
+import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
+import 
org.apache.shardingsphere.proxy.backend.distsql.export.ExportedClusterInfo;
+import org.apache.shardingsphere.proxy.backend.distsql.export.ExportedMetaData;
+import org.apache.shardingsphere.proxy.backend.exception.FileIOException;
+import org.apache.shardingsphere.proxy.backend.util.ImportUtils;
+import org.apache.shardingsphere.proxy.backend.util.JsonUtils;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.sql.SQLException;
+import java.util.Collection;
+import java.util.Objects;
+
+/**
+ * Import meta data updater.
+ */
+public final class ImportMetaDataUpdater implements 
RALUpdater<ImportMetaDataStatement> {
+    
+    private final YamlRuleConfigurationSwapperEngine ruleConfigSwapperEngine = 
new YamlRuleConfigurationSwapperEngine();
+    
+    @Override
+    public void executeUpdate(final String databaseName, final 
ImportMetaDataStatement sqlStatement) throws SQLException {
+        String jsonMetaDataConfig;
+        if (sqlStatement.getFilePath().isPresent()) {
+            File file = new File(sqlStatement.getFilePath().get());
+            try {
+                jsonMetaDataConfig = FileUtils.readFileToString(file, 
Charset.defaultCharset());
+            } catch (final IOException ex) {
+                throw new FileIOException(ex);
+            }
+        } else {
+            jsonMetaDataConfig = sqlStatement.getMetaDataValue();
+        }
+        ExportedClusterInfo exportedClusterInfo = 
JsonUtils.readValue(jsonMetaDataConfig, ExportedClusterInfo.class);
+        ExportedMetaData exportedMetaData = exportedClusterInfo.getMetaData();
+        importServerConfig(exportedMetaData);
+        importDatabase(exportedMetaData);
+    }
+    
+    private void importServerConfig(final ExportedMetaData exportedMetaData) {
+        YamlProxyServerConfiguration yamlServerConfig = 
YamlEngine.unmarshal(exportedMetaData.getRules() + System.lineSeparator() + 
exportedMetaData.getProps(), YamlProxyServerConfiguration.class);
+        if (Objects.isNull(yamlServerConfig)) {
+            return;
+        }
+        Collection<RuleConfiguration> rules = 
ruleConfigSwapperEngine.swapToRuleConfigurations(yamlServerConfig.getRules());
+        
ProxyContext.getInstance().getContextManager().getMetaDataContexts().getPersistService().getGlobalRuleService().persist(rules);
+        
ProxyContext.getInstance().getContextManager().getMetaDataContexts().getPersistService().getPropsService().persist(yamlServerConfig.getProps());
+    }
+    
+    private void importDatabase(final ExportedMetaData exportedMetaData) {
+        for (final String each : exportedMetaData.getDatabases().values()) {
+            YamlProxyDatabaseConfiguration yamlDatabaseConfig = 
YamlEngine.unmarshal(each, YamlProxyDatabaseConfiguration.class);
+            ImportUtils.importDatabaseConfig(yamlDatabaseConfig);
+        }
+    }
+    
+    @Override
+    public String getType() {
+        return ImportMetaDataStatement.class.getName();
+    }
+}
diff --git 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportDatabaseConfigurationExecutor.java
 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/ExportUtils.java
similarity index 73%
copy from 
proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportDatabaseConfigurationExecutor.java
copy to 
proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/ExportUtils.java
index d02cffd8b68..c398ffaa50c 100644
--- 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportDatabaseConfigurationExecutor.java
+++ 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/ExportUtils.java
@@ -15,16 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable;
+package org.apache.shardingsphere.proxy.backend.util;
 
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
 import 
org.apache.shardingsphere.dbdiscovery.api.config.DatabaseDiscoveryRuleConfiguration;
-import 
org.apache.shardingsphere.distsql.handler.ral.query.DatabaseRequiredQueryableRALExecutor;
-import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ExportDatabaseConfigurationStatement;
 import org.apache.shardingsphere.encrypt.api.config.EncryptRuleConfiguration;
 import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
 import org.apache.shardingsphere.infra.datasource.props.DataSourceProperties;
 import 
org.apache.shardingsphere.infra.datasource.props.DataSourcePropertiesCreator;
-import 
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
 import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
 import org.apache.shardingsphere.infra.util.spi.type.ordered.OrderedSPILoader;
 import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
@@ -45,27 +44,38 @@ import java.util.Collections;
 import java.util.Map.Entry;
 
 /**
- * Export database configuration executor.
+ * Export utility class.
  */
-public final class ExportDatabaseConfigurationExecutor implements 
DatabaseRequiredQueryableRALExecutor<ExportDatabaseConfigurationStatement> {
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public class ExportUtils {
     
-    @Override
-    public Collection<String> getColumnNames() {
-        return Collections.singleton("result");
-    }
-    
-    @Override
-    public Collection<LocalDataQueryResultRow> getRows(final 
ShardingSphereDatabase database, final ExportDatabaseConfigurationStatement 
sqlStatement) {
-        String exportedData = generateExportData(database);
-        if (sqlStatement.getFilePath().isPresent()) {
-            String filePath = sqlStatement.getFilePath().get();
-            exportToFile(filePath, exportedData);
-            return Collections.singleton(new 
LocalDataQueryResultRow(String.format("Successfully exported to:'%s'", 
filePath)));
+    /**
+     * Export configuration data to specified file.
+     * 
+     * @param filePath file path
+     * @param exportedData exported configuration data
+     */
+    @SuppressWarnings("ResultOfMethodCallIgnored")
+    public static void exportToFile(final String filePath, final String 
exportedData) {
+        File file = new File(filePath);
+        if (!file.exists()) {
+            file.getParentFile().mkdirs();
+        }
+        try (FileOutputStream output = new FileOutputStream(file)) {
+            output.write(exportedData.getBytes());
+            output.flush();
+        } catch (final IOException ex) {
+            throw new FileIOException(ex);
         }
-        return Collections.singleton(new 
LocalDataQueryResultRow(exportedData));
     }
     
-    private String generateExportData(final ShardingSphereDatabase database) {
+    /**
+     * Generate configuration data of ShardingSphere database.
+     * 
+     * @param database ShardingSphere database
+     * @return configuration data
+     */
+    public static String generateExportDatabaseData(final 
ShardingSphereDatabase database) {
         StringBuilder result = new StringBuilder();
         appendDatabaseName(database.getName(), result);
         appendDataSourceConfigurations(database, result);
@@ -73,11 +83,11 @@ public final class ExportDatabaseConfigurationExecutor 
implements DatabaseRequir
         return result.toString();
     }
     
-    private void appendDatabaseName(final String databaseName, final 
StringBuilder stringBuilder) {
+    private static void appendDatabaseName(final String databaseName, final 
StringBuilder stringBuilder) {
         stringBuilder.append("databaseName: 
").append(databaseName).append(System.lineSeparator());
     }
     
-    private void appendDataSourceConfigurations(final ShardingSphereDatabase 
database, final StringBuilder stringBuilder) {
+    private static void appendDataSourceConfigurations(final 
ShardingSphereDatabase database, final StringBuilder stringBuilder) {
         if (database.getResourceMetaData().getDataSources().isEmpty()) {
             return;
         }
@@ -87,7 +97,7 @@ public final class ExportDatabaseConfigurationExecutor 
implements DatabaseRequir
         }
     }
     
-    private void appendDataSourceConfiguration(final String name, final 
DataSource dataSource, final StringBuilder stringBuilder) {
+    private static void appendDataSourceConfiguration(final String name, final 
DataSource dataSource, final StringBuilder stringBuilder) {
         stringBuilder.append("  
").append(name).append(":").append(System.lineSeparator());
         DataSourceProperties dataSourceProps = 
DataSourcePropertiesCreator.create(dataSource);
         dataSourceProps.getConnectionPropertySynonyms().getStandardProperties()
@@ -96,7 +106,7 @@ public final class ExportDatabaseConfigurationExecutor 
implements DatabaseRequir
     }
     
     @SuppressWarnings({"rawtypes", "unchecked"})
-    private void appendRuleConfigurations(final Collection<RuleConfiguration> 
ruleConfigs, final StringBuilder stringBuilder) {
+    private static void appendRuleConfigurations(final 
Collection<RuleConfiguration> ruleConfigs, final StringBuilder stringBuilder) {
         if (ruleConfigs.isEmpty()) {
             return;
         }
@@ -109,7 +119,7 @@ public final class ExportDatabaseConfigurationExecutor 
implements DatabaseRequir
         }
     }
     
-    private boolean checkRuleConfigIsEmpty(final RuleConfiguration ruleConfig) 
{
+    private static boolean checkRuleConfigIsEmpty(final RuleConfiguration 
ruleConfig) {
         if (ruleConfig instanceof ShardingRuleConfiguration) {
             ShardingRuleConfiguration shardingRuleConfig = 
(ShardingRuleConfiguration) ruleConfig;
             return shardingRuleConfig.getTables().isEmpty() && 
shardingRuleConfig.getAutoTables().isEmpty();
@@ -128,23 +138,4 @@ public final class ExportDatabaseConfigurationExecutor 
implements DatabaseRequir
         }
         return false;
     }
-    
-    @SuppressWarnings("ResultOfMethodCallIgnored")
-    private void exportToFile(final String filePath, final String 
exportedData) {
-        File file = new File(filePath);
-        if (!file.exists()) {
-            file.getParentFile().mkdirs();
-        }
-        try (FileOutputStream output = new FileOutputStream(file)) {
-            output.write(exportedData.getBytes());
-            output.flush();
-        } catch (final IOException ex) {
-            throw new FileIOException(ex);
-        }
-    }
-    
-    @Override
-    public String getType() {
-        return ExportDatabaseConfigurationStatement.class.getName();
-    }
 }
diff --git 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportDatabaseConfigurationUpdater.java
 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/ImportUtils.java
similarity index 69%
copy from 
proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportDatabaseConfigurationUpdater.java
copy to 
proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/ImportUtils.java
index 227a5a6770c..c8321ac356c 100644
--- 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportDatabaseConfigurationUpdater.java
+++ 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/ImportUtils.java
@@ -15,41 +15,43 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable;
+package org.apache.shardingsphere.proxy.backend.util;
 
 import com.google.common.base.Preconditions;
 import com.zaxxer.hikari.HikariDataSource;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
 import 
org.apache.shardingsphere.dbdiscovery.api.config.DatabaseDiscoveryRuleConfiguration;
 import org.apache.shardingsphere.dbdiscovery.rule.DatabaseDiscoveryRule;
 import 
org.apache.shardingsphere.dbdiscovery.yaml.config.YamlDatabaseDiscoveryRuleConfiguration;
 import 
org.apache.shardingsphere.dbdiscovery.yaml.swapper.YamlDatabaseDiscoveryRuleConfigurationSwapper;
 import org.apache.shardingsphere.distsql.handler.exception.DistSQLException;
 import 
org.apache.shardingsphere.distsql.handler.exception.storageunit.InvalidStorageUnitsException;
-import org.apache.shardingsphere.distsql.handler.ral.update.RALUpdater;
 import 
org.apache.shardingsphere.distsql.handler.validate.DataSourcePropertiesValidateHandler;
-import 
org.apache.shardingsphere.distsql.parser.statement.ral.updatable.ImportDatabaseConfigurationStatement;
 import org.apache.shardingsphere.encrypt.api.config.EncryptRuleConfiguration;
 import org.apache.shardingsphere.encrypt.rule.EncryptRule;
 import 
org.apache.shardingsphere.encrypt.yaml.config.YamlEncryptRuleConfiguration;
 import 
org.apache.shardingsphere.encrypt.yaml.swapper.YamlEncryptRuleConfigurationSwapper;
 import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.infra.database.type.DatabaseTypeEngine;
+import 
org.apache.shardingsphere.infra.datasource.pool.creator.DataSourcePoolCreator;
 import org.apache.shardingsphere.infra.datasource.props.DataSourceProperties;
 import 
org.apache.shardingsphere.infra.datasource.props.DataSourcePropertiesCreator;
 import org.apache.shardingsphere.infra.instance.InstanceContext;
 import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
 import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
-import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
 import 
org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlRuleConfiguration;
 import org.apache.shardingsphere.mask.api.config.MaskRuleConfiguration;
 import org.apache.shardingsphere.mask.rule.MaskRule;
 import org.apache.shardingsphere.mask.yaml.config.YamlMaskRuleConfiguration;
 import 
org.apache.shardingsphere.mask.yaml.swapper.YamlMaskRuleConfigurationSwapper;
+import org.apache.shardingsphere.mode.manager.ContextManager;
 import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
 import 
org.apache.shardingsphere.proxy.backend.config.yaml.YamlProxyDataSourceConfiguration;
 import 
org.apache.shardingsphere.proxy.backend.config.yaml.YamlProxyDatabaseConfiguration;
 import 
org.apache.shardingsphere.proxy.backend.config.yaml.swapper.YamlProxyDataSourceConfigurationSwapper;
 import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import org.apache.shardingsphere.proxy.backend.exception.FileIOException;
 import 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.checker.DatabaseDiscoveryRuleConfigurationImportChecker;
 import 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.checker.EncryptRuleConfigurationImportChecker;
 import 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.checker.MaskRuleConfigurationImportChecker;
@@ -69,8 +71,7 @@ import org.apache.shardingsphere.sharding.rule.ShardingRule;
 import 
org.apache.shardingsphere.sharding.yaml.config.YamlShardingRuleConfiguration;
 import 
org.apache.shardingsphere.sharding.yaml.swapper.YamlShardingRuleConfigurationSwapper;
 
-import java.io.File;
-import java.io.IOException;
+import javax.sql.DataSource;
 import java.sql.SQLException;
 import java.util.Collection;
 import java.util.Collections;
@@ -80,38 +81,36 @@ import java.util.Map;
 import java.util.Map.Entry;
 
 /**
- * Import database configuration updater.
+ * Import utility class.
  */
-public final class ImportDatabaseConfigurationUpdater implements 
RALUpdater<ImportDatabaseConfigurationStatement> {
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public class ImportUtils {
     
-    private final ShardingRuleConfigurationImportChecker 
shardingRuleConfigurationImportChecker = new 
ShardingRuleConfigurationImportChecker();
+    private static final ShardingRuleConfigurationImportChecker 
SHARDING_RULE_CONFIGURATION_IMPORT_CHECKER = new 
ShardingRuleConfigurationImportChecker();
     
-    private final ReadwriteSplittingRuleConfigurationImportChecker 
readwriteSplittingRuleConfigurationImportChecker = new 
ReadwriteSplittingRuleConfigurationImportChecker();
+    private static final ReadwriteSplittingRuleConfigurationImportChecker 
READWRITE_SPLITTING_RULE_CONFIGURATION_IMPORT_CHECKER = new 
ReadwriteSplittingRuleConfigurationImportChecker();
     
-    private final DatabaseDiscoveryRuleConfigurationImportChecker 
databaseDiscoveryRuleConfigurationImportChecker = new 
DatabaseDiscoveryRuleConfigurationImportChecker();
+    private static final DatabaseDiscoveryRuleConfigurationImportChecker 
DATABASE_DISCOVERY_RULE_CONFIGURATION_IMPORT_CHECKER = new 
DatabaseDiscoveryRuleConfigurationImportChecker();
     
-    private final EncryptRuleConfigurationImportChecker 
encryptRuleConfigurationImportChecker = new 
EncryptRuleConfigurationImportChecker();
+    private static final EncryptRuleConfigurationImportChecker 
ENCRYPT_RULE_CONFIGURATION_IMPORT_CHECKER = new 
EncryptRuleConfigurationImportChecker();
     
-    private final ShadowRuleConfigurationImportChecker 
shadowRuleConfigurationImportChecker = new 
ShadowRuleConfigurationImportChecker();
+    private static final ShadowRuleConfigurationImportChecker 
SHADOW_RULE_CONFIGURATION_IMPORT_CHECKER = new 
ShadowRuleConfigurationImportChecker();
     
-    private final MaskRuleConfigurationImportChecker 
maskRuleConfigurationImportChecker = new MaskRuleConfigurationImportChecker();
+    private static final MaskRuleConfigurationImportChecker 
MASK_RULE_CONFIGURATION_IMPORT_CHECKER = new 
MaskRuleConfigurationImportChecker();
     
-    private final YamlProxyDataSourceConfigurationSwapper 
dataSourceConfigSwapper = new YamlProxyDataSourceConfigurationSwapper();
+    private static final YamlProxyDataSourceConfigurationSwapper 
DATA_SOURCE_CONFIGURATION_SWAPPER = new 
YamlProxyDataSourceConfigurationSwapper();
     
-    private final DataSourcePropertiesValidateHandler validateHandler = new 
DataSourcePropertiesValidateHandler();
+    private static final DataSourcePropertiesValidateHandler VALIDATE_HANDLER 
= new DataSourcePropertiesValidateHandler();
     
-    @Override
-    public void executeUpdate(final String databaseName, final 
ImportDatabaseConfigurationStatement sqlStatement) throws SQLException {
-        File file = new File(sqlStatement.getFilePath());
-        YamlProxyDatabaseConfiguration yamlConfig;
-        try {
-            yamlConfig = YamlEngine.unmarshal(file, 
YamlProxyDatabaseConfiguration.class);
-        } catch (final IOException ex) {
-            throw new FileIOException(ex);
-        }
+    /**
+     * Import proxy database from yaml configuration.
+     * 
+     * @param yamlConfig yaml proxy database configuration
+     */
+    public static void importDatabaseConfig(final 
YamlProxyDatabaseConfiguration yamlConfig) {
         String yamlDatabaseName = yamlConfig.getDatabaseName();
-        checkDatabase(yamlDatabaseName, file);
-        checkDataSource(yamlConfig.getDataSources(), file);
+        checkDatabase(yamlDatabaseName);
+        checkDataSource(yamlConfig.getDataSources());
         addDatabase(yamlDatabaseName);
         addResources(yamlDatabaseName, yamlConfig.getDataSources());
         try {
@@ -122,36 +121,41 @@ public final class ImportDatabaseConfigurationUpdater 
implements RALUpdater<Impo
         }
     }
     
-    private void checkDatabase(final String databaseName, final File file) {
-        Preconditions.checkNotNull(databaseName, "Property `databaseName` in 
file `%s` is required", file.getName());
+    private static void checkDatabase(final String databaseName) {
+        Preconditions.checkNotNull(databaseName, "Property `databaseName` in 
imported config is required");
         if (ProxyContext.getInstance().databaseExists(databaseName)) {
             
Preconditions.checkState(ProxyContext.getInstance().getDatabase(databaseName).getResourceMetaData().getDataSources().isEmpty(),
 "Database `%s` exists and is not empty", databaseName);
         }
     }
     
-    private void checkDataSource(final Map<String, 
YamlProxyDataSourceConfiguration> dataSources, final File file) {
-        Preconditions.checkState(!dataSources.isEmpty(), "Data source 
configurations in file `%s` is required", file.getName());
+    private static void checkDataSource(final Map<String, 
YamlProxyDataSourceConfiguration> dataSources) {
+        Preconditions.checkState(!dataSources.isEmpty(), "Data source 
configurations in imported config is required");
     }
     
-    private void addDatabase(final String databaseName) {
-        
ProxyContext.getInstance().getContextManager().getInstanceContext().getModeContextManager().createDatabase(databaseName);
+    private static void addDatabase(final String databaseName) {
+        ContextManager contextManager = 
ProxyContext.getInstance().getContextManager();
+        
contextManager.getInstanceContext().getModeContextManager().createDatabase(databaseName);
+        DatabaseType protocolType = 
DatabaseTypeEngine.getProtocolType(Collections.emptyMap(), 
contextManager.getMetaDataContexts().getMetaData().getProps());
+        
contextManager.getMetaDataContexts().getMetaData().addDatabase(databaseName, 
protocolType);
     }
     
-    private void addResources(final String databaseName, final Map<String, 
YamlProxyDataSourceConfiguration> yamlDataSourceMap) {
+    private static void addResources(final String databaseName, final 
Map<String, YamlProxyDataSourceConfiguration> yamlDataSourceMap) {
         Map<String, DataSourceProperties> dataSourcePropsMap = new 
LinkedHashMap<>(yamlDataSourceMap.size(), 1);
         for (Entry<String, YamlProxyDataSourceConfiguration> entry : 
yamlDataSourceMap.entrySet()) {
-            dataSourcePropsMap.put(entry.getKey(), 
DataSourcePropertiesCreator.create(HikariDataSource.class.getName(), 
dataSourceConfigSwapper.swap(entry.getValue())));
+            dataSourcePropsMap.put(entry.getKey(), 
DataSourcePropertiesCreator.create(HikariDataSource.class.getName(), 
DATA_SOURCE_CONFIGURATION_SWAPPER.swap(entry.getValue())));
         }
-        validateHandler.validate(dataSourcePropsMap);
+        VALIDATE_HANDLER.validate(dataSourcePropsMap);
         try {
             
ProxyContext.getInstance().getContextManager().getInstanceContext().getModeContextManager().registerStorageUnits(databaseName,
 dataSourcePropsMap);
         } catch (final SQLException ex) {
             throw new 
InvalidStorageUnitsException(Collections.singleton(ex.getMessage()));
         }
+        Map<String, DataSource> dataSource = 
ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getDatabase(databaseName).getResourceMetaData().getDataSources();
+        dataSourcePropsMap.forEach((key, value) -> dataSource.put(key, 
DataSourcePoolCreator.create(value)));
     }
     
-    private void addRules(final String databaseName, final 
Collection<YamlRuleConfiguration> yamlRuleConfigs) {
-        if (yamlRuleConfigs.isEmpty()) {
+    private static void addRules(final String databaseName, final 
Collection<YamlRuleConfiguration> yamlRuleConfigs) {
+        if (yamlRuleConfigs == null || yamlRuleConfigs.isEmpty()) {
             return;
         }
         Collection<RuleConfiguration> ruleConfigs = new LinkedList<>();
@@ -162,32 +166,32 @@ public final class ImportDatabaseConfigurationUpdater 
implements RALUpdater<Impo
         for (YamlRuleConfiguration each : yamlRuleConfigs) {
             if (each instanceof YamlShardingRuleConfiguration) {
                 ShardingRuleConfiguration shardingRuleConfig = new 
YamlShardingRuleConfigurationSwapper().swapToObject((YamlShardingRuleConfiguration)
 each);
-                shardingRuleConfigurationImportChecker.check(database, 
shardingRuleConfig);
+                SHARDING_RULE_CONFIGURATION_IMPORT_CHECKER.check(database, 
shardingRuleConfig);
                 ruleConfigs.add(shardingRuleConfig);
                 rules.add(new ShardingRule(shardingRuleConfig, 
database.getResourceMetaData().getDataSources().keySet(), instanceContext));
             } else if (each instanceof 
YamlReadwriteSplittingRuleConfiguration) {
                 ReadwriteSplittingRuleConfiguration 
readwriteSplittingRuleConfig = new 
YamlReadwriteSplittingRuleConfigurationSwapper().swapToObject((YamlReadwriteSplittingRuleConfiguration)
 each);
-                
readwriteSplittingRuleConfigurationImportChecker.check(database, 
readwriteSplittingRuleConfig);
+                
READWRITE_SPLITTING_RULE_CONFIGURATION_IMPORT_CHECKER.check(database, 
readwriteSplittingRuleConfig);
                 ruleConfigs.add(readwriteSplittingRuleConfig);
                 rules.add(new ReadwriteSplittingRule(databaseName, 
readwriteSplittingRuleConfig, rules, instanceContext));
             } else if (each instanceof YamlDatabaseDiscoveryRuleConfiguration) 
{
                 DatabaseDiscoveryRuleConfiguration databaseDiscoveryRuleConfig 
= new 
YamlDatabaseDiscoveryRuleConfigurationSwapper().swapToObject((YamlDatabaseDiscoveryRuleConfiguration)
 each);
-                
databaseDiscoveryRuleConfigurationImportChecker.check(database, 
databaseDiscoveryRuleConfig);
+                
DATABASE_DISCOVERY_RULE_CONFIGURATION_IMPORT_CHECKER.check(database, 
databaseDiscoveryRuleConfig);
                 ruleConfigs.add(databaseDiscoveryRuleConfig);
                 rules.add(new DatabaseDiscoveryRule(databaseName, 
database.getResourceMetaData().getDataSources(), databaseDiscoveryRuleConfig, 
instanceContext));
             } else if (each instanceof YamlEncryptRuleConfiguration) {
                 EncryptRuleConfiguration encryptRuleConfig = new 
YamlEncryptRuleConfigurationSwapper().swapToObject((YamlEncryptRuleConfiguration)
 each);
-                encryptRuleConfigurationImportChecker.check(database, 
encryptRuleConfig);
+                ENCRYPT_RULE_CONFIGURATION_IMPORT_CHECKER.check(database, 
encryptRuleConfig);
                 ruleConfigs.add(encryptRuleConfig);
                 rules.add(new EncryptRule(encryptRuleConfig));
             } else if (each instanceof YamlShadowRuleConfiguration) {
                 ShadowRuleConfiguration shadowRuleConfig = new 
YamlShadowRuleConfigurationSwapper().swapToObject((YamlShadowRuleConfiguration) 
each);
-                shadowRuleConfigurationImportChecker.check(database, 
shadowRuleConfig);
+                SHADOW_RULE_CONFIGURATION_IMPORT_CHECKER.check(database, 
shadowRuleConfig);
                 ruleConfigs.add(shadowRuleConfig);
                 rules.add(new ShadowRule(shadowRuleConfig));
             } else if (each instanceof YamlMaskRuleConfiguration) {
                 MaskRuleConfiguration maskRuleConfig = new 
YamlMaskRuleConfigurationSwapper().swapToObject((YamlMaskRuleConfiguration) 
each);
-                maskRuleConfigurationImportChecker.check(database, 
maskRuleConfig);
+                MASK_RULE_CONFIGURATION_IMPORT_CHECKER.check(database, 
maskRuleConfig);
                 ruleConfigs.add(maskRuleConfig);
                 rules.add(new MaskRule(maskRuleConfig));
             }
@@ -195,12 +199,7 @@ public final class ImportDatabaseConfigurationUpdater 
implements RALUpdater<Impo
         
metaDataContexts.getPersistService().getDatabaseRulePersistService().persist(metaDataContexts.getMetaData().getActualDatabaseName(databaseName),
 ruleConfigs);
     }
     
-    private void dropDatabase(final String databaseName) {
+    private static void dropDatabase(final String databaseName) {
         
ProxyContext.getInstance().getContextManager().getInstanceContext().getModeContextManager().dropDatabase(databaseName);
     }
-    
-    @Override
-    public String getType() {
-        return ImportDatabaseConfigurationStatement.class.getName();
-    }
 }
diff --git 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/JsonUtils.java
 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/JsonUtils.java
new file mode 100644
index 00000000000..0c5e6cbcd2e
--- /dev/null
+++ 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/JsonUtils.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.proxy.backend.util;
+
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import lombok.SneakyThrows;
+
+/**
+ * Json utility class.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public class JsonUtils {
+    
+    private static final ObjectMapper MAPPER;
+    
+    static {
+        MAPPER = initDefaultMapper();
+    }
+    
+    private static ObjectMapper initDefaultMapper() {
+        ObjectMapper mapper = new ObjectMapper();
+        mapper.findAndRegisterModules();
+        mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
+        mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
+        mapper.setSerializationInclusion(Include.NON_NULL);
+        return mapper;
+    }
+    
+    /**
+     * Parse data to json string.
+     * 
+     * @param data data
+     * @return json string
+     */
+    @SneakyThrows(JsonProcessingException.class)
+    public static String toJsonString(final Object data) {
+        return MAPPER.writeValueAsString(data);
+    }
+    
+    /**
+     * Deserialize to Object from json string.
+     * 
+     * @param value json string
+     * @param clazz target Object
+     * @param <T> the type of return Object data
+     * @return target Object data
+     */
+    @SneakyThrows(JsonProcessingException.class)
+    public static <T> T readValue(final String value, final Class<T> clazz) {
+        return MAPPER.readValue(value, clazz);
+    }
+}
diff --git 
a/proxy/backend/core/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor
 
b/proxy/backend/core/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor
index 8819524c883..a075df90bfc 100644
--- 
a/proxy/backend/core/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor
+++ 
b/proxy/backend/core/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor
@@ -19,6 +19,7 @@ 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ShowComput
 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ShowComputeNodeInfoExecutor
 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ShowComputeNodeModeExecutor
 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ExportDatabaseConfigurationExecutor
+org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ExportMetaDataExecutor
 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ConvertYamlConfigurationExecutor
 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ShowDistVariableExecutor
 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ShowDistVariablesExecutor
diff --git 
a/proxy/backend/core/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.ral.update.RALUpdater
 
b/proxy/backend/core/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.ral.update.RALUpdater
index 54b05b5a171..c1f5c018ee1 100644
--- 
a/proxy/backend/core/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.ral.update.RALUpdater
+++ 
b/proxy/backend/core/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.ral.update.RALUpdater
@@ -20,6 +20,7 @@ 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable.LabelCompu
 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable.UnlabelComputeNodeUpdater
 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable.SetInstanceStatusUpdater
 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable.ImportDatabaseConfigurationUpdater
+org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable.ImportMetaDataUpdater
 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable.AlterReadwriteSplittingStorageUnitStatusStatementUpdater
 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable.SetDistVariableUpdater
 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable.RefreshDatabaseMetaDataUpdater
diff --git 
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportMetaDataExecutorTest.java
 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportMetaDataExecutorTest.java
new file mode 100644
index 00000000000..6816a0551c3
--- /dev/null
+++ 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportMetaDataExecutorTest.java
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable;
+
+import lombok.SneakyThrows;
+import org.apache.shardingsphere.authority.rule.AuthorityRule;
+import 
org.apache.shardingsphere.authority.rule.builder.DefaultAuthorityRuleConfigurationBuilder;
+import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ExportMetaDataStatement;
+import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
+import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey;
+import 
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
+import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
+import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
+import 
org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData;
+import org.apache.shardingsphere.mode.manager.ContextManager;
+import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
+import org.apache.shardingsphere.mode.metadata.persist.MetaDataPersistService;
+import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
+import org.apache.shardingsphere.test.util.PropertiesBuilder;
+import org.apache.shardingsphere.test.util.PropertiesBuilder.Property;
+import org.junit.After;
+import org.junit.Test;
+import org.mockito.MockedStatic;
+
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.IOException;
+import java.sql.SQLException;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Objects;
+import java.util.Properties;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.mockStatic;
+import static org.mockito.Mockito.when;
+
+public final class ExportMetaDataExecutorTest {
+    
+    private final MockedStatic<ProxyContext> proxyContext = 
mockStatic(ProxyContext.class, RETURNS_DEEP_STUBS);
+    
+    private final ShardingSphereDatabase database = 
mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS);
+    
+    @After
+    public void tearDown() {
+        proxyContext.close();
+    }
+    
+    @Test
+    public void assertGetColumns() {
+        Collection<String> columns = new 
ExportMetaDataExecutor().getColumnNames();
+        assertThat(columns.size(), is(3));
+        Iterator<String> columnIterator = columns.iterator();
+        assertThat(columnIterator.next(), is("id"));
+        assertThat(columnIterator.next(), is("create_time"));
+        assertThat(columnIterator.next(), is("cluster_info"));
+    }
+    
+    @Test
+    @SuppressWarnings("ResultOfMethodCallIgnored")
+    public void assertExecuteWithEmptyMetaData() {
+        ContextManager contextManager = mockEmptyContextManager();
+        proxyContext.when(() -> 
ProxyContext.getInstance().getContextManager()).thenReturn(contextManager);
+        proxyContext.when(() -> 
ProxyContext.getInstance().getAllDatabaseNames()).thenReturn(Collections.singleton("empty_metadata"));
+        when(database.getName()).thenReturn("empty_metadata");
+        
when(database.getResourceMetaData().getAllInstanceDataSourceNames()).thenReturn(Collections.singleton("empty_metadata"));
+        
when(database.getResourceMetaData().getDataSources()).thenReturn(Collections.emptyMap());
+        
when(database.getRuleMetaData().getConfigurations()).thenReturn(Collections.emptyList());
+        ExportMetaDataStatement sqlStatement = new 
ExportMetaDataStatement(null);
+        Collection<LocalDataQueryResultRow> actual = new 
ExportMetaDataExecutor().getRows(database, sqlStatement);
+        assertThat(actual.size(), is(1));
+        LocalDataQueryResultRow row = actual.iterator().next();
+        assertThat(row.getCell(3), 
is("{\"storageNodes\":[],\"metaData\":{\"databases\":{\"empty_metadata\":\"databaseName:
 null\\ndataSources:\\nrules:\\n\"},\"props\":\"\",\"rules\":\"\"}}"));
+    }
+    
+    private ContextManager mockEmptyContextManager() {
+        ContextManager result = mock(ContextManager.class, RETURNS_DEEP_STUBS);
+        MetaDataContexts metaDataContexts = new 
MetaDataContexts(mock(MetaDataPersistService.class), new 
ShardingSphereMetaData(new HashMap<>(),
+                new ShardingSphereRuleMetaData(Collections.emptyList()),
+                new ConfigurationProperties(new Properties())));
+        when(result.getMetaDataContexts()).thenReturn(metaDataContexts);
+        return result;
+    }
+    
+    @Test
+    @SuppressWarnings("ResultOfMethodCallIgnored")
+    public void assertExecute() throws SQLException {
+        when(database.getName()).thenReturn("normal_db");
+        ContextManager contextManager = mockContextManager();
+        proxyContext.when(() -> 
ProxyContext.getInstance().getContextManager()).thenReturn(contextManager);
+        Collection<LocalDataQueryResultRow> actual = new 
ExportMetaDataExecutor().getRows(database, new ExportMetaDataStatement(null));
+        assertThat(actual.size(), is(1));
+        LocalDataQueryResultRow row = actual.iterator().next();
+        assertThat(row.getCell(3), is(loadExpectedRow()));
+    }
+    
+    private ContextManager mockContextManager() {
+        ContextManager result = mock(ContextManager.class, RETURNS_DEEP_STUBS);
+        MetaDataContexts metaDataContexts = new 
MetaDataContexts(mock(MetaDataPersistService.class), new 
ShardingSphereMetaData(Collections.singletonMap(database.getName(), database),
+                new ShardingSphereRuleMetaData(Collections.singleton(new 
AuthorityRule(new DefaultAuthorityRuleConfigurationBuilder().build(), 
Collections.emptyMap()))),
+                new ConfigurationProperties(PropertiesBuilder.build(new 
Property(ConfigurationPropertyKey.SQL_SHOW.getKey(), "true")))));
+        when(result.getMetaDataContexts()).thenReturn(metaDataContexts);
+        return result;
+    }
+    
+    @SneakyThrows(IOException.class)
+    private String loadExpectedRow() {
+        StringBuilder result = new StringBuilder();
+        String fileName = 
Objects.requireNonNull(ExportMetaDataExecutorTest.class.getResource("/expected/export-metadata-configuration.json")).getFile();
+        try (
+                FileReader fileReader = new FileReader(fileName);
+                BufferedReader reader = new BufferedReader(fileReader)) {
+            String line;
+            while (null != (line = reader.readLine())) {
+                result.append(line);
+            }
+        }
+        return result.toString();
+    }
+}
diff --git 
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportDatabaseConfigurationUpdaterTest.java
 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportDatabaseConfigurationUpdaterTest.java
index 5128c8ab41a..a8ebbe54823 100644
--- 
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportDatabaseConfigurationUpdaterTest.java
+++ 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportDatabaseConfigurationUpdaterTest.java
@@ -17,7 +17,6 @@
 
 package org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable;
 
-import 
org.apache.shardingsphere.distsql.handler.validate.DataSourcePropertiesValidateHandler;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.updatable.ImportDatabaseConfigurationStatement;
 import org.apache.shardingsphere.infra.database.DefaultDatabase;
 import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
@@ -27,20 +26,12 @@ import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSp
 import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereTable;
 import org.apache.shardingsphere.mode.manager.ContextManager;
 import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.checker.DatabaseDiscoveryRuleConfigurationImportChecker;
-import 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.checker.EncryptRuleConfigurationImportChecker;
-import 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.checker.MaskRuleConfigurationImportChecker;
-import 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.checker.ReadwriteSplittingRuleConfigurationImportChecker;
-import 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.checker.ShadowRuleConfigurationImportChecker;
-import 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.checker.ShardingRuleConfigurationImportChecker;
 import org.apache.shardingsphere.test.fixture.jdbc.MockedDataSource;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.mockito.Mock;
 import org.mockito.MockedStatic;
-import org.mockito.internal.configuration.plugins.Plugins;
 import org.mockito.junit.MockitoJUnitRunner;
 
 import javax.sql.DataSource;
@@ -74,27 +65,6 @@ public final class ImportDatabaseConfigurationUpdaterTest {
     
     private final MockedStatic<ProxyContext> proxyContext = 
mockStatic(ProxyContext.class, RETURNS_DEEP_STUBS);
     
-    @Mock
-    private DataSourcePropertiesValidateHandler validateHandler;
-    
-    @Mock
-    private ShardingRuleConfigurationImportChecker 
shardingRuleConfigurationImportChecker;
-    
-    @Mock
-    private ReadwriteSplittingRuleConfigurationImportChecker 
readwriteSplittingRuleConfigurationImportChecker;
-    
-    @Mock
-    private DatabaseDiscoveryRuleConfigurationImportChecker 
databaseDiscoveryRuleConfigurationImportChecker;
-    
-    @Mock
-    private EncryptRuleConfigurationImportChecker 
encryptRuleConfigurationImportChecker;
-    
-    @Mock
-    private ShadowRuleConfigurationImportChecker 
shadowRuleConfigurationImportChecker;
-    
-    @Mock
-    private MaskRuleConfigurationImportChecker 
maskRuleConfigurationImportChecker;
-    
     private ImportDatabaseConfigurationUpdater 
importDatabaseConfigurationUpdater;
     
     private final Map<String, String> featureMap = new HashMap<>(3, 1);
@@ -115,46 +85,36 @@ public final class ImportDatabaseConfigurationUpdaterTest {
     }
     
     @Test(expected = IllegalStateException.class)
-    public void assertImportDatabaseExecutorForSharding() throws 
ReflectiveOperationException, SQLException {
+    public void assertImportDatabaseExecutorForSharding() throws SQLException {
         init(sharding);
-        
Plugins.getMemberAccessor().set(importDatabaseConfigurationUpdater.getClass().getDeclaredField("shardingRuleConfigurationImportChecker"),
-                importDatabaseConfigurationUpdater, 
shardingRuleConfigurationImportChecker);
         importDatabaseConfigurationUpdater.executeUpdate(sharding,
                 new 
ImportDatabaseConfigurationStatement(Objects.requireNonNull(ImportDatabaseConfigurationUpdaterTest.class.getResource(featureMap.get(sharding))).getPath()));
     }
     
     @Test(expected = IllegalStateException.class)
-    public void assertImportDatabaseExecutorForReadwriteSplitting() throws 
ReflectiveOperationException, SQLException {
+    public void assertImportDatabaseExecutorForReadwriteSplitting() throws 
SQLException {
         init(readwriteSplitting);
-        
Plugins.getMemberAccessor().set(importDatabaseConfigurationUpdater.getClass().getDeclaredField("readwriteSplittingRuleConfigurationImportChecker"),
-                importDatabaseConfigurationUpdater, 
readwriteSplittingRuleConfigurationImportChecker);
         importDatabaseConfigurationUpdater.executeUpdate(readwriteSplitting,
                 new 
ImportDatabaseConfigurationStatement(Objects.requireNonNull(ImportDatabaseConfigurationUpdaterTest.class.getResource(featureMap.get(readwriteSplitting))).getPath()));
     }
     
     @Test(expected = IllegalStateException.class)
-    public void assertImportDatabaseExecutorForDatabaseDiscovery() throws 
ReflectiveOperationException, SQLException {
+    public void assertImportDatabaseExecutorForDatabaseDiscovery() throws 
SQLException {
         init(databaseDiscovery);
-        
Plugins.getMemberAccessor().set(importDatabaseConfigurationUpdater.getClass().getDeclaredField("databaseDiscoveryRuleConfigurationImportChecker"),
-                importDatabaseConfigurationUpdater, 
databaseDiscoveryRuleConfigurationImportChecker);
         importDatabaseConfigurationUpdater.executeUpdate(databaseDiscovery,
                 new 
ImportDatabaseConfigurationStatement(Objects.requireNonNull(ImportDatabaseConfigurationUpdaterTest.class.getResource(featureMap.get(databaseDiscovery))).getPath()));
     }
     
     @Test(expected = IllegalStateException.class)
-    public void assertImportDatabaseExecutorForEncrypt() throws 
ReflectiveOperationException, SQLException {
+    public void assertImportDatabaseExecutorForEncrypt() throws SQLException {
         init(encrypt);
-        
Plugins.getMemberAccessor().set(importDatabaseConfigurationUpdater.getClass().getDeclaredField("encryptRuleConfigurationImportChecker"),
-                importDatabaseConfigurationUpdater, 
encryptRuleConfigurationImportChecker);
         importDatabaseConfigurationUpdater.executeUpdate(encrypt,
                 new 
ImportDatabaseConfigurationStatement(Objects.requireNonNull(ImportDatabaseConfigurationUpdaterTest.class.getResource(featureMap.get(encrypt))).getPath()));
     }
     
     @Test(expected = IllegalStateException.class)
-    public void assertImportDatabaseExecutorForShadow() throws 
ReflectiveOperationException, SQLException {
+    public void assertImportDatabaseExecutorForShadow() throws SQLException {
         init(shadow);
-        
Plugins.getMemberAccessor().set(importDatabaseConfigurationUpdater.getClass().getDeclaredField("shadowRuleConfigurationImportChecker"),
-                importDatabaseConfigurationUpdater, 
shadowRuleConfigurationImportChecker);
         importDatabaseConfigurationUpdater.executeUpdate(shadow,
                 new 
ImportDatabaseConfigurationStatement(Objects.requireNonNull(ImportDatabaseConfigurationUpdaterTest.class.getResource(featureMap.get(shadow))).getPath()));
     }
@@ -162,15 +122,13 @@ public final class ImportDatabaseConfigurationUpdaterTest 
{
     @Test(expected = IllegalStateException.class)
     public void assertImportDatabaseExecutorForMask() throws 
ReflectiveOperationException, SQLException {
         init(mask);
-        
Plugins.getMemberAccessor().set(importDatabaseConfigurationUpdater.getClass().getDeclaredField("maskRuleConfigurationImportChecker"),
-                importDatabaseConfigurationUpdater, 
maskRuleConfigurationImportChecker);
         importDatabaseConfigurationUpdater.executeUpdate(mask,
                 new 
ImportDatabaseConfigurationStatement(Objects.requireNonNull(ImportDatabaseConfigurationUpdaterTest.class.getResource(featureMap.get(mask))).getPath()));
     }
     
-    private void init(final String feature) throws 
ReflectiveOperationException {
+    @SuppressWarnings("ResultOfMethodCallIgnored")
+    private void init(final String feature) {
         importDatabaseConfigurationUpdater = new 
ImportDatabaseConfigurationUpdater();
-        
Plugins.getMemberAccessor().set(importDatabaseConfigurationUpdater.getClass().getDeclaredField("validateHandler"),
 importDatabaseConfigurationUpdater, validateHandler);
         ContextManager contextManager = mockContextManager(feature);
         proxyContext.when(() -> 
ProxyContext.getInstance().getContextManager()).thenReturn(contextManager);
         proxyContext.when(() -> 
ProxyContext.getInstance().databaseExists(feature)).thenReturn(true);
diff --git 
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportMetaDataUpdaterTest.java
 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportMetaDataUpdaterTest.java
new file mode 100644
index 00000000000..378a110b8cc
--- /dev/null
+++ 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportMetaDataUpdaterTest.java
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable;
+
+import 
org.apache.shardingsphere.distsql.parser.statement.ral.updatable.ImportMetaDataStatement;
+import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
+import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey;
+import org.apache.shardingsphere.infra.database.DefaultDatabase;
+import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
+import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereColumn;
+import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereIndex;
+import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema;
+import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereTable;
+import org.apache.shardingsphere.mode.manager.ContextManager;
+import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
+import org.apache.shardingsphere.test.fixture.jdbc.MockedDataSource;
+import org.apache.shardingsphere.test.util.PropertiesBuilder;
+import org.apache.shardingsphere.test.util.PropertiesBuilder.Property;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.MockedStatic;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import javax.sql.DataSource;
+import java.sql.SQLException;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Objects;
+
+import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.mockStatic;
+import static org.mockito.Mockito.when;
+
+@RunWith(MockitoJUnitRunner.class)
+public final class ImportMetaDataUpdaterTest {
+    
+    private static final String METADATA_VALUE = 
"{\"storageNodes\":[{\"ip\":\"127.0.0.1\",\"port\":\"3306\",\"username\":\"root\",\"password\":\"\",\"database\":\"demo_ds_0\"}],"
+            + "\"metaData\":{\"databases\":{\"sharding_db\":\"databaseName: 
sharding_db\\ndataSources:\\nrules:\\n\"},\"props\":\"props:\\n  
system-log-level: INFO\\n  sql-show: false\\n\","
+            + "\"rules\":\"rules:\\n- !AUTHORITY\\n  privilege:\\n    type: 
ALL_PERMITTED\\n  users:\\n  - authenticationMethodName: ''\\n    password: 
root\\n    user: root@%\\n\"}}";
+    
+    private final String empty = "empty_metadata";
+    
+    private final MockedStatic<ProxyContext> proxyContext = 
mockStatic(ProxyContext.class, RETURNS_DEEP_STUBS);
+    
+    private ImportMetaDataUpdater importMetaDataUpdater;
+    
+    private final Map<String, String> featureMap = new HashMap<>(1, 1);
+    
+    @Before
+    public void setup() {
+        featureMap.put(empty, "/conf/import/empty-metadata.json");
+    }
+    
+    @After
+    public void tearDown() {
+        proxyContext.close();
+    }
+    
+    @Test(expected = IllegalStateException.class)
+    public void assertCheckImportEmptyMetaData() throws SQLException {
+        init(null);
+        importMetaDataUpdater.executeUpdate(empty, new 
ImportMetaDataStatement(null, 
Objects.requireNonNull(ImportMetaDataUpdaterTest.class.getResource(featureMap.get(empty))).getPath()));
+    }
+    
+    @Test(expected = NullPointerException.class)
+    public void assertImportMetaDataFromJsonValue() throws SQLException {
+        init(empty);
+        importMetaDataUpdater.executeUpdate(empty, new 
ImportMetaDataStatement(METADATA_VALUE, null));
+    }
+    
+    @Test(expected = IllegalStateException.class)
+    public void assertImportExistedMetaDataFromFile() throws SQLException {
+        init(empty);
+        importMetaDataUpdater.executeUpdate(empty,
+                new ImportMetaDataStatement(null, 
Objects.requireNonNull(ImportMetaDataUpdaterTest.class.getResource(featureMap.get(empty))).getPath()));
+    }
+    
+    @SuppressWarnings("ResultOfMethodCallIgnored")
+    private void init(final String feature) {
+        importMetaDataUpdater = new ImportMetaDataUpdater();
+        ContextManager contextManager = mockContextManager(feature);
+        proxyContext.when(() -> 
ProxyContext.getInstance().getContextManager()).thenReturn(contextManager);
+        proxyContext.when(() -> 
ProxyContext.getInstance().databaseExists(feature)).thenReturn(true);
+    }
+    
+    private ContextManager mockContextManager(final String feature) {
+        ContextManager result = mock(ContextManager.class, RETURNS_DEEP_STUBS);
+        when(result.getMetaDataContexts().getMetaData().getProps())
+                .thenReturn(new 
ConfigurationProperties(PropertiesBuilder.build(new 
Property(ConfigurationPropertyKey.PROXY_FRONTEND_DATABASE_PROTOCOL_TYPE.getKey(),
 "MySQL"))));
+        if (feature != null) {
+            ShardingSphereDatabase database = 
mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS);
+            
when(database.getSchema(DefaultDatabase.LOGIC_NAME)).thenReturn(new 
ShardingSphereSchema(createTableMap(), Collections.emptyMap()));
+            
when(database.getResourceMetaData().getDataSources()).thenReturn(createDataSourceMap());
+            
when(result.getMetaDataContexts().getMetaData().getDatabases()).thenReturn(Collections.singletonMap(feature,
 database));
+            
when(result.getMetaDataContexts().getMetaData().getDatabase(feature)).thenReturn(database);
+        }
+        return result;
+    }
+    
+    private Map<String, DataSource> createDataSourceMap() {
+        Map<String, DataSource> result = new LinkedHashMap<>(2, 1);
+        result.put("ds_0", new MockedDataSource());
+        result.put("ds_1", new MockedDataSource());
+        return result;
+    }
+    
+    private Map<String, ShardingSphereTable> createTableMap() {
+        Collection<ShardingSphereColumn> columns = Collections.singleton(new 
ShardingSphereColumn("order_id", 0, false, false, false, true, false));
+        Collection<ShardingSphereIndex> indexes = Collections.singleton(new 
ShardingSphereIndex("primary"));
+        return Collections.singletonMap("t_order", new 
ShardingSphereTable("t_order", columns, indexes, Collections.emptyList()));
+    }
+}
diff --git 
a/proxy/backend/core/src/test/resources/conf/import/empty-metadata.json 
b/proxy/backend/core/src/test/resources/conf/import/empty-metadata.json
new file mode 100644
index 00000000000..ce344551ba5
--- /dev/null
+++ b/proxy/backend/core/src/test/resources/conf/import/empty-metadata.json
@@ -0,0 +1 @@
+{"storageNodes":[],"metaData":{"databases":{"empty_metadata":"databaseName: 
empty_metadata\n"},"props":"","rules":""}}
\ No newline at end of file
diff --git 
a/proxy/backend/core/src/test/resources/expected/export-metadata-configuration.json
 
b/proxy/backend/core/src/test/resources/expected/export-metadata-configuration.json
new file mode 100644
index 00000000000..3e3397c6ab3
--- /dev/null
+++ 
b/proxy/backend/core/src/test/resources/expected/export-metadata-configuration.json
@@ -0,0 +1 @@
+{"storageNodes":[],"metaData":{"databases":{},"props":"props:\n  sql-show: 
true\n","rules":"rules:\n- !AUTHORITY\n  privilege:\n    type: ALL_PERMITTED\n  
users:\n  - authenticationMethodName: ''\n    password: root\n    user: 
root@%\n"}}
diff --git 
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ral/impl/QueryableRALStatementAssert.java
 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ral/impl/QueryableRALStatementAssert.java
index 2e4557d7a86..a034b711499 100644
--- 
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ral/impl/QueryableRALStatementAssert.java
+++ 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ral/impl/QueryableRALStatementAssert.java
@@ -23,45 +23,48 @@ import 
org.apache.shardingsphere.authority.distsql.parser.statement.ShowAuthorit
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.QueryableRALStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ConvertYamlConfigurationStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ExportDatabaseConfigurationStatement;
-import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowDistVariablesStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ExportMetaDataStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowComputeNodeInfoStatement;
-import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowComputeNodesStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowComputeNodeModeStatement;
-import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowTableMetaDataStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowComputeNodesStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowDistVariableStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowDistVariablesStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowTableMetaDataStatement;
 import 
org.apache.shardingsphere.parser.distsql.parser.statement.queryable.ShowSQLParserRuleStatement;
 import 
org.apache.shardingsphere.readwritesplitting.distsql.parser.statement.ShowStatusFromReadwriteSplittingRulesStatement;
 import 
org.apache.shardingsphere.sqltranslator.distsql.parser.statement.ShowSQLTranslatorRuleStatement;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.SQLCaseAssertContext;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.queryable.ConvertYamlConfigurationStatementAssert;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.queryable.ExportDatabaseConfigurationStatementAssert;
-import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.queryable.ShowDistVariablesStatementAssert;
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.queryable.ExportMetaDataStatementAssert;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.queryable.ShowAuthorityRuleStatementAssert;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.queryable.ShowComputeNodeInfoStatementAssert;
-import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.queryable.ShowComputeNodesStatementAssert;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.queryable.ShowComputeNodeModeStatementAssert;
-import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.queryable.ShowStatusFromReadwriteSplittingRulesStatementAssert;
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.queryable.ShowComputeNodesStatementAssert;
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.queryable.ShowDistVariableStatementAssert;
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.queryable.ShowDistVariablesStatementAssert;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.queryable.ShowSQLParserRuleStatementAssert;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.queryable.ShowSQLTranslatorRuleStatementAssert;
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.queryable.ShowStatusFromReadwriteSplittingRulesStatementAssert;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.queryable.ShowTableMetaDataStatementAssert;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.queryable.ShowTrafficRulesStatementAssert;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.queryable.ShowTransactionRuleStatementAssert;
-import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.queryable.ShowDistVariableStatementAssert;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.SQLParserTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.ConvertYamlConfigurationStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.ExportDatabaseConfigurationStatementTestCase;
-import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.ShowDistVariablesStatementTestCase;
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.ExportMetaDataStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.ShowAuthorityRuleStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.ShowComputeNodeInfoStatementTestCase;
-import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.ShowComputeNodesStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.ShowComputeNodeModeStatementTestCase;
-import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.ShowStatusFromReadwriteSplittingRulesStatementTestCase;
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.ShowComputeNodesStatementTestCase;
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.ShowDistVariableStatementTestCase;
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.ShowDistVariablesStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.ShowSQLParserRuleStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.ShowSQLTranslatorRuleStatementTestCase;
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.ShowStatusFromReadwriteSplittingRulesStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.ShowTableMetaDataStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.ShowTrafficRulesStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.ShowTransactionRuleStatementTestCase;
-import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.ShowDistVariableStatementTestCase;
 import 
org.apache.shardingsphere.traffic.distsql.parser.statement.queryable.ShowTrafficRulesStatement;
 import 
org.apache.shardingsphere.transaction.distsql.parser.statement.queryable.ShowTransactionRuleStatement;
 
@@ -100,6 +103,8 @@ public final class QueryableRALStatementAssert {
             ShowSQLParserRuleStatementAssert.assertIs(assertContext, 
(ShowSQLParserRuleStatement) actual, (ShowSQLParserRuleStatementTestCase) 
expected);
         } else if (actual instanceof ExportDatabaseConfigurationStatement) {
             ExportDatabaseConfigurationStatementAssert.assertIs(assertContext, 
(ExportDatabaseConfigurationStatement) actual, 
(ExportDatabaseConfigurationStatementTestCase) expected);
+        } else if (actual instanceof ExportMetaDataStatement) {
+            ExportMetaDataStatementAssert.assertIs(assertContext, 
(ExportMetaDataStatement) actual, (ExportMetaDataStatementTestCase) expected);
         } else if (actual instanceof ShowSQLTranslatorRuleStatement) {
             ShowSQLTranslatorRuleStatementAssert.assertIs(assertContext, 
(ShowSQLTranslatorRuleStatement) actual, 
(ShowSQLTranslatorRuleStatementTestCase) expected);
         } else if (actual instanceof ShowComputeNodeInfoStatement) {
diff --git 
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ral/impl/UpdatableRALStatementAssert.java
 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ral/impl/UpdatableRALStatementAssert.java
index 4d81b85285e..9840612f15e 100644
--- 
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ral/impl/UpdatableRALStatementAssert.java
+++ 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ral/impl/UpdatableRALStatementAssert.java
@@ -22,6 +22,7 @@ import lombok.NoArgsConstructor;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.UpdatableRALStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.updatable.AlterComputeNodeStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.updatable.ImportDatabaseConfigurationStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.ral.updatable.ImportMetaDataStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.updatable.LabelComputeNodeStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.updatable.RefreshTableMetaDataStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.updatable.SetDistVariableStatement;
@@ -35,6 +36,7 @@ import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.r
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.updatable.AlterTrafficRuleStatementAssert;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.updatable.AlterTransactionRuleStatementAssert;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.updatable.ImportDatabaseConfigurationStatementAssert;
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.updatable.ImportMetaDataStatementAssert;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.updatable.LabelComputeNodeStatementAssert;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.updatable.RefreshTableMetaDataStatementAssert;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.updatable.SetDistVariableStatementAssert;
@@ -45,6 +47,7 @@ import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.s
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.AlterSQLParserRuleStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.AlterTrafficRuleStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.ImportDatabaseConfigurationStatementTestCase;
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.ImportMetaDataStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.LabelComputeNodeStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.RefreshTableMetaDataStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.SetDistVariableStatementTestCase;
@@ -82,6 +85,8 @@ public final class UpdatableRALStatementAssert {
             AlterTrafficRuleStatementAssert.assertIs(assertContext, 
(AlterTrafficRuleStatement) actual, (AlterTrafficRuleStatementTestCase) 
expected);
         } else if (actual instanceof ImportDatabaseConfigurationStatement) {
             ImportDatabaseConfigurationStatementAssert.assertIs(assertContext, 
(ImportDatabaseConfigurationStatement) actual, 
(ImportDatabaseConfigurationStatementTestCase) expected);
+        } else if (actual instanceof ImportMetaDataStatement) {
+            ImportMetaDataStatementAssert.assertIs(assertContext, 
(ImportMetaDataStatement) actual, (ImportMetaDataStatementTestCase) expected);
         } else if (actual instanceof AlterTransactionRuleStatement) {
             AlterTransactionRuleStatementAssert.assertIs(assertContext, 
(AlterTransactionRuleStatement) actual, expected);
         } else if (actual instanceof 
AlterReadwriteSplittingStorageUnitStatusStatement) {
diff --git 
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ral/impl/queryable/ExportMetaDataStatementAssert.java
 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ral/impl/queryable/ExportMetaDataStatementAssert.java
new file mode 100644
index 00000000000..e5533a27573
--- /dev/null
+++ 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ral/impl/queryable/ExportMetaDataStatementAssert.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.queryable;
+
+import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ExportMetaDataStatement;
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.SQLCaseAssertContext;
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.ExportMetaDataStatementTestCase;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+/**
+ * Export meta data statement assert.
+ */
+public final class ExportMetaDataStatementAssert {
+    
+    /**
+     * Assert export meta data statement is correct with expected parser 
result.
+     * 
+     * @param assertContext assert context
+     * @param actual actual export meta data statement
+     * @param expected expected export meta data statement test case
+     */
+    public static void assertIs(final SQLCaseAssertContext assertContext, 
final ExportMetaDataStatement actual,
+                                final ExportMetaDataStatementTestCase 
expected) {
+        if (null == expected) {
+            assertNull(assertContext.getText("Actual statement should not 
exist."), actual);
+        } else {
+            assertNotNull(assertContext.getText("Actual statement should 
exist."), actual);
+        }
+    }
+}
diff --git 
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ral/impl/updatable/ImportMetaDataStatementAssert.java
 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ral/impl/updatable/ImportMetaDataStatementAssert.java
new file mode 100644
index 00000000000..1ae5c42871d
--- /dev/null
+++ 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ral/impl/updatable/ImportMetaDataStatementAssert.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.updatable;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import 
org.apache.shardingsphere.distsql.parser.statement.ral.updatable.ImportMetaDataStatement;
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.SQLCaseAssertContext;
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.ImportMetaDataStatementTestCase;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertNull;
+
+/**
+ * Import meta data statement assert.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class ImportMetaDataStatementAssert {
+    
+    /**
+     * Assert import meta data statement is correct with expected parser 
result.
+     *
+     * @param assertContext assert context
+     * @param actual actual import meta data statement
+     * @param expected expected import meta data statement test case
+     */
+    public static void assertIs(final SQLCaseAssertContext assertContext, 
final ImportMetaDataStatement actual,
+                                final ImportMetaDataStatementTestCase 
expected) {
+        if (null == expected) {
+            assertNull(assertContext.getText("Actual statement should not 
exist."), actual);
+        } else {
+            assertThat(actual.getFilePath().get(), is(expected.getFilePath()));
+        }
+    }
+}
diff --git 
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/RootSQLParserTestCases.java
 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/RootSQLParserTestCases.java
index 7471b675367..3f965365b03 100644
--- 
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/RootSQLParserTestCases.java
+++ 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/RootSQLParserTestCases.java
@@ -300,7 +300,9 @@ import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.s
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.ConvertYamlConfigurationStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.DiscardDistSQLStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.ExportDatabaseConfigurationStatementTestCase;
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.ExportMetaDataStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.ImportDatabaseConfigurationStatementTestCase;
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.ImportMetaDataStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.LabelComputeNodeStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.PrepareDistSQLStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.RefreshTableMetaDataStatementTestCase;
@@ -1430,6 +1432,9 @@ public final class RootSQLParserTestCases {
     @XmlElement(name = "export-database-config")
     private final List<ExportDatabaseConfigurationStatementTestCase> 
exportDatabaseConfigurationTestCases = new LinkedList<>();
     
+    @XmlElement(name = "export-metadata")
+    private final List<ExportMetaDataStatementTestCase> 
exportMetaDataStatementTestCases = new LinkedList<>();
+    
     @XmlElement(name = "convert-yaml-config")
     private final List<ConvertYamlConfigurationStatementTestCase> 
convertYamlConfigurationStatementTestCases = new LinkedList<>();
     
@@ -1463,6 +1468,9 @@ public final class RootSQLParserTestCases {
     @XmlElement(name = "import-database-config")
     private final List<ImportDatabaseConfigurationStatementTestCase> 
importDatabaseConfigurationTestCases = new LinkedList<>();
     
+    @XmlElement(name = "import-metadata")
+    private final List<ImportMetaDataStatementTestCase> 
importMetaDataTestCases = new LinkedList<>();
+    
     @XmlElement(name = "drop-operator")
     private final List<DropOperatorStatementTestCase> dropOperatorTestCases = 
new LinkedList<>();
     
diff --git a/distsql/parser/src/main/antlr4/imports/BaseRule.g4 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ral/ExportMetaDataStatementTestCase.java
similarity index 56%
copy from distsql/parser/src/main/antlr4/imports/BaseRule.g4
copy to 
test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ral/ExportMetaDataStatementTestCase.java
index 95f6357780b..7f1fe31c5d8 100644
--- a/distsql/parser/src/main/antlr4/imports/BaseRule.g4
+++ 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ral/ExportMetaDataStatementTestCase.java
@@ -15,50 +15,12 @@
  * limitations under the License.
  */
 
-grammar BaseRule;
+package 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral;
 
-import Symbol, Keyword, Literals;
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.DatabaseContainedTestCase;
 
-literal
-    : STRING_ | (MINUS_)? INT_ | TRUE | FALSE
-    ;
-
-algorithmDefinition
-    : TYPE LP_ NAME EQ_ algorithmTypeName (COMMA_ propertiesDefinition)? RP_
-    ;
-
-algorithmTypeName
-    : STRING_
-    ;
-
-propertiesDefinition
-    : PROPERTIES LP_ properties? RP_
-    ;
-
-properties
-    : property (COMMA_ property)*
-    ;
-
-property
-    : key=STRING_ EQ_ value=literal
-    ;
-
-databaseName
-    : IDENTIFIER_
-    ;
-
-schemaName
-    : IDENTIFIER_
-    ;
-
-tableName
-    : IDENTIFIER_
-    ;
-
-resourceName
-    : IDENTIFIER_
-    ;
-
-storageUnitName
-    : IDENTIFIER_
-    ;
+/**
+ * Export meta data statement test case.
+ */
+public final class ExportMetaDataStatementTestCase extends 
DatabaseContainedTestCase {
+}
diff --git a/distsql/parser/src/main/antlr4/imports/BaseRule.g4 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ral/ImportMetaDataStatementTestCase.java
similarity index 56%
copy from distsql/parser/src/main/antlr4/imports/BaseRule.g4
copy to 
test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ral/ImportMetaDataStatementTestCase.java
index 95f6357780b..77d515c369f 100644
--- a/distsql/parser/src/main/antlr4/imports/BaseRule.g4
+++ 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ral/ImportMetaDataStatementTestCase.java
@@ -15,50 +15,21 @@
  * limitations under the License.
  */
 
-grammar BaseRule;
+package 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral;
 
-import Symbol, Keyword, Literals;
+import lombok.Getter;
+import lombok.Setter;
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.SQLParserTestCase;
 
-literal
-    : STRING_ | (MINUS_)? INT_ | TRUE | FALSE
-    ;
+import javax.xml.bind.annotation.XmlElement;
 
-algorithmDefinition
-    : TYPE LP_ NAME EQ_ algorithmTypeName (COMMA_ propertiesDefinition)? RP_
-    ;
-
-algorithmTypeName
-    : STRING_
-    ;
-
-propertiesDefinition
-    : PROPERTIES LP_ properties? RP_
-    ;
-
-properties
-    : property (COMMA_ property)*
-    ;
-
-property
-    : key=STRING_ EQ_ value=literal
-    ;
-
-databaseName
-    : IDENTIFIER_
-    ;
-
-schemaName
-    : IDENTIFIER_
-    ;
-
-tableName
-    : IDENTIFIER_
-    ;
-
-resourceName
-    : IDENTIFIER_
-    ;
-
-storageUnitName
-    : IDENTIFIER_
-    ;
+/**
+ * Import meta data statement test case.
+ */
+@Getter
+@Setter
+public final class ImportMetaDataStatementTestCase extends SQLParserTestCase {
+    
+    @XmlElement(name = "file-path")
+    private String filePath;
+}
diff --git a/test/it/parser/src/main/resources/case/ral/queryable.xml 
b/test/it/parser/src/main/resources/case/ral/queryable.xml
index 5a2418c1c16..4cd391b979b 100644
--- a/test/it/parser/src/main/resources/case/ral/queryable.xml
+++ b/test/it/parser/src/main/resources/case/ral/queryable.xml
@@ -40,6 +40,7 @@
     <export-database-config sql-case-id="export-database-config">
         <database name="database_name" start-index="28" stop-index="40" />
     </export-database-config>
+    <export-metadata sql-case-id="export-metadata" />
     <convert-yaml-config sql-case-id="convert-yaml-config">
         <file-path>/yaml/config-sharding.yaml</file-path>
     </convert-yaml-config>
diff --git a/test/it/parser/src/main/resources/case/ral/updatable.xml 
b/test/it/parser/src/main/resources/case/ral/updatable.xml
index adf1eda022b..374b559b314 100644
--- a/test/it/parser/src/main/resources/case/ral/updatable.xml
+++ b/test/it/parser/src/main/resources/case/ral/updatable.xml
@@ -67,6 +67,9 @@
     <import-database-config sql-case-id="import-database-config">
         <file-path>/yaml/config-sharding.yaml</file-path>
     </import-database-config>
+    <import-metadata sql-case-id="import-metadata">
+        <file-path>/json/exported-metadata.json</file-path>
+    </import-metadata>
     
     <alter-readwrite-splitting-storage-unit-status-enable 
sql-case-id="alter-readwrite-splitting-storage-unit-status-enable" 
group-name="group_1" storage-unit-name="read_ds_0" status="ENABLE">
         <database name="read_write" start-index="61" stop-index="70" />
diff --git a/test/it/parser/src/main/resources/sql/supported/ral/queryable.xml 
b/test/it/parser/src/main/resources/sql/supported/ral/queryable.xml
index fac5acb0e4b..2eebb1ba0b0 100644
--- a/test/it/parser/src/main/resources/sql/supported/ral/queryable.xml
+++ b/test/it/parser/src/main/resources/sql/supported/ral/queryable.xml
@@ -35,5 +35,6 @@
     <sql-case id="show-compute-node-mode" value="SHOW COMPUTE NODE MODE" 
db-types="ShardingSphere" />
     
     <sql-case id="export-database-config" value="EXPORT DATABASE CONFIGURATION 
FROM database_name" db-types="ShardingSphere" />
+    <sql-case id="export-metadata" value="EXPORT METADATA" 
db-types="ShardingSphere" />
     <sql-case id="convert-yaml-config" value="CONVERT YAML CONFIGURATION FROM 
FILE '/yaml/config-sharding.yaml'" db-types="ShardingSphere" />
 </sql-cases>
diff --git a/test/it/parser/src/main/resources/sql/supported/ral/updatable.xml 
b/test/it/parser/src/main/resources/sql/supported/ral/updatable.xml
index 5f047b4db75..8c8bf5f37dd 100644
--- a/test/it/parser/src/main/resources/sql/supported/ral/updatable.xml
+++ b/test/it/parser/src/main/resources/sql/supported/ral/updatable.xml
@@ -40,6 +40,7 @@
     <sql-case id="unlabel-compute-node-without-label" value="UNLABEL COMPUTE 
NODE instance_unlabel_2" db-types="ShardingSphere" />
     
     <sql-case id="import-database-config" value="IMPORT DATABASE CONFIGURATION 
FROM FILE '/yaml/config-sharding.yaml'" db-types="ShardingSphere" />
+    <sql-case id="import-metadata" value="IMPORT METADATA FROM FILE 
'/json/exported-metadata.json'" db-types="ShardingSphere" />
     
     <sql-case id="alter-readwrite-splitting-storage-unit-status-enable" 
value="ALTER READWRITE_SPLITTING RULE group_1 ENABLE read_ds_0 FROM read_write" 
db-types="ShardingSphere" />
     <sql-case id="alter-readwrite-splitting-storage-unit-status-disable" 
value="ALTER READWRITE_SPLITTING RULE group_1 DISABLE read_ds_0 FROM 
read_write" db-types="ShardingSphere" />


Reply via email to