copytable

Copies or moves table data and index data files in the specified date range to the specified path. Administrative privileges are required to execute this command.

Syntax

copytable
[from=yyyyMMdd] [to=yyyyMMdd]
[incremental=BOOL|overwrite=BOOL|worm=BOOL] [move=BOOL]
[tables="TABLE, ..."]
[indexpath="PATH"] path="PATH"
Required Parameter
path="PATH"
Path to save the table backup by enclosing it in a pair of double quotes (" "). If the backup path has special characters such as backslashes (\) or whitespaces, you need to escape it using backslashes (\).
Optional Parameter
from=yyyyMMdd
Start date of record to be backed up in the form of yyyyMMdd. The command backs up all the records within the specified period including the start date.
to=yyyyMMdd
End date of last record to be backed up in the form of yyyyMMdd. The command backs up all the records within the specified period including the end date.
incremental=BOOL
Option to enable incremental backup (default: f).
  • t: Enables incremental backup. When incremental=t, the command appends data to the end of the file when there is an identical file in the path specified by the path option. This option cannot be used with the worm or overwrite option.
  • f: Disables incremental backup.
overwrite=BOOL
Option to enable overwriting the file specified by the path option, if it exists (default: f).
  • t: Overwrites the file specified by the path option if it exists. You can keep the old backup file even if you cancel it while the backup is in progress. This option cannot be used with the incremental and the worm option.
  • f: NOT overwrite the file specified by the path option if it exists. The query fails if the file exists.
worm=BOOL
Option to copy tables to WORM (Write Once Read Many) storage or CD (default: f).
  • t: Copies the source files to the backup media without creating a temporary file with the .transfer extension. This option cannot be used with the incremental or the overwrite option.
  • f: Writes data to a temporary file with the .transfer extension, deletes the source file when writing to this file is complete, and renames this file to that of the source file.
move=BOOL
Option to delete/keep the source file after copying is complete.
  • t: Deletes the source file after copying is complete. If the file size of the backup media does not match the file volume of the source, the command does not delete the source file.
  • f: Keeps the source file.
tables="TABLE, ..."
Tables to be backed up, separated by a comma (a) (default: all the tables). Define the entire list by enclosing it in a pair of double quotes (" ").
indexpath="PATH"
Path to save the full-text index file by enclosing it in a pair of double quotes (" ") (default: none). If the backup path has special characters such as backslashes (\) or whitespaces, you need to escape it using backslashes (\).

Description

This command is typically used to periodically back up table data and index data files to storage such as NAS.

This command returns the current progress while copying each data file. If exceptions such as the existence of a file with the same name, failure to rename, or insufficient capacity of the backup media occur, the command displays the contents of the error in the error_msg field. This allows you to perform other post-processing, such as sending an alert email when an error occurs. If the backup of some data files fails during the process, the query runs without interruption until the user explicitly cancels it.

Usage

  1. Copy all table data files to the /backup path.

    copytable path="/backup"
    
  2. Copy all table data files from June 24, 2015, to June 25, 2015, to the e:\backup path.

    copytable from=20150624 to=20150625 path="e:\\backup"
    
  3. Move all table data files from June 24, 2015, to June 25, 2015, to the /backup path.

    copytable from=20150624 to=20150625 move=t path="/backup"
    
  4. Copy test table and index data files from June 24, 2015, to June 25, 2015, to the /backup path.

    copytable from=20150624 to=20150625 tables="test" path="/backup" indexpath="/backup"