Quantcast
Channel: MySQL Forums - MySQL Workbench - Database Migration
Viewing all 561 articles
Browse latest View live

Migrating new database to live database server with changes (1 reply)

$
0
0
Hi guys,

Recently I am working on project where I have made some changes to database definition by adding new fields and some new tables to database on local server. I already have live database with some data in it. Now I want to reflect the changes of database definition to live database. Could you please let me know procedure for the same.


Thanks.

Bug in workbench data migration script (1 reply)

$
0
0
Hi-

I originally posted this under Newbies, and someone suggested that I post it as a bug now that I found a solution. I couldn't find a thread for just bug reporting.

--

My SQL workbench v. 6.3.4.0 64 bit.
Migrating from Access .accdb (2010)

I get this error (or something like it) on most of my tables during the migration SQL script review:


ERROR: Error executing 'CREATE TABLE IF NOT EXISTS `InvertData_TESTCopy3_be`.`tblPCRsamples` (
`VialID` VARCHAR(50) NULL COMMENT '',
`PCRPlate` VARCHAR(50) NOT NULL COMMENT '',
`PCRWell` VARCHAR(50) NOT NULL COMMENT '',
`PCRresult` VARCHAR(255) NULL COMMENT '',
`fivecycleredo` VARCHAR(10) NULL COMMENT '',
`FinalResult` VARCHAR(50) NULL COMMENT '',
PRIMARY KEY (`PCRPlate`, `PCRWell`) COMMENT '',
CONSTRAINT `{94D83037-86D5-49E4-B0FD-34AE34CEDE1A}`
FOREIGN KEY (`PCRWell`)
REFERENCES `InvertData_TESTCopy3_be`.`tblListWells` (`Well`)
ON DELETE RESTRICT
ON UPDATE RESTRICT,
CONSTRAINT `{E3A31516-8923-4698-A429-3F244CA968DF}`
FOREIGN KEY (`FinalResult`)
REFERENCES `InvertData_TESTCopy3_be`.`tblListPCRResults` (`FinalResult`)
ON DELETE RESTRICT
ON UPDATE RESTRICT,
CONSTRAINT `{80503C8F-1844-4E52-BC34-935DF141BFBB}`
FOREIGN KEY (`VialID`)
REFERENCES `InvertData_TESTCopy3_be`.`tblMaster` (`VialID`)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `{2D98A0ED-3A04-413D-976D-3787C91A9FCF}`
FOREIGN KEY (`PCRPlate`)
REFERENCES `InvertData_TESTCopy3_be`.`tblPCRplates` (`PCRPlate`)
ON DELETE CASCADE
ON UPDATE CASCADE)'
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'COMMENT '',
CONSTRAINT `{94D83037-86D5-49E4-B0FD-34AE34CEDE1A}`
FOREIGN KE' at line 8.
SQL Error: 1064

FIX-

But, I did figure out the problem. For some reason it didn't like the comment after INDEX `{80503C8F-1844-4E52-BC34-935DF141BFBB}` (`VialID` ASC) COMMENT '',
INDEX `VialID` (`VialID` ASC) COMMENT '',


So I deleted the COMMENT '' to make it look like this:
INDEX `{80503C8F-1844-4E52-BC34-935DF141BFBB}` (`VialID` ASC),
INDEX `VialID` (`VialID` ASC),

And locked the edited scripts that were automatically produced by MySQL workbench.

It had no problem with the previous COMMENT '' commands, so I left those.

Then it worked.

The rest of the import steps worked (mostly).

Workbench Migration Scheduling? (6 replies)

$
0
0
Hello,

Hope you can help me out here. I have a source MSSQL database on one server, a target MySQL db on another server and I'm using Workbench 6.3CE on a client machine to migrate the bits that I need from source to target.

Then I have a script file to merge some tables in the target db in prep for a web app I have written. The data in the source db changes on a regular basis so I need to redo the migration and prep work regularly as well.

My Google-Fu is letting me down so...

My Question: is there a way to schedule / automate this at all? Perhaps in Workbench or using Windows Task Scheduler?

Thanks in advance for any help!

Wrong number of columns in target DB (1 reply)

$
0
0
We are using MySQL Workbench 6.2 Migration wizard to migrate data. Our source table and destination table have different numbers of columns. Say, the source table has 16 and destination table has 18.

When we migrate, Workbench says Error wrong number of columns in target DB.

Do the source and destination table columns numbers to be same? Or is there some way to tell Workbench default or derived values for the destination table columns?

