#Check whether unzip is installed on the system
#Store the command output into a temp file.
#Get the value of the  variable from perl, to MTR
#Check the status is non-zero
#Remove the temp file tar.inc
# Set the environmental variables
# Stop server
# Copy the remote tablespace & DB zip files from suite location to working location.
# Check that the file exists in the working folder.
# Unzip the zip file.
# Remove the DOS based *.isl files from the MySql Data directory.
# Check that the *.ibd files are in the required location.
# Create new *.isl files with the correct path to the *.ibd files,
# Change path separator Linux "/" format to windows "\" format by Perl script,
# in the *.ISL files, in the Mysql data directory
emp2#p#p1.isl
emp2#p#p2.isl
emp3.isl
emp4#p#p1.isl
emp4#p#p2.isl
purchase#p#p0#sp#s0.isl
purchase#p#p0#sp#s1.isl
purchase#p#p1#sp#s2.isl
purchase#p#p1#sp#s3.isl
# Restarting the server with skip-grant-tables option and updating
# mysql.user table. This is to deal with the restriction imposed on
# plugin field for users in WL6982.
# Restart the DB server from unzip location of MySQL Data Dir
Run mysql_upgrade once
mysql_upgrade: [ERROR] 1072: Key column 'Id' doesn't exist in table
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.engine_cost                                  OK
mysql.event                                        OK
mysql.func                                         OK
mysql.general_log                                  OK
mysql.gtid_executed                                OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.host                                         OK
mysql.innodb_index_stats                           OK
mysql.innodb_table_stats                           OK
mysql.ndb_binlog_index                             OK
mysql.plugin                                       OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.proxies_priv                                 OK
mysql.server_cost                                  OK
mysql.servers                                      OK
mysql.slave_master_info                            OK
mysql.slave_relay_log_info                         OK
mysql.slave_worker_info                            OK
mysql.slow_log                                     OK
mysql.tables_priv                                  OK
mysql.time_zone                                    OK
mysql.time_zone_leap_second                        OK
mysql.time_zone_name                               OK
mysql.time_zone_transition                         OK
mysql.time_zone_transition_type                    OK
mysql.user                                         OK
sys.sys_config                                     OK
test.emp1                                          OK
test.emp2
error    : Partitioning upgrade required. Please dump/reload to fix it or do: ALTER TABLE `test`.`emp2` UPGRADE PARTITIONING
warning  : The partition engine, used by table 'test.emp2', is deprecated and will be removed in a future release. Please use native partitioning instead.
test.emp3                                          OK
test.emp4
error    : Partitioning upgrade required. Please dump/reload to fix it or do: ALTER TABLE `test`.`emp4` UPGRADE PARTITIONING
warning  : The partition engine, used by table 'test.emp4', is deprecated and will be removed in a future release. Please use native partitioning instead.
test.purchase
error    : Partitioning upgrade required. Please dump/reload to fix it or do: ALTER TABLE `test`.`purchase` UPGRADE PARTITIONING
warning  : The partition engine, used by table 'test.purchase', is deprecated and will be removed in a future release. Please use native partitioning instead.

