Compacting Used Space
The cubrid compactdb utility is used to secure unused space of the database volume. In case the database server is not running (offline), you can perform the job in standalone mode. In case the database server is running, you can perform it in client-server mode.
The cubrid compactdb utility secures the space being taken by OIDs of deleted objects and by class changes. When an object is deleted, the space taken by its OID is not immediately freed because there might be other objects that refer to the deleted one. Reference to the object deleted during compacting is displayed as NULL, which means this can be reused by OIDs.
cubrid compactdb options database_name [class_name], class_name2,...]
options: [-v | --verbose] [-S|--SA-mode | -C| --CS-mode]
- cubrid: An integrated utility for the CUBRID service and database management.
- compactdb: A command that compacts the space of the database so that OIDs assigned to deleted data can be reused.
- options: The -v , -S and -Coptions are supported. Options (-I, -i, -c, -d, -p) that is applied in client/server mode only.
- database_name: The name of the database whose space is to be compacted. The path name to the directory where the database is to be created must not be included.
- class_name_list: You can specify the list of tables names that you want to compact space after a database name; the -i option cannot be used together. It is used in client/server mode only.
Displaying detailed messages during execution (-v)
You can output messages that shows which class is currently being compacted and how many instances have been processed for the class by using the -v option.
cubrid compactdb -v testdb
Executing in standalone mode (-S or --SA mode)
The -S option is specified to compact used space in standalone mode while database server is not running; no arugment is specified. If the -S option is not specified, system recognizes that the job is executed in client/server mode.
cubrid compactdb --SA-mode testdb
Executing in client/server mode (C or --CS mode)
The -C option is specified to compact used space in client/server mode while database server is running; no argument is specified. Even though this option is omitted, system recognizes that the job is executed in client/server mode. The following options can be used in client/server mode only.
- - i, --input-class-file=FILE : You can specify an input file name that contains the table table name with this option. Write one table name in a single line; invalid table name is ignored. Note that you cannot specify the list of the table names after a database name in case of you use this option.
- -p, --pages-commited-once=NUMBER : You can specify the number of maximum pages that can be commited once with this option. The default value is 10, the minimum value is 1, and the maximum value is 10. The less option value is specified, the more concurrency is enhanced because the value for class/instance lock is small; however, it causes slowdown on operation, and vice versa.
- -d, --delete-old-repr: You can delete an existing table representation (schema structure) from catalog with this option. When a column is added or deleted by the ALTER statement, if the existing record still refers to the previous schema, no additional cost to update the schema is required and the previous table is kept.
- -I, --Instance-lock-timeout: You can specify a value of instance lock timeout with this option. The default value is 2 (seconds), the minimum value is 1, and the maximum value is 10. The less option value is specified, the more operation speeds up. However, the number of instances that can be processed becomes smaller, and vice versa.
- -c, --class-lock-timeout: You can specify a value of instance lock timeout with this option. The default value is 10 (seconds), the minimum value is 1, and the maximum value is 10. The less option value is specified, the more operation speeds up. However, the number of tables that can be processed becomes smaller, and vice versa.
- cubrid compactdb --CS-mode -p 10 testdb tbl1, tbl2, tbl5