1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
|
--echo #
--echo # WL#12261 Control (enforce and disable) table encryption
--echo #
--echo # Pre-define user u1, which is used in different tests below.
CREATE USER u1@localhost;
GRANT ALL ON db1.* TO u1@localhost;
GRANT CREATE TABLESPACE, PROCESS, SYSTEM_VARIABLES_ADMIN ON *.* TO u1@localhost;
SET GLOBAL debug= '+d,skip_table_encryption_admin_check_for_set';
connect (con1, localhost, u1);
--echo # The test cases run ALTER TABLESPACE to check its encryption mode.
--echo # The importance of this test is to check the way ALTER TABLESPACE
--echo # updates the ENCRYPTION clause of tables in it.
--echo # We run this command in various configuration as,
--echo #
--echo # - Setting table_encryption_privilege_check to true/false.
--echo # - Setting per database default encryption to true/false.
--echo # - With and without user holding TABLE_ENCRYPTION_ADMIN privilege.
--echo # - Check for warnings generated.
--echo #
--let table1_encryption_clause=yes
--let table2_encryption_clause=yes
--let caseno=0
--echo `````````````````````````````````````````````````````````
--echo # Unencrypted TABLESPACE to Unencrypted TABLESPACE (Nop)
--let database_encryption='n'
--let tablespace_encryption='n'
--let tablespace_encryption_to='n'
--let privilege_check=false
--let alter_tablespace_error=0
--source ./tablespace_with_tables.inc
--let privilege_check=true
--let alter_tablespace_error=0
--source ./tablespace_with_tables.inc
--echo `````````````````````````````````````````````````````````
--echo # Encrypted TABLESPACE to Encrypted TABLESPACE (Nop)
--let database_encryption='y'
--let tablespace_encryption='y'
--let tablespace_encryption_to='y'
--let privilege_check=false
--let alter_tablespace_error=0
--source ./tablespace_with_tables.inc
--let privilege_check=true
--let alter_tablespace_error=0
--source ./tablespace_with_tables.inc
--let has_grant=true
--let alter_tablespace_error=0
--source ./tablespace_with_tables.inc
--let has_grant=false
--echo `````````````````````````````````````````````````````````
--echo # Unencrypted TABLESPACE to encrypted TABLESPACE
--echo # with database encryption default 'n'
--let database_encryption='n'
--let tablespace_encryption='n'
--let tablespace_encryption_to='y'
--let privilege_check=false
--let alter_tablespace_error=0
--source ./tablespace_with_tables.inc
--echo `````````````````````````````````````````````````````````
--echo # Reject creating encrypted table in database with default encryption='n'
--let privilege_check=true
--let alter_tablespace_error=ER_TABLESPACE_CANNOT_BE_ENCRYPTED
--source ./tablespace_with_tables.inc
--let has_grant=true
--let alter_tablespace_error=0
--source ./tablespace_with_tables.inc
--let has_grant=false
--echo # With some tables without ENCRYPTION clause;
--let table2_encryption_clause=no
--let privilege_check=false
--let alter_tablespace_error=0
--source ./tablespace_with_tables.inc
--echo `````````````````````````````````````````````````````````
--echo # Reject creating encrypted table in database with default encryption='n'
--let privilege_check=true
--let alter_tablespace_error=ER_TABLESPACE_CANNOT_BE_ENCRYPTED
--source ./tablespace_with_tables.inc
--let has_grant=true
--let alter_tablespace_error=0
--source ./tablespace_with_tables.inc
--let has_grant=false
--let table2_encryption_clause=yes
--echo # With all tables without ENCRYPTION clause;
--let table1_encryption_clause=no
--let table2_encryption_clause=no
--let privilege_check=false
--let alter_tablespace_error=0
--source ./tablespace_with_tables.inc
--echo `````````````````````````````````````````````````````````
--echo # Request to create encrypted tablespace with default_table_encryption='n'
--let privilege_check=true
--let alter_tablespace_error=ER_TABLESPACE_CANNOT_BE_ENCRYPTED
--source ./tablespace_with_tables.inc
--let has_grant=true
--let alter_tablespace_error=0
--source ./tablespace_with_tables.inc
--let has_grant=false
--let table1_encryption_clause=yes
--let table2_encryption_clause=yes
--echo `````````````````````````````````````````````````````````
--echo # Unencrypted TABLESPACE to encrypted TABLESPACE
--echo # with database encryption 'y'
--let database_encryption='y'
--let tablespace_encryption='n'
--let tablespace_encryption_to='y'
--let privilege_check=false
--let alter_tablespace_error=0
--source ./tablespace_with_tables.inc
--let privilege_check=true
--let alter_tablespace_error=0
--source ./tablespace_with_tables.inc
--let has_grant=true
--let alter_tablespace_error=0
--source ./tablespace_with_tables.inc
--let has_grant=false
--echo # Case $caseno.1 With some tables without ENCRYPTION clause;
--echo # CREATE table using unencrypted tablespace without
--echo # ENCRYPTION clause would inherit ENCRYPTION from database.
--echo # This makes CREATE TABLE fail because the ENCRYPTION clause
--echo # and the tablespace encryption type mismatches. The test
--echo # encryption.create_table does test this.
--echo # Case $caseno.2 With all tables without ENCRYPTION clause;
--echo # Behavior would be same as described in Case $caseno.1
--echo `````````````````````````````````````````````````````````
--echo # Encrypted TABLESPACE to unencrypted TABLESPACE
--echo # with database encryption 'n'
--let database_encryption='n'
--let tablespace_encryption='y'
--let tablespace_encryption_to='n'
--let privilege_check=false
--let alter_tablespace_error=0
--source ./tablespace_with_tables.inc
--let privilege_check=true
--let alter_tablespace_error=0
--source ./tablespace_with_tables.inc
--let has_grant=true
--let alter_tablespace_error=0
--source ./tablespace_with_tables.inc
--let has_grant=false
--echo `````````````````````````````````````````````````````````
--echo # Encrypted TABLESPACE to unencrypted TABLESPACE
--echo # with database encryption 'y'
--let database_encryption='y'
--let tablespace_encryption='y'
--let tablespace_encryption_to='n'
--let privilege_check=false
--let alter_tablespace_error=0
--source ./tablespace_with_tables.inc
--let privilege_check=true
--echo `````````````````````````````````````````````````````````
--echo # Request to create unencrypted tablespace with default_table_encryption='y'
--let alter_tablespace_error=ER_TABLESPACE_CANNOT_BE_DECRYPTED
--source ./tablespace_with_tables.inc
--let has_grant=true
--let alter_tablespace_error=0
--source ./tablespace_with_tables.inc
--let has_grant=false
--echo # Clean up.
connection default;
DROP USER u1@localhost;
SET GLOBAL debug= '-d,skip_table_encryption_admin_check_for_set';
|