Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


  1. Log in to the server from which you want to take backup.
  2. Open context.xml file from $TOMCAT_HOME/conf/context.xml to get a Username and Password of that database.

    Code Block
    titleUsername and Password from the context.xml file
    <!--    <Resource name="jdbc/openspecimen" auth="Container" type="javax.sql.DataSource" 
      maxActive="100" maxIdle="30" maxWait="10000" 
      username="root" password="<password>"  driverClassName="com.mysql.jdbc.Driver"  
          url="jdbc:mysql://localhost:3306/<database name>" 
         validationQuery="Select 1 from dual" 
       /> -->

  3. Access the database using mysql -u<username> -p command
  4. Take the backup of the database using script. (Fill the appropriate values in the script for DB name, user, root password, hostname etc..)

  5. Take the backup of the data folder of OpenSpecimen.


  1. Log in to the server where you need to import the backup file.
  2. Shutdown the OpenSpecimen tomcat service.

    Code Block
    titleShutdown tomcat
    ./ stop

  3.  Drop the existing database.


    Confirm the database before dropping.

    Code Block
    titleDrop Existing Database
    DROP DATABASE database_name;

  4. First, uncompress the file using the below command.

    Code Block
    titleUncompress the file
    gunzip <file_name>.sql.gz

  5.  Open the dump(.sql) file in text editor.
    1. Change the DEFINER value relevant to the database you are using.
      1. To find the current database user hostname('current hostname'), enter the following query:

        1. Code Block
          SHOW GRANTS FOR current_user();

      2. Find and replace every occurrence of  DEFINER = `<other user>`@`<other hostname>` with DEFINER = `<current user>`@`<current hostname>`. 
      3. For example, while importing the backup of a dump taken from the prod server, every entry of DEFINER = `prod_user`@`prod_host`
        should become DEFINER = `test_user`@`localhost`
    2. Save the file as .sql
  6. Create the Database of the same name (Use dropped database name).

    Code Block
    titleCreate Database
    CREATE DATABASE database_name;

  7.    Import the dump file into the database using the following command.

    Code Block
    titleRestore Database Backup
    mysql -u <new_user> -p <database_name> < <file_name>.SQL;

  8. Exit from the database and take the backup of the existing data folder. and after taking backup clear all the data directory.
  9. Unzip the copied data folder zip. and copy all data from the unzipped data folder and paste it into the current cleared data directory.
  10. Start the stopped tomcat.

    Code Block
    titleStart tomcat
    ./ start


Connect to the MySQL. get into the database.

 Run the following query query.

Code Block
select RULE_DEF from os_print_rules where ACTIVITY_STATUS = 'Active';