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

duanzhengqiang 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 3509bb8a114 support encrypt and shadow mix it. (#20218)
3509bb8a114 is described below

commit 3509bb8a11455fadc4ca42f60eff0b5632209988
Author: Chuxin Chen <[email protected]>
AuthorDate: Sat Aug 20 20:52:40 2022 +0800

    support encrypt and shadow mix it. (#20218)
    
    * support encrypt and shadow mix it.
    
    * support encrypt and shadow mix it.
---
 .github/workflows/it.yml                           |  2 +-
 .../mysql/pro_insert_order_batch_value.xml         | 40 +++++++++
 .../mysql/pro_insert_order_value.xml               | 39 +++++++++
 .../mysql/pro_update_order_by_user_id.xml          | 38 +++++++++
 .../mysql/shadow_insert_order_batch_value.xml      | 40 +++++++++
 .../mysql/shadow_insert_order_value.xml            | 39 +++++++++
 .../mysql/shadow_update_order_by_user_id.xml       | 38 +++++++++
 .../postgresql/pro_insert_order_value.xml          | 39 +++++++++
 .../postgresql/pro_update_order_by_user_id.xml     | 38 +++++++++
 .../postgresql/shadow_insert_order_value.xml       | 39 +++++++++
 .../postgresql/shadow_update_order_by_user_id.xml  | 38 +++++++++
 .../encrypt_shadow/pro_delete_order_by_user_id.xml | 36 ++++++++
 .../shadow_delete_order_by_user_id.xml             | 36 ++++++++
 .../cases/dml/dml-integration-test-cases.xml       | 24 +++---
 .../cases/dql/dql-integration-test-cases.xml       |  5 ++
 .../src/test/resources/env/it-env.properties       |  4 +-
 .../env/scenario/encrypt_shadow/authority.xml      | 71 ++++++++++++++++
 .../encrypt_shadow/data/actual/databases.xml       | 22 +++++
 .../encrypt_shadow/data/actual/dataset.xml         | 43 ++++++++++
 .../data/actual/init-sql/h2/01-actual-init.sql     | 19 +++++
 .../data/actual/init-sql/h2/actual-db-init.sql     | 16 ++++
 .../actual/init-sql/h2/actual-shadow_db-init.sql   | 16 ++++
 .../data/actual/init-sql/mysql/01-actual-init.sql  | 29 +++++++
 .../data/actual/init-sql/oracle/01-actual-init.sql | 27 ++++++
 .../actual/init-sql/postgresql/01-actual-init.sql  | 38 +++++++++
 .../actual/init-sql/sqlserver/01-actual-init.sql   | 27 ++++++
 .../encrypt_shadow/data/expected/databases.xml     | 22 +++++
 .../encrypt_shadow/data/expected/dataset.xml       | 42 ++++++++++
 .../data/expected/init-sql/h2/01-expected-init.sql | 20 +++++
 .../data/expected/init-sql/mysql/expected-init.sql | 31 +++++++
 .../expected/init-sql/oracle/expected-init.sql     | 27 ++++++
 .../expected/init-sql/postgresql/expected-init.sql | 41 +++++++++
 .../expected/init-sql/sqlserver/expected-init.sql  | 27 ++++++
 .../proxy/conf/mysql/config-encrypt-shadow.yaml    | 98 ++++++++++++++++++++++
 .../conf/postgresql/config-encrypt-shadow.yaml     | 97 +++++++++++++++++++++
 .../env/scenario/encrypt_shadow/rules.yaml         | 76 +++++++++++++++++
 36 files changed, 1269 insertions(+), 15 deletions(-)

diff --git a/.github/workflows/it.yml b/.github/workflows/it.yml
index db277bfeaf0..f0d7e3eed91 100644
--- a/.github/workflows/it.yml
+++ b/.github/workflows/it.yml
@@ -182,7 +182,7 @@ jobs:
         adapter: [ proxy, jdbc ]
         mode: [ Standalone, Cluster ]
         database: [ MySQL, PostgreSQL ]
-        scenario: [ dbtbl_with_readwrite_splitting, 
dbtbl_with_readwrite_splitting_and_encrypt, sharding_and_encrypt, 
encrypt_and_readwrite_splitting ]
+        scenario: [ dbtbl_with_readwrite_splitting, 
dbtbl_with_readwrite_splitting_and_encrypt, sharding_and_encrypt, 
encrypt_and_readwrite_splitting, encrypt_shadow ]
         exclude:
           - adapter: jdbc
             mode: Cluster
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/mysql/pro_insert_order_batch_value.xml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/mysql/pro_insert_order_batch_value.xml
new file mode 100644
index 00000000000..d2bc2255986
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/mysql/pro_insert_order_batch_value.xml
@@ -0,0 +1,40 @@
+<!--
+  ~ 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.
+  -->
+
+<dataset update-count="2">
+    <metadata data-nodes="db.t_shadow">
+        <column name="order_id" type="long" />
+        <column name="user_id" type="int" />
+        <column name="order_name_cipher" type="varchar" />
+        <column name="order_name_plain" type="varchar" />
+        <column name="type_char" type="char" />
+        <column name="type_boolean" type="boolean" />
+        <column name="type_smallint" type="smallint" />
+        <column name="type_enum" type="enum#season" />
+        <column name="type_decimal" type="decimal" />
+        <column name="type_date" type="Date" />
+        <column name="type_time" type="time" />
+        <column name="type_timestamp" type="timestamp" />
+    </metadata>
+    <row data-node="db.t_shadow" values="1, 1, C4J8SHnvFT1FDZ3vF2ELDA==, 
pro_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 
18:30:30.0" />
+    <row data-node="db.t_shadow" values="2, 1, C4J8SHnvFT1FDZ3vF2ELDA==, 
pro_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 
18:30:30.0" />
+    <row data-node="db.t_shadow" values="3, 1, C4J8SHnvFT1FDZ3vF2ELDA==, 
pro_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 
18:30:30.0" />
+    <row data-node="db.t_shadow" values="4, 1, C4J8SHnvFT1FDZ3vF2ELDA==, 
pro_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 
18:30:30.0" />
+    <row data-node="db.t_shadow" values="5, 1, C4J8SHnvFT1FDZ3vF2ELDA==, 
pro_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 
18:30:30.0" />
+    <row data-node="db.t_shadow" values="7, 1, C4J8SHnvFT1FDZ3vF2ELDA==, 
pro_order, S, true, 50, summer, 100.00, 2021-01-01, 12:30:30, 2021-01-01 
12:30:30.0" />
+    <row data-node="db.t_shadow" values="8, 1, C4J8SHnvFT1FDZ3vF2ELDA==, 
pro_order, S, true, 50, summer, 100.00, 2021-01-01, 12:30:30, 2021-01-01 
12:30:30.0" />
+</dataset>
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/mysql/pro_insert_order_value.xml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/mysql/pro_insert_order_value.xml
new file mode 100644
index 00000000000..798d985a1a5
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/mysql/pro_insert_order_value.xml
@@ -0,0 +1,39 @@
+<!--
+  ~ 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.
+  -->
+
+<dataset update-count="1">
+    <metadata data-nodes="db.t_shadow">
+        <column name="order_id" type="long" />
+        <column name="user_id" type="int" />
+        <column name="order_name_cipher" type="varchar" />
+        <column name="order_name_plain" type="varchar" />
+        <column name="type_char" type="char" />
+        <column name="type_boolean" type="boolean" />
+        <column name="type_smallint" type="smallint" />
+        <column name="type_enum" type="enum#season" />
+        <column name="type_decimal" type="decimal" />
+        <column name="type_date" type="Date" />
+        <column name="type_time" type="time" />
+        <column name="type_timestamp" type="timestamp" />
+    </metadata>
+    <row data-node="db.t_shadow" values="1, 1, C4J8SHnvFT1FDZ3vF2ELDA==, 
pro_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 
18:30:30.0" />
+    <row data-node="db.t_shadow" values="2, 1, C4J8SHnvFT1FDZ3vF2ELDA==, 
pro_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 
18:30:30.0" />
+    <row data-node="db.t_shadow" values="3, 1, C4J8SHnvFT1FDZ3vF2ELDA==, 
pro_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 
18:30:30.0" />
+    <row data-node="db.t_shadow" values="4, 1, C4J8SHnvFT1FDZ3vF2ELDA==, 
pro_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 
18:30:30.0" />
+    <row data-node="db.t_shadow" values="5, 1, C4J8SHnvFT1FDZ3vF2ELDA==, 
pro_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 
18:30:30.0" />
+    <row data-node="db.t_shadow" values="6, 1, C4J8SHnvFT1FDZ3vF2ELDA==, 
pro_order, S, true, 50, summer, 100.00, 2021-01-01, 12:30:30, 2021-01-01 
12:30:30.0" />
+</dataset>
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/mysql/pro_update_order_by_user_id.xml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/mysql/pro_update_order_by_user_id.xml
new file mode 100644
index 00000000000..792ceedce8c
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/mysql/pro_update_order_by_user_id.xml
@@ -0,0 +1,38 @@
+<!--
+  ~ 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.
+  -->
+
+<dataset update-count="2">
+    <metadata data-nodes="db.t_shadow">
+        <column name="order_id" type="long" />
+        <column name="user_id" type="int" />
+        <column name="order_name_cipher" type="varchar" />
+        <column name="order_name_plain" type="varchar" />
+        <column name="type_char" type="char" />
+        <column name="type_boolean" type="boolean" />
+        <column name="type_smallint" type="smallint" />
+        <column name="type_enum" type="enum#season" />
+        <column name="type_decimal" type="decimal" />
+        <column name="type_date" type="Date" />
+        <column name="type_time" type="time" />
+        <column name="type_timestamp" type="timestamp" />
+    </metadata>
+    <row data-node="db.t_shadow" values="1, 1, 
pJ3IVa8/6/MAHE+Y37RBewq2ZLhWcqfQ8/EQnIqMx+g=, pro_order_update, F, false, 60, 
spring, 120.00, 2021-01-02, 13:30:30, 2021-01-02 13:30:30.0" />
+    <row data-node="db.t_shadow" values="2, 1, 
pJ3IVa8/6/MAHE+Y37RBewq2ZLhWcqfQ8/EQnIqMx+g=, pro_order_update, F, false, 60, 
spring, 120.00, 2021-01-02, 13:30:30, 2021-01-02 13:30:30.0" />
+    <row data-node="db.t_shadow" values="3, 1, C4J8SHnvFT1FDZ3vF2ELDA==, 
pro_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 
18:30:30.0" />
+    <row data-node="db.t_shadow" values="4, 1, C4J8SHnvFT1FDZ3vF2ELDA==, 
pro_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 
18:30:30.0" />
+    <row data-node="db.t_shadow" values="5, 1, C4J8SHnvFT1FDZ3vF2ELDA==, 
pro_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 
18:30:30.0" />
+</dataset>
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/mysql/shadow_insert_order_batch_value.xml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/mysql/shadow_insert_order_batch_value.xml
new file mode 100644
index 00000000000..ce0ac3af9c5
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/mysql/shadow_insert_order_batch_value.xml
@@ -0,0 +1,40 @@
+<!--
+  ~ 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.
+  -->
+
+<dataset update-count="2">
+    <metadata data-nodes="encrypt_shadow_db.t_shadow">
+        <column name="order_id" type="long" />
+        <column name="user_id" type="int" />
+        <column name="order_name_cipher" type="varchar" />
+        <column name="order_name_plain" type="varchar" />
+        <column name="type_char" type="char" />
+        <column name="type_boolean" type="boolean" />
+        <column name="type_smallint" type="smallint" />
+        <column name="type_enum" type="enum#season" />
+        <column name="type_decimal" type="decimal" />
+        <column name="type_date" type="Date" />
+        <column name="type_time" type="time" />
+        <column name="type_timestamp" type="timestamp" />
+    </metadata>
+    <row data-node="encrypt_shadow_db.t_shadow" values="1, 0, 
OuQCPda97jMdDtibdBO6Jg==, shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 
18:30:30, 2017-08-08 18:30:30.0" />
+    <row data-node="encrypt_shadow_db.t_shadow" values="2, 0, 
OuQCPda97jMdDtibdBO6Jg==, shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 
18:30:30, 2017-08-08 18:30:30.0" />
+    <row data-node="encrypt_shadow_db.t_shadow" values="3, 0, 
OuQCPda97jMdDtibdBO6Jg==, shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 
18:30:30, 2017-08-08 18:30:30.0" />
+    <row data-node="encrypt_shadow_db.t_shadow" values="4, 0, 
OuQCPda97jMdDtibdBO6Jg==, shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 
18:30:30, 2017-08-08 18:30:30.0" />
+    <row data-node="encrypt_shadow_db.t_shadow" values="5, 0, 
OuQCPda97jMdDtibdBO6Jg==, shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 
18:30:30, 2017-08-08 18:30:30.0" />
+    <row data-node="encrypt_shadow_db.t_shadow" values="7, 0, 
OuQCPda97jMdDtibdBO6Jg==, shadow_order, S, true, 50, summer, 100.00, 
2021-01-01, 12:30:30, 2021-01-01 12:30:30.0" />
+    <row data-node="encrypt_shadow_db.t_shadow" values="8, 0, 
OuQCPda97jMdDtibdBO6Jg==, shadow_order, S, true, 50, summer, 100.00, 
2021-01-01, 12:30:30, 2021-01-01 12:30:30.0" />
+</dataset>
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/mysql/shadow_insert_order_value.xml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/mysql/shadow_insert_order_value.xml
new file mode 100644
index 00000000000..7f073778d66
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/mysql/shadow_insert_order_value.xml
@@ -0,0 +1,39 @@
+<!--
+  ~ 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.
+  -->
+
+<dataset update-count="1">
+    <metadata data-nodes="encrypt_shadow_db.t_shadow">
+        <column name="order_id" type="long" />
+        <column name="user_id" type="int" />
+        <column name="order_name_cipher" type="varchar" />
+        <column name="order_name_plain" type="varchar" />
+        <column name="type_char" type="char" />
+        <column name="type_boolean" type="boolean" />
+        <column name="type_smallint" type="smallint" />
+        <column name="type_enum" type="enum#season" />
+        <column name="type_decimal" type="decimal" />
+        <column name="type_date" type="Date" />
+        <column name="type_time" type="time" />
+        <column name="type_timestamp" type="timestamp" />
+    </metadata>
+    <row data-node="encrypt_shadow_db.t_shadow" values="1, 0, 
OuQCPda97jMdDtibdBO6Jg==, shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 
18:30:30, 2017-08-08 18:30:30.0" />
+    <row data-node="encrypt_shadow_db.t_shadow" values="2, 0, 
OuQCPda97jMdDtibdBO6Jg==, shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 
18:30:30, 2017-08-08 18:30:30.0" />
+    <row data-node="encrypt_shadow_db.t_shadow" values="3, 0, 
OuQCPda97jMdDtibdBO6Jg==, shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 
18:30:30, 2017-08-08 18:30:30.0" />
+    <row data-node="encrypt_shadow_db.t_shadow" values="4, 0, 
OuQCPda97jMdDtibdBO6Jg==, shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 
18:30:30, 2017-08-08 18:30:30.0" />
+    <row data-node="encrypt_shadow_db.t_shadow" values="5, 0, 
OuQCPda97jMdDtibdBO6Jg==, shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 
18:30:30, 2017-08-08 18:30:30.0" />
+    <row data-node="encrypt_shadow_db.t_shadow" values="6, 0, 
OuQCPda97jMdDtibdBO6Jg==, shadow_order, S, true, 50, summer, 100.00, 
2021-01-01, 12:30:30, 2021-01-01 12:30:30.0" />
+</dataset>
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/mysql/shadow_update_order_by_user_id.xml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/mysql/shadow_update_order_by_user_id.xml
new file mode 100644
index 00000000000..7add3bb37f1
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/mysql/shadow_update_order_by_user_id.xml
@@ -0,0 +1,38 @@
+<!--
+  ~ 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.
+  -->
+
+<dataset update-count="2">
+    <metadata data-nodes="encrypt_shadow_db.t_shadow">
+        <column name="order_id" type="long" />
+        <column name="user_id" type="int" />
+        <column name="order_name_cipher" type="varchar" />
+        <column name="order_name_plain" type="varchar" />
+        <column name="type_char" type="char" />
+        <column name="type_boolean" type="boolean" />
+        <column name="type_smallint" type="smallint" />
+        <column name="type_enum" type="enum#season" />
+        <column name="type_decimal" type="decimal" />
+        <column name="type_date" type="Date" />
+        <column name="type_time" type="time" />
+        <column name="type_timestamp" type="timestamp" />
+    </metadata>
+    <row data-node="encrypt_shadow_db.t_shadow" values="1, 0, 
Maa/yGvU7aHHk/5ojIbu0yjdF4JsYXG9BME4tDIAAiE=, shadow_order_update, F, false, 
60, spring, 120.00, 2021-01-02, 13:30:30, 2021-01-02 13:30:30.0" />
+    <row data-node="encrypt_shadow_db.t_shadow" values="2, 0, 
Maa/yGvU7aHHk/5ojIbu0yjdF4JsYXG9BME4tDIAAiE=, shadow_order_update, F, false, 
60, spring, 120.00, 2021-01-02, 13:30:30, 2021-01-02 13:30:30.0" />
+    <row data-node="encrypt_shadow_db.t_shadow" values="3, 0, 
OuQCPda97jMdDtibdBO6Jg==, shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 
18:30:30, 2017-08-08 18:30:30.0" />
+    <row data-node="encrypt_shadow_db.t_shadow" values="4, 0, 
OuQCPda97jMdDtibdBO6Jg==, shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 
18:30:30, 2017-08-08 18:30:30.0" />
+    <row data-node="encrypt_shadow_db.t_shadow" values="5, 0, 
OuQCPda97jMdDtibdBO6Jg==, shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 
18:30:30, 2017-08-08 18:30:30.0" />
+</dataset>
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/postgresql/pro_insert_order_value.xml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/postgresql/pro_insert_order_value.xml
new file mode 100644
index 00000000000..8ee1e9f89d4
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/postgresql/pro_insert_order_value.xml
@@ -0,0 +1,39 @@
+<!--
+  ~ 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.
+  -->
+
+<dataset update-count="1">
+    <metadata data-nodes="db.t_shadow">
+        <column name="order_id" type="long" />
+        <column name="user_id" type="int" />
+        <column name="order_name_cipher" type="varchar" />
+        <column name="order_name_plain" type="varchar" />
+        <column name="type_char" type="char" />
+        <column name="type_boolean" type="boolean" />
+        <column name="type_smallint" type="smallint" />
+        <column name="type_enum" type="enum#season" />
+        <column name="type_decimal" type="decimal" />
+        <column name="type_date" type="Date" />
+        <column name="type_time" type="time" />
+        <column name="type_timestamp" type="timestamp" />
+    </metadata>
+    <row data-node="db.t_shadow" values="1, 1, C4J8SHnvFT1FDZ3vF2ELDA==, 
pro_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 
18:30:30.0 " />
+    <row data-node="db.t_shadow" values="2, 1, C4J8SHnvFT1FDZ3vF2ELDA==, 
pro_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 
18:30:30.0" />
+    <row data-node="db.t_shadow" values="3, 1, C4J8SHnvFT1FDZ3vF2ELDA==, 
pro_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 
18:30:30.0" />
+    <row data-node="db.t_shadow" values="4, 1, C4J8SHnvFT1FDZ3vF2ELDA==, 
pro_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 
18:30:30.0" />
+    <row data-node="db.t_shadow" values="5, 1, C4J8SHnvFT1FDZ3vF2ELDA==, 
pro_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 
18:30:30.0" />
+    <row data-node="db.t_shadow" values="6, 1, C4J8SHnvFT1FDZ3vF2ELDA==, 
pro_order, S, true, 50, summer, 120.00, 2021-01-01, 12:30:30, 2021-01-01 
12:30:30.0" />
+</dataset>
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/postgresql/pro_update_order_by_user_id.xml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/postgresql/pro_update_order_by_user_id.xml
new file mode 100644
index 00000000000..f88094ad503
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/postgresql/pro_update_order_by_user_id.xml
@@ -0,0 +1,38 @@
+<!--
+  ~ 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.
+  -->
+
+<dataset update-count="2">
+    <metadata data-nodes="db.t_shadow">
+        <column name="order_id" type="long" />
+        <column name="user_id" type="int" />
+        <column name="order_name_cipher" type="varchar" />
+        <column name="order_name_plain" type="varchar" />
+        <column name="type_char" type="char" />
+        <column name="type_boolean" type="boolean" />
+        <column name="type_smallint" type="smallint" />
+        <column name="type_enum" type="enum#season" />
+        <column name="type_decimal" type="decimal" />
+        <column name="type_date" type="Date" />
+        <column name="type_time" type="time" />
+        <column name="type_timestamp" type="timestamp" />
+    </metadata>
+    <row data-node="db.t_shadow" values="1, 1, 
pJ3IVa8/6/MAHE+Y37RBewq2ZLhWcqfQ8/EQnIqMx+g=, pro_order_update, F, false, 60, 
spring, 120.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+    <row data-node="db.t_shadow" values="2, 1, 
pJ3IVa8/6/MAHE+Y37RBewq2ZLhWcqfQ8/EQnIqMx+g=, pro_order_update, F, false, 60, 
spring, 120.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+    <row data-node="db.t_shadow" values="3, 1, C4J8SHnvFT1FDZ3vF2ELDA==, 
pro_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 
18:30:30.0" />
+    <row data-node="db.t_shadow" values="4, 1, C4J8SHnvFT1FDZ3vF2ELDA==, 
pro_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 
18:30:30.0" />
+    <row data-node="db.t_shadow" values="5, 1, C4J8SHnvFT1FDZ3vF2ELDA==, 
pro_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 
18:30:30.0" />
+</dataset>
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/postgresql/shadow_insert_order_value.xml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/postgresql/shadow_insert_order_value.xml
new file mode 100644
index 00000000000..b4e05a550cd
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/postgresql/shadow_insert_order_value.xml
@@ -0,0 +1,39 @@
+<!--
+  ~ 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.
+  -->
+
+<dataset update-count="1">
+    <metadata data-nodes="encrypt_shadow_db.t_shadow">
+        <column name="order_id" type="long" />
+        <column name="user_id" type="int" />
+        <column name="order_name_cipher" type="varchar" />
+        <column name="order_name_plain" type="varchar" />
+        <column name="type_char" type="char" />
+        <column name="type_boolean" type="boolean" />
+        <column name="type_smallint" type="smallint" />
+        <column name="type_enum" type="enum#season" />
+        <column name="type_decimal" type="decimal" />
+        <column name="type_date" type="Date" />
+        <column name="type_time" type="time" />
+        <column name="type_timestamp" type="timestamp" />
+    </metadata>
+    <row data-node="encrypt_shadow_db.t_shadow" values="1, 0, 
OuQCPda97jMdDtibdBO6Jg==, shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 
18:30:30, 2017-08-08 18:30:30.0" />
+    <row data-node="encrypt_shadow_db.t_shadow" values="2, 0, 
OuQCPda97jMdDtibdBO6Jg==, shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 
18:30:30, 2017-08-08 18:30:30.0" />
+    <row data-node="encrypt_shadow_db.t_shadow" values="3, 0, 
OuQCPda97jMdDtibdBO6Jg==, shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 
18:30:30, 2017-08-08 18:30:30.0" />
+    <row data-node="encrypt_shadow_db.t_shadow" values="4, 0, 
OuQCPda97jMdDtibdBO6Jg==, shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 
18:30:30, 2017-08-08 18:30:30.0" />
+    <row data-node="encrypt_shadow_db.t_shadow" values="5, 0, 
OuQCPda97jMdDtibdBO6Jg==, shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 
18:30:30, 2017-08-08 18:30:30.0" />
+    <row data-node="encrypt_shadow_db.t_shadow" values="6, 0, 
OuQCPda97jMdDtibdBO6Jg==, shadow_order, S, true, 50, summer, 120.00, 
2021-01-01, 12:30:30, 2021-01-01 12:30:30.0" />
+</dataset>
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/postgresql/shadow_update_order_by_user_id.xml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/postgresql/shadow_update_order_by_user_id.xml
new file mode 100644
index 00000000000..3057a877990
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/postgresql/shadow_update_order_by_user_id.xml
@@ -0,0 +1,38 @@
+<!--
+  ~ 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.
+  -->
+
+<dataset update-count="2">
+    <metadata data-nodes="encrypt_shadow_db.t_shadow">
+        <column name="order_id" type="long" />
+        <column name="user_id" type="int" />
+        <column name="order_name_cipher" type="varchar" />
+        <column name="order_name_plain" type="varchar" />
+        <column name="type_char" type="char" />
+        <column name="type_boolean" type="boolean" />
+        <column name="type_smallint" type="smallint" />
+        <column name="type_enum" type="enum#season" />
+        <column name="type_decimal" type="decimal" />
+        <column name="type_date" type="Date" />
+        <column name="type_time" type="time" />
+        <column name="type_timestamp" type="timestamp" />
+    </metadata>
+    <row data-node="encrypt_shadow_db.t_shadow" values="1, 0, 
Maa/yGvU7aHHk/5ojIbu0yjdF4JsYXG9BME4tDIAAiE=, shadow_order_update, F, false, 
60, spring, 120.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+    <row data-node="encrypt_shadow_db.t_shadow" values="2, 0, 
Maa/yGvU7aHHk/5ojIbu0yjdF4JsYXG9BME4tDIAAiE=, shadow_order_update, F, false, 
60, spring, 120.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+    <row data-node="encrypt_shadow_db.t_shadow" values="3, 0, 
OuQCPda97jMdDtibdBO6Jg==, shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 
18:30:30, 2017-08-08 18:30:30.0" />
+    <row data-node="encrypt_shadow_db.t_shadow" values="4, 0, 
OuQCPda97jMdDtibdBO6Jg==, shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 
18:30:30, 2017-08-08 18:30:30.0" />
+    <row data-node="encrypt_shadow_db.t_shadow" values="5, 0, 
OuQCPda97jMdDtibdBO6Jg==, shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 
18:30:30, 2017-08-08 18:30:30.0" />
+</dataset>
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/pro_delete_order_by_user_id.xml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/pro_delete_order_by_user_id.xml
new file mode 100644
index 00000000000..d998b364c02
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/pro_delete_order_by_user_id.xml
@@ -0,0 +1,36 @@
+<!--
+  ~ 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.
+  -->
+
+<dataset update-count="2">
+    <metadata data-nodes="db.t_shadow">
+        <column name="order_id" type="long" />
+        <column name="user_id" type="int" />
+        <column name="order_name_cipher" type="varchar" />
+        <column name="order_name_plain" type="varchar" />
+        <column name="type_char" type="char" />
+        <column name="type_boolean" type="boolean" />
+        <column name="type_smallint" type="smallint" />
+        <column name="type_enum" type="enum#season" />
+        <column name="type_decimal" type="decimal" />
+        <column name="type_date" type="Date" />
+        <column name="type_time" type="time" />
+        <column name="type_timestamp" type="timestamp" />
+    </metadata>
+    <row data-node="db.t_shadow" values="1, 1, C4J8SHnvFT1FDZ3vF2ELDA==, 
pro_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 
18:30:30.0" />
+    <row data-node="db.t_shadow" values="2, 1, C4J8SHnvFT1FDZ3vF2ELDA==, 
pro_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 
18:30:30.0" />
+    <row data-node="db.t_shadow" values="3, 1, C4J8SHnvFT1FDZ3vF2ELDA==, 
pro_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 
18:30:30.0" />
+</dataset>
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/shadow_delete_order_by_user_id.xml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/shadow_delete_order_by_user_id.xml
new file mode 100644
index 00000000000..21e989b6012
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/encrypt_shadow/shadow_delete_order_by_user_id.xml
@@ -0,0 +1,36 @@
+<!--
+  ~ 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.
+  -->
+
+<dataset update-count="2">
+    <metadata data-nodes="encrypt_shadow_db.t_shadow">
+        <column name="order_id" type="long" />
+        <column name="user_id" type="int" />
+        <column name="order_name_cipher" type="varchar" />
+        <column name="order_name_plain" type="varchar" />
+        <column name="type_char" type="char" />
+        <column name="type_boolean" type="boolean" />
+        <column name="type_smallint" type="smallint" />
+        <column name="type_enum" type="enum#season" />
+        <column name="type_decimal" type="decimal" />
+        <column name="type_date" type="Date" />
+        <column name="type_time" type="time" />
+        <column name="type_timestamp" type="timestamp" />
+    </metadata>
+    <row data-node="encrypt_shadow_db.t_shadow" values="1, 0, 
OuQCPda97jMdDtibdBO6Jg==, shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 
18:30:30, 2017-08-08 18:30:30.0" />
+    <row data-node="encrypt_shadow_db.t_shadow" values="2, 0, 
OuQCPda97jMdDtibdBO6Jg==, shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 
18:30:30, 2017-08-08 18:30:30.0" />
+    <row data-node="encrypt_shadow_db.t_shadow" values="3, 0, 
OuQCPda97jMdDtibdBO6Jg==, shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 
18:30:30, 2017-08-08 18:30:30.0" />
+</dataset>
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dml-integration-test-cases.xml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dml-integration-test-cases.xml
index 256f27fd157..ffcb5cebe59 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dml-integration-test-cases.xml
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dml-integration-test-cases.xml
@@ -210,58 +210,58 @@
     <!--</test-case>-->
     
     <test-case sql="INSERT INTO t_shadow (order_id, user_id, order_name, 
type_char, type_boolean, type_smallint, type_enum, type_decimal, type_date, 
type_time, type_timestamp)
-                            VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);" 
db-types="MySQL" scenario-types="shadow">
+                            VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);" 
db-types="MySQL" scenario-types="shadow,encrypt_shadow">
         <assertion parameters="6:long, 1:int, pro_order:String, S:char, 
