Product Documentation

BTRV Edition User's Guide

Previous Topic

Next Topic

-copy

Copies a file record-by-record creating a new file based on the configuration settings.

Usage

ctutil -copy source_file dest_file

where:

  • source_file - Source file name without extension
  • dest_file - Destination file name without extension

Notes:

-copy vs -filecopy

The -copy option creates a copy of a file by building it record-by-record, which creates a new file based on the configuration settings. The -filecopy option makes an exact copy of the source file, which can be faster than the -copy option.

The difference between these options is that the -copy option creates the destination file based on the configuration setting while the -filecopy option creates an exact copy of the source file.

Both approaches have limitations and advantages:

  • -filecopy is faster than -copy and provides an exact copy of the file.
  • -copy may be helpful when you need to change file characteristics.

For example, suppose you use <keycompress> in your ctree.conf file to compress keys and you need to disable it for a specific file. You could add a specific <file> section in your ctree.conf that removes the <keycompress> setting from the destination file and then simply run ctutil -copy. The ctree.conf would look as shown below:

<config>

<instance>

<file> <!--default rule matching all files-->

<keycompress>yes</keycompress>

</file>

<file name="*_nocompress"> <!--rule matching file names ending with "_nocompress"-->

<keycompress>no</keycompress>

</file>

</instance>

</config>

Run ctutil -copy making sure to use the correct ctree.conf:

ctutil -c ctree.conf -copy myfile myfile_nocompress

The resulting destination file myfile_nocompress will have all data records from the source file but its keys will be not compressed.

ctutil -copy vs Dynamic Dump

The recommended alternative to the ctutil -copy operation is the "Dynamic Dump" backup and restore option using the ctdump utility. (See Dynamic Dump in the FairCom DB Server Administrator's Guide).

If your files are under transaction processing control (TRNLOG), the Dynamic Dump utility, ctdump, is preferable because the ctdump utility uses transaction processing control if the data file is TRNLOG enabled. This has the advantage that the data file and any associated indexes are guaranteed to be in a consistent state, even if the file is updated during the backup process.

The ctutil -copy operation is not under TRNLOG control, therefore it is possible to end up with an index file that is inconsistent with the data file (for example, if a file is updated during the copy operation).

If a data file is not under TRNLOG control, the Dynamic Dump offers one advantage over ctutil -copy: The !PROTECT and !PROTECT_LOW keywords can be used in a Dynamic Dump backup script to instruct the system not to allow any file updates while each non-TRNLOG file is being backed up. (See Dump Files Without Transaction Control in the FairCom DB Server Administrator's Guide).

See also:

  • -filecopy
  • -fileid

TOCIndex