Move Moodle from test server to Production server

Move Moodle from test server to Production server

by Murali Sriram -
Number of replies: 6

I recently upgraded Moodle from 1.95 to 3.2 on test server and I need to move to Production. Please let me know how can I do that with Sql server as database. Thanks!

Average of ratings: -
In reply to Murali Sriram

Re: Move Moodle from test server to Production server

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Read - Moodle_migration

Any questions, just ask!

In reply to Howard Miller

Re: Move Moodle from test server to Production server

by Murali Sriram -

Hey Miller, 

Thanks for responding. I checked that document before and its pointing to mysql . I am using sql server. Is there any different process to migrate?


Thanks

In reply to Murali Sriram

Re: Move Moodle from test server to Production server

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I've never used sql server but essentially, I doubt there's a difference. You have to export/dump the database from the test site and import it on the production site. I'm assuming you either know how to do that or can easily find out (it's not specific to Moodle after all).

In reply to Howard Miller

Re: Move Moodle from test server to Production server

by Murali Sriram -

This is my first time to work on moodle. SO I am little confusing on how to move the course and everything.

In reply to Murali Sriram

Re: Move Moodle from test server to Production server

by Luis de Vasconcelos -

Migrating a MSSQL database is simple:

  1. Using SQL Management Studio backup the Moodle database on the test machine. That will produce a .bak file.
  2. Install SQL Server in the production environment.
  3. Restore that .bak file to a new database on that SQL Server production environment.
  4. Create the database user in Management Studio and link it to the Moodle database on production. Make sure it has full create/drop/select/insert/update/delete permissions.
  5. In your Moodle config.php file change $CFG->dbhost to point to your production database host.
  6. Update the other variables like $CFG->dbname, $CFG->dbuser and $CFG->dbpass with the production host details.
  7. You should probably also use $CFG->dbtype = 'sqlsrv'; so that PHP can connect to MSSQL. For that to work you need to make sure that MS SQLSRV driver has been loaded in your php.ini file and that PHPInfo() shows the SQLSRV section.

After doing that Moodle should be able to connect to SQL Server on the production instance.

https://docs.moodle.org/34/en/Installing_MSSQL_for_PHP

https://docs.moodle.org/34/en/Using_the_Microsoft_SQL_Server_Driver_for_PHP

In reply to Luis de Vasconcelos

Re: Move Moodle from test server to Production server

by Murali Sriram -

Hi Luis,

As you mentioned, I did the following process from my end.


1. Performed backup on test database 

2. Restored the .bak file on new database 

3. Created a database user and granted the permissions as you described.

4. In the config.php  changed the  dbhost pointing to production database.

5 Updated the other variables like dbname, dbuser and dbpass.

7. Updated the dbtype to 'sqlsrv'.

When I am trying to connect to the moodle from the application pool, stuck up with the following message attached. Help me on it. Thanks!




Attachment moodle error message.JPG