true:boolean, 50:smallint, summer:enum#season, 100.00:decimal, 2021-01-01:Date, 
12:30:30:time, 2021-01-01 12:30:30:timestamp"
                    expected-data-file="pro_insert_order_value.xml" />
     </test-case>
     
     <test-case sql="INSERT INTO t_shadow (order_id, user_id, order_name, 
type_char, type_boolean, type_smallint, type_enum, type_decimal, type_date, 
type_time, type_timestamp)
-                            VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);" 
db-types="MySQL" scenario-types="shadow">
+                            VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);" 
db-types="MySQL" scenario-types="shadow,encrypt_shadow">
         <assertion parameters="6:long, 0:int, shadow_order:String, S:char, 
true:boolean, 50:smallint, summer:enum#season, 100.00:decimal, 2021-01-01:Date, 
12:30:30:time, 2021-01-01 12:30:30:timestamp"
                    expected-data-file="shadow_insert_order_value.xml" />
     </test-case>
     
     <test-case sql="INSERT INTO t_shadow (order_id, user_id, order_name, 
type_char, type_boolean, type_smallint, type_enum, type_decimal, type_date, 
type_time, type_timestamp)
-                    VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, 
?, ?, ?, ?, ?, ?);" db-types="MySQL" scenario-types="shadow">
+                    VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, 
?, ?, ?, ?, ?, ?);" db-types="MySQL" scenario-types="shadow,encrypt_shadow">
         <assertion parameters="7:long, 1:int, pro_order:String, S:char, 
