It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to delete all drafts from Confluence using SQL or any Script.

I want to delete the the pages in the spaces which is save in draft. So is any SQL query or any other script for removing draft pages in confluence?

2 answers

1 accepted

4 votes
Answer accepted

Hi Siddheshwar,

You can easily deduct the SQL you need from the SQL on that page.

You'll need to do the following :

  1. select * into temp_conf from CONTENT where CONTENTTYPE='DRAFT' (maybe change this to how it works in you DB)
  2. DELETE FROM BODYCONTENT where CONTENTID IN (select CONTENTID from temp_conf);
  3. DELETE from ATTACHMENTS where PAGEID in (select CONTENTID from temp_conf);
  4. DELETE from CONTENT where CONTENTID in (select CONTENTID from temp_conf);

Keep in mind that doing stuff in your database is not something you should consider doing lightly and is completely at your own risk.

Best regards,


Davin Studer Community Leader Dec 05, 2013

I would say if you are going to delete the data then backup your instance and create a test environment out of it. Then do it in the test environment and validate that you didn't mess anything up. Once you are confident in the process then apply to production.


Yes I have taken the backup first and test it in dummy database. With the help of above SQL query I can delete the Draft from my confluence.

Thanks for the help...:)

Best Regards,


Not sure which version of Confluence this is for. With 5.4.4 the above fails if any draft has an attachment. So I extended the initial query with _and CONTENTID not in (select PAGEID from ATTACHMENTS)_

Hi Siddheshwar

The information in this knowledge base article should help you out :

Best regards,


Hi peter,

I have already tried these steps, but this is only for the Orphaned Pages. But I want all the pages or spaces to be remove from the Draft.



Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence Cloud

What's New in Confluence Cloud – July 2020 Edition

Here’s another edition of “What’s New” this month in Confluence Cloud. Quickly (and more easily) adjust permission settings We know that sometimes the layers of space permissions and page restric...

82 views 1 4
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you