How to restore JIRA from a full database backup?

Russell Warren July 29, 2013

Per many recommendations (including Atlassian's) I have been backing up my JIRA instance using:

  1. A full native DB backup (`pg_dumpall` for postgres in my case)
  2. A snapshot of the JIRA data dir

Now I am trying to actually do a restore to a brand new server (the old one is gone) and am having trouble getting it to work.

First, when I fully restore the database in advance of the JIRA installation, JIRA does not recognize the existing data at all and goes though the process of a fresh DB creation. When the installation is complete, the data is definitely not in JIRA... presumably because JIRA altered the restored database (but I didn't dig into this).

Next I did afew variations of the following:

  1. Stop JIRA
  2. Drop the JIRA DB
  3. Re-run the postgres restore script (`psql -f pg_backup_file postgres` as user postgres)
  4. Stop and restart PostgreSQL (for good measure)
  5. Restore the JIRA data dir snapshot
  6. Ensure the DB connection works properly for JIRA
    • (I had to change the user password, so I fix DB connectivity by either altering `dbconfig.xml` directly and/or changing/testing with `config.sh`)
  7. Restart JIRA
  8. Connect to my JIRA URL

When I do this, JIRA still does not recognize any of the restored project data. I can log in successfully to JIRA, but he project list is empty.

What is the correct way to restore JIRA from a full database backup?

2 answers

1 accepted

9 votes
Answer accepted
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 29, 2013

Ahh, nicely spotted!

Yes, next time, I will also try to remember to say "Check that you are connecting to the right database name - is Jira definitely looking at the restored data and not another area?"

Russell Warren July 29, 2013

Nic's other answer is also critical. Without re-indexing, all the issues will exist... but only if accessed directly. This makes it look like your restore did not work since no JIRA queries or any non-direct views will see the issues at all. Based on Nic's comment in the other answer, this is a known issue. DON'T FORGET TO REINDEX!

3 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 29, 2013

Ah - step 8 and the following paragraph are shouting at me.

The fact you can log in, and get some screens implies you've got something there. Specifically though, you don't mention re-indexing.

My instincts are screaming that you've done everything right, except rebuilding the index, and it's actually working fine, except for stuff that relies on the index... Go to Admin -> indexing and rebuild the whole thing. It could take a while if you've got a lot of data, but try it and let us know!

Russell Warren July 29, 2013

I was quite excited that this would work... but it did not. The re-index completed successfully, but there are still no projects and/or issues.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 29, 2013

Bother.

Ok, sadly, there's a string of questions now. Can you check what is in the database now? Specifically the jiraissue table. If there's stuff in there, then pick one issue and see if you can get to it directly (http://yourjira/browse/ABC-1). Finally, what is your log saying as Jira starts up? What does it think it's connecting to and is it recognising any of your data? Any warnings or errors.

Russell Warren July 29, 2013

Ok, more sadly, while checking the jiraissue table I realized that I had JIRA looking at the `postgres` database, and not the `jira` database. ie: my restore worked well, except I didn't tell JIRA to look at it. All is well now (or at least, I'm on the right road). thanks for the kick!! Nic, if you want to make a quick answer along the lines of "make sure JIRA is pointing at the correct database name in your restore" I'll accept it as the correct answer. Otherwise I'll wait a bit and answer it myself so others don't have the same issue (assuming people as dumb as me exist out there :) ).

Like Marsel Davletov likes this

Suggest an answer

Log in or Sign up to answer