Is there a way to "capture" a specific error code? (1 reply)

$
0
0
Is it possible to capture an error code? I am trying to set up an automated data migration process. Part of the process is to write to an audit table. I would like to indicate whether or not the job succeeded. If not, I would like to write the exact error message that was thrown.

character set problem (2 replies)

$
0
0
Hi!

I have an issue with MS SQL to MySQL migration.
The database migration is OK, but in the database the words with hungarian accented character are truncated. After many attempts I tried it with collation latin2_hungarian_ci (during manual mapping objects of migration) and the result was that the words no truncate but instead of accented character I have got "?". For example the right word is: kövirózsa but i get k?vir?zsa.
I have tried to set names of database latin2 with no result. The default was utf8.

I have MSSQL2008 with database collation SQL_Hungarian_CP1250_CI_AS
MySQL Workbench newest wersion: 6.3.5
MySQL version: 5.5.39
I use connection method: ODBC Data Source (Free TDS). (Without free TDS the migration stops with errors)

I have been trying it for days with bunch of possibility but no success... And our project stopped because it. Please help me. Many thanks.

What's the reason of "Copy data to target RDBMS failed" in Transfer the data to the MySQL database (no replies)

$
0
0
Starting...
Prepare information for data copy...
Prepare information for data copy done
Determine number of rows to copy....
Counting number of rows in tables...
wbcopytables.exe --count-only --passwords-from-stdin --odbc-source="DSN=MS Access Database" --table-file=c:\users\bwang\appdata\local\temp\tmposhc5x
01:02:35 [INF][ copytable]: --table "Hcp_Contactlist_DB"
01:02:35 [INF][ copytable]: Opening ODBC connection to [unknown] 'DSN=MS Access Database;PWD=XXX'
01:02:35 [INF][ copytable]: ODBC connection to 'DSN=MS Access Database;PWD=' opened

10410 total rows in 1 tables need to be copied:
- ."Hcp_Contactlist_DB": 10410
Determine number of rows to copy finished
Copy data to target RDBMS....

Migrating data...
wbcopytables.exe --odbc-source="DSN=MS Access Database" --target="root@127.0.0.1:3306" --progress --passwords-from-stdin --log-level=debug3 --thread-count=1 --source-rdbms-type=MsAccess --source-charset=gb2312 --table-file=c:\users\bwang\appdata\local\temp\tmpoheofq
Loading table information from file c:\users\bwang\appdata\local\temp\tmpoheofq

ERROR: `China Channel Database_CCSCC`.`Hcp_Contactlist_DB`:SQLExecDirect(SELECT "ID_IDC", "Tracker", "名单类型", "上期进货量", "本期进货量", "访问员", "合作等级", "本期情况分类", "本期情况说明", "上期情况分类", "上期情况说明", "品牌中文", "品牌英文", "渠道级别_IDC定义", "技术类型", "产品线", "渠道级别", "拿货渠道级别", "区域", "省份", "城市", "公司名称", "首要联系人", "联系人", "部门", "职务", "性别", "座机", "手机", "Email", "副营产品", "主营行业", "员工人数", "去年收入金额_全年", "是否同意", "注册人数", "合作伙伴注册人姓名", "C15Q3情况分类", "C15Q3情况说明", "C15Q2情况分类", "C15Q2情况说明", "C13Q4情况分类", "C13Q4情况说明", "C13Q3情况分类", "C13Q3情况说明", "C13Q2情况分类", "C13Q2情况说明", "C13Q1情况分类", "C13Q1情况说明", "公司主页", "地址", "邮编", "传真", "预约时间", "预约电话", "预约联系人" FROM "Hcp_Contactlist_DB"): 07002:117:[Microsoft][ODBC Microsoft Access Driver]COUNT field incorrect


ERROR: `China Channel Database_CCSCC`.`Hcp_Contactlist_DB`:Failed copying 10410 rows
FINISHED

01:02:35 [INF][ copytable]: Logger set to level 'debug3'. '0111111'

