If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Data Migration between diffeent schemas

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-06-03, 15:42
mahanti mahanti is offline
Registered User
 
Join Date: Nov 2003
Posts: 4
Unhappy Data Migration between diffeent schemas

Hi !!

I am new to My SQL. I have got a requirement where data existing in one schema has to be migrated to another. Both schemas look alike except some minor changes in the table definitions here and there.

Does MySQL provide some kind of tools by default for these sort of things or we need to go for third party tools? Please let me know.

Thankx in Advance,
Mahanti.
Reply With Quote
  #2 (permalink)  
Old 11-06-03, 16:25
aus aus is offline
Registered User
 
Join Date: Oct 2003
Location: Denver, Colorado
Posts: 137
Re: Data Migration between diffeent schemas

If you give an example, it would be easier to tell if mysqldump and mysqlimport are capable.

Quote:
Originally posted by mahanti
Hi !!

I am new to My SQL. I have got a requirement where data existing in one schema has to be migrated to another. Both schemas look alike except some minor changes in the table definitions here and there.

Does MySQL provide some kind of tools by default for these sort of things or we need to go for third party tools? Please let me know.

Thankx in Advance,
Mahanti.
Reply With Quote
  #3 (permalink)  
Old 11-06-03, 16:46
mahanti mahanti is offline
Registered User
 
Join Date: Nov 2003
Posts: 4
Some of the most frequent differences between 2 schemas are like below...

1)

< id int(7) unsigned zerofill NOT NULL auto_increment,
< project_id int(7) unsigned zerofill NOT NULL default '0000000',
---
> id int(7) unsigned NOT NULL auto_increment,
> project_id int(7) unsigned NOT NULL default '0',

2)

< user_id int(7) unsigned zerofill NOT NULL default '0000000',
< bug_id int(7) unsigned NOT NULL default '0'
< );
---
> user_id int(7) unsigned NOT NULL default '0',
> bug_id int(7) unsigned NOT NULL default '0',
> PRIMARY KEY (user_id,bug_id)
> ) TYPE=MyISAM;

Schemas belong to two different versions of application mantis.

Thanks in Advance
Reply With Quote
  #4 (permalink)  
Old 11-07-03, 00:53
aus aus is offline
Registered User
 
Join Date: Oct 2003
Location: Denver, Colorado
Posts: 137
If your two databases are on the same MySQL server, then you should be able to use a statement like

INSERT INTO destdb.desttable
SELECT * FROM sourcedb.sourcetable;

It looks like you shouldn't have to do anything special to make the transfer go smoothly.

If your databases are on separate servers, then it will require you to dump the data into text files, move them to the destination server and make a connection to import them. The commands look like:

SELECT * FROM sourcedb.sourcetable INTO OUTFILE 'C:\\datafile.dat';

move the data file to the destination server
connect to the server

LOAD DATA INFILE 'C:\\datafile.dat' INTO TABLE destdb.desttable;

Of course, if you issue "USE sourcedb;" or "USE destdb;" then you won't need to prefix the table names with the database names.

Quote:
Originally posted by mahanti
Some of the most frequent differences between 2 schemas are like below...
Reply With Quote
  #5 (permalink)  
Old 11-09-03, 04:38
mahanti mahanti is offline
Registered User
 
Join Date: Nov 2003
Posts: 4
Hi !!

Thanks a lot for the information.

Yes, I understood that we can use default MySQL tools for data migration from one schema to another.

But, the problem i may face is, one or two of the tables do have blob/longblob columns. And i am not clear to what extent these MySQL tools support longblob column types. Can anyone throw some light on this please?

Thanks in Advance
Reply With Quote
  #6 (permalink)  
Old 11-09-03, 13:21
aus aus is offline
Registered User
 
Join Date: Oct 2003
Location: Denver, Colorado
Posts: 137
The mysql tools support blob and longblob column types.

Quote:
Originally posted by mahanti
Hi !!

Thanks a lot for the information.

Yes, I understood that we can use default MySQL tools for data migration from one schema to another.

But, the problem i may face is, one or two of the tables do have blob/longblob columns. And i am not clear to what extent these MySQL tools support longblob column types. Can anyone throw some light on this please?

Thanks in Advance
Reply With Quote
  #7 (permalink)  
Old 11-09-03, 23:43
mahanti mahanti is offline
Registered User
 
Join Date: Nov 2003
Posts: 4
Thanks a lot. That's good to know.

To be more clear, does it mean,

if we use "mysqldump", blob, longblob types also can be written from database to text files?

Similarly, using "Load Data" we can read them from textfiles to database ?

Thanks for your time.
Reply With Quote
  #8 (permalink)  
Old 11-10-03, 12:37
aus aus is offline
Registered User
 
Join Date: Oct 2003
Location: Denver, Colorado
Posts: 137
These tools can handle writting blob types to textfiles.

Quote:
Originally posted by mahanti
Thanks a lot. That's good to know.

To be more clear, does it mean,

if we use "mysqldump", blob, longblob types also can be written from database to text files?

Similarly, using "Load Data" we can read them from textfiles to database ?

Thanks for your time.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On