solidDB Help : Configuring and administering : Administering solidDB : Compacting database files (database reorganization)
  
Compacting database files (database reorganization)
Database reorganization returns unused space back to the file system. Reorganization is useful, for example, if your application causes short-term peaks in the database space usage, resulting in large allocated disk space. The database reorganization is started at solidDB startup with the command-line option:
solid -x reorganize
When databases grow, solidDB server allocates new disk pages. However, it does not free the space allocated previously in the database files even if the space is not needed any more. Instead, the server maintains a list of unused pages for later use. For example, you might want to use the reorganization feature to shrink the database size after you have deleted a large amount of data.
The solidDB database file compaction feature works in offline mode at the page level. Offline mode means that, while a database file is being compacted, it cannot be actively used by the server. Page level means that only empty pages are discovered and removed from the file. No intra-page compaction is performed; data is not moved among pages.
Note The reorganization operation is not recoverable. If there is a failure during the reorganization operation, the reorganization or the database file cannot be recovered later. To avoid losing data, make a database backup before starting the reorganization.
To compact your database files, complete the following steps:
1 Make a backup copy of your database and log files.
2 Shut down the solidDB server.
3 View information about the database file size by starting the solidDB server with the following command:
solid -x infodbfreefactor
The -x infodbfreefactor option outputs a report of how many free pages there are in the database, how much space in kilobytes is free, and a percentage value of free space. After printing the report to the ssdebug.log file and console window, the solidDB process returns with a success return value. For example:
Database file size = 152064 Kbytes
Free blocks = 82128 Kbytes
Log file size = 0 Kbytes
Free space = 54.01%
Block size = 16384 bytes
4 Start database reorganization by starting the solidDB server with the following command:
solid -x reorganize
The -x reorganize option invokes database reorganization. The operation moves pages to unused slots in the database file. When the page relocation is complete, the unused space is released back to the file system. The database file is truncated, a new checkpoint is created, and the solidDB process terminates with a success return code. The report of the reorganization run is written to the ssdebug.log file in the solidDB working directory.
5 Verify that the database size has been reduced by starting the server with the solid -x infodbfreefactor command.
Go up to
Administering solidDB