true:boolean, 50:smallint, summer:enum#season, 100.00:decimal, 2021-01-01:Date, 
12:30:30:time, 2021-01-01 12:30:30:timestamp, 8:long, 1:int, pro_order:String, 
S:char, true:boolean, 50:smallint, summer:enum#season, 100.00:decimal, 
2021-01-01:Date, 12:30:30:time, 2021-01-01 12:30:30:timestamp"
                 expected-data-file="pro_insert_order_batch_value.xml" />
     </test-case>
     
     <test-case sql="INSERT INTO t_shadow (order_id, user_id, order_name, 
type_char, type_boolean, type_smallint, type_enum, type_decimal, type_date, 
type_time, type_timestamp)
-                    VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, 
?, ?, ?, ?, ?, ?);" db-types="MySQL" scenario-types="shadow">
+                    VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, 
?, ?, ?, ?, ?, ?);" db-types="MySQL" scenario-types="shadow,encrypt_shadow">
         <assertion parameters="7:long, 0:int, shadow_order:String, S:char, 
true:boolean, 50:smallint, summer:enum#season, 100.00:decimal, 2021-01-01:Date, 
12:30:30:time, 2021-01-01 12:30:30:timestamp, 8:long, 0:int, 
shadow_order:String, S:char, true:boolean, 50:smallint, summer:enum#season, 
100.00:decimal, 2021-01-01:Date, 12:30:30:time, 2021-01-01 12:30:30:timestamp"
                    expected-data-file="shadow_insert_order_batch_value.xml" />
     </test-case>
     
     <test-case sql="UPDATE t_shadow SET order_name = ?, type_char = ?, 
