General developer forum

Error writing to database (on any page)

 
Picture of v k
Error writing to database (on any page)
 

Hi all!

I made a copy of working Moodle from sever A to server B:

  1. Copied moodle source code files from A to B
  2. Copied moodledata folder as well (and folder permissions are OK...)
  3. Copied tables and their content from SQLSRV on A to SQLSRV on B
    (SQLSRV on A is v.12, SQLSRV on B is v.17, but doubt this is a problem)
  4. In SQLSRV on B, checked properties for the database - moodle_user is owner, all good. 
  5. On B, in config.php, checked all parameters are OK to connect to SQL..

So as you've might thought already, after all settings I am still getting an "Error writing to database" when trying to load ANY page on Moodle on sever B...

I understand somewhere is a setting, which prevents from proper working after just copying files and DB tables.

Do anybody know, where to look at to resolve this problem? Where to get more detaily info on "Error writing to database", in which log-files etc.?


Thank you!

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: Error writing to database (on any page)
Core developersDocumentation writersParticularly helpful MoodlersPlugin developers

The most likely thing is you made a mistake at step 5. Or somewhere else in the process.

You need to carefully check each separate bit, to see what is not working.

Can you get a command-line on the new server? What happens if you try to connect to the database with the mysql command line tool? Does that work?

 
Average of ratings: -
Picture of v k
Re: Error writing to database (on any page)
 

Hello, thank you for respond!

I am using IIS and MS SQL Server, not MySQL.

The problem has been already found: after copying tables from server A to server B (I used the Export and Import data wizard), the "id" column in each table became "Is Identity = NO".

For testing, I dropped and recreated the mdl_sessions table, and then could browse the site, and log in as admin, and browse site pages..

But, other tables are with "id isidentity=NO" too, and either they all should be recreated at once with some script - but all their records will be lost..

Or should I have used another way to copy tables from A to B? 
I tried to use backup at A, and restore at B, but the SQL on B gave me an error that SQL versions are different...

Btw, I tried the Export&Import Data Wizard on SQL on A again, and checked "Insert identity". But again after copying finished, on server B all "id" columns were "IsIdentity=NO".

 
Average of ratings: -