Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

DIY Bitbucket backup with postgreSQL fails with unable to lock database

lhaynes4 January 29, 2019

I am using the DIY bitbucket backup script for backups.  My shared directory is on an NFS partition and the database is local.

When I run the backup script the rsync completes however I get an error that the system is unable to lock the database.  I am running Bitbucket version 5.4.6.

 

I am using PostgreSQL 9.4.  Any suggestions on how to get past this error?

Thanks in advance.

 

1 answer

0 votes
Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 31, 2019

Hello Leslie,

Sounds like your DIY backup script is almost complete. We just need to get back this database dump error.

Can you please share how you're executing your Bitbucket database backup?

Once we have the above we can see what is causing this and what needs to be done to resolve the issue.

Regards,
Stephen Sifers

lhaynes4 February 8, 2019

Hello Stephen,

 

I am using pg_dump to backup the database.

Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 8, 2019

Hello Leslie,

Could you please let me know the exact command string you are using with pg_dump?

(Please remove any usernames or passwords, just replace those with admin and password).

Regards,
Stephen Sifers

lhaynes4 February 8, 2019

prefix=/home/atlassian/bitbucket/backups

suffix=`date +%Y -%m -%d`

# Backup the database

/bin/su - postgres -c /sw1/PostgreSQL/9.4/bin/pg_dumpall | bzip2 > ${prefix}/bitbucket.sq$suffix.bz2

Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 8, 2019

Hello Leslie,

Thank you for sending me your pg_dump string. Reviewing what you sent, the pg_dumpall will attempt to backup every database within postgres at the time of execute. This may be the cause of your error. I would like to try only backing up the Bitbucket database and see what the result is that we get.

Could you please adjust your script to use a pg_dump string as follows:

pg_dump -F t bitbucketdb --no-synchronized-snapshots -f /path/folder

The above will backup only the bitbucket data you set along with creating a tar file of the database back within the path/folder you specify.

There is also additional instructions on creating DIY bitbucket backups at Using Bitbucket Server DIY Backup.

Please let us know the results of your database backup while only backing up bitbucket.

Regards,
Stephen Sifers

lhaynes4 February 8, 2019

Thanks for the update.  I will have to test the command off hours as there are users accessing bitbucket now.  I will let you know how I make out.

Thanks,

Like Stephen Sifers likes this
ajay.vanga@omnicell.com August 17, 2020

Hi Did this work out for you?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events