To compare two oracle schemas and produce a migration script, we could use a tool called dbForge Schema Compare.
Do we have a similar tool that can compare two different Memsql database schemas and generate a migration script that can be applied to the Target schema.
I donât know of a tool that can do that out of the box for SingleStore, handling all our table types, indexes, and sharding. Thereâs a related discussion on this post, including how to do some schema comparison yourself.
I posted this in the other thread too, but thought will post it here and it may help someone. The below tool not only finds all of the differences but produces the exact ALTER / CREATE syntax that is used by Singlestore, including the sharding, indexes, table types.
The best tool I found for this, believe it or not, is the perl mysqldiff utility (part of MySQL::Diff module). This is not to be confused with a similarly named MySQL utility. I couldnât really find anything else that does a good job.
Check this out:
(python) [ec2-user@prod-jump-1_10-1-1-5 db]$ mysqldiff --keep-old-tables -h memsql-prod -u proof -p $PASSWORD_DB_PT trading_hist trading
## mysqldiff 0.60
##
## Run on Tue Apr 6 17:47:13 2021
## Options: user=proof_post_trade, debug=0, keep-old-tables, host=memsql-prod.prooftrading.com
##
## --- db: trading_hist ('host=memsql-prod' 'user=proof')
## +++ db: trading ('host=memsql-prod' 'user=proof')
ALTER TABLE Venue ADD COLUMN auctionCollarBps smallint(6) DEFAULT NULL;
ALTER TABLE ClientConnection ADD COLUMN senderSubId varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL;
ALTER TABLE ClientConnection ADD COLUMN targetSubId varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL;
CREATE TABLE KillSwitch (
sbeClassName varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
sbeVersion int(11) DEFAULT NULL,
sessionId smallint(6) DEFAULT NULL,
sequenceTime timestamp(6) NULL DEFAULT NULL,
sequenceTime_nanos bigint(20) DEFAULT NULL,
sequence bigint(20) DEFAULT NULL,
sourceType smallint(6) DEFAULT NULL,
sourceInstance smallint(6) DEFAULT NULL,
sourceId int(11) DEFAULT NULL,
sourceSequence bigint(20) DEFAULT NULL,
active varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
checkString varchar(8) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
note varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
KEY sequenceTime_nanos (sequenceTime_nanos) USING CLUSTERED COLUMNSTORE
, SHARD KEY ()
) AUTOSTATS_CARDINALITY_MODE=INCREMENTAL AUTOSTATS_HISTOGRAM_MODE=CREATE AUTOSTATS_SAMPLING=ON SQL_MODE='STRICT_ALL_TABLES';
I am trying to use this tool but very little documentation, so struggling there.
I have set up vagrant on my local and i am trying to connect to a remote server that has 2 DB s and trying to compare them but got this error. Do we need to have mysql server installed on memsql node? or Any suggestion for the following error?
I have executed the same command for two schemas on same host ,
but it is running for a long time
Do you have an idea regarding time based on volumes ?
What time it takes
Thank you, command works but it takes more than 50 mins to execute.
1.Could you please provide me command for diff between two schemas having different host,
Like you posted example for two schemas on same host.?
2.Does it always required root user to execute?
On Centos, mysqlshow should be available using the mariadb package.
Hereâs the shell script I use to get mysqldiff working on a Centos server (put these into a script and run with sudo):
#!/bin/sh
# this is what is needed to get MySQL::Diff installed
yum -y install perl-CPAN
yum -y install mariadb
yum -y install mariadb-devel
yum -y install gcc
echo | cpan # configures cpan for first use
cpan -i MySQL::Diff