type_boolean = ?, type_smallint = ?, type_enum = ?, type_decimal = ?, type_date 
= ?, type_time = ?, type_timestamp = ?
-                    WHERE user_id = ? and order_id in (?, ?)" db-types="MySQL" 
scenario-types="shadow">
+                    WHERE user_id = ? and order_id in (?, ?)" db-types="MySQL" 
scenario-types="shadow,encrypt_shadow">
         <assertion parameters="pro_order_update:String, F:char, false:boolean, 
60:smallint, spring:enum#season, 120.00:decimal, 2021-01-02:Date, 
13:30:30:time, 2021-01-02 13:30:30:timestamp, 1:int, 1:long, 2:long"
                    expected-data-file="pro_update_order_by_user_id.xml" />
     </test-case>
     
     <test-case sql="UPDATE t_shadow SET order_name = ?, type_char = ?, 
type_boolean = ?, type_smallint = ?, type_enum = ?, type_decimal = ?, type_date 
= ?, type_time = ?, type_timestamp = ?
-                    WHERE user_id = ? and order_id in (?, ?)" db-types="MySQL" 
scenario-types="shadow">
+                    WHERE user_id = ? and order_id in (?, ?)" db-types="MySQL" 
scenario-types="shadow,encrypt_shadow">
         <assertion parameters="shadow_order_update:String, F:char, 
false:boolean, 60:smallint, spring:enum#season, 120.00:decimal, 
2021-01-02:Date, 13:30:30:time, 2021-01-02 13:30:30:timestamp, 0:int, 1:long, 
2:long"
                    expected-data-file="shadow_update_order_by_user_id.xml" />
     </test-case>
     
-    <test-case sql="DELETE FROM t_shadow WHERE user_id = ? and order_id in (?, 
?)" db-types="MySQL" scenario-types="shadow">
+    <test-case sql="DELETE FROM t_shadow WHERE user_id = ? and order_id in (?, 
?)" db-types="MySQL" scenario-types="shadow,encrypt_shadow">
         <assertion parameters="1:int, 4:long, 5:long" 
expected-data-file="pro_delete_order_by_user_id.xml" />
     </test-case>
     
-    <test-case sql="DELETE FROM t_shadow WHERE user_id = ? and order_id in (?, 
?)" db-types="MySQL" scenario-types="shadow">
+    <test-case sql="DELETE FROM t_shadow WHERE user_id = ? and order_id in (?, 
?)" db-types="MySQL" scenario-types="shadow,encrypt_shadow">
         <assertion parameters="0:int, 4:long, 5:long" 
expected-data-file="shadow_delete_order_by_user_id.xml" />
     </test-case>
     
     <!-- FIXME Support enum types for PostgreSQL -->
     <test-case sql="INSERT INTO t_shadow (order_id, user_id, order_name, 
type_char, type_boolean, type_smallint, type_decimal, type_date, type_time, 
type_timestamp)
-                    VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);" 
db-types="PostgreSQL" scenario-types="shadow">
+                    VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);" 
db-types="PostgreSQL" scenario-types="shadow,encrypt_shadow">
         <assertion parameters="6:long, 1:int, pro_order:String, S:char, 
