Note: You are currently viewing documentation for Moodle 1.9. Up-to-date documentation for the latest stable version is available here: Database migration.

Database migration: Difference between revisions

From MoodleDocs
mNo edit summary
mNo edit summary
 
(6 intermediate revisions by 2 users not shown)
Line 5: Line 5:


==Language option==
==Language option==
If you run your site in one language only, select this option to save a lot of time on the migration. Otherwise, Moodle will figure out how to do the migration for every piece of data, based on the language of the user, course and your Moodle site.
If you run your site in one language only, select this option to save a lot of time on the migration. Otherwise, Moodle will figure out how to do the migration for every piece of data, based on the language of the user, course and your Moodle site.


==The migration process==
==The migration process==


=== The right way ===
Since the migration is a process which causes heavy processor and disk load and can take a long time to perform, you should choose when to upgrade carefully. As an indication, Moodle.org had about 3 million bits of text and took 2.5 hours on a very fast dual-opteron server.
Since the migration is a process which causes heavy processor and disk load and can take a long time to perform, you should choose when to upgrade carefully. As an indication, Moodle.org had about 3 million bits of text and took 2.5 hours on a very fast dual-opteron server.


Line 16: Line 16:
The migration process places your Moodle site in [[Maintenance mode|maintenance mode]], so non-admins cannot login. Once the migration process has started, it needs to finish completely before non-admins can login. Your Moodle site will then automatically come out of maintenance mode.
The migration process places your Moodle site in [[Maintenance mode|maintenance mode]], so non-admins cannot login. Once the migration process has started, it needs to finish completely before non-admins can login. Your Moodle site will then automatically come out of maintenance mode.


=== Quick&dirty ===
==See also==
If, to meet Moodle 1.6 requirement, you are upgrading your MySQL server also, you can apply this strategy (tested converting database from MySQL 4.0.x to 5.0.x):
 
* ensure your Moodle site use only one encoding (eg. all courses use a latin1/ISO-8859-1 language)
* put your Moodle site off line
* export your data from old server; MySQL 4.0.x uses 8 bit encoding by default, so data will be dump in the same encoding of your Moodle site:
 
mysqldump -h ''<old mysql host>'' -u ''<moodle db user>'' -p ''<old moodle db name>'' > dbdump.sql
 
* upgrade your MySQL server
* upgrade your Moodle; remeber to install UTF-8 version of all require languages
* create your new Moodle database and set appropriate privileges
* re-import your data (MySQL 5.x uses UTF-8 encoding, suppose your data is ISO-8859-1 encoded)
 
mysql -h ''<new mysql host>'' -u ''<moodle db user>'' -p --default-character-set=latin1 ''<new moodle db name>'' < dbdump.sql


* MySQL will convert character encoding automatically.
*[[UTF-8 PostgreSQL|PostgreSQL database migration]]
* Now, you must update some data; from a mysql console:
*[[Alternative migration process]]
 
*[[Database migration Q and A]]
update mdl_config set value=concat(value, '.utf8') where name='locale';
*[[Converting files to UTF-8]]
update mdl_config set value=concat(value, '_utf8') where name='lang';
update mdl_course set modinfo=null;
update mdl_course set lang=concat(lang, '_utf8') where length(lang) > 1;
update mdl_user set lang=concat(lang, '_utf8') where length(lang) > 1;
update mdl_config set value='true' where name=unicodedb;
* update your Moodle config.php to use new server
* put on line your Moodle site.
 
For a medium size database, migration require only 3-4 minutes.
 
==See also==
*[[Upgrading to Moodle 1.6]]
*[[Upgrading to Moodle 1.6]]
*Using Moodle [http://moodle.org/mod/forum/discuss.php?d=79992 A little Unicode puzzle] forum discussion


[[Category:Administrator]]
[[Category:Language]]
[[Category:Language]]
[[Category:UTF-8]]


[[fr:Migration de la base de données]]
[[fr:Migration de la base de données]]
[[de:Migration_der_Moodle-Datenbank]]

Latest revision as of 23:44, 17 May 2009

Moodle1.6


Migration and third party modules

If you have third party modules installed, not yet ready yet for the UTF-8 migration, you'll be warned about these on this page. You need to either disable them or install a later version. The migration script can only run once, so if you have problematic third party modules disabled, you will need to use an alternative method such as converting all files to UTF-8 with a database dump.

Language option

If you run your site in one language only, select this option to save a lot of time on the migration. Otherwise, Moodle will figure out how to do the migration for every piece of data, based on the language of the user, course and your Moodle site.

The migration process

Since the migration is a process which causes heavy processor and disk load and can take a long time to perform, you should choose when to upgrade carefully. As an indication, Moodle.org had about 3 million bits of text and took 2.5 hours on a very fast dual-opteron server.

During the migration process, you'll see a progress bar which updates every now and then. Let it go all the way to 100%. If the migration is interrupted for some reason (browser closed or network failure) don't worry - just wait for a while to make sure the process is finished on the server (you might check processor load, caused by your webserver), and then start the migration again. The process is smart enough to take up where it left off and you'll see messages about this. However, starting the migration script while a former process of the script is still running might cause data corruption.

The migration process places your Moodle site in maintenance mode, so non-admins cannot login. Once the migration process has started, it needs to finish completely before non-admins can login. Your Moodle site will then automatically come out of maintenance mode.

See also