Change database
From DoKSwiki
This is a manual intended for people who would like to change from one database to another. We moved from PostgreSQL to MySQL.
| Table of contents |
[edit]
Export your data
If you already have data in your export directory, you could copy this data to a backup directory. Export all your data:
- ant exportfileformats
- ant exportusers
- ant exportscripts
- ant exportfolders
- ant exportrecords
[edit]
Backup your upload directory
Get a copy of the directory where your files are stored
[edit]
Install new database system
If it isn't installed yet, install a new DBMS.
[edit]
Create a new database
For MySQL it goes like this:
- mysql -u root -p
- CREATE DATABASE doks;
- GRANT ALL PRIVILEGES ON doks.* TO doks@localhost IDENTIFIED BY 'my_doks_password '; (Grant all privileges to the user doks on a database doks)
- FLUSH PRIVILEGES;
- \q;
[edit]
Adjust the configuration file
- You have to adjust the file DOKS_HOME/conf/hibernate.properties.
- Uncomment the lines you need (in our case the MySQL section.
- Adjust the hibernateconnection.url
- Adjust the hibernate.connection.username
- Adjust the hibernate.connection.password
- Put the lines you don't need anymore in comment by pasting a # in front of the lines.
- Save the file.
[edit]
Deploy
- ant deploy
[edit]
Schemaupdate
- ant schemaupdate
[edit]
Import the data
- ant importfileformats
- ant importusers
- ant importscripts
- ant importfolders
- ant importrecords
- restart tomcat
note: importing the records could cause problems (e.g. java.lang.OutOfMemory error) because it is a very demanding process. If you experience this problem, try following commands (available from version 1.2.2):
- ant importrecordsPass1 (this command only imports the records without creating the links between records)
- ant importrecordsPass2 (this command creates the links between records)
- restart tomcat
[edit]
If something goes wrong
In case something goes wrong, you can go back to your other database (don't drop it too soon):
- Adjust the DOKS_HOME/conf/hibernate.properties to your previous settings
- Copy the backup of your upload-directory to the right location
- Ant deploy
- restart Tomcat
