<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.moodle.org/310/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Seb.mehr</id>
	<title>MoodleDocs - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.moodle.org/310/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Seb.mehr"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/Special:Contributions/Seb.mehr"/>
	<updated>2026-04-14T19:31:11Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=Database_transfer&amp;diff=138299</id>
		<title>Database transfer</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=Database_transfer&amp;diff=138299"/>
		<updated>2020-09-01T08:10:42Z</updated>

		<summary type="html">&lt;p&gt;Seb.mehr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Admin tools}}&lt;br /&gt;
The database transfer tool enables an administrator to migrate their Moodle site from one database to another, for example from MySQL to Postgres. &lt;br /&gt;
&lt;br /&gt;
The tool is currently classed as an experimental feature and may be found in &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Development &amp;gt; Experimental &amp;gt; Database migration&#039;&#039;. There is also a command line script in &#039;&#039;admin/tool/dbtransfer/cli/migrate.php&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The dbtransfer tool uses the XMLDB schema definitions  from Moodle and installed plugins to retrieve the data from one database and transfer it another.&lt;br /&gt;
&lt;br /&gt;
Some troubles you may find when using this tool:&lt;br /&gt;
&lt;br /&gt;
* If there is any object in the current database (columns, tables,...) not included in the XMLDB schema or the other way around the dbtransfer won&#039;t be executed until these objects are removed (this may happen if Moodle has been upgraded from earlier versions, if some plugin hasn&#039;t been correctly uninstalled...).&lt;br /&gt;
* If there is some wrong encoded data in the current database the transfer will crash; in that case find and fix the troublemaking data and launch de dbtranfer tool again.&lt;br /&gt;
* If you are trying to migrate a big instance it will take a while, and there can be set some timeout (database, PHP, Apache) that can break the migration.&lt;br /&gt;
&lt;br /&gt;
==CLI Database Transfer==&lt;br /&gt;
&lt;br /&gt;
* put your original plateform in [[Maintenance_mode]]&lt;br /&gt;
* disable [[Cron]] to avoid writing in database during the process&lt;br /&gt;
* execute the script with this command  :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo -u www-data /usr/bin/php /path/to/moodle/admin/tool/dbtransfer/cli/migrate.php --dbtype=&#039;pgsql&#039; --dbhost=&#039;x.x.x.x&#039; --dbname=&#039;moodleDbName&#039; --dbuser=&#039;moodleUser&#039; --dbpass=&#039;***&#039; --dbport=5432 --prefix=&#039;mdl_&#039; --dbsocket=&#039;/var/run/postgresql&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more information, type &amp;lt;code&amp;gt;sudo -u www-data /usr/bin/php /path/to/moodle/admin/tool/dbtransfer/cli/migrate.php --help&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Depending on the size of your database, the process may take several hours.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* MDL-34441 finish dbtransfer tool implementation&lt;br /&gt;
&lt;br /&gt;
Using Moodle forum discussions:&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=207413 Moving Moodle from Oracle to PostgreSQL (dbtransfer tool)]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=206759 Where did dbtransfer.php go?]&lt;br /&gt;
&lt;br /&gt;
[[es:Transferencia de la BasedeDatos]]&lt;br /&gt;
[[de:Datenbank-Transfer]]&lt;br /&gt;
[[fr:Transfert de base de données]]&lt;/div&gt;</summary>
		<author><name>Seb.mehr</name></author>
	</entry>
</feed>