01:02:35 [INF][ copytable]: --table "Hcp_Contactlist_DB" `China Channel Database_CCSCC` `Hcp_Contactlist_DB` "ID_IDC", "Tracker", "名单类型", "上期进货量", "本期进货量", "访问员", "合作等级", "本期情况分类", "本期情况说明", "上期情况分类", "上期情况说明", "品牌中文", "品牌英文", "渠道级别_IDC定义", "技术类型", "产品线", "渠道级别", "拿货渠道级别", "区域", "省份", "城市", "公司名称", "首要联系人", "联系人", "部门", "职务", "性别", "座机", "手机", "Email", "副营产品", "主营行业", "员工人数", "去年收入金额_全年", "是否同意", "注册人数", "合作伙伴注册人姓名", "C15Q3情况分类", "C15Q3情况说明", "C15Q2情况分类", "C15Q2情况说明", "C13Q4情况分类", "C13Q4情况说明", "C13Q3情况分类", "C13Q3情况说明", "C13Q2情况分类", "C13Q2情况说明", "C13Q1情况分类", "C13Q1情况说明", "公司主页", "地址", "邮编", "传真", "预约时间", "预约电话", "预约联系人"

01:02:35 [INF][ copytable]: Connecting to MySQL server at 127.0.0.1:3306 with user root

01:02:35 [INF][ copytable]: Connection to MySQL opened

01:02:35 [DB1][ copytable]: Detected server version=5.7.12-log

01:02:35 [DB1][ copytable]: Detected max_allowed_packet=4194304

01:02:35 [INF][ copytable]: Setting charset for source data to gb2312

01:02:35 [DB1][ copytable]: Retrieving trigger list

01:02:35 [INF][ copytable]: Opening ODBC connection to [MsAccess] 'DSN=MS Access Database;PWD=XXX'

01:02:35 [INF][ copytable]: ODBC connection to 'DSN=MS Access Database;PWD=' opened

01:02:35 [INF][ copytable]: Connecting to MySQL server at 127.0.0.1:3306 with user root

01:02:35 [INF][ copytable]: Connection to MySQL opened

01:02:35 [DB1][ copytable]: Detected server version=5.7.12-log

01:02:35 [DB1][ copytable]: Detected max_allowed_packet=4194304

01:02:35 [INF][ copytable]: Setting charset for source data to gb2312

01:02:35 [DB1][ copytable]: Executing query: SELECT count(*) FROM ."Hcp_Contactlist_DB"

01:02:35 [DB1][ copytable]: Executing query: SELECT "ID_IDC", "Tracker", "名单类型", "上期进货量", "本期进货量", "访问员", "合作等级", "本期情况分类", "本期情况说明", "上期情况分类", "上期情况说明", "品牌中文", "品牌英文", "渠道级别_IDC定义", "技术类型", "产品线", "渠道级别", "拿货渠道级别", "区域", "省份", "城市", "公司名称", "首要联系人", "联系人", "部门", "职务", "性别", "座机", "手机", "Email", "副营产品", "主营行业", "员工人数", "去年收入金额_全年", "是否同意", "注册人数", "合作伙伴注册人姓名", "C15Q3情况分类", "C15Q3情况说明", "C15Q2情况分类", "C15Q2情况说明", "C13Q4情况分类", "C13Q4情况说明", "C13Q3情况分类", "C13Q3情况说明", "C13Q2情况分类", "C13Q2情况说明", "C13Q1情况分类", "C13Q1情况说明", "公司主页", "地址", "邮编", "传真", "预约时间", "预约电话", "预约联系人" FROM "Hcp_Contactlist_DB"

01:02:35 [INF][ copytable]: Re-enabling triggers for schema 'China Channel Database_CCSCC'

01:02:35 [DB1][ copytable]: Retrieving trigger definitions

01:02:35 [INF][ copytable]: No triggers found for 'China Channel Database_CCSCC'














Copy helper has finished

Data copy results:
- `China Channel Database_CCSCC`.`Hcp_Contactlist_DB` has FAILED (0 of 10410 rows copied)
0 tables of 1 were fully copied
Click [Retry] to retry copying remaining data from tables
Copy data to target RDBMS finished
Tasks finished with warnings and/or errors, view the logs for details
Finished performing tasks.

wbcopytables: Invalid option (1 reply)

$
0
0
I am migrating sql server tables in MySQL using wbcopytables command. I want to copy a specific range(id 1-10000) of data from MSSQL to MySQL, so I am using below syntax.

wbcopytables --odbc-source="DRIVER={FreeTDS};SERVER=**.**.**.**;PORT=1433;DATABASE=TESTDB;UID=***;PWD=***;TDS_VERSION=7.1" --target="root@127.0.0.1:3306" --force-utf8-for-source --truncate-target --table-range [TESTDB] [dbo].[DeletedUnits] TESTDB DeletedUnits Unit_Id Unit_Id 1 10000