Upgrading tables
Running  : ALTER TABLE `test`.`emp2` UPGRADE PARTITIONING
status   : OK
Running  : ALTER TABLE `test`.`emp4` UPGRADE PARTITIONING
status   : OK
Running  : ALTER TABLE `test`.`purchase` UPGRADE PARTITIONING
status   : OK
# Stop server
# Restart the DB server from unzip location of MySQL Data Dir
# Check the DB & tables with DML statements.
SHOW CREATE TABLE emp1;
Table	Create Table
emp1	CREATE TABLE `emp1` (
  `empno` int(11) DEFAULT NULL,
  `ename` varchar(30) DEFAULT NULL,
  `sal` decimal(3,0) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SHOW CREATE TABLE emp2;
Table	Create Table
emp2	CREATE TABLE `emp2` (
  `empno` int(11) DEFAULT NULL,
  `ename` varchar(30) DEFAULT NULL,
  `sal` decimal(3,0) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (empno)
(PARTITION p1 DATA DIRECTORY = 'MYSQL_TMP_DIR/mysqld.5980/tab1' ENGINE = InnoDB,
 PARTITION p2 DATA DIRECTORY = 'MYSQL_TMP_DIR/mysqld.5980/tab2' ENGINE = InnoDB) */
SHOW CREATE TABLE emp3;
Table	Create Table
emp3	CREATE TABLE `emp3` (
  `empno` int(11) DEFAULT NULL,
  `ename` varchar(30) DEFAULT NULL,
  `sal` decimal(3,0) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/mysqld.5980/tab3/'
SHOW CREATE TABLE emp4;
Table	Create Table
emp4	CREATE TABLE `emp4` (
  `empno` int(11) DEFAULT NULL,
  `ename` varchar(30) DEFAULT NULL,
  `sal` decimal(3,0) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
/*!50100 PARTITION BY HASH (empno)
(PARTITION p1 DATA DIRECTORY = 'MYSQL_TMP_DIR/mysqld.5980/tab4' ENGINE = InnoDB,
 PARTITION p2 DATA DIRECTORY = 'MYSQL_TMP_DIR/mysqld.5980/tab5' ENGINE = InnoDB) */
SHOW CREATE TABLE purchase;
Table	Create Table
purchase	CREATE TABLE `purchase` (
  `id` int(11) DEFAULT NULL,
  `purchased` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE ( YEAR(purchased))
SUBPARTITION BY HASH ( TO_DAYS(purchased))
(PARTITION p0 VALUES LESS THAN (1990)
 (SUBPARTITION s0 DATA DIRECTORY = 'MYSQL_TMP_DIR/mysqld.5980/part0' ENGINE = InnoDB,
  SUBPARTITION s1 DATA DIRECTORY = 'MYSQL_TMP_DIR/mysqld.5980/part1' ENGINE = InnoDB),
 PARTITION p1 VALUES LESS THAN (2000)
 (SUBPARTITION s2 DATA DIRECTORY = 'MYSQL_TMP_DIR/mysqld.5980/part2' ENGINE = InnoDB,
  SUBPARTITION s3 DATA DIRECTORY = 'MYSQL_TMP_DIR/mysqld.5980/part3' ENGINE = InnoDB)) */
SELECT COUNT(*) FROM emp1;
COUNT(*)
2
SELECT COUNT(*) FROM emp2;
COUNT(*)
2
SELECT COUNT(*) FROM emp3;
COUNT(*)
2
SELECT COUNT(*) FROM emp4;
COUNT(*)
2
SELECT COUNT(*) FROM purchase;
COUNT(*)
1
DELETE  FROM emp1;
DELETE  FROM emp2;
DELETE  FROM emp3;
DELETE  FROM emp4;
DELETE FROM purchase;
SELECT COUNT(*) FROM emp1;
COUNT(*)
0
SELECT COUNT(*) FROM emp2;
COUNT(*)
0
SELECT COUNT(*) FROM emp3;
COUNT(*)
0
SELECT COUNT(*) FROM emp4;
COUNT(*)
0
SELECT COUNT(*) FROM purchase;
COUNT(*)
0
# Check the system tables have the proper entry of the tables.
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
Space_Name	Space_Type	Page_Size	Zip_Size	Formats_Permitted	Path
test/emp1	Single	DEFAULT	0	Compact or Redundant	MYSQLD_DATADIR/test/emp1.ibd
test/emp2#p#p1	Single	DEFAULT	0	Compact or Redundant	MYSQL_TMP_DIR/mysqld.5980/tab1/test/emp2#p#p1.ibd
test/emp2#p#p2	Single	DEFAULT	0	Compact or Redundant	MYSQL_TMP_DIR/mysqld.5980/tab2/test/emp2#p#p2.ibd
test/emp3	Single	DEFAULT	0	Compact or Redundant	MYSQL_TMP_DIR/mysqld.5980/tab3/test/emp3.ibd
test/purchase#p#p0#sp#s0	Single	DEFAULT	0	Compact or Redundant	MYSQL_TMP_DIR/mysqld.5980/part0/test/purchase#p#p0#sp#s0.ibd
test/purchase#p#p0#sp#s1	Single	DEFAULT	0	Compact or Redundant	MYSQL_TMP_DIR/mysqld.5980/part1/test/purchase#p#p0#sp#s1.ibd
test/purchase#p#p1#sp#s2	Single	DEFAULT	0	Compact or Redundant	MYSQL_TMP_DIR/mysqld.5980/part2/test/purchase#p#p1#sp#s2.ibd
test/purchase#p#p1#sp#s3	Single	DEFAULT	0	Compact or Redundant	MYSQL_TMP_DIR/mysqld.5980/part3/test/purchase#p#p1#sp#s3.ibd
test/emp4#p#p1	Single	DEFAULT	0	Dynamic	MYSQL_TMP_DIR/mysqld.5980/tab4/test/emp4#p#p1.ibd
test/emp4#p#p2	Single	DEFAULT	0	Dynamic	MYSQL_TMP_DIR/mysqld.5980/tab5/test/emp4#p#p2.ibd
=== information_schema.files ===
Space_Name	File_Type	Engine	Status	Tablespace_Name	Path
test/emp1	TABLESPACE	InnoDB	NORMAL	innodb_file_per_table.##	MYSQLD_DATADIR/test/emp1.ibd
test/emp2#p#p1	TABLESPACE	InnoDB	NORMAL	innodb_file_per_table.##	MYSQL_TMP_DIR/mysqld.5980/tab1/test/emp2#p#p1.ibd
test/emp2#p#p2	TABLESPACE	InnoDB	NORMAL	innodb_file_per_table.##	MYSQL_TMP_DIR/mysqld.5980/tab2/test/emp2#p#p2.ibd
test/emp3	TABLESPACE	InnoDB	NORMAL	innodb_file_per_table.##	MYSQL_TMP_DIR/mysqld.5980/tab3/test/emp3.ibd
test/purchase#p#p0#sp#s0	TABLESPACE	InnoDB	NORMAL	innodb_file_per_table.##	MYSQL_TMP_DIR/mysqld.5980/part0/test/purchase#p#p0#sp#s0.ibd
test/purchase#p#p0#sp#s1	TABLESPACE	InnoDB	NORMAL	innodb_file_per_table.##	MYSQL_TMP_DIR/mysqld.5980/part1/test/purchase#p#p0#sp#s1.ibd
test/purchase#p#p1#sp#s2	TABLESPACE	InnoDB	NORMAL	innodb_file_per_table.##	MYSQL_TMP_DIR/mysqld.5980/part2/test/purchase#p#p1#sp#s2.ibd
test/purchase#p#p1#sp#s3	TABLESPACE	InnoDB	NORMAL	innodb_file_per_table.##	MYSQL_TMP_DIR/mysqld.5980/part3/test/purchase#p#p1#sp#s3.ibd
test/emp4#p#p1	TABLESPACE	InnoDB	NORMAL	innodb_file_per_table.##	MYSQL_TMP_DIR/mysqld.5980/tab4/test/emp4#p#p1.ibd
test/emp4#p#p2	TABLESPACE	InnoDB	NORMAL	innodb_file_per_table.##	MYSQL_TMP_DIR/mysqld.5980/tab5/test/emp4#p#p2.ibd
=== information_schema.innodb_sys_tables  and innodb_sys_tablespaces ===
Table Name	Tablespace	Table Flags	Columns	Row Format	Zip Size	Space Type
test/emp1	test/emp1	1	6	Compact	0	Single
test/emp2#p#p1	test/emp2#p#p1	65	6	Compact	0	Single
test/emp2#p#p2	test/emp2#p#p2	65	6	Compact	0	Single
test/emp3	test/emp3	65	6	Compact	0	Single
test/emp4#p#p1	test/emp4#p#p1	97	6	Dynamic	0	Single
test/emp4#p#p2	test/emp4#p#p2	97	6	Dynamic	0	Single
test/purchase#p#p0#sp#s0	test/purchase#p#p0#sp#s0	65	5	Compact	0	Single
test/purchase#p#p0#sp#s1	test/purchase#p#p0#sp#s1	65	5	Compact	0	Single
test/purchase#p#p1#sp#s2	test/purchase#p#p1#sp#s2	65	5	Compact	0	Single
test/purchase#p#p1#sp#s3	test/purchase#p#p1#sp#s3	65	5	Compact	0	Single
#
# Cleanup
#
DROP TABLE emp1;
DROP TABLE emp2;
DROP TABLE emp3;
DROP TABLE emp4;
DROP TABLE purchase;
CREATE DATABASE mtr;
CREATE PROCEDURE mtr.check_warnings(OUT result INT)
BEGIN
SELECT 0 INTO RESULT;
END|
