Question
Eduard Lebedyuk · Jun 23, 2016

How do I compact database?

Long story short, I created some test data, then deleted it. The database (cache.dat) is 67 GB in size (was around 1 GB before tests).

How do I compact that?

0
0 1,625
Discussion (4)1
Log in or sign up to continue

Thanks.

In regards to the documentation, I'd like to clarify that it refers to a database page accessible at

SMP → System Operation → Databases, and not SMP → Menu → Configure Databases.

I usually create new empty DB, then ^GBLOCKCOPY globals from old DB. And then replace old DB with the new one.

Please check your Caché version before you use ^DATABASE to compact a database or defragment globals in a database as in older versions (pre-2014.1) database compaction and database defragmentation may cause corruption:

(http://www.intersystems.com/services-support/product-support/product-new...)

May 11, 2012 – Alert: Database Compaction and Database Defragmentation May Cause Corruption

InterSystems has identified a defect in the Database Compaction and Database Defragmentation feature that can cause the target database to become corrupt.

The Database Compaction and Database Defragmentation features were introduced in Caché and Ensemble versions 2010.2, and all releases 2010.2.0 and later are at risk.  This impacts all Operating Systems, except VMS where these features aren’t currently enabled.

The older global compaction utility, ^GCOMPACT, is not affected.

InterSystems recommends discontinuing the use of Database Defragmentation and Database Compaction.  An additional alert will be posted when a correction is available.

If either of these features, which appear in the ^DATABASE utility as options 13 (“Compact freespace in a database”) and 14 (“Defragment globals in a database”), have been used, an integrity check should be run against the database(s) in question to detect if any problems were introduced.

In addition, InterSystems is removing these options from the ^DATABASE menu for 2012.2, and for any future maintenance release beyond 2012.1.2.

If you have any questions regarding this, please contact InterSystems Worldwide Response Center (WRC).

This utility was re-introduced into Caché in version 2014.1 (http://docs.intersystems.com/documentation/cache/20141/pdfs/GCRN.pdf).