unfortunately I am getting below error message this syntax.

wbcopytables: Invalid option 10000

workbench version : 6.0.8 11354 build 833

Tables missing in conversion from SQLServer (1 reply)

$
0
0
bulk_copy_tables.cmd fails if the bcp query length is exceeded.
Once it fails, all subsequent tables are omitted from the import_<database>.sql file.

The length is exceeded because all text fields are converted to 'CAST( [field] as NVARCHAR(len)) as [field]'. So instead of just [field], it includes the CAST...

Proposed Fix:
The addition of the CAST should be made optional, or indicated.
I don't think it is even necessary when converting from Latin1 to UTF-8.

The length of the bcp query should be calculated and a warning given.

Workaround:
1) Remove the block that is going to fail and run it again.
2) Use Toad to export the data.

SQL_NO_TOTAL error while moving data from SQL Server 2014 to MySQL 5.7 (2 replies)

$
0
0
Hi,

I am getting a SQL_NO_TOTAL error for one of the columns with data type as varchar(1024) when trying to move data from MS SQL Server 2014 to MySQL 5.7. I am using freeTDS 1.00 version with MySQL Workbench 6.3 on a Windows 7 machine. Not sure what is causing it.


Regards,
Pratik Gandhi

mysql migration - data verification (no replies)

$
0
0
How do i verify the migrated table data between sql server to mysql?
Is there any 3rd party software, i can use to compare each table data?

thanks
krishna

Automation of Data load from Excel (no replies)

$
0
0
Is it right forum to post the question ?

Request info on DB migration while Live (no replies)

$
0
0
I would like to know, Will DB replication/migration activity lock the database and impact the application if we perform this on live production environment of heavy usage? If so, what is the expected time and which is the best solution for doing this activity with out outage/risks involved.

Thanks in advance.

Regards,
Surendra.

The Problem Due to wrong passwords in the database of mysql/logmysql is not able to connect to the database with the existing password. We need to change the passwords manually. The Error The error might looks like this. #logmysql ERROR 1044: Acc (no replies)

$
0
0
The Problem
Due to wrong passwords in the database of mysql/logmysql is not able to connect to the database with the existing password. We need to change the passwords manually.

The Error
The error might looks like this.

#logmysql
ERROR 1044: Access denied for user 'zimbra'@'localhost' to database 'zimbra_logger'
#mysql
ERROR 1044: Access denied for user 'zimbra'@'localhost' to database 'zimbra'
For Mysql Database
1. Stop the mysql service. [Run as Zimbra]

$ mysql.server stop
2. Modify the /opt/zimbra/bin/mysql.server to start the mysql with skipping the grant tables. [Run as ROOT]

# vi /opt/zimbra/bin/mysql.server

Modify the following:

--defaults-file=${mysql_mycnf} \
--external-locking \
--ledir=${mysql_directory}/libexec < /dev/null > /dev/null 2>&1 &
TO
--defaults-file=${mysql_mycnf} \
--external-locking \
--ledir=${mysql_directory}/libexec < /dev/null > /dev/null 2>&1 --skip-grant-tables &
Save and Exit the file.

3. Start the mysql service. [Run as Zimbra]

$ mysql.server start
4. Connect to the database and change the passwords.

# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6883
Server version: 5.0.45-log Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root'; ----> Root user.
mysql> UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='zimbra'; ----> Zimbra user.
Make sure the 'password' you specify is should be same as in the localconfig. Run following command to check those passwords.

zmlocalconfig -s | grep mysql_root_password
zmlocalconfig -s | grep zimbra_mysql_password
Flush the privileges and exit.

mysql> FLUSH PRIVILEGES;
mysql> exit
5. Go back to the file remove the --skip-grant-tables from /opt/zimbra/bin/mysql.server and save and exit the file. You will need to do it as root.

6. Stop and start the mysql service. [Run as zimbra]

$ mysql.server stop
$ mysql.server start
7. Now you should be able to connect to the mysql.

$ mysql zimbra
For logger database
1. Stop the logger mysql service. [Run as Zimbra]

$ logmysql.server stop
2. Modify the /opt/zimbra/bin/logmysql.server to start the logmysql with skipping the grant tables. [Run as ROOT]

# vi /opt/zimbra/bin/logmysql.server
Modify the following:

