You are viewing limited content. For full access, please sign in.

Question

Question

SQL Query to delete all documents

asked on April 14, 2015

Hi,
Anybody got a SQL Query that will delete all documents inside a repository? Not from the hard drives, just remove them from the database.

When we want to create a new test or development repository we want to keep the folder structure, groups and access rights but not the documents.

We found that the easiest way is to copy the database and register a new repository with it but we need to run the UUIDUpdater tool which takes a long time on big databases.

 

We have some big repositories, sometimes more than 6 million documents.

So I am looking for a way of removing those documents and their associated metadata directly from the database. 

 

Any ideas?

 

We are using mostly version 9.1 and some servers still with version 8.3.

 

Thanks

 

Gian

0 0

Answer

SELECTED ANSWER
replied on April 14, 2015

The following SQL query will do it:

DELETE FROM toc WHERE etype = -2

1 0

Replies

replied on April 18, 2015

Rather than delete all the documents, you could move all documents to a new volume and then detach the new volume.  Otherwise, you could also unregister the repository and create a new repository.

1 0
replied on April 15, 2015 Show version history

Thanks Michael,

Will that include the associated metadata for each document?

We want to delete as well as pages, activity logs,  and everything related to those documents.

Gian

0 0
replied on April 17, 2015

The above query will delete pages and metadata, but not rows from the activity_log table. However, you can probably just delete every row from the activity_log table.

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.