true:boolean, 50:smallint, 120.00:decimal, 2021-01-01:Date, 12:30:30:time, 
2021-01-01 12:30:30:timestamp"
                    expected-data-file="pro_insert_order_value.xml" />
     </test-case>
     
     <test-case sql="INSERT INTO t_shadow (order_id, user_id, order_name, 
type_char, type_boolean, type_smallint, type_decimal, type_date, type_time, 
type_timestamp)
-                    VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);" 
db-types="PostgreSQL" scenario-types="shadow">
+                    VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);" 
db-types="PostgreSQL" scenario-types="shadow,encrypt_shadow">
         <assertion parameters="6:long, 0:int, shadow_order:String, S:char, 
true:boolean, 50:smallint, 120.00:decimal, 2021-01-01:Date, 12:30:30:time, 
2021-01-01 12:30:30:timestamp"
                    expected-data-file="shadow_insert_order_value.xml" />
     </test-case>
@@ -278,11 +278,11 @@
                    expected-data-file="shadow_update_order_by_user_id.xml" />
     </test-case>
     
-    <test-case sql="DELETE FROM t_shadow WHERE user_id = ? and order_id in (?, 
?)" db-types="PostgreSQL" scenario-types="shadow">
+    <test-case sql="DELETE FROM t_shadow WHERE user_id = ? and order_id in (?, 
?)" db-types="PostgreSQL" scenario-types="shadow,encrypt_shadow">
         <assertion parameters="1:int, 4:long, 5:long" 
expected-data-file="pro_delete_order_by_user_id.xml" />
     </test-case>
     
-    <test-case sql="DELETE FROM t_shadow WHERE user_id = ? and order_id in (?, 
?)" db-types="PostgreSQL" scenario-types="shadow">
+    <test-case sql="DELETE FROM t_shadow WHERE user_id = ? and order_id in (?, 
?)" db-types="PostgreSQL" scenario-types="shadow,encrypt_shadow">
         <assertion parameters="0:int, 4:long, 5:long" 
expected-data-file="shadow_delete_order_by_user_id.xml" />
     </test-case>
 </integration-test-cases>
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dql/dql-integration-test-cases.xml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dql/dql-integration-test-cases.xml
index 161d381d991..f0146bb444d 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dql/dql-integration-test-cases.xml
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dql/dql-integration-test-cases.xml
@@ -628,4 +628,9 @@
         <assertion parameters="1:int" expected-data-source-name="prod_dataset" 
/>
         <assertion parameters="0:int" 
expected-data-source-name="shadow_dataset" />
     </test-case>
+
+    <test-case sql="SELECT order_id, user_id, order_name, type_char, 
type_boolean, type_smallint, type_enum, type_decimal, type_date, type_time, 
type_timestamp FROM t_shadow WHERE user_id = ?" db-types="MySQL,PostgreSQL" 
scenario-types="encrypt_shadow">
+        <assertion parameters="1:int" expected-data-source-name="prod_dataset" 
/>
+        <assertion parameters="0:int" 
expected-data-source-name="encrypt_shadow_dataset" />
+    </test-case>
 </integration-test-cases>
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/it-env.properties
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/it-env.properties
index d6782b3798b..10b3d1ac720 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/it-env.properties
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/it-env.properties
@@ -19,8 +19,8 @@
 it.run.modes=Standalone
 it.run.additional.cases=false
 
