Migrate Data from Sybase to MySQL | → 6.13.3 | Created: 6.10.1; Updated: 6.13.3 |
This document describes the switch of the database for an ePages installation from Sybase to MySQL.
Chapter Local Single Machine Installation describes the process for a standard installation on a single machine.
Chapter Distributed Installation describes the process for a distributed installation with a separate database machine.
Chapter Case Study: Migration of a Distributed Installation (Windows) shows a case study installing the MySQL database on a new machine for an existing distributed installation.
Table of Contents |
In UNIX execute the following steps as UNIX user 'root'.
Perform a backup of the database and save the config files, basically Backup.conf, Site.conf, Store.conf, and maybe other [storedb_name].conf.
Windows:
Make sure the MySQL 5.1 database is installed using the following options:
mysqladmin -u root password epages
[mysqld] ... # # Set logging to binary format # log_bin = mysql-bin.log log_bin_index = mysql-bin.log.index relay-log = mysqld-relay-bin relay-log_index = mysqld-relay-bin.index # binlog-format = mixed # set binlog format to mixed mode (both statement and row based) (v5.1 or higher!) ...
The binary logging is necessary to perform incremental backups.
Redhat/CentOS:
/etc/init.d/mysqld stop /etc/init.d/mysqld start
SuSE:
/etc/init.d/mysql stop /etc/init.d/mysql start
Copy the config files Backup.conf, Site.conf, and [Storedb].conf to [name]_syb.conf.
Check all database relevant parameters in the original named config files. Replace the Sybase values settings by MySQL values. Check especially the parameter "datasource".
[Connection] datasource=dbi:Sybase:charset=utf8;server=DBServer login=usr_sitedb passwd=epages active=1 Database=sitedb StoreType=Site Backup=Backup BackupHost=localhost DumpDir=_SYBASE_/dumps FinalBackupType=-full InitialBackupType=-full
[Connection] datasource=dbi:mysql login=usr_sitedb passwd=epages active=1 Database=sitedb StoreType=Site Backup=Backup BackupHost=localhost FinalBackupType=-full InitialBackupType=-full
[Connection] datasource=dbi:Sybase(LongReadLen=200000):charset=utf8;server=DBServer login=usr_storedb passwd=epages active=1 Database=storedb StoreType=Store Backup=Backup BackupHost=localhost DumpDir=_SYBASE_/dumps FinalBackupType=-full InitialBackupType=-full
[Connection] datasource=dbi:mysql login=usr_storedb passwd=epages active=1 Database=storedb StoreType=Store Backup=Backup BackupHost=localhost FinalBackupType=-full InitialBackupType=-full
[Connection] datasource=dbi:Sybase:charset=utf8;server=DBServer login=sa passwd=epages active=1 Database=master
[Connection] active=1 datasource=dbi:mysql login=root passwd=epages Database=mysql
datasource=dbi:mysql:mysql_socket=/var/lib/mysql/mysql.sock
Make sure the config files were changed correctly. Sybase entries mustn't exist in the config files.
Windows:
1. Run once for the installation:
cd %EPAGES_CARTRIDGES%\DE_EPAGES perl Makefile.PL nmake create_db install_store STORE=Site
2. Run for each STORE database:
nmake new_store STORE=[storedb_name]
UNIX:
1. Run once for the installation:
. /etc/default/epages6 cd $EPAGES_CARTRIDGES/DE_EPAGES $PERL Makefile.PL make create_db install_store STORE=Site
2. Run for each STORE database:
make new_store STORE=[storedb_name]
Run the installation also for all other cartridges not located in
Windows: %EPAGES_CARTRIDGES%\DE_EPAGES. UNIX: $EPAGES_CARTRIDGES/DE_EPAGES.
Run the script copyAllTables.pl:
Windows: perl %EPAGES_CARTRIDGES%\DE_EPAGES\Database\Scripts\copyAllTables.pl -source [store_config_name]_syb -target [store_config_name] UNIX: $PERL $EPAGES_CARTRIDGES/DE_EPAGES/Database/Scripts/copyAllTables.pl -source [store_config_name]_syb -target [store_config_name]
Run the script just for the Site database and all Store databases. Do not run the script using "Backup"!
Windows: perl %EPAGES_CARTRIDGES%\DE_EPAGES\Object\Scripts\refreshPoolDB.pl -storename Site perl %EPAGES_CARTRIDGES%\DE_EPAGES\Object\Scripts\refreshPoolDB.pl -storename Store UNIX: $PERL $EPAGES_CARTRIDGES/DE_EPAGES/Object/Scripts/refreshPoolDB.pl -storename Site $PERL $EPAGES_CARTRIDGES/DE_EPAGES/Object/Scripts/refreshPoolDB.pl -storename Store
Windows: %EPAGES_CONFIG%\Scheduler.conf UNIX: $EPAGES_CONFIG/Scheduler.conf Set IsActive=0 in the relevant sections.
Windows: %EPAGES_STATIC% UNIX: $EPAGES_STATIC
/etc/init.d/epages6 stop /etc/init.d/mysqld stop mv $SYBASE/ASE-15_0 $SYBASE/ASE-15_0.old cp -p $EPAGES_CONFIG/License.xml $EPAGES_CONFIG/License.xml.org rpm -hiv http://www.epages.com/RPMS/6.11/i386/epages-mysql-6.11.0-0.i386.rpm rpm -hiv http://www.epages.com/RPMS/6.11/i386/epages-mysqld-6.11.0-0.i386.rpm cp -p $EPAGES_CONFIG/License.xml.org $EPAGES_CONFIG/License.xml /etc/init.d/epages6 start
Proceed the steps as defined in chapter Local Single Machine Installation.
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
datasource=dbi:mysql:host=[db_server_name];3306
Example UNIX:
datasource=dbi:mysql:host=[db_server_name];port=3306
Transfer database content from Sybase database to a MySQL database on a new machine M3.
1. Install patch 6.10.0 on M1 with all LP
- Unzip patch package
- run: perl patch.pl install
2. Test if patch ok
3. Install MySQL DB on M3
Important - Enable remote user access!
See chapter "Custom Installation" in ePages Installation Guide for Windows
Short list:Run in MySQL:
- Typical installation
- Configure the MySQL server
- Standard Configuration
- Install As Windows Service "MySQL"
- Launch the MySQL Server automatically
- Include Bin Directory in Windows PATH
- Modify Security Settings (Save the password for the ePages settings)
- Enable root access from remote machines
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
5. Run install cartridges on M1 as described in step Install the New Databases (see above)
cd %EPAGES_CARTRIDGES%\DE_EPAGES perl Makefile.PL nmake create_db install_store STORE=Site nmake new_store STORE=Store
6. Copy all tables on M1 as described in step Copy Tables (see above)
perl copyAllTables.pl -source Site_syb -target Site perl copyAllTables.pl -source Store_syb -target Store
7. Delete the directory %EPAGES_STATIC% on M2
8. Restart the epages service and the request router service on M1
9. Disable all Sybase related entries on M2 in %EPAGES_CONFIG%\Scheduler.conf. Set IsActive=0 in the relevant section.