--defaults-file=${logger_mysql_mycnf} \
--external-locking \
--ledir=${logger_mysql_directory}/libexec &
TO
--defaults-file=${logger_mysql_mycnf} \
--external-locking \
--ledir=${logger_mysql_directory}/libexec --skip-grant-tables &
Save and Exit the file.

3. Start the logmysql service. [Run as Zimbra]

$ logmysql.server start
4. Connect to the database and change the passwords.

# logmysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6883
Server version: 5.0.45-log Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root'; ----> Root user.
mysql> UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='zimbra'; ----> Zimbra user.
Make sure the 'password' you specify is should be same as in the localconfig. Run following command to check those passwords.

zmlocalconfig -s | grep mysql_logger_root_password
zmlocalconfig -s | grep zimbra_logger_mysql_password
Flush the privileges and exit.

mysql> FLUSH PRIVILEGES;
mysql> exit
5. Go back to the file remove the --skip-grant-tables from /opt/zimbra/bin/logmysql.server and save and exit the file. You will need to do it as root.

6. Stop and start the mysql service. [Run as zimbra]

$ logmysql.server stop
$ logmysql.server start
7. Now you should be able to connect to the logmysql.

MySQL Workbench 6.0 is GA (no replies)

$
0
0
MySQL Workbench 6.0 is GA
- https://blogs.oracle.com/MySQL/entry/mysql_workbench_6_0_new
- http://mysqlworkbench.org/2013/08/mysql-workbench-6-0-6-ga-released/
- http://mysqlworkbench.org/2013/06/mysql-workbench-6-0-whats-new/
- http://mysqlworkbench.org/2013/06/mysql-workbench-6-0-home-screen/

WB 6.0 includes:
- Model (upgrade from DBDesigner)
- Query (upgrade from MySQL Query Browser)
- Admin (upgrade from MySQL Administrator)
- Migration (upgrade from MySQL Migration Toolkit)
- SSH-Tunnel

Resources:
- Downloads: http://dev.mysql.com/downloads/workbench/
- Forums: http://forums.mysql.com/index.php?151
- Blogs: http://mysqlworkbench.org/

Decyrpt using select atatement (no replies)

$
0
0
Hi,

Anyone can help on how decrypt the data using select statement;

Input row:

encrypt_column
YjBhNjY5MzE3MWQ4ZDJmOR89/ChuhaRG0gOVBlfHmPmJ3SbZfsKJhCOOPrs98ui0
YjBhNjY5MzE3MWQ4ZDJmObCJqm2JTsFxDnWytJqnFU7asBXQCIUY5cYlrdSMcii7
YjBhNjY5MzE3MWQ4ZDJmOV210xNkpkW5iwWq7ehrG5e4VVBsBkiWrmio0TyKIZna


Output:

encrypt_column
test@ethical.com
applied@ethics.com
provider@lead.com

I've notice that most of the rows in my table having all "YjBhNjY5MzE3MWQ4ZDJmO"

Thanks in advance.

Regards,
Fspalero

Setting up MySQL DB on a network drive (no replies)

$
0
0
I am trying to setup a MySQL database on a network drive so my colleagues can have access to it. From what I've read, this setup is inadvisable and a better way would be to setup a dedicated MySQL server machine with users connecting via ODBC. Unfortunately, this is not feasible for us at the moment due to a lack of dedicated machine that can be used as a MySQL server.

I am currently using MySQL 5.7. So far, I have been able to do the following:
1. Create a database template in my localhost (C:\ProgramData\MySQL\MySQL Server 5.7\Data)
2. Copy MySQL folder to a network drive (C:\ProgramData\MySQL to O:\Some Network Folder\Another Network Folder\MySQL)
3. Edited mysql_config.pl (in C:\Program Files\MySQL\MySQL Server 5.7\bin) so that: my $ldata = 'O:/Some Network Folder/Another Network Folder/MySQL/MySQL Server 5.7/data';
4. Restarted MySQL service

MySQL is now unable to connect to a server with the following error:
Could not connect, server may not be running. Can't connect to MySQL server on 'localhost' (10061)

Is there a step that I'm missing in this process? I am also open to a better way to doing this if anyone has any good ideas.

freetool for datamigrating from oracle to mysql (no replies)

$
0
0
Sir,

Is there any free tool available for datamigrating from oracle to mysql?

Troublesoot (no replies)

$
0
0
Hi,
I have a problem with Migration Wizard and an MSACCESS database.
Source Selection step is ok when i test the connection.
Target Selection step is ok when i test the connection.
Fetch Schémas List step is ok.

