Posts tagged "mysql"

If you are attempting to restore a backup copy (mysqldump) of the EDC database into MySQL, you may encounter a MySQL error 1005.

Reason

This is linked to INNODB and the foreign keys.

Solution

You should follow the steps below to backup and restore the EDC database successfully on JBoss/MySQL:

A/ Backup

To fully backup the current state of a policy server, you need to do the following:

While the APS service is running, export the configuration settings from the UI by going to Configuration -> Manual Configuration -> Export

While the APS service is either running or shut down, backup the login-config.xml from the jboss\server\all\conf directory (and any other JBoss configuration files that you might have manually modified)

While the APS service is shut down, backup the database using mysqldump (from the bin directory in mysql) by issuing the following command on a command prompt: mysqldump –user=root –password edc > backup.sql

B/ Restoration

Assuming that you are restoring on a clean machine, here are the steps you would follow:

Install Policy Server and logon as Admin

Import the APS configuration settings which you saved in step a) above

Shut down the service and edit/restore the jboss\server\all\conf\login-config.xml so that the <application-policyname="UsernamePwd_Auth_Search"> section matches the one you were using previously

Note: The last step shouldn’t really be necessary, as the root user should already have all rights on all databases. These commands clear the whole database content.

5. edit the backup.sql which you saved in 3) above, and add the following line at the beginning:

SET foreign_key_checks=0;

Note: If you don’t do this, you will get error 1005 / errno 150 from mySQL when restoring the table – this is a known issue with foreign_keys and mysqldump, and can be easily addressed with the above line.

6. run the following command to restore all the SQL data:

mysql -u root -p edc < backup.sql

This should not give you any error.

7. restart the APS service. Once APS is started, you should be back to the state from the backup, and all the policies should work exactly as before.

After running these exact steps, you should be able to open a PDF with an existing policy even after you have removed the server and its database completely.