-#it.scenarios=db,tbl,readwrite_splitting,encrypt,shadow,dbtbl_with_readwrite_splitting,dbtbl_with_readwrite_splitting_and_encrypt,empty_rules,sharding_and_encrypt,encrypt_and_readwrite_splitting
-it.scenarios=db,tbl,readwrite_splitting,encrypt,shadow,dbtbl_with_readwrite_splitting,dbtbl_with_readwrite_splitting_and_encrypt,empty_rules,sharding_and_encrypt,encrypt_and_readwrite_splitting
+#it.scenarios=db,tbl,readwrite_splitting,encrypt,shadow,dbtbl_with_readwrite_splitting,dbtbl_with_readwrite_splitting_and_encrypt,empty_rules,sharding_and_encrypt,encrypt_and_readwrite_splitting,encrypt_shadow
+it.scenarios=db,tbl,readwrite_splitting,encrypt,shadow,dbtbl_with_readwrite_splitting,dbtbl_with_readwrite_splitting_and_encrypt,empty_rules,sharding_and_encrypt,encrypt_and_readwrite_splitting,encrypt_shadow
 
 # it.cluster.env.type=DOCKER,NATIVE
 it.cluster.env.type=DOCKER
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/authority.xml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/authority.xml
new file mode 100644
index 00000000000..34a53503f0e
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/authority.xml
@@ -0,0 +1,71 @@
+<!--
+  ~ 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.
+  -->
+
+<authority>
+    <sqlset db-types="Oracle,SQLServer,PostgreSQL">
+        <user-create>
+            <sql>CREATE USER default_user</sql>
+            <sql>CREATE ROLE default_role</sql>
+            <sql>CREATE ROLE role2</sql>
+            <sql>CREATE ROLE role3</sql>
+            <sql>CREATE ROLE role4</sql>
+        </user-create>
+        <user-drop>
+            <sql>DROP ROLE IF EXISTS default_role</sql>
+            <sql>DROP ROLE IF EXISTS role_dev</sql>
+            <sql>DROP ROLE IF EXISTS role_dev_new</sql>
+            <sql>DROP ROLE IF EXISTS role2</sql>
+            <sql>DROP ROLE IF EXISTS role3</sql>
+            <sql>DROP ROLE IF EXISTS role4</sql>
+            <sql>DROP USER IF EXISTS user_dev</sql>
+            <sql>DROP USER IF EXISTS user_dev_new</sql>
+            <sql>DROP USER IF EXISTS default_user</sql>
+        </user-drop>
+    </sqlset>
+    <sqlset db-types="SQLServer">
+        <user-create>
+            <sql>CREATE LOGIN login_dev</sql>
+            <sql>CREATE USER user_dev FOR LOGIN login_dev</sql>
+        </user-create>
+        <user-drop>
+            <sql>DROP LOGIN IF EXISTS login_dev</sql>
+            <sql>DROP LOGIN IF EXISTS login_dev_new</sql>
+        </user-drop>
+    </sqlset>
+    <sqlset db-types="MySQL">
+        <user-create>
+            <sql>CREATE ROLE default_role</sql>
+            <sql>CREATE USER user_dev@localhost</sql>
+            <sql>GRANT select,update,insert,delete on db.* to 
user_dev@localhost</sql>
+            <sql>GRANT select,update,insert,delete on encrypt_shadow_db.* to 
user_dev@localhost</sql>
+        </user-create>
+        <user-drop>
+            <sql>DROP USER IF EXISTS user_dev@localhost</sql>
+            <sql>DROP USER IF EXISTS user_dev_new@localhost</sql>
+            <sql>DROP USER IF EXISTS [email protected]</sql>
+            <sql>DROP ROLE IF EXISTS default_role</sql>
+            <sql>DROP ROLE IF EXISTS role_dev</sql>
+            <sql>DROP ROLE IF EXISTS role_dev_new</sql>
+            <sql>FLUSH PRIVILEGES</sql>
+        </user-drop>
+    </sqlset>
+    <sqlset db-types="Oracle">
+        <user-create>
+            <sql>CREATE USER user_dev identified by passwd_dev</sql>
+        </user-create>
+    </sqlset>
+</authority>
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/actual/databases.xml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/actual/databases.xml
new file mode 100644
index 00000000000..381bc1019cb
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/actual/databases.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<databases>
+    <database>db</database>
+    <database>encrypt_shadow_db</database>
+</databases>
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/actual/dataset.xml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/actual/dataset.xml
new file mode 100644
index 00000000000..6e2ba82f260
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/actual/dataset.xml
@@ -0,0 +1,43 @@
+<!--
+  ~ 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.
+  -->
+
+<dataset>
+    <metadata data-nodes="db.t_shadow,encrypt_shadow_db.t_shadow">
+        <column name="order_id" type="long" />
+        <column name="user_id" type="int" />
+        <column name="order_name_cipher" type="varchar" />
+        <column name="order_name_plain" type="varchar" />
+        <column name="type_char" type="char" />
+        <column name="type_boolean" type="boolean" />
+        <column name="type_smallint" type="smallint" />
+        <column name="type_enum" type="enum#season" />
+        <column name="type_decimal" type="decimal" />
+        <column name="type_date" type="Date" />
+        <column name="type_time" type="time" />
+        <column name="type_timestamp" type="timestamp" />
+    </metadata>
+    <row data-node="db.t_shadow" values="1, 1, C4J8SHnvFT1FDZ3vF2ELDA==, 
pro_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 
18:30:30.0" />
+    <row data-node="db.t_shadow" values="2, 1, C4J8SHnvFT1FDZ3vF2ELDA==, 
pro_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 
18:30:30.0" />
+    <row data-node="db.t_shadow" values="3, 1, C4J8SHnvFT1FDZ3vF2ELDA==, 
pro_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 
18:30:30.0" />
+    <row data-node="db.t_shadow" values="4, 1, C4J8SHnvFT1FDZ3vF2ELDA==, 
pro_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 
18:30:30.0" />
+    <row data-node="db.t_shadow" values="5, 1, C4J8SHnvFT1FDZ3vF2ELDA==, 
pro_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 
18:30:30.0" />
+    <row data-node="encrypt_shadow_db.t_shadow" values="1, 0, 
OuQCPda97jMdDtibdBO6Jg==, shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 
18:30:30, 2017-08-08 18:30:30.0" />
+    <row data-node="encrypt_shadow_db.t_shadow" values="2, 0, 
OuQCPda97jMdDtibdBO6Jg==, shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 
18:30:30, 2017-08-08 18:30:30.0" />
+    <row data-node="encrypt_shadow_db.t_shadow" values="3, 0, 
OuQCPda97jMdDtibdBO6Jg==, shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 
18:30:30, 2017-08-08 18:30:30.0" />
+    <row data-node="encrypt_shadow_db.t_shadow" values="4, 0, 
OuQCPda97jMdDtibdBO6Jg==, shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 
18:30:30, 2017-08-08 18:30:30.0" />
+    <row data-node="encrypt_shadow_db.t_shadow" values="5, 0, 
OuQCPda97jMdDtibdBO6Jg==, shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 
18:30:30, 2017-08-08 18:30:30.0" />
+</dataset>
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/actual/init-sql/h2/01-actual-init.sql
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/actual/init-sql/h2/01-actual-init.sql
new file mode 100644
index 00000000000..16e0b3e7538
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/actual/init-sql/h2/01-actual-init.sql
@@ -0,0 +1,19 @@
+--
+-- 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.
+--
+DROP TABLE IF EXISTS t_shadow;
+
+CREATE TABLE t_shadow (order_id BIGINT NOT NULL, user_id INT NOT NULL, 
order_name_cipher VARCHAR(200) NOT NULL, order_name_plain VARCHAR(200) NOT 
NULL, type_char CHAR(1) NOT NULL, type_boolean BOOLEAN NOT NULL, type_smallint 
SMALLINT NOT NULL, type_enum ENUM('spring', 'summer', 'autumn', 'winter'), 
type_decimal DECIMAL(18,2) NOT NULL, type_date DATE NOT NULL, type_time TIME 
NOT NULL, type_timestamp TIMESTAMP NOT NULL, PRIMARY KEY (order_id));
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/actual/init-sql/h2/actual-db-init.sql
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/actual/init-sql/h2/actual-db-init.sql
new file mode 100644
index 00000000000..e3b8a181bea
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/actual/init-sql/h2/actual-db-init.sql
@@ -0,0 +1,16 @@
+--
+-- 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.
+--
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/actual/init-sql/h2/actual-shadow_db-init.sql
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/actual/init-sql/h2/actual-shadow_db-init.sql
new file mode 100644
index 00000000000..e3b8a181bea
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/actual/init-sql/h2/actual-shadow_db-init.sql
@@ -0,0 +1,16 @@
+--
+-- 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.
+--
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/actual/init-sql/mysql/01-actual-init.sql
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/actual/init-sql/mysql/01-actual-init.sql
new file mode 100644
index 00000000000..12c74518f19
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/actual/init-sql/mysql/01-actual-init.sql
@@ -0,0 +1,29 @@
+--
+-- 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.
+--
+
+SET character_set_database='utf8';
+SET character_set_server='utf8';
+
+DROP DATABASE IF EXISTS db;
+CREATE DATABASE db;
+
+CREATE TABLE db.t_shadow (order_id BIGINT NOT NULL, user_id INT NOT NULL, 
order_name_cipher VARCHAR(200) NOT NULL, order_name_plain VARCHAR(200) NOT 
NULL, type_char CHAR(1) NOT NULL, type_boolean BOOLEAN NOT NULL, type_smallint 
SMALLINT NOT NULL, type_enum ENUM('spring', 'summer', 'autumn', 'winter'), 
type_decimal DECIMAL(18,2) NOT NULL, type_date DATE NOT NULL, type_time TIME 
NOT NULL, type_timestamp TIMESTAMP NOT NULL, PRIMARY KEY (order_id));
+
+DROP DATABASE IF EXISTS encrypt_shadow_db;
+CREATE DATABASE encrypt_shadow_db;
+
+CREATE TABLE encrypt_shadow_db.t_shadow (order_id BIGINT NOT NULL, user_id INT 
NOT NULL, order_name_cipher VARCHAR(200) NOT NULL, order_name_plain 
VARCHAR(200) NOT NULL, type_char CHAR(1) NOT NULL, type_boolean BOOLEAN NOT 
NULL, type_smallint SMALLINT NOT NULL, type_enum ENUM('spring', 'summer', 
'autumn', 'winter'), type_decimal DECIMAL(18,2) NOT NULL, type_date DATE NOT 
NULL, type_time TIME NOT NULL, type_timestamp TIMESTAMP NOT NULL, PRIMARY KEY 
(order_id));
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/actual/init-sql/oracle/01-actual-init.sql
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/actual/init-sql/oracle/01-actual-init.sql
new file mode 100644
index 00000000000..3c2dad2b10c
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/actual/init-sql/oracle/01-actual-init.sql
@@ -0,0 +1,27 @@
+--
+-- 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.
+--
+
+DROP SCHEMA db;
+CREATE SCHEMA db;
+
+CREATE TABLE db.t_shadow (order_id BIGINT NOT NULL, user_id INT NOT NULL, 
order_name_cipher VARCHAR(200) NOT NULL, order_name_plain VARCHAR(200) NOT 
NULL, type_char CHAR(1) NOT NULL, type_boolean BOOLEAN NOT NULL, type_smallint 
SMALLINT NOT NULL, type_enum ENUM('spring', 'summer', 'autumn', 'winter'), 
type_decimal DECIMAL(18,2) NOT NULL, type_date DATE NOT NULL, type_time TIME 
NOT NULL, type_timestamp TIMESTAMP NOT NULL, PRIMARY KEY (order_id));
+
+
+DROP SCHEMA encrypt_shadow_db;
+CREATE SCHEMA encrypt_shadow_db;
+
+CREATE TABLE encrypt_shadow_db.t_shadow (order_id BIGINT NOT NULL, user_id INT 
NOT NULL, order_name_cipher VARCHAR(200) NOT NULL, order_name_plain 
VARCHAR(200) NOT NULL, type_char CHAR(1) NOT NULL, type_boolean BOOLEAN NOT 
NULL, type_smallint SMALLINT NOT NULL, type_enum ENUM('spring', 'summer', 
'autumn', 'winter'), type_decimal DECIMAL(18,2) NOT NULL, type_date DATE NOT 
NULL, type_time TIME NOT NULL, type_timestamp TIMESTAMP NOT NULL, PRIMARY KEY 
(order_id));
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/actual/init-sql/postgresql/01-actual-init.sql
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/actual/init-sql/postgresql/01-actual-init.sql
new file mode 100644
index 00000000000..e6067b58c20
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/actual/init-sql/postgresql/01-actual-init.sql
@@ -0,0 +1,38 @@
+--
+-- 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.
+--
+
+CREATE DATABASE db;
+CREATE DATABASE encrypt_shadow_db;
+
+GRANT ALL PRIVILEGES ON DATABASE db TO test_user;
+GRANT ALL PRIVILEGES ON DATABASE encrypt_shadow_db TO test_user;
+
+\c db
+
+DROP TABLE IF EXISTS t_shadow;
+
+CREATE TYPE season AS ENUM ('spring', 'summer', 'autumn', 'winter');
+
+CREATE TABLE t_shadow (order_id BIGINT NOT NULL, user_id INT NOT NULL, 
order_name_cipher VARCHAR(200) NOT NULL, order_name_plain VARCHAR(200) NOT 
NULL, type_char CHAR(1) NOT NULL, type_boolean BOOLEAN NOT NULL, type_smallint 
SMALLINT NOT NULL, type_enum season DEFAULT 'summer', type_decimal 
NUMERIC(18,2) DEFAULT NULL, type_date DATE DEFAULT NULL, type_time TIME DEFAULT 
NULL, type_timestamp TIMESTAMP DEFAULT NULL, PRIMARY KEY (order_id));
+
+\c encrypt_shadow_db
+
+DROP TABLE IF EXISTS t_shadow;
+
+CREATE TYPE season AS ENUM ('spring', 'summer', 'autumn', 'winter');
+
+CREATE TABLE t_shadow (order_id BIGINT NOT NULL, user_id INT NOT NULL, 
order_name_cipher VARCHAR(200) NOT NULL, order_name_plain VARCHAR(200) NOT 
NULL, type_char CHAR(1) NOT NULL, type_boolean BOOLEAN NOT NULL, type_smallint 
SMALLINT NOT NULL, type_enum season DEFAULT 'summer', type_decimal 
NUMERIC(18,2) DEFAULT NULL, type_date DATE DEFAULT NULL, type_time TIME DEFAULT 
NULL, type_timestamp TIMESTAMP DEFAULT NULL, PRIMARY KEY (order_id));
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/actual/init-sql/sqlserver/01-actual-init.sql
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/actual/init-sql/sqlserver/01-actual-init.sql
new file mode 100644
index 00000000000..d4ebd6bda55
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/actual/init-sql/sqlserver/01-actual-init.sql
@@ -0,0 +1,27 @@
+--
+-- 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.
+--
+
+DROP DATABASE IF EXISTS db;
+CREATE DATABASE db;
+
+CREATE TABLE db.t_shadow (order_id BIGINT NOT NULL, user_id INT NOT NULL, 
order_name_cipher VARCHAR(200) NOT NULL, order_name_plain VARCHAR(200) NOT 
NULL, type_char CHAR(1) NOT NULL, type_boolean BOOLEAN NOT NULL, type_smallint 
SMALLINT NOT NULL, type_enum ENUM('spring', 'summer', 'autumn', 'winter'), 
type_decimal DECIMAL(18,2) NOT NULL, type_date DATE NOT NULL, type_time TIME 
NOT NULL, type_timestamp TIMESTAMP NOT NULL, PRIMARY KEY (order_id));
+
+
+DROP DATABASE IF EXISTS encrypt_shadow_db;
+CREATE DATABASE encrypt_shadow_db;
+
+CREATE TABLE encrypt_shadow_db.t_shadow (order_id BIGINT NOT NULL, user_id INT 
NOT NULL, order_name_cipher VARCHAR(200) NOT NULL, order_name_plain 
VARCHAR(200) NOT NULL, type_char CHAR(1) NOT NULL, type_boolean BOOLEAN NOT 
NULL, type_smallint SMALLINT NOT NULL, type_enum ENUM('spring', 'summer', 
'autumn', 'winter'), type_decimal DECIMAL(18,2) NOT NULL, type_date DATE NOT 
NULL, type_time TIME NOT NULL, type_timestamp TIMESTAMP NOT NULL, PRIMARY KEY 
(order_id));
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/expected/databases.xml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/expected/databases.xml
new file mode 100644
index 00000000000..84b5684397e
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/expected/databases.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<databases>
+    <database>prod_dataset</database>
+    <database>encrypt_shadow_dataset</database>
+</databases>
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/expected/dataset.xml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/expected/dataset.xml
new file mode 100644
index 00000000000..2d5f19bd787
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/expected/dataset.xml
@@ -0,0 +1,42 @@
+<!--
+  ~ 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.
+  -->
+
+<dataset>
+    <metadata 
data-nodes="prod_dataset.t_shadow,encrypt_shadow_dataset.t_shadow">
+        <column name="order_id" type="long" />
+        <column name="user_id" type="int" />
+        <column name="order_name" type="varchar" />
+        <column name="type_char" type="char" />
+        <column name="type_boolean" type="boolean" />
+        <column name="type_smallint" type="smallint" />
+        <column name="type_enum" type="enum#season" />
+        <column name="type_decimal" type="decimal" />
+        <column name="type_date" type="Date" />
+        <column name="type_time" type="time" />
+        <column name="type_timestamp" type="timestamp" />
+    </metadata>
+    <row data-node="prod_dataset.t_shadow" values="1, 1, pro_order, S, true, 
5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+    <row data-node="prod_dataset.t_shadow" values="2, 1, pro_order, S, true, 
5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+    <row data-node="prod_dataset.t_shadow" values="3, 1, pro_order, S, true, 
5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+    <row data-node="prod_dataset.t_shadow" values="4, 1, pro_order, S, true, 
5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+    <row data-node="prod_dataset.t_shadow" values="5, 1, pro_order, S, true, 
5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 18:30:30.0" />
+    <row data-node="encrypt_shadow_dataset.t_shadow" values="1, 0, 
shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 
18:30:30.0" />
+    <row data-node="encrypt_shadow_dataset.t_shadow" values="2, 0, 
shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 
18:30:30.0" />
+    <row data-node="encrypt_shadow_dataset.t_shadow" values="3, 0, 
shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 
18:30:30.0" />
+    <row data-node="encrypt_shadow_dataset.t_shadow" values="4, 0, 
shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 
18:30:30.0" />
+    <row data-node="encrypt_shadow_dataset.t_shadow" values="5, 0, 
shadow_order, S, true, 5, summer, 10.00, 2017-08-08, 18:30:30, 2017-08-08 
18:30:30.0" />
+</dataset>
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/expected/init-sql/h2/01-expected-init.sql
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/expected/init-sql/h2/01-expected-init.sql
new file mode 100644
index 00000000000..5a0798c11db
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/expected/init-sql/h2/01-expected-init.sql
@@ -0,0 +1,20 @@
+--
+-- 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.
+--
+
+DROP TABLE IF EXISTS t_shadow;
+
+CREATE TABLE t_shadow (order_id BIGINT NOT NULL, user_id INT NOT NULL, 
order_name VARCHAR(200) NOT NULL, type_char CHAR(1) NOT NULL, type_boolean 
BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum ENUM('spring', 
'summer', 'autumn', 'winter'), type_decimal DECIMAL(18,2) NOT NULL, type_date 
DATE NOT NULL, type_time TIME NOT NULL, type_timestamp TIMESTAMP NOT NULL, 
PRIMARY KEY (order_id));
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/expected/init-sql/mysql/expected-init.sql
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/expected/init-sql/mysql/expected-init.sql
new file mode 100644
index 00000000000..e29d4e6cedd
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/expected/init-sql/mysql/expected-init.sql
@@ -0,0 +1,31 @@
+--
+-- 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.
+--
+
+SET character_set_database='utf8';
+SET character_set_server='utf8';
+
+
+DROP DATABASE IF EXISTS prod_dataset;
+CREATE DATABASE prod_dataset;
+
+CREATE TABLE prod_dataset.t_shadow (order_id BIGINT NOT NULL, user_id INT NOT 
NULL, order_name VARCHAR(200) NOT NULL, type_char CHAR(1) NOT NULL, 
type_boolean BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum 
ENUM('spring', 'summer', 'autumn', 'winter'), type_decimal DECIMAL(18,2) NOT 
NULL, type_date DATE NOT NULL, type_time TIME NOT NULL, type_timestamp 
TIMESTAMP NOT NULL, PRIMARY KEY (order_id));
+
+
+DROP DATABASE IF EXISTS encrypt_shadow_dataset;
+CREATE DATABASE encrypt_shadow_dataset;
+
+CREATE TABLE encrypt_shadow_dataset.t_shadow (order_id BIGINT NOT NULL, 
user_id INT NOT NULL, order_name VARCHAR(200) NOT NULL, type_char CHAR(1) NOT 
NULL, type_boolean BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum 
ENUM('spring', 'summer', 'autumn', 'winter'), type_decimal DECIMAL(18,2) NOT 
NULL, type_date DATE NOT NULL, type_time TIME NOT NULL, type_timestamp 
TIMESTAMP NOT NULL, PRIMARY KEY (order_id));
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/expected/init-sql/oracle/expected-init.sql
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/expected/init-sql/oracle/expected-init.sql
new file mode 100644
index 00000000000..4beb4b81810
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/expected/init-sql/oracle/expected-init.sql
@@ -0,0 +1,27 @@
+--
+-- 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.
+--
+
+DROP SCHEMA prod_dataset;
+CREATE SCHEMA prod_dataset;
+
+CREATE TABLE prod_dataset.t_shadow (order_id BIGINT NOT NULL, user_id INT NOT 
NULL, order_name VARCHAR(200) NOT NULL, type_char CHAR(1) NOT NULL, 
type_boolean BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum 
ENUM('spring', 'summer', 'autumn', 'winter'), type_decimal DECIMAL(18,2) NOT 
NULL, type_date DATE NOT NULL, type_time TIME NOT NULL, type_timestamp 
TIMESTAMP NOT NULL, PRIMARY KEY (order_id));
+
+
+DROP SCHEMA encrypt_shadow_dataset;
+CREATE SCHEMA encrypt_shadow_dataset;
+
+CREATE TABLE encrypt_shadow_dataset.t_shadow (order_id BIGINT NOT NULL, 
user_id INT NOT NULL, order_name VARCHAR(200) NOT NULL, type_char CHAR(1) NOT 
NULL, type_boolean BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum 
ENUM('spring', 'summer', 'autumn', 'winter'), type_decimal DECIMAL(18,2) NOT 
NULL, type_date DATE NOT NULL, type_time TIME NOT NULL, type_timestamp 
TIMESTAMP NOT NULL, PRIMARY KEY (order_id));
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/expected/init-sql/postgresql/expected-init.sql
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/expected/init-sql/postgresql/expected-init.sql
new file mode 100644
index 00000000000..85e2a4a734c
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/expected/init-sql/postgresql/expected-init.sql
@@ -0,0 +1,41 @@
+--
+-- 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.
+--
+
+DROP DATABASE IF EXISTS prod_dataset;
+CREATE DATABASE prod_dataset;
+
+GRANT ALL PRIVILEGES ON DATABASE prod_dataset TO test_user;
+
+\c prod_dataset;
+
+DROP TABLE IF EXISTS t_shadow;
+
+CREATE TYPE season AS ENUM ('spring', 'summer', 'autumn', 'winter');
+CREATE TABLE t_shadow (order_id BIGINT NOT NULL, user_id INT NOT NULL, 
order_name VARCHAR(200) NOT NULL, type_char CHAR(1) NOT NULL, type_boolean 
BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum season DEFAULT 
'summer', type_decimal NUMERIC(18,2) DEFAULT NULL, type_date DATE DEFAULT NULL, 
type_time TIME DEFAULT NULL, type_timestamp TIMESTAMP DEFAULT NULL, PRIMARY KEY 
(order_id));
+
+
+DROP DATABASE IF EXISTS encrypt_shadow_dataset;
+CREATE DATABASE encrypt_shadow_dataset;
+
+GRANT ALL PRIVILEGES ON DATABASE encrypt_shadow_dataset TO test_user;
+
+\c encrypt_shadow_dataset;
+
+DROP TABLE IF EXISTS t_shadow;
+
+CREATE TYPE season AS ENUM ('spring', 'summer', 'autumn', 'winter');
+CREATE TABLE t_shadow (order_id BIGINT NOT NULL, user_id INT NOT NULL, 
order_name VARCHAR(200) NOT NULL, type_char CHAR(1) NOT NULL, type_boolean 
BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum season DEFAULT 
'summer', type_decimal NUMERIC(18,2) DEFAULT NULL, type_date DATE DEFAULT NULL, 
type_time TIME DEFAULT NULL, type_timestamp TIMESTAMP DEFAULT NULL, PRIMARY KEY 
(order_id));
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/expected/init-sql/sqlserver/expected-init.sql
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/expected/init-sql/sqlserver/expected-init.sql
new file mode 100644
index 00000000000..4459e2e01d9
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/data/expected/init-sql/sqlserver/expected-init.sql
@@ -0,0 +1,27 @@
+--
+-- 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.
+--
+
+DROP DATABASE IF EXISTS prod_dataset;
+CREATE DATABASE prod_dataset;
+
+CREATE TABLE prod_dataset.encrypt_shadow_dataset (order_id BIGINT NOT NULL, 
user_id INT NOT NULL, order_name VARCHAR(200) NOT NULL, type_char CHAR(1) NOT 
NULL, type_boolean BOOLEAN NOT NULL, type_smallint SMALLINT NOT NULL, type_enum 
ENUM('spring', 'summer', 'autumn', 'winter'), type_decimal DECIMAL(18,2) NOT 
NULL, type_date DATE NOT NULL, type_time TIME NOT NULL, type_timestamp 
TIMESTAMP NOT NULL, PRIMARY KEY (order_id));
+
+
+DROP DATABASE IF EXISTS encrypt_shadow_dataset;
+CREATE DATABASE encrypt_shadow_dataset;
+
+CREATE TABLE encrypt_shadow_dataset.encrypt_shadow_dataset (order_id BIGINT 
NOT NULL, user_id INT NOT NULL, order_name VARCHAR(200) NOT NULL, type_char 
CHAR(1) NOT NULL, type_boolean BOOLEAN NOT NULL, type_smallint SMALLINT NOT 
NULL, type_enum ENUM('spring', 'summer', 'autumn', 'winter'), type_decimal 
DECIMAL(18,2) NOT NULL, type_date DATE NOT NULL, type_time TIME NOT NULL, 
type_timestamp TIMESTAMP NOT NULL, PRIMARY KEY (order_id));
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/proxy/conf/mysql/config-encrypt-shadow.yaml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/proxy/conf/mysql/config-encrypt-shadow.yaml
new file mode 100644
index 00000000000..eb9a90dd622
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/proxy/conf/mysql/config-encrypt-shadow.yaml
@@ -0,0 +1,98 @@
+#
+# 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.
+#
+
+databaseName: encrypt_shadow
+
+dataSources:
+  db:
+    url: 
jdbc:mysql://mysql.encrypt_shadow.host:3306/db?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  encrypt_shadow_db:
+    url: 
jdbc:mysql://mysql.encrypt_shadow.host:3306/encrypt_shadow_db?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+
+rules:
+- !SHADOW
+  dataSources:
+    shadowDataSource:
+      sourceDataSourceName: db
+      shadowDataSourceName: encrypt_shadow_db
+  tables:
+    t_shadow:
+      dataSourceNames:
+        - shadowDataSource
+      shadowAlgorithmNames:
+        - user-id-insert-match-algorithm
+        - user-id-update-match-algorithm
+        - user-id-delete-match-algorithm
+        - user-id-select-match-algorithm
+        - simple-hint-algorithm
+  shadowAlgorithms:
+    user-id-insert-match-algorithm:
+      type: VALUE_MATCH
+      props:
+        operation: insert
+        column: user_id
+        value: 0
+    user-id-update-match-algorithm:
+      type: VALUE_MATCH
+      props:
+        operation: update
+        column: user_id
+        value: 0
+    user-id-delete-match-algorithm:
+      type: VALUE_MATCH
+      props:
+        operation: delete
+        column: user_id
+        value: 0
+    user-id-select-match-algorithm:
+      type: VALUE_MATCH
+      props:
+        operation: select
+        column: user_id
+        value: 0
+    simple-hint-algorithm:
+      type: SIMPLE_HINT
+      props:
+        foo: bar
+        
+- !ENCRYPT
+  encryptors:
+    aes_encryptor:
+      type: AES
+      props:
+        aes-key-value: 123456abc
+  tables:
+    t_shadow:
+      columns:
+        order_name:
+          plainColumn: order_name_plain
+          cipherColumn: order_name_cipher
+          encryptorName: aes_encryptor
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/proxy/conf/postgresql/config-encrypt-shadow.yaml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/proxy/conf/postgresql/config-encrypt-shadow.yaml
new file mode 100644
index 00000000000..1568d839706
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/proxy/conf/postgresql/config-encrypt-shadow.yaml
@@ -0,0 +1,97 @@
+#
+# 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.
+#
+
+databaseName: encrypt_shadow
+
+dataSources:
+  db:
+    url: jdbc:postgresql://postgresql.encrypt_shadow.host:5432/db
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  encrypt_shadow_db:
+    url: 
jdbc:postgresql://postgresql.encrypt_shadow.host:5432/encrypt_shadow_db
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+
+rules:
+- !SHADOW
+  dataSources:
+    shadowDataSource:
+      sourceDataSourceName: db
+      shadowDataSourceName: encrypt_shadow_db
+  tables:
+    t_shadow:
+      dataSourceNames:
+        - shadowDataSource
+      shadowAlgorithmNames:
+        - user-id-insert-match-algorithm
+        - user-id-update-match-algorithm
+        - user-id-delete-match-algorithm
+        - user-id-select-match-algorithm
+        - simple-hint-algorithm
+  shadowAlgorithms:
+    user-id-insert-match-algorithm:
+      type: VALUE_MATCH
+      props:
+        operation: insert
+        column: user_id
+        value: 0
+    user-id-update-match-algorithm:
+      type: VALUE_MATCH
+      props:
+        operation: update
+        column: user_id
+        value: 0
+    user-id-delete-match-algorithm:
+      type: VALUE_MATCH
+      props:
+        operation: delete
+        column: user_id
+        value: 0
+    user-id-select-match-algorithm:
+      type: VALUE_MATCH
+      props:
+        operation: select
+        column: user_id
+        value: 0
+    simple-hint-algorithm:
+      type: SIMPLE_HINT
+      props:
+        foo: bar
+- !ENCRYPT
+  encryptors:
+    aes_encryptor:
+      type: AES
+      props:
+        aes-key-value: 123456abc
+  tables:
+    t_shadow:
+      columns:
+        order_name:
+          plainColumn: order_name_plain
+          cipherColumn: order_name_cipher
+          encryptorName: aes_encryptor
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/rules.yaml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/rules.yaml
new file mode 100644
index 00000000000..0d277bfbfd4
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/scenario/encrypt_shadow/rules.yaml
@@ -0,0 +1,76 @@
+#
+# 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.
+#
+
+rules:
+- !SHADOW
+  dataSources:
+    shadowDataSource:
+      sourceDataSourceName: db
+      shadowDataSourceName: encrypt_shadow_db
+  tables:
+    t_shadow:
+      dataSourceNames:
+        - shadowDataSource
+      shadowAlgorithmNames:
+        - user-id-insert-match-algorithm
+        - user-id-update-match-algorithm
+        - user-id-delete-match-algorithm
+        - user-id-select-match-algorithm
+        - simple-hint-algorithm
+  shadowAlgorithms:
+    user-id-insert-match-algorithm:
+      type: VALUE_MATCH
+      props:
+        operation: insert
+        column: user_id
+        value: 0
+    user-id-update-match-algorithm:
+      type: VALUE_MATCH
+      props:
+        operation: update
+        column: user_id
+        value: 0
+    user-id-delete-match-algorithm:
+      type: VALUE_MATCH
+      props:
+        operation: delete
+        column: user_id
+        value: 0
+    user-id-select-match-algorithm:
+      type: VALUE_MATCH
+      props:
+        operation: select
+        column: user_id
+        value: 0
+    simple-hint-algorithm:
+      type: SIMPLE_HINT
+      props:
+        foo: bar
+        
+- !ENCRYPT
+  encryptors:
+    aes_encryptor:
+      type: AES
+      props:
+        aes-key-value: 123456abc
+  tables:
+    t_shadow:
+      columns:
+        order_name:
+          plainColumn: order_name_plain
+          cipherColumn: order_name_cipher
+          encryptorName: aes_encryptor

Reply via email to