The worry is in Reverse Engineer Source Step.

I have this log

Starting...
Connect to source DBMS...
- Connecting...
Connecting to ...
Opening ODBC connection to DSN=AIR...
Traceback (most recent call last):
File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE\modules\db_msaccess_re_grt.py", line 697, in connect
return MsAccessReverseEngineering.connect(connection, password)
File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE\modules\db_msaccess_re_grt.py", line 148, in connect
con = db_driver.connect(connection, password)
File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE\workbench\db_driver.py", line 91, in connect
connection = library.connect(connection_string, password=password)
pyodbc.Error: ('HY000', 'The driver did not supply an error!')

Traceback (most recent call last):
File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE\workbench\wizard_progress_page_widget.py", line 66, in run
self.func()
File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE\modules\migration_schema_selection.py", line 164, in task_connect
if not self.main.plan.migrationSource.connect():
File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE\modules\migration.py", line 201, in connect
self._rev_eng_module.connect(self.connection, self.password or "")
SystemError: Error("('HY000', 'The driver did not supply an error!')"): error calling Python module function DbMsAccessRE.connect
ERROR: Error during Connect to source DBMS: Error("('HY000', 'The driver did not supply an error!')"): error calling Python module function DbMsAccessRE.connect
ERROR: Exception in task 'Connect to source DBMS': SystemError('Error("(\'HY000\', \'The driver did not supply an error!\')"): error calling Python module function DbMsAccessRE.connect',)

Failed

Thanks for your help

Primary index issue (3 replies)

$
0
0
Now, I´ve found somthing that looks like a very big bug in MySQL 5.5.11, so before to think that choose MySQL is a bad decission, I prefer to ask the people that has a better knowled about MySQL...

mysql> show index from historico;
+-----------+------------+-----------------------------------+--------------+----------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+-----------+------------+-----------------------------------+--------------+----------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| historico | 0 | idx_Historico_Clave | 1 | IdTerminal | A | 810 | NULL | NULL | | BTREE | | |
| historico | 0 | idx_Historico_Clave | 2 | Clave | A | 394315658 | NULL | NULL | YES | BTREE | | |
| historico | 1 | idx_historico_FechaRecepcion | 1 | IdTerminal | A | 810 | NULL | NULL | | BTREE | | |
| historico | 1 | idx_historico_FechaRecepcion | 2 | FechaRecepcion | A | 394315658 | NULL | NULL | YES | BTREE | | |
| historico | 1 | idx_historico_idterminal_fechagps | 1 | IdTerminal | A | 810 | NULL | NULL | | BTREE | | |
| historico | 1 | idx_historico_idterminal_fechagps | 2 | FechaGPS | A | 394315658 | NULL | NULL | YES | BTREE | | |
+-----------+------------+-----------------------------------+--------------+----------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
6 rows in set (50.31 sec)

As it is possible to see, the "historico" table has a unique index named "idx_historico_clave" over the "idterminal" and "clave" fields.
The question are how is it possible the following:

mysql> select idterminal, clave from historico where idterminal = 38720 and fechagps = '20170611230057';
+------------+------------------------+
| idterminal | clave |
+------------+------------------------+
| 38720 | G20170611230057P102355 |
| 38720 | G20170611230057P102355 |
+------------+------------------------+


Aditional information:
- Table historico is a huge table, it has over 300.000.000 registers
- Table historico is partitioned by HASH(idterminal) in 64 partitions
- The database who has the problem is a "copy" of a production data base, obtained throw a "total" mysqldump (mysqldump -uroot -pXXXXXXX --skip-lock-tables datos historico, and then inject into the database using "mysql" command line.
then, I´ve done a partial backup of the production database using "mysqldump -uroot -pXXXXXXXX --skip-lock-tables --insert-ignore datos historico -t -w"fecharecepcion>'20170619230000'", and import in the copy database
Then, I´ve done a partial backup of the production database using "mysqldump -uroot -pXXXXXXXX --skip-lock-tables --insert-ignore datos historico -t -w"fecharecepcion>'20170619230000'", and import in the copy database

So, when I try to do "alter table historico rebuild partition p0;" I get the following error:
ERROR 1062 (23000) at line 1: Duplicate entry '38720-G20170611230057P102355' for key 'idx_Historico_Clave'

or if I try to do something like 'insert into historico (idterminal, clave) Values (1, 'pp'); twice, the second time I get a similar error message
Viewing all 561 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>