97
Reference Guide Command-Line Tools

Reference Guide Command-Line Tools - FairCom Command-Line Tools .....1 1.1 File Locations.....1 2. Administrative Utilities - Client .....2 ... Change Internal Path Separators .....11

  • Upload
    vukhue

  • View
    257

  • Download
    6

Embed Size (px)

Citation preview

Reference Guide

Command-Line Tools

All Rights Reserved ii www.faircom.com

Contents

1. FairCom Command-Line Tools ......................................................................... 1

1.1 File Locations ....................................................................................................... 1

2. Administrative Utilities - Client ......................................................................... 2

2.1 ctadmn - Server Administrator Utility .................................................................... 2

2.2 ctcmpcif - IFIL-based Compact Utility ................................................................... 2

Updates in handling of security attributes ........................................................................... 3

2.3 ctdbpartidxent - Utility to Enable GUIx Key Count Optimization ............................ 4

2.4 ctdump - Dynamic Dump Utility ............................................................................ 5

Scripting a Dynamic Dump ................................................................................................. 6

2.5 ctfilblkif - File Block Utility ..................................................................................... 8

2.6 ctfileid - Update File IDs ....................................................................................... 9

2.7 ctflush - File Flush Utility ...................................................................................... 9

2.8 ctpass - Password Utility .................................................................................... 10

2.9 ctpathmigr - Change Internal Path Separators ................................................... 11

2.10 ctquiet - Quiesce c-treeACE Utility ..................................................................... 11

2.11 ctrbldif - IFIL-based Rebuild Utility ..................................................................... 14

Option to set index's automatic segment attributes .......................................................... 15

Updates in handling of security attributes ......................................................................... 16

2.12 ctsqlcdb - c-treeACE SQL Database Maintenance Utility ................................... 16

2.13 ctsqlimp - SQL Import Utility ............................................................................... 17

2.14 ctsqlutl - c-treeSQL Maintenance Utility ............................................................. 18

2.15 ctstat - Statistics Monitoring Utility ...................................................................... 19

2.16 ctstop - Server Stop Utility .................................................................................. 21

2.17 ctsysm - Server Status Monitoring Utility ............................................................ 22

2.18 cttrap - Communications Trap Playback utility .................................................... 23

2.19 cttrap - TRAP_COMM Utility .............................................................................. 25

2.20 cttrnmod - Change Transaction Mode Utility ...................................................... 27

2.21 dbdump - Data Unload Utility ............................................................................. 30

2.22 dbload - Data Load Utility ................................................................................... 31

2.23 dbschema - Schema Export Utility ..................................................................... 32

2.24 ISQL .................................................................................................................. 34

2.25 sa_admin - Command-line security administration utility .................................... 34

FairCom Command-Line Tools

All Rights Reserved iii www.faircom.com

ADMINISTRATOR OPTIONS ........................................................................................... 36

USER OPTIONS ............................................................................................................... 36

GROUP OPTIONS ............................................................................................................ 38

FILE OPTIONS ................................................................................................................. 39

3. Administrative Utilities - Standalone .............................................................. 41

3.1 ctcfgset - Server Configuration File Encoding Utility ........................................... 41

3.2 ctcmdset - Configuration File Encoding Utility .................................................... 42

3.3 ctcpvf - Master Password Verification File Utility ................................................ 42

3.4 ctfchk - File Checksum Utility ............................................................................. 43

3.5 cthghtrn - Displays the high-water mark for transactions .................................... 44

3.6 ctredirect - IFIL Update Utility for Redirected Filenames .................................... 44

4. Utilities - Client ................................................................................................. 46

4.1 ctinfo - ISAM File Info ......................................................................................... 46

4.2 ctixmg - Incremental ISAM / Resource sample ................................................... 47

4.3 ctsfex - Superfile Data Export Utility ................................................................... 48

4.4 cttpca - TPC A Test ............................................................................................ 49

4.5 ct_tpc - TPC A Test ............................................................................................ 49

4.6 ctvlqa - Variable-length quality assurance utility ................................................. 49

4.7 ISQL .................................................................................................................. 50

5. Utilities - Low Level ......................................................................................... 51

5.1 ctalgn - Change Alignment ................................................................................. 51

5.2 CTCMPC - File compaction ............................................................................... 51

5.3 ctcnfg - System Configuration Example ............................................................. 52

5.4 CTCV43 - Convert V4.3 Data File to c-tree Format ............................................ 52

5.5 ctcv67 - Extended File Conversion Utility ........................................................... 52

5.6 ctdidx - Create flat key file .................................................................................. 55

5.7 ctdmpidx - Index Dump Utility............................................................................. 55

5.8 ctflat - Create c-treeACE file from a flat file ........................................................ 56

5.9 ctflvrfy - Index Verify Utility ................................................................................. 56

5.10 ctindx - Create index file from flat key file ........................................................... 59

5.11 ctpkey - Print key utility ...................................................................................... 60

5.12 ctpotp - Parameter to OTP conversion ............................................................... 60

5.13 ctptoi - Parameter to IFIL conversion ................................................................. 60

5.14 ctrbld - Parameter file rebuild utility .................................................................... 61

FairCom Command-Line Tools

All Rights Reserved iv www.faircom.com

5.15 ctsfil - Superfile contents .................................................................................... 61

5.16 ctunf1 - File Reformatting Utility ......................................................................... 62

5.17 ctupdpad - Update the c-treeDB Pad Resource Utility ........................................ 63

5.18 ctvfyidx - Index Verify Utility ............................................................................... 63

5.19 ctvfyfil - File Verify Utility .................................................................................... 64

6. Utilities - Standalone ....................................................................................... 66

6.1 ct_ver - Display c-treeACE version that created file ........................................... 66

6.2 ctchkbin - Checking for affected tables ............................................................... 66

6.3 ctclntrn Utility - Clean Transaction Mark ............................................................. 67

6.4 ctcmpcif - IFIL-based Compact Utility ................................................................. 68

Updates in handling of security attributes ......................................................................... 71

6.5 ctencrypt - Utility to Change Master Password ................................................... 72

6.6 ctfdmp - Forward Dump Utility ............................................................................ 74

6.7 ctfileid - Update File IDs ..................................................................................... 75

6.8 ctfixbin - Fixing Affected Tables ......................................................................... 75

6.9 ctidmp - Examine Dump Files ............................................................................ 76

6.10 ctinfo - ISAM File Info ......................................................................................... 76

6.11 ctldmp - Transaction Log Dump ......................................................................... 77

6.12 ctrbldif - IFIL-based Rebuild Utility ..................................................................... 77

Option to set index's automatic segment attributes .......................................................... 79

Updates in handling of security attributes ......................................................................... 79

6.13 ctrdmp - Dynamic Dump Recovery or System Rollback ..................................... 80

Rollback to New Restore Points with ctrdmp .................................................................... 81

ctrdmp options to convert path separators to operating system's native path separator..................................................................................................................... 82

6.14 ctsbld - Superfile rebuild pre-pass ...................................................................... 83

6.15 ctsbldm - Rebuild Superfile Index Members ....................................................... 83

6.16 ctscmp - Superfile Compact Utility ..................................................................... 84

6.17 ctsfex - Superfile Data Export Utility ................................................................... 85

6.18 ctsqlmgr - Migration Utility .................................................................................. 86

7. Utilities for Stored Procedures, User-Defined Functions & Triggers ........... 87

7.1 dbschema – Option to dump SP, UDF, and triggers ........................................... 87

7.2 dbdeploy – Utility to deploy SP, UDF, and triggers ............................................. 87

7.3 Password Security ............................................................................................. 88

7.4 Requirements to Develop and Deploy (JDK, JRE) ............................................. 88

FairCom Command-Line Tools

All Rights Reserved v www.faircom.com

8. Index ................................................................................................................. 90

All Rights Reserved 1 www.faircom.com

1. FairCom Command-Line Tools

The FairCom products ship with a wealth of utilities for developers

and administrators. This book documents the command-line tools

that are available with your product.

1.1 File Locations

The command-line tools are provided in the following folders:

All tools:

All command-line tools:

All administrative tools:

Client-side administrative tools Administrative Utilities - Client (page 2)

Standalone administrative tools Administrative Utilities - Standalone (page 41)

All other utilities:

Client-side utilities Utilities - Client (page 46)

Low-level utilities Utilities - Low Level (page 51)

Standalone utilities Utilities - Standalone (page 66)

Note: The exact set of tools and utilities and their directory structure depends on the FairCom product you have installed.

All Rights Reserved 2 www.faircom.com

2. Administrative Utilities - Client

These utilities are intended for administrators. They are run from the client-side. They are located

in the following folder:

All tools:

All command-line tools:

All administrative tools:

Client-side administrative tools tools\cmdline\admin\client

Standalone administrative tools

All other utilities:

Client-side utilities

Low-level utilities

Standalone utilities

Note: The exact set of tools and utilities and their directory structure depends on the FairCom

product you have installed.

2.1 ctadmn - Server Administrator Utility ctadmn [<AdminId> <AdminPassword> [ <filepassword>

[ <ServerName> ]]]]

Used by the Server Administrator to manage users, groups, and files.

See Also

Administrator Utilities > c-treeACE Server Administrator Utility

(https://docs.faircom.com/doc/ctserver/#56551.htm) in the c-tree Server Administrators Guide

2.2 ctcmpcif - IFIL-based Compact Utility

New Standalone Usage # ctcmpcif DataFileName [-purge] [-updifil]

[-temppath=<temporary_path>] [-<sectors>]

Administrative Utilities - Client

All Rights Reserved 3 www.faircom.com

where:

-purge - purge duplicate records.

-updifil - update IFIL resources in the data file.

-temppath=<temporary_path> - the temporary file directory. The default is the current

directory.

-<sectors> - the sector size to use. The sector parameter is especially useful if you need to

adjust a file’s PAGE_SIZE to match the c-treeACE Server.

Client-Side Usage # ctcmpcif DataFileName [-purge] [-updifil] [<UserId>]

[<UserPassword> [<ServerName>]]

where

-purge - purge duplicate records.

-updifil - update IFIL resources in the data file.

UserID, UserPassword, and ServerName are only needed for client versions of this utility.

FairCom recommends building this utility as a Single-user Standalone application.

ctcmpcif reads the IFIL structure from DataFileName and calls CompactIFileXtd() and

RebuildIFileXtd() to compact and rebuild DataFileName and its associated indices. If ctcmpcif

cannot extract the IFIL from the target file, it will ask for the name of another copy of the file from

which to extract the IFIL information.

Considerations

Even without the -x8 option, some extended create block settings such as the huge file,

extended header, and 6-byte transaction number options, are always applied to new files.

This option requires all associated index files that are referenced in the data file's IFIL

structure to exist, as the utilities use OpenIFile() to open the data file and all associated index

files to read the extended create block values.

When an application calls the standalone version of the Xtd8 file compact or rebuild functions

(For example, CMPIFILX8() or RBLIFILX8() ), index files created by the compact or rebuild

no longer have the 6-byte transaction number attribute enabled if the specified extended

create block's x8mode field has the ctNO6BTRAN bit set.

Updates in handling of security attributes

In V10.3 and later, the ctrbldif utility assigns data file owner/group/permissions to index files and

ctcmpcif assigns original data file owner/group/permissions to compacted data/index files.

The rebuild and compact utilities now read the permission mask, owner, and group settings from

the original data file and after the rebuild or compact is completed, the utilities assign these same

attributes to the new files. It is desirable for the newly rebuilt or compacted files to preserve the

original security attributes as much as possible and the index file security attributes should match

the data file security attributes.

A command-line option has been added to the utilities to restore the previous security attribute

behavior. Use the -oldsec option to cause the rebuild and compact utilities to set the security

attributes as they did before this revision. For example:

Administrative Utilities - Client

All Rights Reserved 4 www.faircom.com

ctrbldif mark.dat -oldsec ADMIN ADMIN FAIRCOMS

The -oldsec option can be used if rebuild and compact are failing with error 455 (user does not

belong to group) if you delete an index then run the rebuild or compact utility on the data file using

a user account that does not belong to the group that is assigned to the data file.

Note: These changes only apply to the client and server versions of these utilities. Setting the security attributes is not supported in standalone mode, so the standalone rebuild and compact utilities behave as follows: 1) When the standalone mode rebuild utility creates new index files instead of reusing the new index files (for example if the original index files have been deleted before running the rebuild utility), the new index files are assigned a permission mask of zero (no restrictions on permissions), and the owner and group are unassigned (empty). 2) The standalone mode compact utility always preserves the security attributes of the data file. If the index files do not exist, the newly-created index files are assigned the same values as the standalone rebuild does when it creates new index files.

2.3 ctdbpartidxent - Utility to Enable GUIx Key Count

Optimization

Enhancements to partitioned file query efficiency required changes to certain header bits of the

files. While these are default with newly created tables, existing tables with partitioned files will

need to have this bit enabled to take advantage of the new optimizations.

A command-line utility that can be used to enable the partition file global unique index (GUIx) key

count optimization for partitioned files. The usage is as follows:

Usage ctdbpartidxent -u <username> -p <password> -s <servername> -m on|off -d <dbname> -t <tblname>

Options

-u <username> User name

-p <password> User password

-s <servername> c-tree Server name

-m on|off Enable or disable the partition file GUIx key count optimization

(default=on)

-d <dbname> Database name (default=update all databases)

-t <tblname> Table name (default=update all tables)

Example

Enables optimization for all tables in the ctreeSQL database on server FAIRCOMS:

ctdbpartidxent -u ADMIN -p ADMIN -s FAIRCOMS -d ctreeSQL

Administrative Utilities - Client

All Rights Reserved 5 www.faircom.com

The ctinfo utility has also been updated to display the file definition bits. To check if the GUIx key

count optimization is enabled, look for the DEF_MARK_PRTENT bit to be set, as shown below:

File Definition Mask Details

DEF_MASK_PRTENT : enhanced IDXENT for GUIx

Note: ctdbpartidxent also attempts to rename partition files to ensure they are properly named should a rebuild be required.

2.4 ctdump - Dynamic Dump Utility

Note: For a complete discussion of dynamic dumps, see Backups and Data Integrity (http://docs.faircom.com/doc/ctserver/8373.htm) in the c-treeACE Server Administrator's Guide.

The user may pass a User ID, Password, Dump Script name, and Server Name to a ctdump

utility, which schedules a dynamic dump. The syntax is as follows:

ctdump [-s svn] [-u uid] [-p upw] [-t script] [-b bufsiz] [-n] [-c] [-o backup_filename]

Options:

-s svn - c-tree Server name

-u uid - User name

-p upw - User password

-t script - Dump script name

-b bufsiz - Use buffer size of bufsiz bytes

-c - Send dump script from client

-m - Minimize progress notifications

-n - Send progress notifications to client

-o backup_filename - Write dump stream from server to file on client

For options available when scripting a dynamic dump (added in c-treeACE V11), see Scripting a

Dynamic Dump (page 6).

The following demonstrates example usage of this utility:

ctdump ADMIN ADMIN thescript FAIRCOMS

The following error codes are related to dynamic dump operations:

Error Name Error Code Explanation

FUNK_ERR 13 Cannot determine file type. Possibly a c-tree V4.3 file?

READ_ERR 36 Failed to read file, either a corrupted or non-tree file.

TCOL_ERR 537 Transaction log collision. Two sets of transaction logs in the same directory?

FCPY_ERR 796 Immediate dump restore file copy failed.

Administrative Utilities - Client

All Rights Reserved 6 www.faircom.com

Error Name Error Code Explanation

DRST_ERR 797 Immediate dump restore failed.

See Also

For a complete discussion of dynamic dumps, see Backups and Data Integrity

(http://docs.faircom.com/doc/ctserver/8373.htm) in the c-treeACE Server Administrator's

Guide.

Scripting a Dynamic Dump

In V11 and later, the Dynamic Dump can send a script to the server and receive a dump stream

and/or status messages from the server. The following capabilities are available for scripting a

dynamic dump:

1. When scheduling a dynamic dump, the client can send the dump script to the server. Prior to V11, the only option was to create the dump script on the server beforehand and the client passed the name of the existing dump script file to the server.

2. When running a dynamic dump, the client can request that status messages be sent to it while the dump is performed and/or the dump stream file can also be sent to the client process.

To use these options, call the function dyndmpsetopt() before calling dyndmp():

extern NINT dyndmpsetopt(NINT option,pVOID value);

The following are the supported options. All options are disabled by default.

DDOPT_SENDSCRIPT - Send dump script to server. Set value to the script name, or set it to

NULL to disable this option. Example:

dyndmpsetopt(DDOPT_SENDSCRIPT, "script.txt");

DDOPT_RECVSTREAM - Receive dump stream from server. Set value to YES to enable this

option or NO to disable this option. Example:

dyndmpsetopt(DDOPT_RECVSTREAM, (pVOID) YES);

DDOPT_RECVSTATUS - Receive status messages from server. Set value to YES to enable

this option or NO to disable this option. Example:

dyndmpsetopt(DDOPT_RECVSTATUS, (pVOID) YES);

DDOPT_SETCALLBK - Set callback function. Set value to the callback function pointer, or

set it to NULL to disable the use of the callback function. Example:

extern ctCONV NINT mycallback(pVOID pctx,pVOID pdata,NINT datalen,NINT

opcode);

dyndmpsetopt(DDOPT_SETCALLBK , &mycallback);

DDOPT_SETCONTEXT - Set callback function context pointer. Set value to the context

pointer that will be passed to the callback function. Example:

mystruct mycontext;

dyndmpsetopt(DDOPT_SETCONTEXT, &mycontext);

Administrative Utilities - Client

All Rights Reserved 7 www.faircom.com

DDOPT_SETBUFSIZ - Set communication buffer size. Set value to the buffer size to use.

Example:

dyndmpsetopt(DDOPT_SETBUFSIZ, (pVOID) 100000);

Notes:

1) The dump options remain in effect for all dynamic dumps performed by the current connection until they are changed.

2) When the DDOPT_RECVSTREAM or DDOPT_RECVSTATUS options are used, the following dynamic dump script options are ignored:

COPY_NONCTREE - Non-ctree files cannot be copied.

DATE and TIME - No scheduling of dump for later time.

EXT_SIZE - Only one dump extent is created.

FREQ - No repeat of dump.

SEGMENT - No segmenting of dump stream.

In V11 and later, the ctdump utility supports these features through command-line options:

usage: ctdump [-s svn] [-u uid] [-p upw] [-t script] [-b bufsiz] [-n] [-c] [-o backup]

Options:

-s svn - c-tree Server name

-u uid - User name

-p upw - User password

-t - Dump script name

-b bufsiz - Use buffer size of bufsiz bytes

-c - Send dump script from client

-m - Minimize progress notifications

-n - Send progress notifications to the client

-o backup_filename - Write dump stream from server to file on client

Example:

# ctdump -u ADMIN -p ADMIN -o backup.fcd -c -t script.txt -s FAIRCOMS -n

Results:

c-treeACE(tm) Version 11.1.0.46197(Build-150826) Dynamic Backup Utility

Copyright (C) 1992 - 2015 FairCom Corporation

ALL RIGHTS RESERVED.

Reading dump stream from server with buffer size of 100000

Start dump. Estimated dump size: 2691072

FAIRCOM.FCS

86% 100% [ 2328576 of 2326528 bytes]

SYSLOGDT.FCS

89% 100% [ 86016 of 81920 bytes]

SYSLOGIX.FCS

99% 100% [ 266240 of 262144 bytes]

S0000000.FCS

100% 100% [ 4096 of 128 bytes]

S0000001.FCS

100% 100% [ 4096 of 128 bytes]

L0000001.FCS

100% 100% [ 2048 of 679 bytes]

End dump. Actual dump size: 2705408

Administrative Utilities - Client

All Rights Reserved 8 www.faircom.com

Dynamic Dump has been successfully written to the file backup.fcd.

2.5 ctfilblkif - File Block Utility ctfilblkif

ctfilblkif will block, or unblock a specified c-treeACE file. The default behavior is to block access

to the specified file. Pass the -u option to unblock a file.

Usage ctfilblk [-s server][-f filename][-u][-m] {-p password|-a authfile}

-s: Server (default: FAIRCOMS@localhost)

-f: File name

-u: Unblock file

-m: Block file with manual reopen option (otherwise automatic reopen)

-a: Authentication file name

-p: Admin Password

Authentication File

This utility supports the use of an encrypted password file. Encrypted password files keep user

IDs and passwords from plain view when the utility is used within a script file. They are created

with the ctcmdset utility. The plain text form of the file should be:

; User Id

USERID ADMIN

; User Password

PASSWD <pass>

Use the -a option to specify the name of the encrypted file.

See also

ctquiet - Quiesce c-treeACE Utility (page 11,

http://docs.faircom.com/doc/ctreeplus/#55779.htm)

Administrative Utilities - Client

All Rights Reserved 9 www.faircom.com

2.6 ctfileid - Update File IDs

The Update File ID utility, ctfileid, provides a convenient and safe way to update the fileid

parameter of the file header. See the section Copying Server Controlled Files in the c-treeACE

Programmer's Reference Guide (http://docs.faircom.com/doc/ctreeplus/29354.htm) for details for

when this may be necessary. The file is opened exclusively, ensuring that the server does not

have it open. The syntax for this utility is shown below:

ctfileid file [-ioq] [-n <size>] [-s <svn>] [-u <uid>] [-p <upw>]

-i - Also update indices related to data file.

-o - Force open of corrupted files (ctOPENCRPT).

-q - Quiet (do not output to stdout).

-s <server name> - c-treeACE Server name.

-u <user ID> - User name.

-p <user password> - User password.

Note: ctfileid.c is located in ctree\samples\special\utils and replaces the previous informal and undocumented utilities, updateid.c and newid.c.

Standalone Usage

An additional option is available to set the node size in standalone mode:

-n <size> - Set node size (stand-alone only).

2.7 ctflush - File Flush Utility

ctflush is a c-tree utility that flushes updated buffers for c-tree files.

Usage ctflush [-1 <passfile>] [-u <userid>] [-p <password>]

[-s <servername>] [-m 1|2|3 <filename>|4|5|6]

[-i <interval>] [-t <timeout>]

Where:

-1 <passfile> - encrypted password file (see below)

-u <userid> - user id for logon

-p <password> - user password for logon

-s <servername> - c-treeACE Server name including machine name or IP address

-i <interval> - for mode 4: interval in seconds between checkpoint calls for mode 5: interval

in seconds between restore points

-t <timeout> - for modes 5 and 6: maximum time in seconds to wait for active transactions

to complete

-m <mode> - 1, 2, 3 <filename>, 4, 5, or 6:

Mode 1 flushes updated buffers for all transaction-controlled files.

Administrative Utilities - Client

All Rights Reserved 10 www.faircom.com

Mode 2 flushes updated buffers for all open files.

Mode 3 <filename> flushes updated buffers for the file <filename>.

Mode 4 performs a checkpoint.

Mode 5 creates a lightweight restore point.

Mode 6 creates a restore point with a checkpoint.

Authentication File

This utility supports the use of an encrypted password file. Encrypted password files keep user

IDs and passwords from plain view when the utility is used within a script file. They are created

with the ctcmdset utility. The plain text form of the file should be:

; User Id

USERID ADMIN

; User Password

PASSWD <pass>

Use the -1 option to specify the name of the encrypted file.

2.8 ctpass - Password Utility

c-treeACE Server utility to allow users to change their password.

The following steps are required for a user to change the password associated with their own

User ID:

1. Run the utility program ctpass as any other program in the environment.

2. Enter your current User ID.

3. Enter the current password for your User ID, if you have one. (Maximum 63 characters. Maximum nine characters for V9 and prior).

4. Continue by entering the current name of the c-treeACE Server (i.e., the default name or another name, supplied in the c-treeACE Server configuration file).

5. Now change your password by entering the new password.

6. To be sure to enter the new password, you may be asked to enter it twice before it will be accepted. If the same name is not entered both times, try again.

Note: Whenever input is requested, the user may enter a question mark (?) to receive HELP.

After the new password is entered and confirmed, a message saying your User ID password has

been successfully updated will be displayed. After being updated successfully, the new password

must be used with the User ID to log on to the c-treeACE Server.

Note: All users can change their own passwords. In addition, users who are members of the

ADMIN group can change the password of all accounts that are not members of the ADMIN

group. Only the super ADMIN account (named ADMIN) can change a password for an account

that is a member of the ADMIN group.

Authentication File

This utility supports the use of an encrypted password file. Encrypted password files keep user

IDs and passwords from plain view when the utility is used within a script file. They are created

with the ctcmdset utility. The plain text form of the file should be:

; User Id

Administrative Utilities - Client

All Rights Reserved 11 www.faircom.com

USERID ADMIN

; User Password

PASSWD <pass>

Use the -a option to specify the name of the encrypted file.

2.9 ctpathmigr - Change Internal Path Separators

The ctpathmigr utility is used to change embedded path separators for c-treeACE SQL

databases when migrating between Unix and Windows platforms. This functionality was

previously available in the ctpath utility. This utility changes database and IFIL resource path

separators from the native format of the system where the utility is run (i.e., \ for Windows; / for

Unix) to the non-native format. It should be run before moving the files.

Syntax ctpathmigr [-s <server>] [-u <user>] [-p <password>] [-d <database>]

Description

ctpathmigr with command line arguments returns 0 when the execution detected no errors,

or a value different than 0 when errors were detected and the error messages are written to

the screen.

If you omit the -d database switch, all databases in the session will be scanned.

Command line options should start with a '-' or '/' character. Use a lowercase character for the

option (e.g., -s not -S).

Command line switches may have optional spaces between the switch and the argument.

Example: -s FAIRCOMS or -sFAIRCOMS are the same.

Command line options may be entered in any order.

2.10 ctquiet - Quiesce c-treeACE Utility

The ctquiet utility allows an administrator to quiet the server from a script. An interactive option is

available in the ctadmn utility.

ctquiet [-c] [-f] [-i] {-p password|-a authfile} [-r] [-s server] [-t timeout] [-u] [-x]

Parameters:

-a: Authentication file name

-c: Wait for replication readers to finish processing

-f: Full consistency (default: crash consistency)

-i: Ignore inactive replication readers (used with -c option)

-p: Admin Password

-r: Create an incremental backup restore point. Automatically unquiets server

-s: Server (default: FAIRCOMS@localhost)

-t: Set transaction timeout in seconds. (maximum/default: 60 seconds).

-u: Unquiet server

Administrative Utilities - Client

All Rights Reserved 12 www.faircom.com

-x: Abandon Quiet request if timeout exceeded. (Default: Abort long transactions.) Applies

ctQTfailAfterTimeout mode. This mode has been extended to apply to restore point

checkpoint creation for incremental forward rolls.

-w - (Linux only) Execute command on successful quiet. Waits for SIGINT to unquiet server.

Note: The -c option requires ALL client utilities, replication readers, and servers to be installed

from c-treeACE V11.3 or later. It is not compatible as a drop-in to current running environments.

Support for Incremental Backup Restore Points

Several changes have been made to ctquiet to support restore points necessary to carry out an

incremental backup strategy:

The -r feature can be used to generate the restore point files necessary to carry out an

incremental backup strategy.

The ctQTfailAfterTimeout mode has been extended to apply to restore point checkpoint

creation for incremental forward rolls.

The -x option applies the ctQTfailAfterTimeout mode to the already existing options.

The -t timeout output has an effect only if -f or -r is specified.

The default timeout has been changed to match the server's maximum.

Authentication File

This utility supports the use of an encrypted password file. Encrypted password files keep user

IDs and passwords from plain view when the utility is used within a script file. They are created

with the ctcmdset utility. The plain text form of the file should be:

; User Id

USERID ADMIN

; User Password

PASSWD <pass>

Use the -a option to specify the name of the encrypted file.

Note: This utility provides a -f option, which enables full consistency (also known as a "clean quiesce") in which files are flushed to disk from cache. When this option is used, the system does not require any files to be rebuilt or recovery from transaction logs to occur. The default is the -f option is off, which results in "crash consistency" (also known as a "dirty quiesce"). The default means that transaction logs are required and, if present, the transaction logs are used to get back into a clean state once recovery completes. If files are NOT under transaction control, the -f option is strongly recommended, otherwise you

will have to do a rebuild to get the files back to a clean state.

A quiesced state allows a physical copy of files to be taken that can then be restored at a later

time. For systems that provide hardware-based snapshot features, this allows extremely fast

system backups to take place while maintaining full data integrity.

The -r option creates an incremental backup restore point. After the ctquiet call succeeds, this

new restore point and all server transaction logs can be copied to a backup area and used for an

incremental recovery.

Administrative Utilities - Client

All Rights Reserved 13 www.faircom.com

The -f and -r options require that no transactions are active for the quiet to complete. The quiet

operation defaults to waiting 60 seconds for outstanding transaction to complete before aborting

these transactions. Operations by other users and connections wait during this time.

The -t and -x options modify the timeout behavior:

-t - Allows setting a shorter timeout. Times longer than 60 seconds are reduced to 60

seconds.

-x - Instead of aborting the transactions, the quiet operation will fail if the timeout expires

without all transactions completing.

Example 1:

You want to create a server backup for your application that is not using transaction logging on all

the files you want to backup. Only allow 10 seconds before aborting outstanding transactions.

ctquiet -f -t 10 -s FAIRCOMS -p <admin password>

Make your backup and then end the quiet:

ctquiet -u -s FAIRCOMS -p <admin password>

Example 2:

You want to create a fast server backup, and all your files are using transaction logging. Your

backup will need to go through recovery before being used.

ctquiet -s FAIRCOMS -p <admin password>

Make your backup and then end the quiet:

ctquiet -u -s FAIRCOMS -p <admin password>

Example 3:

You want to create a restore point for an incremental backup and only allow a brief (1 second)

delay. You don't want ctquiet to abort any long running transactions.

ctquiet -r -t 1 -x -s FAIRCOMS -p <admin password>

Notes

When you quiesce the server, as long as the connection that quiesced the server remains

connected, all other connections are blocked. Only if that connection goes away do we allow

the ADMIN user to logon again and undo the quiesce.

After the server is quiet and the ctquiet utility disconnects, one ADMIN connection is allowed

to reconnect. There is no prevention of a separate process connecting as ADMIN while the

server is in a quiet state and precluding the unquiet call.

There is a subtle distinction between a "quiet" state and a file blocked with the ctFILBLK()

call. While in the quiet state, files are not physically closed and cannot be moved or replaced

while in this mode. Compare this to a "blocked" state, where the file can be replaced, as the

OS file handle has been released.

When the optional -w COMMAND switch is used (unavailable on Windows), the behavior of

ctquiet is modified to perform as follows:

a. After successfully quieting the server, it makes a system call to execute COMMAND.

Administrative Utilities - Client

All Rights Reserved 14 www.faircom.com

b. It remains connected and waits for SIGINT to unquiet the server. If ctquiet is killed before receiving SIGINT, the server will remain in a quiet state until a new connection unquiets the server.

2.11 ctrbldif - IFIL-based Rebuild Utility

Usage

A rebuild utility using the IFIL definitions stored in the header of a file:

ctrbldif DataFileName [ -x8 ] [ -purge ] [ -updifil ] [ -<sectors> ]

[ -temppath=<temporary_path> ] [ -sortmem=<n> ]

[ <UserId> ] [ <UserPassword> ] [ <ServerName> ]

Description

ctrbldif reads the IFIL structure from DataFileName and calls RebuildIFileXtd() to rebuild

DataFileName and its associated indices.

-purge - Purge duplicate records.

-updifil - Update the IFIL resource within the data file.

-sortmem=<N> - Use N KB of memory for sorting. This option can be used to increase the

rebuild speed for large files.

-x8 - Use extended create blocks read from data and index files.

-idxseg=<M>@<S> - If creating index, use M automatic segments of size S. Size is specified

in megabytes, or you can specify MB or GB as a suffix. For example: -idxseg=10@1GB

-skipdatascan - In V11.5 and later, if you know your datafile is in a good state, you can use

this option to skip the initial datafile validity scan for faster rebuilds.

-callback - In V11.5 and later: When used with a c-treeACE Server this will provide additional

feedback on the rebuild progress.

c-treeACE Standalone Options

-temppath= - directory path, <temporary_path>, to create temporary sort and purged record

files. (This standalone option is the equivalent of the TMP_PATH server configuration option.)

The default location is the current directory.

-<sectors> - sector size, <sectors>. (in multiples of 128). The sector parameter is especially

useful if you need to adjust a file’s PAGE_SIZE (index node size) to match the c-treeACE

Server. c-treeACE standalone models default to 16 sectors (2048 byte node size) while the

c-treeACE Server defaults to 64 sectors (8192 bytes).

c-treeACE Server Options

<UserID> : client user name to logon to a c-treeACE Server.

<UserPassword> : client user password to authenticate to a c-treeACE Server.

<ServerName> : c-treeACE Server name for a client to connect.

Environment Variable to Enable Advanced Encryption

In V11.5 and later, c-tree supports enabling advanced encryption at run time using an

environment variable. Set the environment variable CTREE_ADVANCED_ENCRYPTION to YES to

enable advanced encryption if it is supported. This environment variable can be used to allow

Administrative Utilities - Client

All Rights Reserved 15 www.faircom.com

c-tree utilities to enable advanced encryption even if they haven't been updated yet to

automatically enable advanced encryption when needed. Examples include the rebuild and

compact utilities, ctrbldif and ctcmpcif.

Note: If c-tree does not support advanced encryption and this environment variable is set, the c-tree initialization will fail.

Considerations

Even without the -x8 option, some extended create block settings such as the huge file,

extended header, and 6-byte transaction number options, are always applied to new files.

This option requires all associated index files that are referenced in the data file's IFIL

structure to exist, as the utilities use OpenIFile() to open the data file and all associated index

files to read the extended create block values.

When an application calls the standalone version of the Xtd8 file compact or rebuild functions

(for example, CMPIFILX8() or RBLIFILX8()), index files created by the compact or rebuild no

longer have the 6-byte transaction number attribute enabled if the specified extended create

block's x8mode field has the ctNO6BTRAN bit set.

A rebuild or compact will fail with the new error code TFLN_ERR (943) when a client library

that supports the new rebuild or compact option format attempts to use this feature with a

c-treeACE Server that does not support this new format.

See Also:

Preventing Possible Data Loss with Compact & Rebuild Operations

Option to set index's automatic segment attributes

If a segmented index file was deleted and rebuilt using the ctrbldif utility or the rebuild API

function, the new index file was not segmented. The index file's segment attributes, which are

stored in the index file, were lost when the index file was deleted.

Beginning with V10.3, an option is provided with the rebuild and compact utilities that causes

index files that are created by the utilities to be created using automatic segments of the specified

size and maximum. The option is:

-idxseg=M@S

where M is the maximum number of segments and S is the segment size. S is interpreted as

megabytes by default. Two suffixes, MB and GB, are also supported. MB indicates that the value

is in megabytes and GB indicates that the value is in gigabytes.

Examples:

50 segments of 10 MB each:

ctrbldif test.dat -idxseg=50@10

100 segments of 300 MB each:

ctrbldif test.dat -idxseg=100@300MB

Administrative Utilities - Client

All Rights Reserved 16 www.faircom.com

20 segments of 3 GB each:

ctrbldif test.dat -idxseg=20@3GB

Note: If the index files exist, the -idxseg option has no effect. It is only when the rebuild or compact utility creates new index files because the old index files do not exist that the -idxseg

option affects the automatic segment properties of the index files.

Updates in handling of security attributes

In V10.3 and later, the ctrbldif utility assigns data file owner/group/permissions to index files and

ctcmpcif assigns original data file owner/group/permissions to compacted data/index files.

The rebuild and compact utilities now read the permission mask, owner, and group settings from

the original data file and after the rebuild or compact is completed, the utilities assign these same

attributes to the new files. It is desirable for the newly rebuilt or compacted files to preserve the

original security attributes as much as possible and the index file security attributes should match

the data file security attributes.

A command-line option has been added to the utilities to restore the previous security attribute

behavior. Use the -oldsec option to cause the rebuild and compact utilities to set the security

attributes as they did before this revision. For example:

ctrbldif mark.dat -oldsec ADMIN ADMIN FAIRCOMS

The -oldsec option can be used if rebuild and compact are failing with error 455 (user does not

belong to group) if you delete an index then run the rebuild or compact utility on the data file using

a user account that does not belong to the group that is assigned to the data file.

Note: These changes only apply to the client and server versions of these utilities. Setting the security attributes is not supported in standalone mode, so the standalone rebuild and compact utilities behave as follows: 1) When the standalone mode rebuild utility creates new index files instead of reusing the new index files (for example if the original index files have been deleted before running the rebuild utility), the new index files are assigned a permission mask of zero (no restrictions on permissions), and the owner and group are unassigned (empty). 2) The standalone mode compact utility always preserves the security attributes of the data file. If the index files do not exist, the newly-created index files are assigned the same values as the standalone rebuild does when it creates new index files.

2.12 ctsqlcdb - c-treeACE SQL Database Maintenance Utility

Usage ctsqlcdb <command> <dbname> [<servername>]

Administrative Utilities - Client

All Rights Reserved 17 www.faircom.com

Valid Commands:

-add: Adds a reference to an existing database

-create: Creates a new database

-drop: Removes a reference to an existing database

-exist: Returns 1 if database exists, 0 if not, 2 on error

-list <servername>: Lists databases available from the server

-create_preimage: Creates a preimage only database (supporting only atomicity; no

transaction logs for durability.)

Or the following command syntax copies an existing database and adds a reference to the new

copy:

-copy <dbname> <newname> [<servername>]

-copy also includes non c-tree files when present in the database directory area.

where:

• <dbname> is the database name, and

• <servername> is the optional c-treeACE SQL name.

The -copy command supports virtual tables (called "Multi Record Tables" or "MRT tables").

2.13 ctsqlimp - SQL Import Utility

ctsqlimp is used as follows (after creating the database file):

ctsqlimp <filename> [-d database] [-s srvname] [-u userid] [-a password]

[-n symbolic] [-o userid] [-i] [-r] [-k] [-x] [-p|-P] [-z] [-g] [-b]

[-w script] [-m idxname] [-f s|z|sz] [-l size] [-h]

<filename>: data file name/path (relative paths to c-treeACE SQL directory)

-d database: database name (default: ctreeSQL)

-s server: c-treeACE SQL Server name (default: FAIRCOMS)

-u userid: userID for logging into c-treeACE SQL

-a password: password for authorization

-n symbolic: set SQL table name to symbolic symbolic

-o userid: set owner of table to userid

-i: non-interactive mode: ignore errors and continue

-r: remove existing linked table from dictionaries (file is not deleted)

-k: skip fields that don't comply with conventional identifiers rules

-c: allow table names that don't comply with conventional identifiers rules

-x: skip indices

-p: promote unsigned integer to greater signed type

-P: promote unsigned types to greater signed type and set check for fitting value

-w script: write CREATE statements into script file script instead of importing the table

-m idxname: set index idxname as primary key

-z: allow indices with missing string terminator in key segments

Administrative Utilities - Client

All Rights Reserved 18 www.faircom.com

-f s | z | sz: force string padding to (s)paces (z)eroes or (sz)spaces zero terminated

-l size: specify LONGVAR* field size threshold

-g: ignore existing index name in IFIL resource

-b: (lowercase) grants all permissions on the table to the public

-B: (uppercase) grants read-only permissions on the table to the public

Note: If both -B and -b are specified, the read-only setting takes precedence. Notice that the owner of the table and the DBA have all the permissions. This is a change in behavior for existing applications because this switch is now case-sensitive.

-j: non-interactive relink of existing table

-q prefix: prefix SQL table name with prefix (when the -q option is combined with the symbolic

table name option, -n, the prefix is prepended to the symbolic name instead to the table

name)

-h: display usage help

Note: Parameters are case-sensitive. By default, they are lower case unless otherwise stated.

See Also:

ctsqlimp - c-treeACE SQL Import Utility (https://docs.faircom.com/doc/sqlops/#41003.htm) in

the c-treeACE SQL Operations and Utilities Guide

2.14 ctsqlutl - c-treeSQL Maintenance Utility

The c-treeSQL Maintenance Utility, ctsqlutl, is a general purpose program to perform

maintenance on the c-treeSQL Server. At this time only the "rename column" (-rencol ) command

has been implemented. Please refer to the V8.14 Update Guide, Section 14.7, for complete

details.

Syntax

The ctsqlutl utility syntax is as follows:

ctsqlutl [options] -rencol table_name column newcolumn

table_name: Name of the table

column: Current name of the column you are going to rename

newcolumn: Name of the columns after renaming

Options

-o owner_name: Owner of table

-d database_name: Database name (default: ctreeSQL)

-s server_name: c-treeSQL Server name (default: FAIRCOMS)

-u userid: userid for logging onto the c-treeSQL Server

-a password: Password for authentication

-h: Display usage help

Administrative Utilities - Client

All Rights Reserved 19 www.faircom.com

2.15 ctstat - Statistics Monitoring Utility

The c-treeACE Statistics Utility, ctstat, is a client utility used to display statistics collected by

c-treeACE. This utility provides valuable real-time monitoring of critical c-treeACE operations.

Usage # ctstat report_type [-s svn] [-u uid] [-p upw]

[-i int [cnt]] [-h frq] [-d] [-m] [-t]

Reports:

-vas Admin-System Report

-vts Tivoli-System Report

-vaf file... Admin-File Report

-vtf file... Tivoli-File Report

-vau user... Admin-User Report by User Name

-vau handle... Admin-User Report by User Handle

-vah handle... Admin-User Report by Connection Handle

-vat Admin-Transaction Report

-var Admin-Replication Reader Report

-func Function Timing Report

-funcfile [csv] Function Timing By File Report (the csv option saves in comma-delimited format)

-userinfo User Report with stats from USERINFO() function

-isam ISAM Activity Report

-sql SQL Activity Report

-sqlidx Shows index scan statistics

-sqlcache Shows SQL cache information

-text System Activity Report, Write System Snapshot to SNAPSHOT.FCS.

-file [csv] File Activity Report (the csv option saves in comma-delimited format)

-iotime on | off Turn disk I/O call timing on or off

-wrktime on | off | reset

Turn function call timing on or off or reset the function-timing statistics

-mf logfile Log all memory allocations to the specified file

-ma logfile Log aggregate memory allocations to the specified file

-mr min,max Log only memory allocations in the range min,max

-ms Output memory allocation statistics

-mu Unload module debug symbols

-filelocks datafile List all locks on a data file

Administrative Utilities - Client

All Rights Reserved 20 www.faircom.com

-filelocks file [N] List all locks on a data file. Displays the Nth key. See -filelocks Notes below.

-userlocks user List all locks held by a user. See -userlocks Notes below.

Options:

-s svn c-treeACE Server name

-u uid User name

-p upw User password

-i int [cnt] Pause int seconds for optional cnt times.

In V11 and later, standard output is flushed after the interval determined by -i so that output is written to the file immediately. This better handles cases where output is redirected to a file.

-h frq Print a description header every frq outputs

-d Show cache stats as delta

-I int [cnt] (-I is an upper case i) Pause int seconds for optional cnt times, waiting int seconds before returning the first row.

-m Show memory file stats when using -vaf report. The following additional statistics are output:

• phyrec - Last byte offset of file for non-memory file or current memory in use for memory file.

• mhghbyt - Largest amount of memory used for memory file since file was created.

• memcnt - Current number of memory records.

• hghcnt - Largest number of memory records since file was created.

-t Output timestamp with header.

Authentication File

This utility supports the use of an encrypted password file. Encrypted password files keep user

IDs and passwords from plain view when the utility is used within a script file. They are created

with the ctcmdset utility. The plain text form of the file should be:

; User Id

USERID ADMIN

; User Password

PASSWD <pass>

Use the -a option to specify the name of the encrypted file.

-filelocks Notes

The -filelocks option lists all locks on a data file and, optionally, displays the Nth key. The lock

offset and the associated keys are not read at the same time. Since we are reading records

locked by other users to generate the key, there is no guaranteed relationship between the lock

and the displayed key. The following are possible scenarios:

1. The displayed key is from before or after any changes made by the lock holder.

2. The locked offset no longer holds a valid record (it has been deleted, or updated and moved).

3. The locked offset could have been locked/modified/unlocked more than once between the time the lock offset was acquired and the time the record is read, so the offset could hold an entirely different record than what was originally locked.

Administrative Utilities - Client

All Rights Reserved 21 www.faircom.com

The -filelocks file [key] command supports c-tree's standard wildcard filename matching for the

specified file, allowing locks from multiple files to be displayed. The standard wildcards (used by

ctsrvr.cfg keywords such as MEMORY_FILE and REPLICATE, etc) are:

* - Multi-character match

? - Single-character match

^ - Negation (must be first character)

-userlocks Notes

For the -userlocks report:

If UserID is a number, it is interpreted as a task ID.

If UserID is a string, it is interpreted as a name, and information on locks held by each task ID

with a matching name is returned.

Because the -userlocks report may generate a large number of server calls (for each task ID and

file), the -userlocks report interval may be increased up to 60 seconds, depending on the number

of matching users and files involved.

See Also

ctstat - Statistics Utility (http://docs.faircom.com/doc/ctserver/#52856.htm) in the c-tree Server

Administrator's Guide

2.16 ctstop - Server Stop Utility

Usage ctstop [ -auto ] [ <AdminId> <AdminPassword> <ServerName> [ delay ] ]

This utility shuts down a c-treeACE Server.

Passing the -auto switch to ctstop without specifying a ServerName, AdminPassword, or

AdminID shuts down a c-treeACE Server with the defaults shown below:

ctstop -AUTO FAIRCOMS ADMIN ADMIN

The ctstop utility supports passing in ServerName, AdminPassword, and AdminID when the

-auto switch is used.

The optional delay value is the number of seconds to wait before shutting down, with a default of

no delay and a maximum of 60 seconds.

Note: If the Replication Agent is running on a server, replication should be stopped before trying to stop the server. If replication is running when you attempt to stop the server, you will see error 792 (External server shutdown disabled).

Administrative Utilities - Client

All Rights Reserved 22 www.faircom.com

Authentication File

This utility supports the use of an encrypted password file. Encrypted password files keep user

IDs and passwords from plain view when the utility is used within a script file. They are created

with the ctcmdset utility. The plain text form of the file should be:

; User Id

USERID ADMIN

; User Password

PASSWD <pass>

Use the -1 option to specify the name of the encrypted file.

2.17 ctsysm - Server Status Monitoring Utility

The c-treeACE Server status monitoring utility, ctsysm, facilitates the monitoring of error,

warning, and informational messages logged to the server status log, CTSTATUS.FCS, by the

c-treeACE Server. Using this utility, the c-treeACE Server status log can be monitored by an

automated external process such as the Tivoli monitoring system from IBM.

To use the ctsysm utility, the c-treeACE Server must be configured to log messages to the

system log. This can be achieved by adding the following keyword to the server's configuration

file:

SYSLOG CTSTATUS

With this keyword in place, the server logs each entry in the CTSTATUS.FCS file to the system

log files (SYSLOGDT.FCS and SYSLOGIX.FCS).

The utility can read the system log from the beginning each time it starts up, or it can save its

current position and start again from that set position by specifying the -f command line option.

The following is the supported command line usage of the c-treeACE Server Status Monitoring

Utility:

ctsysm [-s svn] [-u uid] [-p upw] [-r rpt] [-c cfg] [-f fil] [-l log]

-s svn - c-treeACE Server name

-u uid - user name

-p upw - user password

-r rpt - repeat interval in seconds (for example, -r 1 is a one-second delay before checking

for new messages)

-c cfg - config file

-f fil - save/restore state to file

-l log - status log name (SYSLOGDT.FCS)

-e - direct ctsysm error messages to standard output in the same format as messages

read from the server status log

Administrative Utilities - Client

All Rights Reserved 23 www.faircom.com

Authentication File

This utility supports the use of an encrypted password file. Encrypted password files keep user

IDs and passwords from plain view when the utility is used within a script file. They are created

with the ctcmdset utility. The plain text form of the file should be:

; User Id

USERID ADMIN

; User Password

PASSWD <pass>

Use the -a option to specify the name of the encrypted file.

Example

The following command causes ctsysm to monitor the c-treeACE Server system log for the

server FAIRCOMS (-s FAIRCOMS) for status messages, checking for new messages every

second (-r 1), saving the position of the last entry read to the file ctsysm.log (-f ctsysm.log).

ctsysm -s FAIRCOMS -u ADMIN -p ADMIN -r 1 -c ctsysm.cfg -f ctsysm.log

The ctsysm utility outputs messages in the following format:

<timestamp> <code> <subsystem> <action> <text>

Sample output from the utility is shown below (each message is output as a single line but is

shown split into two lines here):

Thu Jul 29 16:44:04 2004 I0455 STUP NONE - User# 01

Alternative server name... FAIRCOMS

Thu Jul 29 16:44:04 2004 I0492 STUP NONE - User# 01

Compatibility bit maps: 00000000 00002000x

Thu Jul 29 16:44:04 2004 I0491 STUP NONE - User# 01

Diagnostic bit maps: 00000000 00000000x

Thu Jul 29 16:44:04 2004 I0490 STUP NONE - User# 01

64-bit File Address Support

Thu Jul 29 16:44:04 2004 I0489 STUP NONE - User# 01

6 Byte Transaction Numbers

Thu Jul 29 16:44:04 2004 I0488 STUP NONE - User# 01

NOWAIT usrsema enabled

Note: When the repeat (-r) option is used, the utility can be stopped by sending it a SIGINT

signal.

See Also

c-treeACE Server Status Monitoring Utility, ctsysm

(http://docs.faircom.com/doc/ctserver/34515.htm) in the c-tree Server Administrator's Guide

2.18 cttrap - Communications Trap Playback utility

Usage cttrap <Trap Comm Log File Name> [-p <password_file>][-x] [<Server>]

Where:

<TrapCommLogFileName> - the name of the file to be played back.

Administrative Utilities - Client

All Rights Reserved 24 www.faircom.com

<ServerName> - the optional name of the server.

-p <password_file> - use a text file containing a list of user names and passwords, one per

line (see Using a Password File, below).

-x - skip serialization. cttrap serializes all the recorded operations and enforces the original

call ordering when allowing multiple client threads to replay the original operation. The -x

option allows for faster replay, although it increases the likelihood of causing errors or

differences in the final state of the data that did not exist in the original.

Description

cttrap is a multi-threaded client application that "plays back" a TRAP_COMM log file. Whenever

a multi-threaded Client library is created, cttrap will also be generated. The default TRAP_COMM

file name is TRAPCOMM.FCS.

When the DIAGNOSTICS TRAP_COMM keyword is active, the trap file, TRAPCOMM.FCS, is

created in the server directory by default. To prepend a path onto the trap file name (to route it to

a separate disk or directory), add an entry of the form DIAGNOSTIC_STR <trap file path>.

For example, if the trap file is located in /bigdisk/TRAPCOMM.FCS, the configuration file needs to

contain the following:

DIAGNOSTIC_STR /bigdisk/

Using a Password File

To allow cttrap to connect to a password-protected server when reading from a

TRAPCOMM.FCS file, use the -p <password_file> option to specify the name of a text file

containing a list of user names and passwords, one per line. For example, the file pass.txt might

contain the entries:

ADMIN ADMIN

myusername mypswd

Then cttrap can be run as follows:

cttrap TRAPCOMM.FCS -p pass.txt FAIRCOMS

The passwords must match the passwords on the server where the playback occurs, not

necessarily where the playback was recorded.

Up to 16 user user name/password entries can be specified in the cttrap password file. If you

wish to support more entries, change #define MAXUPW in cttrap.c and recompile the utility.

See Also

DIAGNOSTICS TRAP_COMM in the c-treeACE Server Administrator's Guide

(https://docs.faircom.com/doc/ctserver/#37035.htm)

How to Reproduce a Problem Using TRAPCOMM.FCS in the FairCom knowledgebase.

(https://docs.faircom.com/doc/knowledgebase/#74044.htm)

Administrative Utilities - Client

All Rights Reserved 25 www.faircom.com

2.19 cttrap - TRAP_COMM Utility

The DIAGNOSTICS TRAP_COMM Server keyword allows developers to ‘record’ the communication

traffic coming in to a Server and play it back with the cttrap utility.

DIAGNOSTICS TRAP_COMM

When activated, the DIAGNOSTICS TRAP_COMM keyword instructs the Faircom Server to log

incoming communications packets to TRAPCOMM.FCS prior to execution. This log can be

played back using the cttrap utility and a debug Server to observe the results of the client

requests, allowing the developer to exactly duplicate and repeat client activities.

For information about using this utility and the DIAGNOSTICS TRAP_COMM keyword to

reproduce issues, see How to Reproduce a Problem Using TRAPCOMM.FCS

(https://docs.faircom.com/doc/knowledgebase/#74044.htm) in the FairCom knowledgebase.

cttrap Utility

Usage cttrap <Trap Comm Log File Name> [-p <password_file>][-x] [<Server>]

Where:

<TrapCommLogFileName> - the name of the file to be played back.

<ServerName> - the optional name of the server.

-p <password_file> - use a text file containing a list of user names and passwords, one per

line (see Using a Password File, below).

-x - skip serialization. cttrap serializes all the recorded operations and enforces the original

call ordering when allowing multiple client threads to replay the original operation. The -x

option allows for faster replay, although it increases the likelihood of causing errors or

differences in the final state of the data that did not exist in the original.

Description

cttrap is a multi-threaded client application that "plays back" a TRAP_COMM log file. Whenever

a multi-threaded Client library is created, cttrap will also be generated. The default TRAP_COMM

file name is TRAPCOMM.FCS.

When the DIAGNOSTICS TRAP_COMM keyword is active, the trap file, TRAPCOMM.FCS, is

created in the server directory by default. To prepend a path onto the trap file name (to route it to

a separate disk or directory), add an entry of the form DIAGNOSTIC_STR <trap file path>.

For example, if the trap file is located in /bigdisk/TRAPCOMM.FCS, the configuration file needs to

contain the following:

DIAGNOSTIC_STR /bigdisk/

Using a Password File

To allow cttrap to connect to a password-protected server when reading from a

TRAPCOMM.FCS file, use the -p <password_file> option to specify the name of a text file

containing a list of user names and passwords, one per line. For example, the file pass.txt might

contain the entries:

Administrative Utilities - Client

All Rights Reserved 26 www.faircom.com

ADMIN ADMIN

myusername mypswd

Then cttrap can be run as follows:

cttrap TRAPCOMM.FCS -p pass.txt FAIRCOMS

The passwords must match the passwords on the server where the playback occurs, not

necessarily where the playback was recorded.

Up to 16 user user name/password entries can be specified in the cttrap password file. If you

wish to support more entries, change #define MAXUPW in cttrap.c and recompile the utility.

See Also

DIAGNOSTICS TRAP_COMM in the c-treeACE Server Administrator's Guide

(https://docs.faircom.com/doc/ctserver/#37035.htm)

How to Reproduce a Problem Using TRAPCOMM.FCS in the FairCom knowledgebase.

(https://docs.faircom.com/doc/knowledgebase/#74044.htm)

Administrative Utilities - Client

All Rights Reserved 27 www.faircom.com

2.20 cttrnmod - Change Transaction Mode Utility

cttrnmod allows an advanced user to change the transaction status of a c-treeACE data file and

its associated index files. The utility can also be used to display the transaction status of a c-tree

data file and its associated indices.

It is expected only advanced database administrators will run this utility.

Usage cttrnmod (set <tranmode>|get) (-d <database>|-f <filelist>)

[-u <userid>] [-p <password>] [-s <servername>] [-n <sect>]

Where

set <tranmode> - Set the transaction mode to one of the following:

• T - Full Transaction Control

• P - Partial Transaction Control (No Recoverability)

• N - No Transaction Control (No Recoverability)

repl=on - Enable replication (requires full transaction control).

repl=off - Disable replication.

The following extended header attributes may also be set:

• {+,-}R - {Enable,Disable} Restorable deletes

• {+,-}C - {Enable,Disable} Transaction controlled deletes

• {+,-}A - {Enable,Disable} Auto transaction switching.

get - Display the current transaction mode.

-d or -f - Operate on all files in the database or all listed files:

• -d <database> - Operate on all files in the c-tree database <database>.

• -f <filename> - Operate on all files listed in the file <filelist>.

-u <userid> - Specify c-tree user ID.

-p <password> - Specify c-tree user password.

-s <servername> - Specify c-treeACE Server name to connect to. Default: FAIRCOMS

-n <sect> - Specify node sector size. Default: 64 (PAGE_SIZE=8192)

The files to change are specified by either the -d <database> option or the -f <filelist> option. The

-d <database> option specifies the name of a c-tree database -- when this option is specified, the

utility operates on all files referenced in that database (excluding SQL system data and index

files). The -f <filelist> option specifies the name of a text file containing names of c-tree data files,

one per line -- when this option is specified, the utility operates on all files specified in that text

file.

Note: Indices created with ctPREIMG or ctTRNLOG are physically structured differently than indices that do not support transactions. Thus a non-tran index cannot be converted to transaction control, and must be rebuilt after the conversion. If an index file is created ctPREIMG or ctTRNLOG, it can be accessed in all transaction and non-transaction access modes.

Administrative Utilities - Client

All Rights Reserved 28 www.faircom.com

Important Performance Considerations

When turning transaction processing off for a file, it is possible to take an even larger

performance hit under specific c-treeACE Server configurations. Be sure to remove or comment

out the line COMPATIBILITY FORCE_WRITETHRU from your c-treeACE Server configuration file

ctsrvr.cfg. While this option provides only the safest of data integrity for your non-transaction

processing controlled files, it forces an enormous performance penalty for doing so. This keyword

has historically been included by default with most c-treeACE Server installations.

Example

The following example demonstrates turning off transaction control for all c-tree data files and

their associated index files in the rdsdb database:

# cttrnmod set N -d rdsdb

Setting transaction mode to NON_TRAN for files in database rdsdb...

Tranmode Filemode Filename

-------- -------- --------

NON-TRAN 0x0000 .\rdsdb.dbs\admin_deptbl.dat

NON-TRAN 0x0000 .\rdsdb.dbs\admin_deptbl.idx

NON-TRAN 0x0000 .\rdsdb.dbs\admin_dept_multi_ndx.idx

NON-TRAN 0x0000 .\rdsdb.dbs\admin_dept_ndx.idx

NON-TRAN 0x0000 .\rdsdb.dbs\admin_emptbl.dat

NON-TRAN 0x0000 .\rdsdb.dbs\admin_emptbl.idx

NON-TRAN 0x0000 .\rdsdb.dbs\admin_emp_no_ndx.idx

NON-TRAN 0x0000 .\rdsdb.dbs\admin_emptbl1.dat

NON-TRAN 0x0000 .\rdsdb.dbs\admin_emptbl1.idx

NON-TRAN 0x0000 .\rdsdb.dbs\admin_emp_no_ndx1.idx

VERIFYING No Transaction Control...

VERIFY succeeded

3 Data Files Updated

0 Errors

The following example demonstrates reading the transaction status of the data and index files in

the rdsdb database:

# cttrnmod get -d rdsdb

Reading transaction mode for files in database rdsdb...

Tranmode Filemode Filename

-------- -------- --------

ctTRNLOG 0x0031 .\rdsdb.dbs\admin_deptbl.dat

ctTRNLOG 0x0031 .\rdsdb.dbs\admin_deptbl.idx

ctTRNLOG 0x0031 .\rdsdb.dbs\admin_dept_multi_ndx.idx

ctTRNLOG 0x0031 .\rdsdb.dbs\admin_dept_ndx.idx

ctTRNLOG 0x0031 .\rdsdb.dbs\admin_emptbl.dat

ctTRNLOG 0x0031 .\rdsdb.dbs\admin_emptbl.idx

ctTRNLOG 0x0031 .\rdsdb.dbs\admin_emp_no_ndx.idx

ctTRNLOG 0x0031 .\rdsdb.dbs\admin_emptbl1.dat

ctTRNLOG 0x0031 .\rdsdb.dbs\admin_emptbl1.idx

ctTRNLOG 0x0031 .\rdsdb.dbs\admin_emp_no_ndx1.idx

Administrative Utilities - Client

All Rights Reserved 29 www.faircom.com

ctTRANMODE Control (c-treeACE V11 and c-treeRTG V2 and later)

When using the Transaction Control utility, cttrnmod, to disable transaction support on a file with

extended file mode ctTRANMODE, the utility could report that after successfully disabling

ctTRNLOG, the file still has ctTRNLOG set. This is expected for a file with the ctTRANMODE bit

set when using a TRANPROC c-tree application.

cttrnmod has been updated to disable ctTRANMODE and ctPIMGMODE bits when it sets a file

to no-transaction support. It was also modified to support explicitly enabling or disabling one of

these bits (depending on the file mode that is in effect at the time).

Replication

New replication actions have been added to the cttrnmod utility for flexible control of replication

attributes.

cttrnmod now displays replication state for a data file

cttrnmod can change a file's replication state with the repl option

Note: Replication requires that the data file has a unique index and that the data and index files are using full (ctTRNLOG) transaction control.

Examples

1. Enable full transaction logging on files:

# cttrnmod set T -f files.txt -u ADMIN -p ADMIN -s FAIRCOMS

Setting transaction mode to ctTRNLOG for files listed in file

files.txt...

Replicate Tranmode Filemode Filename

--------- -------- -------- --------

NO ctTRNLOG 0x0032 ctreesql.dbs\admin_t.dat

ctTRNLOG 0x0032 ctreesql.dbs\admin_t.idx

ctTRNLOG 0x0032 ctreesql.dbs\admin_t_ti.idx

Note the "Replicate" column for current replication state information.

2. Enable replication on files:

# cttrnmod set repl=on -f files.txt -u ADMIN -p ADMIN -s FAIRCOMS

Enabling replication for files listed in file files.txt...

Replicate Tranmode Filemode Filename

--------- -------- -------- --------

YES ctTRNLOG 0x0032 ctreesql.dbs\admin_t.dat

ctTRNLOG 0x8032 ctreesql.dbs\admin_t.idx

Administrative Utilities - Client

All Rights Reserved 30 www.faircom.com

ctTRNLOG 0x8032 ctreesql.dbs\admin_t_ti.idx

Note: If cttrnmod is used to disable full transaction logging for a file, it also disables replication

for that file.

2.21 dbdump - Data Unload Utility

The dbdump utility writes the data in a database to a file. The format of the exported data is

specified by the record description given in an input command file.

The dbdump command accepts the commands file name, the database name and a command

option.

Syntax dbdump -f commands_file [-u user_name] [-a password] [-n] [-z] [-p] [-l] database_name

Options

-f commands_file - Specifies the file containing dbdump commands.

-u user_name - The user name c-treeSQL uses to connect to the database. If omitted, the

default value depends on the environment. (On UNIX, the value of the DH_USER

environment variable specifies the default user name. If DH_USER is not set, the value of the

USER environment variable specifies the default user name.)

-a password - The password c-treeSQL uses to connect to the database. If omitted, the

default value depends on the environment. (On UNIX, the value of the DH_PASSWD

environment variable specifies the default password.)

-n - Parse the commands file and display errors, if any, without exporting data. If the

parsing is successful, the following message displays on stdout:

No errors in the commands file.

-z (V10.3 and later) - The number of records to fetch per call is controlled by the -z switch.

To be consistent with the switch of dbload, it defaults to 1.

-l (V10.3 and later) - The -l switch controls the progress output frequency in terms of record

reads (the output is generated whenever the number of record reads since the last output

becomes greater than or equal to the specified value).

-p (V10.3 and later) - The dbdump -p command-line switch activates the new query

passthru mechanism, which does not perform any major change in the query. When this

switch is in use, dbdump interprets the query in the command file, converts it to lowercase,

and wraps everything that is considered an identifier with double-quotes. This can cause a

syntax error if the command file contains functions. For example, consider the following

statement:

SELECT RTRIM(cm_custnumb),...

The default behavior of dbdump results in the following statement, which would cause a

syntax error:

select "rtrim" ( "cm_custnumb" ) ,...

Using the dbdump -p switch results in this statement, which does not cause an error:

Administrative Utilities - Client

All Rights Reserved 31 www.faircom.com

select rtrim ( cm_custnumb ) ,...

database_name - Name of the database.

-B - Use BOM (Unicode Byte Order Mark) in output file.

Unicode

The dbdump Data Unload and dbload Data Load utilities properly dump and load data out of a

Unicode-enabled c-treeACE SQL Server. The commands file must be in ASCII format. The output

file generated by dbdump is in Unicode format with an optional Byte Order Mark (BOM)

indicating the Unicode encoding form (using the -B command-line switch).

The input file for dbload needs to be in Unicode (native "wchar" encoding form) with an optional BOM, in which case the utilities check for the proper format. See Also

Data Unload Utility: dbdump (http://docs.faircom.com/doc/isql/32623.htm) in the c-treeSQL

ISQL Tools and Reference Guide

2.22 dbload - Data Load Utility

The dbload utility loads records from an input data file into tables of a database. The format of

the data file is specified by a record description given in an input commands file.

The dbload command does not directly specify an input file, but instead names a commands file

that in turn specifies data input files. The dbload command accepts the commands file name, the

database name, and a list of command options.

Syntax dbload -f commands_file [ options ] database_name

-f commands_file - Specifies the file containing dbload commands.

options - One or more of the options as described below

database_name - Name of the database.

Options

-u user_name - The user name c-treeSQL uses to connect to the database. If omitted, the

default value depends on the environment. (On UNIX, the value of the DH_USER

environment variable specifies the default user name. If DH_USER is not set, the value of the

USER environment variable specifies the default user name.)

-a password - The password c-treeSQL uses to connect to the database. If omitted, the

default value depends on the environment. (On UNIX, the value of the DH_PASSWD

environment variable specifies the default password.)

-z maximum multiple inserts - The maximum number of records to be inserted at one time

in each bulk insert (used to improve performance)

-l logfile - Specifies the file into which the error logging is done. stderr is the default.

dbload also writes statistics to the file:

• Number of records read

Administrative Utilities - Client

All Rights Reserved 32 www.faircom.com

• Number of records skipped

• Number of records loaded

• Number of records rejected

-b badfile - The file into which the bad rows that were not loaded, are written. By default

badfile is put in the current directory.

-c commit_frequency - Store the specified number of records before committing the

transaction. The default frequency is 100 records.

-e maxerrs - The maximum number of tolerable errors. The default number is 50 errors.

-s skipcount - Skip the specified number of rows in the first data file. If multiple files are

specified, the rows are skipped only in the first file. The default number is zero rows.

-m maxrows - Stop storing rows at the specified number.

-n - Parse the commands file and display errors, if any, without doing the database load. If

the parsing is successful, the following message displays on stdout: "No errors in the

commands file."

Unicode

The dbdump Data Unload and dbload Data Load utilities properly dump and load data out of a

Unicode-enabled c-treeACE SQL Server. The commands file must be in ASCII format. The output

file generated by dbdump is in Unicode format with an optional Byte Order Mark (BOM)

indicating the Unicode encoding form (using the -B command-line switch).

The input file for dbload needs to be in Unicode (native "wchar" encoding form) with an optional

BOM, in which case the utilities check for the proper format.

See Also

Data Load Utility: dbload (http://docs.faircom.com/doc/isql/32580.htm) in the c-treeSQL ISQL

Tools and Reference Guide

2.23 dbschema - Schema Export Utility

The dbschema utility generates c-treeACE SQL statements to recreate the specified database

elements and data.

The c-treeACE SQL utility, dbschema, recreates specified database elements and data.

Syntax dbschema [ -h ] [ -d ] [-u user_name ] [-a password ] [ -o outfile ]

[ -p [ user_name.]procedure_name [ , ... ] ]

[ -t [ user_name.]table_name [ , ... ] ]

[ -T [ user_name.]trigger_name [ , ... ] ]

[ database_name ]

Administrative Utilities - Client

All Rights Reserved 33 www.faircom.com

Description

Generates c-treeSQL statements to recreate the specified database elements and data. If the

dbschema statement omits all arguments, it displays definitions for all elements (tables, views,

indexes, procedures, and triggers) for the default database on the screen.

Options

-h - Displays brief online help of dbschema syntax and options.

-d - In conjunction with the -t option, specifies that dbschema generates c-treeSQL

INSERT statements for data in the tables, in addition to CREATE statements. The output of

the dbschema command invoked with the -d option can be directed to a command file and

executed in interactive c-treeSQL to duplicate and load table definitions.

-u user_name - The user name c-treeSQL uses to connect to the database. c-treeSQL

verifies the user name against a corresponding password before it connects to the database.

If omitted, the default value depends on the environment. (On UNIX, the value of the

DH_USER environment variable specifies the default user name. If DH_USER is not set, the

value of the USER environment variable specifies the default user name.)

-a password - The password c-treeSQL uses to connect to the database. c-treeSQL

verifies the password against a corresponding user name before it connects to the database.

If omitted, the default value depends on the environment. (On UNIX, the value of the

DH_PASSWD environment variable specifies the default password.)

-o outfile - Redirects the output to the specified file. The default is standard output.

-t [ user_name.]table_name [ , ... ] - A comma-separated list of tables and views for which

definitions should be generated. Specify a list of specific tables, or use the % to generate

definitions for all tables.

Note: With the -t option, the % character is not a true wildcard character. It substitutes for the entire table_name argument and cannot be used for pattern matching within in a character string. This differs from the behavior of the % in the -p and -T options.

By default, dbschema generates definitions for tables owned by the current user. Use the

optional user_name qualifier to specify a table owned by a different user.

-p [ user_name.]procedure_name [ , ... ] - A comma-separated list of stored procedures for

which definitions should be generated. The table names in the list can include the ‘%’ and

underscore, ‘ _ ’, characters, which provide pattern-matching semantics:

• The ‘%’ matches zero or more characters in the procedure name

• The underscore ‘ _ ’ matches a single character in the procedure name

By default, dbschema generates definitions for procedures owned by the current user. Use

the optional user_name qualifier to specify a procedure owned by a different user.

-T [ user_name.]trigger_name [ , ... ] - A comma-separated list of triggers for which

definitions should be generated. The table names in the list can include the ‘%’ and

underscore ‘ _ ’ characters, which provide pattern-matching semantics:

• The ‘%’ matches zero or more characters in the trigger name

• The underscore ‘ _ ’ character matches a single character in the trigger name

By default, dbschema generates definitions for triggers owned by the current user. Use the

optional user_name qualifier to specify a trigger owned by a different user.

database_name - The database for which dbschema should generate definitions. If you

omit database_name, dbschema uses the default database, if specified. (How you define the

Administrative Utilities - Client

All Rights Reserved 34 www.faircom.com

default database varies between operating systems. On UNIX, the value of the DB_NAME

environment variable specifies the default database.)

See Also

Schema Export Utility: dbschema (http://docs.faircom.com/doc/isql/32653.htm) in c-treeSQL

ISQL Tools and Reference Guide

2.24 ISQL

The c-treeACE SQL Interactive SQL utility (ISQL) provides an industry-standard "command

processing" interface to the c-treeACE SQL Database Engine.

FairCom offers two separate implementations of Interactive SQL:

1. A command-line version (isql.exe or isql). This utility is designed as a command-line tool and can be placed in job streams.

2. A GUI tool version within the Windows program c-treeACE SQL Explorer.

Either implementation allows you to issue SQL statements directly from a command prompt for

immediate displayed results. You can use Interactive SQL to:

Learn how SQL statements work;

Test and prototype SQL statements to be embedded in programs;

Modify an existing database with data definition statements;

Perform ad-hoc queries and generate formatted reports with special ISQL formatting

statements;

Run existing SQL scripts.

With few exceptions, you can issue any SQL statement in ISQL that can be embedded in a

program, including CREATE, SELECT, and GRANT statements. Interactive SQL includes an

online help facility with syntax and descriptions of the supported statements.

To learn more, view the manual online: c-treeSQL ISQL Tools and Reference Guide

(http://docs.faircom.com/doc/isql/#cover.htm)

2.25 sa_admin - Command-line security administration utility

The command-line version of the system administrator program, sa_admin, can be used to

perform many user operations directly from shell scripts.

sa_admin [-a<adminuserid>] [-p<adminpassword>] [-f<filepassword>] [-s<servername>] <option>

option is one of the following:

Options Users

-oua Add a user account

-oud Change user account description

Administrative Utilities - Client

All Rights Reserved 35 www.faircom.com

-oue Change user account extended settings

-oug Add a user to a group

-oul List user accounts

-oum Change user account memory limit

-oup Change user account password

-our Delete a user account

-ous Show user account information

-oux Remove a user from a group

Options Group

-oga Add a group

-ogd Change group description

-ogl List groups

-ogm Change group memory limit

-ogr Delete a group

-ogs Show group information

Options File

-ofg Change file group

-ofl List files matching filename

-ofo Change file owner

-ofp Change file password

-ofs Change file permissions

Wildcard specifiers with sa_admin

sa_admin, -ofp, -ofs, -ofg, and -ofo options support specifying filenames with wildcard

characters. When one of these options specifies a filename that includes ? or * characters, the

utility retrieves a list of files matching the filename wildcard specifier and executes the specified

command for each file.

Retrieve a List of Filenames from the server with sa_admin

-ofl (list files) is used to list the files on the c-treeACE Server system matching the specified

filename including wildcard characters.

sa_admin Support for Encrypted Password Files

This utility supports the use of an encrypted password file. Encrypted password files keep user

IDs and passwords from plain view when the utility is used within a script file. They are created

with the ctcmdset utility. The plain text form of the file should be:

; User Id

USERID ADMIN

; User Password

PASSWD <pass>

The encrypted password file name is specified using the command-line option:

-1 <filename>

Administrative Utilities - Client

All Rights Reserved 36 www.faircom.com

ADMINISTRATOR OPTIONS

-a System administrator User ID.

-p System administrator password.

-f Optional server system file password.

-s Optional server name.

Note: There is no space between the switch and its parameter.

USER OPTIONS

The following options, all beginning with -ou, allow changes to user information. Additional group

and file options are described below.

Note: To use any optional entry, you must use all the previous entries even if they would otherwise be optional. For example, to add a user with the -oua option and specify a group, you must also enter the userid, desc, and password.

Option User Add -oua <userid> [-d <desc>] [-w <password>] [-g <group>] [-m <memory>[<rule>]]

[-b <begdat>] [-e <enddat>] [-l <loglimit>] [-r <rsmlogon>] [-t <mstlogon>]

userid: User id (required)

-d desc: Optional user description

-w password: Optional user password

-g group: Optional user group

-m memory: Optional user memory limit.

• rule: Optional user memory rule. Used only with memory. The optional <rule> is A for

absolute, D for default, or G for guideline (example -m 10485760a specifies an absolute

memory limit of 10 MB). NULL for Default.

-b begdat: Optional starting validity date. Specify as mm/dd/yyyy. NULL for Default.

-e enddat: Optional ending validity date. Specify as mm/dd/yyyy. NULL for Default.

-l loglimit: Optional maximum invalid logon attempts. NULL for Default.

-r rsmlogon is the logon block period in minutes. Specifying a value of “block” (e.g., -r block)

blocks the account indefinitely (until it is unblocked by an administrator, and specifying a

value of “unblock” (e.g., -r unblock) unblocks the account immediately.

-t mstlogon is the interval in minutes during the user must logon at least once, otherwise the

account is blocked.

Option User Remove -our userid

userid: User id (required)

Option User List -oul

Administrative Utilities - Client

All Rights Reserved 37 www.faircom.com

Option User Change Password -oup userid password

userid: User id (required)

password: New password (required)

Option User Add user to Group -oug userid group

userid: User id (required)

group: Group name (required)

Option User (group) Extract - Remove a user from a group. -oux userid group

userid: User id (required)

group: Group name (required)

Option User Change Description -oud userid desc

userid: User id (required)

desc: New user description

Option User Memory -oum userid memory rule

userid: User id (required)

memory: New memory limit. This can be a number of bytes or ‘D’ for default or left NULL for

no limit

rule: Optional user memory rule. Used only with memory. This may be ‘A’ for Absolute, ‘G’

for Guideline, ‘D’ for Default, or NULL for Default

Option User Change Extended Settings -oue <userid> [-b <begdat>] [-e <enddat>] [-l <loglimit>] [-r <rsmlogon>] [-t <mstlogon>]

userid: User id (required)

-b begdat: Optional starting validity date. Specify as mm/dd/yyyy. NULL for Default

-e enddat: Optional ending validity date. Specify as mm/dd/yyyy. NULL for Default

-l loglimit: Optional maximum invalid logon attempts. 0 for Default. -1 to disable invalid logon

check.

-t mstlogon: Optional must logon period, e.g., how often the user must log on to remain

active. The interval in minutes during the user must logon at least once, otherwise the

account is blocked. Specify as number of minutes. NULL for Default. -1 to disable must logon

period.

-r rsmlogon: Optional logon timeout remaining. If a user has been denied access to the

c-treeACE Server due to excessive invalid logon attempts, you can adjust the remaining user

lockout time here. Specify as number of minutes. NULL to leave unchanged. Specifying a

value of “block” (e.g., -r block) blocks the account indefinitely (until it is unblocked by an

administrator), and specifying a value of “unblock” (e.g., -r unblock) unblocks the account

immediately.

Administrative Utilities - Client

All Rights Reserved 38 www.faircom.com

Option User Show -ous userid

userid: User id (required)

GROUP OPTIONS

The following options, all beginning with -og, allow changes to group information. Additional user

and file options are described elsewhere.

Note: To use any optional entry, you must use all the previous entries. For example, to specify a rule when adding a group with the -oga option, you must also enter the desc and memory options

for the group.

Option Group Add -oga <groupid> [-d <desc>] [-m <memory>][<rule>]]

groupid: Group id (required)

-d desc: Optional group description

memory is the memory limit and the optional <rule> is A for absolute, D for default, or G for

guideline (example -m 10485760a specifies an absolute memory limit of 10 MB).

Option Group Remove -ogr groupid

groupid: Group id (required)

Option Groups List -ogl

Option Group Change Description -ogd groupid desc

groupid: Group id (required)

desc: New group description

Option Group Memory -ogm groupid [-m <memory>[<rule>]]

groupid: Group id (required)

-m memory: New memory limit. memory is the memory limit

• <rule> (optional) is A for absolute, D for default, or G for guideline (example -m

10485760a specifies an absolute memory limit of 10 MB).

Option Group Show -ogs groupid

groupid: Group id (required)

Administrative Utilities - Client

All Rights Reserved 39 www.faircom.com

FILE OPTIONS

The following options, all beginning with -of, allow changes to file information. Additional user and

group options are described elsewhere.

Option File Password -ofp filename password

filename: File name (required)

password: File password (required)

Option File Security (permissions) -ofs <filename> <permission> ...

-ofs +|-<permission> ...

filename: File name (required)

permission: File permission mask.

To set a permission, set the byte at the corresponding offset to a value of ‘+’.

To reset a specified permission, set the corresponding byte to ‘-’.

For example, the string “+++++-----+++++” sets all OWNER and WORLD permissions, and

clears all GROUP permissions.

This field is interpreted as a 15-byte permission mask containing owner, group, and world

permissions:

(offset)

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14

----OWNER---- ----GROUP---- -----WORLD----

r w f d p r w f d p r w f d p

r = Read w = Write f = define d = Delete p = noPass

permission can also be one of the following:

ownerall, ownerread, ownerwrite, ownerdefine, ownerdelete, ownernopass,

groupall, groupread, groupwrite, groupdefine, groupdelete, groupnopass,

worldall, worldread, worldwrite, worlddefine, worlddelete, worldnopass

Options are evaluated left to right. For example, specifying -groupwrite +groupwrite has the

effect of adding the groupwrite permission, and specifying +worldall -worldread turns on all

world permissions except read permission.

Option File Group -ofg filename groupid

filename: File name (required)

groupid: File group id (required)

Option File Owner -ofo filename owner

filename: File name (required)

owner: File owner (required)

Examples of -ofs usage:

-ofs <filename> <permmask> is the same as current usage:

-ofs test.dat ++++++++++-----

Administrative Utilities - Client

All Rights Reserved 40 www.faircom.com

-ofs <filename> <permission> ... sets the file permissions to the specified permissions.

The following command sets all owner and group permissions and resets all world permissions:

-ofs test.dat ownerall groupall

-ofs <filename> +|- <permission> ... adds/removes specified permissions to/from

current file permissions. The following command adds the worldread permission to the current file

permissions and removes the groupwrite permission from the current file permissions:

-ofs test.dat +worldread -groupwrite

All Rights Reserved 41 www.faircom.com

3. Administrative Utilities - Standalone

These standalone utilities are intended for administrators. They are located in the following folder:

All tools:

All command-line tools:

All administrative tools:

Client-side administrative tools

Standalone administrative tools tools\cmdline\admin\standalone

All other utilities:

Client-side utilities

Low-level utilities

Standalone utilities

Note: The exact set of tools and utilities and their directory structure depends on the FairCom product you have installed.

3.1 ctcfgset - Server Configuration File Encoding Utility

The ctcfgset utility converts the standard ASCII-text configuration file, ctsrvr.cfg, into an encoded

settings file, ctsrvr.set. The utility takes as its argument the name of a configuration file, ctsrvr.cfg,

to be converted into a tamper-proof settings file, ctsrvr.set. This creates an optional tamper-proof

version of the server configuration file, referred to as the "settings" file. Because entries in the

settings file cannot be overridden, users cannot alter important aspects of the server

configuration.

Usage: ctcfgset ctsrvr.cfg

Administrative Utilities - Standalone

All Rights Reserved 42 www.faircom.com

3.2 ctcmdset - Configuration File Encoding Utility

Creates an encrypted password file from a text file by encoding a *.cfg file into a *.set file. The file

to be processed should have an extension of .cfg.

Usage: ctcmdset [filename].cfg

3.3 ctcpvf - Master Password Verification File Utility

c-treeACE advanced encryption (AES, Blowfish, Twofish, 3DES) requires a master password to

protect encrypted file access. Before starting c-treeACE for the first time with Advanced

Encryption enabled, the Administrator must use the ctcpvf utility to create the master password

verification file. Each time c-treeACE starts, it prompts for the master password to allow it to open

encrypted files.

ctcpvf creates the master password verification file. It accepts optional parameters: filename (the

file name to create) and password (the master password). If the parameters are not given, ctcpvf

will prompt for the required information.

Usage ctcpvf [-c <cipher>] [-f <filename>] [-k <key>] [-s <store>]

Where:

-c <cipher> - Use encryption cipher <cipher>. Supported ciphers: aes256 and aes128.

Default is aes256.

-f <filename> - Create password verification file <filename>. Default is ctsrvr.pvf.

-k <key> - Use <key> as the master key.

-s [<store>] - Store key in encrypted file <store>. Default is ctsrvr.fkf.

-syslevel - (V11 and later) Create encrypted store file with system-level encryption: all user

accounts on the system can decrypt it.

Note: If you don't use the -syslevel switch, you must run the c-treeACE Server under the same user account that was used to run the ctcpvf utility that created the master key store file. Using the -syslevel switch creates the master key store file so that it can be opened by any user account on that machine, which allows you to run the c-treeACE Server under any user account on the system. (See Advanced encryption master key store encrypted at system level on

Windows.)

Note: c-treeACE looks for the file ctsrvr.pvf in the server binary area, so this file name should be specified.

Administrative Utilities - Standalone

All Rights Reserved 43 www.faircom.com

Key Store Option

By default, this master key must be presented to c-treeACE on startup as prompted. However,

this prompted interaction is not always possible. Consider the case of a failover strategy for

business continuity, or the case where no single person should ever know the complete key as

keys are built from random secure key generators. c-treeACE supports a key store file to provide

this key value at startup.

The ctcpvf utility -s option is used to select the master key length, and to write the master key to

an encrypted keystore file <store>.

The c-treeACE configuration option MASTER_KEY_FILE specifies the key store file, <store>, from

which c-treeACE reads the master encryption key. On Linux and Unix systems, the master key is

stored AES encrypted in a file on disk, with permissions set such that only the user that created

the file can read it (permissions are set to 400). For complete security, it is important to use file

system access safeguards to fully protect this key store file.

Note: The key file (or user key on Linux and Unix) is encrypted using AES. The encryption is intended to only prevent casual inspection of the data when the file's contents are viewed. The permissions on the file are the defense against an unauthorized user reading the file. The Windows master key approach uses the Microsoft DPAPI to encrypt data with user credentials, and only that user can decrypt the file. Unix support is a bit weaker in this regard as it relies on file permissions, which can potentially be changed such that another user could read and decrypt the key.

3.4 ctfchk - File Checksum Utility

ctfchk is a standalone c-tree utility that calculates the checksum on all active records in a

fixed-length c-tree data file. It reads active records from a fixed-length c-tree data file in physical

order and outputs a checksum and active record count. The utility uses the CRC-32 algorithm to

compute the checksum.

This utility can be used to compare the record contents of two fixed-length data files. Two c-tree

data files that contain the same active record images in the same order will generate identical

checksums. Two c-tree data files whose active record contents differ will generate different

checksums (subject to the limitations of the CRC-32 algorithm).

Usage ctfchk <filename> [-skpchk] [-logcrc] [-logbyt]

[-logrec <record number>] [-opencrpt]

Where:

-logcrc - Output the current CRC after each active record is read.

-logbyt - Output the offset of each active record.

-logrec <record_number> - Output the contents of the specified record. The first active record

in the file in physical order is record 1.

-opencrpt - Permits the utility to open a file whose update flag is set.

Administrative Utilities - Standalone

All Rights Reserved 44 www.faircom.com

When the file is already opened by another instance (Server, for instance), trying to open it to

calculate the checksum will fail with error FCRP_ERR (14, File Corrupt at Open). If the -opencrpt

option is added, the utility tries to open the file using the ctOPENCRPT filemode. If this second

open attempt succeeds, the utility outputs the following message and proceeds to calculate the

checksum of all active records in the file:

NOTE: This file's update flag is set. Opened file using ctOPENCRPT mode.

3.5 cthghtrn - Displays the high-water mark for transactions

This utility displays the high-water transaction marks within an index file. This would be typically

used when the c-treeACE Server transaction mark number gets too large.

Usage cthghtrn [-<page size in bytes (e.g., -1024)>] <file name> [-nonzero]

Where:

-nonzero - outputs only the non-zero transaction high water mark values.

Examples cthghtrn custmast.idx

cthghtrn -4096 custmast.idx

See also

ctclntrn Utility - Clean Transaction Mark (page 67,

http://docs.faircom.com/doc/ctreeplus/#31074.htm)

3.6 ctredirect - IFIL Update Utility for Redirected Filenames

Updates IFIL Filenames for redirection to alternate locations.

The Redirect feature is used to allow a file originating in one directory structure to be repositioned

into another directory location following autorecovery, dynamic dump restore, or replication. As a

result, if the IFIL resource of the file contained a path, this path would be incorrect after the file

was redirected to the new location. To support copying c-tree files from one directory location to

another (on the same system or on a different system) and accessing them in their new location,

it is necessary to update any filename paths in a c-tree data file's IFIL resource.

ctredirect is used to update the file names contained in the IFIL resource of the specified files.

ctredirect accepts as command-line options the name of a text file containing the list of files

whose IFIL resources are to be updated and the name of a text file containing the filename

redirection rules.

A comment may be placed in the redirection rules file by starting the line with a semi-colon (;).

Administrative Utilities - Standalone

All Rights Reserved 45 www.faircom.com

Note: The rules must match the path in the IFIL resource, which may differ from the path used to open the file. The rules must precisely match the path in the IFIL resource, which may differ from the path used to open the file, therefore you may not use wild cards.

Usage ctredirect -f <filenamelist> -r <redirectlist> -n <sect>

Where:

-f <filenamelist> - Name of a text file containing the names of c-tree data files whose IFIL

resources are to be updated.

-r <redirectlist> - Name of a text file containing the redirection rules. The rules are in the

format: <current path> <new path> (see the example below).

-n <sect> - Node sector size. The default is 64, corresponding to the server default

PAGE_SIZE of 8192.

Example

Consider the current directory contains the data files customer.dat and inventory.dat, and their

IFIL resources specify the path /export/home/users/marketing/data for the data and index files.

The current directory contains the file myfiles.txt listing the following file names:

customer.dat

inventory.dat

The current directory also contains the file myrules.txt containing the following redirection rules:

/export/home/users/marketing/data /export/home2/users/support/data

ctredirect is then called to change the paths in the IFIL resource of these two data files:

./ctredirect -f myfiles.txt -r myrules.txt

Updating the file paths in the IFIL resources of the specified files...

[ OK ] customer.dat

[ OK ] inventory.dat

Successfully changed IFIL resource for all specified files

All Rights Reserved 46 www.faircom.com

4. Utilities - Client

These client-side utilities are located in the following folder:

All tools:

All command-line tools:

All administrative tools:

Client-side administrative tools

Standalone administrative tools

All other utilities:

Client-side utilities tools\cmdline\utils\client

Low-level utilities

Standalone utilities

Note: The exact set of tools and utilities and their directory structure depends on the FairCom product you have installed.

4.1 ctinfo - ISAM File Info

Usage ctinfo FileName [-isam] [-rdkeys] [<UserId> [<UserPassword> [<ServerName>]]]

Description

ctinfo retrieves IFIL and DODA structures from a c-treeACE file as well as XCREblk extended

header information if available. This utility is useful in both client-server and standalone mode.

-isam - Open the specified data file in ISAM mode (V10.3 and later). See below.

-rdkeys - If this option is enabled, ctinfo opens the data file and associated indexes at the

ISAM level instead of performing a low-level open, which avoids FRSKEY error: 26. Without

this opion, ctinfo does not cause c-treeACE Server to log replication diagnostics; an ISAM

level file open used by -rdkeys will cause the details to be logged

Note: The ISAM open requires the index files to exist and to be accessible, unlike the

low-level open which requires only the data file to exist.

Utilities - Client

All Rights Reserved 47 www.faircom.com

Authentication File

This utility supports the use of an encrypted password file. Encrypted password files keep user

IDs and passwords from plain view when the utility is used within a script file. They are created

with the ctcmdset utility. The plain text form of the file should be:

; User Id

USERID ADMIN

; User Password

PASSWD <pass>

Use the -a option to specify the name of the encrypted file.

Output

In V10.3 and later, the ctinfo utility displays the owner, group, and permissions for the specified

file. Example output:

File owner = ADMIN

File group = ADMIN

Permission mask = 0x85e = {

owner: read write def delete

group: read

world: read

}

In V10.3 and later, the ctinfo -isam option causes the utility to open the specified data file in

ISAM mode. This option is useful for checking if a REPLICATE keyword enables replication for

the file.

In V11 and later, the ctinfo utility outputs the header record for fixed-length files or the header

key count for each logical index. For example:

Header Count

4776 keys in index 0

4776 keys in index 1

4776 keys in index 2

4.2 ctixmg - Incremental ISAM / Resource sample

Usage ctixmg [<UserID> <UserPassWord> <ServerName>]

Utilities - Client

All Rights Reserved 48 www.faircom.com

Description

ctixmg supports variable-length data records using Incremental ISAM structures to specify the

file parameters for creation and optionally supports resources. If RESOURCES are defined in

ctoptn.h prior to opening the files the proper resource open, OpenFileWithResource(), and

close, CloseRFile(), functions are used. If RESOURCES are not defined, then OpenIFileXtd()

and CloseIFile() are used to open and close the files. The optional UserId, UserPassWord and

ServerName parameters only apply to c-treeACE Server based systems.

ctixmg automatically creates the files it needs if they do not exist. It rebuilds the files if they

appear corrupt. In transaction processing environments, automatic recovery replaces the need for

rebuilding the files.

ctixmg runs in all c-treeACE console-based models. ctixmg permits transaction processing

control including Begin(), and Commit(). In a non-transaction processing system, Begin() and

Commit() are replaced by LockISAM() to control ISAM level locking.

4.3 ctsfex - Superfile Data Export Utility

The ctsfex utility exports data from a superfile to another superfile or to individual files identical to

the superfile members. This high-performance utility exports the data without index updates,

transaction control, or file extension. After the data export is completed, the indices are rebuilt

and transaction control and file extension properties are restored on the newly-created files. This

utility also supports a multi-threaded version allowing each thread to process a superfile member.

Usage:

ctsfex sf1 [-f sf2 | -d dir] [-cCrovV] [-t thds] [-e key]

[-m recs] [-n size] [-T <path>] [-ctscmp <args>]

[-s svn] [-u uid] [-p upw]

Where:

-f sf2 - Export to superfile sf2

-d dir - Export to standard files in directory dir

-c - Create the target files without exporting data.

-C - Create AND export data for _isp@ and .group tables only.

-r - Force replacement (overwrite) of existing files.

-o - Force open of a corrupted file using the ctOPENCRPT file mode.

-v - Open the superfile and its members to validate a superfile.

-V - Used in conjunction with -v, this option validates records with a read.

-m recs - Send record counter to stdout every recs records.

-e key - Encrypt the target files with key

-t threads - Maximum number of concurrent threads to use.

-T <path> - Specify the location of temporary files created by the rebuild operation.

-s server_name - Server name for connecting to the server.

-u userID - User ID for connecting to the server.

-p userpassword - User password for connecting to the server.

-ctscmp <args> - Invoke the superfile compact utility, ctscmp with <args>.

Utilities - Client

All Rights Reserved 49 www.faircom.com

Standalone Usage

In standalone mode an additional option is available to specify the index node size:

-n size - Index node size to use (standalone mode only).

4.4 cttpca - TPC A Test

This is a C code sample program implementing the TPC (Transaction Processing Council) A test

using the c-treeACE ISAM, c-treeDB (CTDB), and ODBC APIs. You can execute the same test

set using any combination of these APIs.

When included with c-treeRTG BTRV Edition, this utility supports the c-treeACE BTRV interface

as a fourth API.

This utility is perfect for benchmarking across computer systems, or for comparing the

performance of these c-treeACE APIs. For full usage information, simply execute the utility

without any parameters.

See ct_tpc (page 49) for a C++ code version.

Note: This program is considered legacy, in favor of the more advanced ct_tpc (page 49)

version.

4.5 ct_tpc - TPC A Test

This is a C++ code sample program implementing the TPC (Transaction Processing Council) A

test using the c-treeACE ISAM, c-treeDB (CTDB), and ODBC APIs. You can execute the same

test set using any combination of these three APIs. For full usage information, simply execute the

utility without any parameters.

When included with c-treeRTG BTRV Edition, this utility supports the c-treeACE BTRV interface

as a fourth API.

This utility is perfect for benchmarking across computer systems, or for comparing the

performance of these c-treeACE APIs.

See cttpca (page 49) for a C code version.

4.6 ctvlqa - Variable-length quality assurance utility

Usage ctvlqa

Utilities - Client

All Rights Reserved 50 www.faircom.com

Description

ctvlqa is designed as a torture and performance test for variable-length records. The program

generates random data to build generic records based on the file structure layout from ctixmg.

ctvlqa prompts the user for the file name, beginning record size, ending record size, record

increment size, and quantity of records to add.

The program does the following:

1. Creates the data file with the desired file name.

2. Adds the first record of the beginning record size.

3. Reads back the record to ensure it was properly inserted into the database.

4. Adds the desired quantity of records, checking each insertion by re-reading.

5. Increments the beginning record size by record increment size and inserts the desired quantity of records for this record size.

Steps 2 - 5 repeat until the ending record size is encountered or an error occurs.

An output log can be created by changing OUTLOG in ctvlqa.c from 0 to 1.

4.7 ISQL

The c-treeACE SQL Interactive SQL utility (ISQL) provides an industry-standard "command

processing" interface to the c-treeACE SQL Database Engine.

FairCom offers two separate implementations of Interactive SQL:

1. A command-line version (isql.exe or isql). This utility is designed as a command-line tool and can be placed in job streams.

2. A GUI tool version within the Windows program c-treeACE SQL Explorer.

Either implementation allows you to issue SQL statements directly from a command prompt for

immediate displayed results. You can use Interactive SQL to:

Learn how SQL statements work;

Test and prototype SQL statements to be embedded in programs;

Modify an existing database with data definition statements;

Perform ad-hoc queries and generate formatted reports with special ISQL formatting

statements;

Run existing SQL scripts.

With few exceptions, you can issue any SQL statement in ISQL that can be embedded in a

program, including CREATE, SELECT, and GRANT statements. Interactive SQL includes an

online help facility with syntax and descriptions of the supported statements.

To learn more, view the manual online: c-treeSQL ISQL Tools and Reference Guide

(http://docs.faircom.com/doc/isql/#cover.htm)

All Rights Reserved 51 www.faircom.com

5. Utilities - Low Level

These low-level utilities are located in the following folder:

All tools:

All command-line tools:

All administrative tools:

Client-side administrative tools

Standalone administrative tools

All other utilities:

Client-side utilities

Low-level utilities tools\cmdline\utils\lowlevel

Standalone utilities

Note: The exact set of tools and utilities and their directory structure depends on the FairCom product you have installed.

5.1 ctalgn - Change Alignment

The ctalgn utility is used to change the creation alignment characteristic of a file by updating the

file's header.

Usage: ctalgn <file name> <alignment constant: 1,2,4,8> [<# sectors>]

5.2 CTCMPC - File compaction

DEPRECATED as of V7. Please use the enhanced ctcmpif (page 68) utility.

Utilities - Low Level

All Rights Reserved 52 www.faircom.com

5.3 ctcnfg - System Configuration Example

This sample demonstrates the SystemConfiguration() function. Upon running the utility, you will

see the main menu with the following choices:

SYSCFG: SystemConfiguration example

1. Dynamic system resources

2. Static system resources

3. FairCom Server only resources

4. Client and Server side resources

5. Pre-initialization resources

Enter the number of your choice to see a display of the current configuration. For example, if you

type the number 2 and then press the Enter key, you will see a display similar to the following:

Static system resources

-----------------------

Maximum c-tree Plus FCBs system wide : 14

Maximum indices per data file : 32

Maximum key segments per index : 12

Press the Enter key to return to the main menu.

To exit from the utility, type q at the main menu and then press the Enter key.

5.4 CTCV43 - Convert V4.3 Data File to c-tree Format ctcv43 <V4.3 data file name> <c-treeACE file name>

This utility converts a data file from c-tree V4.1F-V4.3C to c-treeACE format. It supports the

conversion of files with up to 4 GB in size. Both fixed and variable-length files are supported.

If the new data file does not exist, it will be created. ctcv43 is designed to run in single user

mode.

After converting the data files, you may use the rebuild utility, ctrbld, or function, RebuildIFile(),

to construct the associated index files. If you have stand-alone indices to convert, use ctin43 to

first create a flat key file, and then use ctindx to build the new index file.

Note: ctin43, provided with c-treeACE, must be linked with your c-tree V4.3 application library.

5.5 ctcv67 - Extended File Conversion Utility ctcv67 <old file name> <new path> [<option> <argument> ...]

The first two arguments are required. The new path is prepended to the old file name or the files

in the parameter file. The options are listed in the table later in this topic.

ctcv67 performs various conversions, including:

Converting data and index files from Standard c-treeACE format to Extended c-tree format

(HUGE or non-HUGE) using Incremental ISAM (IFIL) or parameter files.

Utilities - Low Level

All Rights Reserved 53 www.faircom.com

Adding huge file support to a non-huge file.

Adding, removing, or changing segment support.

Automatically compacting the output file.

Note: ctcv67 must be built by FairCom. An executable version is included in the c-treeACE Server installation for each platform, in the Utils folder.

If the original file has an extended header, the new file inherits the extended header attributes.

This utility does not convert a huge file to a non-huge file. If a superfile host is specified, ctcv67

converts all member data files and their associated indices. When a mirrored file is specified, the

conversion does NOT produce the mirrors, but maintains the mirrored names in IFIL structures.

Copy the converted master files to produce the mirror files.

Unless a parameter file is used, a data file must have an embedded IFIL definition for its

associated indices to be converted. A data file will have an embedded IFIL definition if it was

created with one of the CreateIFile() routines or PutIFile() was called for the file.

If an index file is specified by the <old file name> parameter, then a new index file with an

extended header will be created, all the resources will be transferred to the new index, its key

length will be increased if HUGE is specified and the key supports duplicates, but no key values

will be transferred to the new file. In essence, it will be an empty index file.

The following options are available:

Option

Arguments Description

F <yes | no> If yes, <old file name> is a parameter file with file modes set to ctREADFIL (8) and the second parameter (# of files) doubled. PP ignored. Default: no

T <yes | no> Set to yes to output the names that will be assigned to the converted files along with pro forma segment specifications. This option is for information purposes only: No actual conversion takes place. Default: no

P <page size> Sets the page size in bytes used to create the new files. This setting must be compatible with the existing file. Default: 8192

PP <yes | no> Set to yes to have the conversion run the Superfile prepass. Default: no

6 <yes | no> Set to yes to enable 6-byte transaction number support. This option is recommended for all files using c-treeACE Server Version 8 and later. Default: no

H <yes | no> Set to yes to create a huge file. Default: yes

G <new segment host file name> <host segment size in MB>

The new file name of a data or index file to be created as a segmented file. Derive this name from the new path and the file’s original name. (The T option can be used to check on the new name assigned to a file.) Use a G entry for each new file to be segmented.

Note: Even if the old file is segmented, segments must be specified for the new file or it will no longer be segmented.

Utilities - Low Level

All Rights Reserved 54 www.faircom.com

Option

Arguments Description

S <segment name> <segment size in MB>

This option must follow immediately after the G option for the associated host file. Repeat this option as necessary to create all the additional segments of the file. The segment name will be used exactly as specified. The new path will NOT be prepended to the name.

A <max # auto segments including host>

Use as many S <name> <size> entries as needed or OR one A <max> entry for each host. The S or A entries for each host must follow immediately after each host's G entry.

E <encryption method> Specify a valid ctSETENCRYPT() mod value (see SetEncryption). For example: ctAES32 for AES with a

32-byte key.

L <File Extension size in Bytes> Note: 2GB maximum.

TP <Temp file directory> Defaults to .\

Example:

ctcv67 vcusti new H no G new\vcusti.ndx 10 S e:\vc.s01 10 S f:\vc.s02 0

where:

vcusti is the existing file name.

new is the new path.

H no creates a normal file rather than a huge file.

G new\vcusti.ndx 10 sets the new segment host file name to new\vcusti.ndx and the host

segment size to 10 MB.

S e:\vc.s01 10 S f:\vc.s02 0 creates the following segments:

e:\vc.s01 with a size of 10 MB.

f:\vc.s02 with a size of 0 MB.

Ordinarily, the new path name is simply prepended to the original file name. If both have absolute

names, the new (absolute) path replaces the absolute portion of the original name. If only the

original file is absolute, the new (relative) path is inserted immediately after the absolute portion of

the original file name. Otherwise, the new path (relative or absolute) is prepended to the original

(relative) file name.

For example, to convert the data file C:\DATA\SAMPLE.DAT and its associated index,

C:\DATA\SAMPLE.IDX, into huge files with three segments of 2000 MB each, use the following

command line:

ctcv67 C:\DATA\SAMPLE.DAT C:\HUGEDATA\ H yes

G C:\HUGEDATA\DATA\SAMPLE.DAT 2000 S D:\HUGEDATA\SAMPLE.SG1 2000 S E:\HUGEDATA\SAMPLE.SG2 2000

G C:\HUGEDATA\DATA\SAMPLE.IDX 2000 S D:\HUGEDATA\SAMPLE.IS1 2000 S E:\HUGEDATA\SAMPLE.IS2 2000

Even if the original file is segmented, the new file will not be segmented unless a new segment

definition is specified using the ‘G’ and ‘S’ options.

The associated indices are recreated based on the IFIL resource embedded in the data file or

based on the parameter file information. If the associated data file becomes huge, index files

allowing duplicate records will have their key lengths automatically increased by 4 bytes to

accommodate the longer associated position information used to break the tie. If you recall, when

allowing duplicate key values in an index, you must add 4 bytes to the key length. For huge files,

Utilities - Low Level

All Rights Reserved 55 www.faircom.com

you must add a total of 8 bytes. In addition, the index file names in the IFIL definition will reflect

the new path name.

ctcv67 creates (or appends to) a text file named CV67.REP, which reports on the actions and

progress of the utility program.

5.6 ctdidx - Create flat key file ctdidx <index file name> <index member #> <flat key file name>

This utility will run either in single user mode or with the c-treeACE Server. The c-treeACE Server

or single-user transaction processing mode is necessary to dump the keys from an index which

supports transaction processing. ctdidx creates a flat file containing each key value at full,

uncompressed length followed by the associated record position in long integer, 4-byte, form.

ctdidx reads each key in order from the index member designated, 0 for the host index, 1 for the

first member, etc., and places the keys in the flat file it creates.

5.7 ctdmpidx - Index Dump Utility

ctdmpidx is available to dump an index. This utility is useful for viewing index header details,

viewing nodes and key values. The syntax is shown below:

ctdmpidx [-<page size>] [-listkeys] <filename> <member #> [<rflg>]

The optional parameter -page size equals sector size * 128 (third parameter in InitCtree()). If

page size is not entered, a default value of 16 will be used. filename specifies the index file

targeted for analysis. The member # refers to the index member number. A physical index file can

contain one or more indices. Each index has a member number (0, 1, 2, 3, etc.). For example, the

sample index file custordr.idx provided with the FairCom ODBC Driver contains a total of two

indices. Depending on whether you specify 0 or 1 you will be looking at either the order number

index or the customer number index. rflg represents an optional recovery flag switch and is only

applicable when compiled with TRANPROC. Any character will enable rflg, which will result in

c-tree skipping automatic recovery.

The -listkeys, option is available in V10.3 and later. It lists all the key values and their associated

record offsets in an index.

Example

Below is an example of launching ctdmpidx along with output showing the header and prompt for

an index node address.

# ctdmpidx -2048 custmast.idx 0

header info for file #0 [custmast.idx]:

configuration version: 81x index root ptr: 1000x

node size: 2048 superfile last member#: 0

data record length: 0 extend file size: 0

max bytes per leaf node: 1348 max bytes per non-leaf: 2030

file mode: 16392 key length: 4

file type: 1 # of additional members: 0

update flag: 0x index member number: 0

Utilities - Low Level

All Rights Reserved 56 www.faircom.com

key type: 0 file id number: 0

duplicate flag: 0 server id number: 0

# of active entries: 4 current node ptr: 0x

delete stack ptr: 0x index high transaction #: 0

last byte used: 1800x serial number: 0x

last physical byte: 1800x delete type: 0

permanent file mode flags: 0 superfile type: 0

leaf anchor ptr: 1000x superfile member #: 0

file flavor: 2 file alignment: 8

key padding byte: 20x maximum name length: 255

header record ptr: 0x resource header ptr: 800x

Enter node address in hex: 1000

NODE: 1000x

trans active: no

predecessor node: 0x

successor node: 0x

# of entries: 4

# of bytes: 32

leaf flag: 1 (0 => non-leaf / 1 => leaf)

member #: 0

element offset key value

1 101fx 31303030

1 0 0 0

2 105ex 31303031

1 0 0 1

3 1099x 31303032

1 0 0 2

4 10d9x 31303033

1 0 0 3

5.8 ctflat - Create c-treeACE file from a flat file

Usage ctflat <flat file> <new file> <record length> [<file mode> <ext size>]

Description

ctflat creates a c-treeACE fixed-length data file from an existing flat file with the specified record

length. Optionally, you can specify the file mode to use when creating the file. For example, to

enable transaction processing and the file size extension parameter.

ctflat assumes that the flat file begins at offset zero and has the record length indicated on the

command line. You can modify the source to make it more appropriate for your specific

circumstances.

5.9 ctflvrfy - Index Verify Utility

Usage ctflvrfy <filename.idx>

Utilities - Low Level

All Rights Reserved 57 www.faircom.com

Description

The Index Verify utility, ctflvrfy, takes an index name as the parameter and calls the ctVERIFY()

and chkidx() functions to allow the user to verify and index, and optionally inspect it at a

low-level.

C:\ctree\utils\>ctflvrfy custmaster.idx

Verifying file [custmaster.idx]

Retrying open with sect of [8]

Retrying open with sect of [12]

Retrying open with sect of [16]

Retrying open with sect of [20]

Retrying open with sect of [24]

Retrying open with sect of [28]

Retrying open with sect of [32]

Retrying open with sect of [36]

Retrying open with sect of [40]

Retrying open with sect of [44]

Retrying open with sect of [48]

Retrying open with sect of [52]

Retrying open with sect of [56]

Retrying open with sect of [60]

Retrying open with sect of [64]

Verifying the host index

Verifying index delete stack...

Verifying index links...

Verifying index leaf nodes...

Index page scan finds entries=75 header=75

Index nodes per level of tree structure - [0: 1]

( 2 resource pages )

Internal Index Verify: SUCCESSFUL

The return of ctVERIFY = 0, 75 KEYS FOUND

Verifying member index #1

Verifying index delete stack...

Verifying index links...

Verifying index leaf nodes...

Index page scan finds entries=75 header=75

Index nodes per level of tree structure - [0: 1]

( 2 resource pages )

Internal Index Verify: SUCCESSFUL

The return of ctVERIFY = 0, 75 KEYS FOUND

Verifying member index #2

Verifying index delete stack...

Verifying index links...

Verifying index leaf nodes...

Index page scan finds entries=75 header=75

Utilities - Low Level

All Rights Reserved 58 www.faircom.com

Index nodes per level of tree structure - [0: 1]

( 2 resource pages )

Internal Index Verify: SUCCESSFUL

The return of ctVERIFY = 0, 75 KEYS FOUND

Verifying member index #3

Verifying index delete stack...

Verifying index links...

Verifying index leaf nodes...

Index page scan finds entries=75 header=75

Index nodes per level of tree structure - [0: 1]

( 2 resource pages )

Internal Index Verify: SUCCESSFUL

The return of ctVERIFY = 0, 75 KEYS FOUND

Verifying member index #4

Verifying index delete stack...

Verifying index links...

Verifying index leaf nodes...

Index page scan finds entries=75 header=75

Index nodes per level of tree structure - [0: 1]

( 2 resource pages )

Internal Index Verify: SUCCESSFUL

The return of ctVERIFY = 0, 75 KEYS FOUND

Verifying member index #5

Verifying index delete stack...

Verifying index links...

Verifying index leaf nodes...

Index page scan finds entries=38 header=38

Index nodes per level of tree structure - [0: 1]

( 2 resource pages )

Internal Index Verify: SUCCESSFUL

The return of ctVERIFY = 0, 38 KEYS FOUND

Verifying member index #6

Internal Index Verify: no tree structure

The return of ctVERIFY = 0, 0 KEYS FOUND

Verifying member index #7

Verifying index delete stack...

Verifying index links...

Verifying index leaf nodes...

Index page scan finds entries=75 header=75

Index nodes per level of tree structure - [0: 1]

( 2 resource pages )

Internal Index Verify: SUCCESSFUL

The return of ctVERIFY = 0, 75 KEYS FOUND

Utilities - Low Level

All Rights Reserved 59 www.faircom.com

Verifying member index #8

Verifying index delete stack...

Verifying index links...

Verifying index leaf nodes...

Index page scan finds entries=16 header=16

Index nodes per level of tree structure - [0: 1]

( 2 resource pages )

Internal Index Verify: SUCCESSFUL

The return of ctVERIFY = 0, 16 KEYS FOUND

Verifying member index #9

Verifying index delete stack...

Verifying index links...

Verifying index leaf nodes...

Index page scan finds entries=75 header=75

Index nodes per level of tree structure - [0: 1]

( 2 resource pages )

Internal Index Verify: SUCCESSFUL

The return of ctVERIFY = 0, 75 KEYS FOUND

Verifying member index #10

Verifying index delete stack...

Verifying index links...

Verifying index leaf nodes...

Index page scan finds entries=75 header=75

Index nodes per level of tree structure - [0: 1]

( 2 resource pages )

Internal Index Verify: SUCCESSFUL

The return of ctVERIFY = 0, 75 KEYS FOUND

Verify complete......

Do you wish to perform a low-level tree walk? (Y/N): n

5.10 ctindx - Create index file from flat key file

Usage ctindx <flat key file> <index file> <index member> [<transformation file>]

Description

This utility runs in single user mode. It supports indices requiring transaction processing. The

index file must already exist, and the index member (0 for the host index, 1 for the first additional

index member, etc.) must be empty. The key length of the index member is used to deduce the

key length of the flat file. You can optionally specify a transformation file specifying how to

transform each key value before entry into the index file.

Utilities - Low Level

All Rights Reserved 60 www.faircom.com

The optional transformation file is a text file similar to an ISAM parameter file formed as follows:

<# of segments>

<offset> <length> <mode>

... repeated for each segment ...

An offset of zero corresponds to the first byte of the key value stored in the flat key file. The

length dictates how many bytes are affected by the transformation. The mode is interpreted as

shown in “Key (http://docs.faircom.com/doc/ctreeplus/#30863.htm)Segment

(http://docs.faircom.com/doc/ctreeplus/30863.htm)Modes”

(http://docs.faircom.com/doc/ctreeplus/#30863.htm) in the c-treeACE Programmer's Reference

Guide (http://docs.faircom.com/doc/ctreeplus/30863.htm).

5.11 ctpkey - Print key utility

Usage ctpkey <parameter file name> [<# of entries>]

Description

ctpkey prints out 1 or more key value(s), up to the optional # of entries, from each index file in the

parameter file, showing how each key segment is defined. The keys are displayed in hex and

ASCII. This utility will run in all modes of operation. It is useful if you are having trouble retrieving

data. ctpkey will allow you to see how a key value is constructed from the data.

By changing a #define, ctpkey.c can be changed from a main line program to the callable function

ctpkey(), with the same parameters as OpenIFileXtd().

5.12 ctpotp - Parameter to OTP conversion

Usage ctpotp <parameter file name> [<user profile bitmask>]

Description

This utility takes a parameter file and produces the corresponding OTP file(s) used by the

FairCom Drivers. If no record schema (DODA) is present, a dummy schema is created.

5.13 ctptoi - Parameter to IFIL conversion

Usage ctptoi <parameter file name> [<user profile bitmask>]

Description

This utility opens the parameter file whose name is specified as a command-line argument and

writes an IFIL (based upon the parameter file definitions) to each data file referenced in the

parameter file. ctptoi is designed for use as a standalone non-server utility.

Utilities - Low Level

All Rights Reserved 61 www.faircom.com

Note: Before running ctptoi, be sure your files have been created and are in the proper path location as specified in the parameter file being passed into the ctptoi utility.

5.14 ctrbld - Parameter file rebuild utility

Usage ctrbld <parameter file name> [ -updateidx ] [ -autopurge ]

Description

ctrbld verifies the deleted space in the data file and completely recreates, in place, any

companion index files. If the index file(s) do not exist, they are created.

CTRBLD can only be used on a superfile if the superfile has first been processed by ctsbld,

which performs a necessary pre-pass. When ctsbld completes, the data file members are in

good form, but the index files are empty. ctrbld, ctindx, or RebuildIFile() can recreate the index

file contents. ctrbld returns a non-zero status code via the system exit to permit invoking from a

shell script and testing for possible errors.

Specify -updateidx to delete the existing indices and re-create the new indices using the index

definitions provided in the parameter file. To implement this feature, enable the

DO_IDX_HEADER_UPDATE define in ctrbld.c. Without -updateidx, ctrbld fails when it detects a

discrepancy between the properties of existing indices and the index properties as defined in the

parameter file, returning KMEM_ERR (23).

Executing ctrbld with -autopurge causes the rebuild to automatically purge records with duplicate

keys. A purge log will be generated.

DEPRECATED as of V7. Please use the enhanced ctrbldif - IFIL-based Rebuild Utility (page 14).

See also File Recovery.

5.15 ctsfil - Superfile contents

Usage ctsfil <superfile name>

Description

ctsfil lists the members of the superfile, indicating whether each member is an index file,

fixed-length data file, or variable-length data file.

Utilities - Low Level

All Rights Reserved 62 www.faircom.com

5.16 ctunf1 - File Reformatting Utility

Usage ctunf1 <file name> <new alignment> <new flavor> <confirm> <binflag> [<files>]

Description

ctunf1 reformats a file IN PLACE provided the new alignment restriction does not cause the data

record contents to become misaligned. Therefore, FairCom strongly encourages ctunf1 be used

only on a copy of your data. ctunf1 takes the place of the UNIFRMAT compile time option; plus it

handles data record contents if record definitions have been provided (DODA). ctunf1 is used to

port data between different machine architectures.

ctunf1 uses record definitions, if present, to convert the contents of the data records. A record

definition is stored as a resource in a data file using the PutDODA() function. In general, the

contents of resource records will NOT be converted. Therefore, if you intend to port your files,

take care with the resources you directly maintain yourself to ensure they are system

independent. However, the resources pertaining to file and record definitions and index

alternative collating sequences maintained by FairCom will have their contents automatically

converted by ctunf1.

<file name> requires the file extension. For example, to convert a file named cust.dat from Intel to

a SPARC platform, issue the following:

ctunf1 cust.dat 4 m

Parameter Description

alignment 1 (byte)

2 (word)

4 (double word)

8

flavor L (LSB first, e.g., 8086 form)

M (MSB first, e.g., 68000 form)

confirm Y convert file without prompting to continue

binfllag optional c-treeDB binary field attribute

B2 binary field data contains length count

B3 binary field data does not contain length count

files is the optional maximum number of files to open. ctunf1 defaults to 32 files, which should be

sufficient for most purposes.

ctunf1 runs in single user mode only. It supports data files, index files and superfiles, and must

be executed before the file is moved to the target machine.

In V11, a case was added for handling FCRES_ATTR resource type. Prior to that release, the

ctunf1 utility failed with DCNV_ERR (439) error on FAIRCOM.FCS.

Utilities - Low Level

All Rights Reserved 63 www.faircom.com

5.17 ctupdpad - Update the c-treeDB Pad Resource Utility

When importing an ISAM data file into a c-treeSQL database, the c-treeSQL import utility,

ctsqlimp, allows specifying the padding and delimiter characters used to pad string fields in a

data file. The c-tree Update Pad Resource Utility, ctupdpad, provides a way to change the

padding and delimiter characters in the c-treeDB padding resource.

Syntax

The usage of this utility is as follows:

ctupdpad [options] table-name pad-char delimiter-char

Options are any combination of the following:

-s server-name [Default: FAIRCOMS]

-u user-name [Default: ADMIN]

-p password [Default: ADMIN]

The pad-char and delimiter-char values are specified with their corresponding ASCII code values.

Examples

To set the pad char to space and delimiter to space:

ctupdpad table.dat 32 32

To set the pad char to space and delimiter to nul:

ctupdpad table.dat 32 0

To set the pad char to nul and delimiter to nul:

ctupdpad table.dat 0 0

5.18 ctvfyidx - Index Verify Utility

The ctvfyidx utility uses the ctVERIFYidx() function to check the integrity of an index file. The

client version of the ctvfyidx utility supports the command-line options listed below.

Usage ctvfyidx [<option> ...] [-u <userid>] [-p <password>] [-s <servername] <file name> [<member #>]

where <option> is one or more of the following:

-excl - Open the file in exclusive mode

-delstk - Check delete stack (on by default)

-link - Check links (on by default)

-leaf - Check leaf nodes (on by default)

-chkkey - Check keys in leaf nodes

The optional parameter -page size equals sector size * 128 (third parameter in InitCtree()). If

page size is not entered, a default value of 16 will be used. filename specifies the index file

Utilities - Low Level

All Rights Reserved 64 www.faircom.com

targeted for analysis. The member # refers to the index member number. A physical index file can

contain one or more indices. Each index has a member number (0, 1, 2, 3, etc.). For example, the

sample index file custordr.idx provided with the FairCom ODBC Driver contains a total of two

indices. Depending on whether you specify 0 or 1 you will be looking at either the order number

index or the customer number index. rflg represents an optional recovery flag switch and is only

applicable when compiled with TRANPROC. Any character will enable rflg, which will result in

c-tree skipping automatic recovery.

In V10.3.1 and later, the ctvfyidx utility defaults to ctREADFIL. It uses ctEXCLUSIVE when

the -excl option is specified. A ctREADFIL open will fail with error 12 and sysiocod -8 if any

connection has the file open for write access.

In versions prior to V10.3.1, ctvfyidx will only work with the -excl option when connecting to

newer servers. Without the -excl option, older versions of ctvfyidx will fail with LERR_ERR.

Example

Below is an example of launching ctvfyidx along with output showing the results of the index

verification.

# ctvfyidx -2048 custmast.idx 0

Index page scan finds entries=4 header=4

Index nodes per level of tree structure - [0: 1]

Internal Index Verify: SUCCESSFUL

5.19 ctvfyfil - File Verify Utility

The ctvfyfil utility calls the ctVerifyFile() function. The utility can be run in standalone and in

client/server mode.

Usage ctvfyfil [<option> ...] <file name>

where <option> is one or more of the following:

-chkdat - Read data file only (default)

-chkdatkeys - Read data file and check keys in index

-chkidx - Read index file

-chkidxrec - Read index file and check records in data file

-excl - Open the file in exclusive mode

-int - Interactive mode: stop on each error

-index=<N> - Check only the Nth index (N=1,2,...)

Standalone Usage

An additional option is available for standalone use:

-<page size> - Use the specified page size (standalone only)

Utilities - Low Level

All Rights Reserved 65 www.faircom.com

The example below shows the utility called standalone on a file called mark.dat with the page size

set to 8192:

ctvfyfil -8192 mark.dat

All Rights Reserved 66 www.faircom.com

6. Utilities - Standalone

These standalone utilities are located in the following folder:

All tools:

All command-line tools:

All administrative tools:

Client-side administrative tools

Standalone administrative tools

All other utilities:

Client-side utilities

Low-level utilities

Standalone utilities tools\cmdline\utils\standalone

Note: The exact set of tools and utilities and their directory structure depends on the FairCom product you have installed.

6.1 ct_ver - Display c-treeACE version that created file

You can run the ct_ver utility to determine what version of c-treeACE was used to create your

data file.

Usage: ctver <filename>

Where:

<filename> - The name of the file to be checked.

6.2 ctchkbin - Checking for affected tables

Execute the ctchkbin utility to scan an entire server or a single database for tables that may be

affected by the binary/varbinary issue. The syntax of ctchkbin is as follows:

ctchkbin.exe [-f] [-s server] [-u username] [-a password] [-d database]

Utilities - Standalone

All Rights Reserved 67 www.faircom.com

Where:

-f - Output only tables that fail check

-d database - Scan database. Default: ctreeSQL

-d ALL - Scan all databases in session.

-s server name - Default: FAIRCOMS

-u user name - Default: ADMIN

-a user password - Default: ADMIN

Example ctchkbin.exe –s FAIRCOMS –u ADMIN –a ADMIN –d ctreeSQL

The ctchkbin utility output to the screen the result of the check scan, printing one table per line,

with the following columns:

database table status comments

Where:

database - database name

table - table name

status - status code of the check performed on table (please see code listing in the following

section)

comments - brief comments if table fail scan

Example output ctreeSQL admin_tb1 0

ctreeSQL admin_tb11 0

ctreeSQL admin_tb12 0

ctreeSQL admin_tb13 3 User may choose CTDB_BINARY_WITH_LENGTH or CTDB_BINARY_WITHOUT_LENGTH

ctreeSQL admin_tb14 3 User may choose CTDB_BINARY_WITH_LENGTH or CTDB_BINARY_WITHOUT_LENGTH

ctreeSQL admin_tb2 0

ctreeSQL admin_tb3 0

ctreeSQL admin_tb4 0

6.3 ctclntrn Utility - Clean Transaction Mark

Usage ctclntrn [-<page size in bytes>] <file name> [<password>]

Description

ctclntrn “cleans” the high-water transactions marks within a c-treeACE index.

Suggested Steps for Successful Clean and Reset

In the event of an impending transaction number overflow, the server administrator should follow

these steps to restart transaction numbering:

1. Perform a clean c-treeACE shutdown.

Utilities - Standalone

All Rights Reserved 68 www.faircom.com

2. Delete the transaction logs and housekeeping files: files S0000000.FCS, S0000001.FCS, D*.FCS, I*.FCS, and L*.FCS.

3. Use the ctclntrn utility to clean all indices (which resets the transaction numbers in the leaf nodes and index header) used by your application, including your application index files, superfiles, variable-length data, and c-tree Server files including the following if present:

• FAIRCOM.FCS -- If you are not using any User IDs or passwords other than ADMIN and

GUEST, you can simply delete this file. (If you do delete this file, tc-treeACE will re-create

it with the single user ADMIN and password ADMIN.)

• CTSYSCAT.FCS -- This is only present if you are using c-tree ODBC Drivers.

• SEQUENCEIX.FCS

• SYSLOGIX.FCS

• SYSLOG*.FCS

• ALL c-treeACE SQL Database Dictionaries

<databasename>.dbs/SQL_SYS/<databasename>.fdd

ctdbdict.fsd (session dictionary)

4. Restart the c-tree Server.

The server will create new transaction logs and start transaction numbering from 1 again.

It is important to run ctclntrn on all files. If you miss any files and later open that file with a large

transaction number in its header, the server will again increase its transaction number to that

large value. You will need to repeat this procedure should that occur.

FYI: The ctclntrn utility uses the CleanIndexXtd() c-treeACE function. This function cleans any leaf nodes of exceptional transaction marks and resets the transaction high-water mark in the header to zero. This avoids rebuilding the entire index file.

You can use the c-tree High-water Mark Utility, cthghtrn, to verify that the transaction high-water

marks in the files are back to zero, or other reasonably low number.

Tip: The AUTO_CLNIXX YES configuration option can help automate and detect files which

have been missed.

See also

cthghtrn - Displays the high-water mark for transactions (page 44,

http://docs.faircom.com/doc/ctreeplus/#31083.htm)

6.4 ctcmpcif - IFIL-based Compact Utility

Standalone Usage # ctcmpcif DataFileName <options> [<UserId> [<Password> [<ServerName>]]]

Where:

-<sectors> - The sector size to use. The sector parameter is especially useful if you need to

adjust a file’s PAGE_SIZE to match the c-treeACE Server.

-purge - Delete records that have illegal duplicate key values.

Utilities - Standalone

All Rights Reserved 69 www.faircom.com

-temppath=<temporary_path> - Use the specified directory for temporary files.

-updifil - Update IFIL resources in the data file.

-sortmem=<N> - Set the size of sort memory to N KB in non-client builds. This option can be

used to increase the rebuild speed for large files.

-redosrl - Reassign serial numbers to the records in the compacted file instead of copying the

values from the original file.

-compress - Create the compacted data file with compression (defaults to zlib library if not

specified in server configuration).

-nocompress - Create the compacted data file without compression.

-x8 - Use extended create blocks read from data and index files.

-idxseg=<M>@<S> - If creating an index, use M automatic segments of size S. Size is

specified in megabytes, or you can specify MB or GB as a suffix. (Example:

-idxseg=10@1GB)

-encrypt=cipher - Create the compacted file using the specified cipher. See the encryption

sections below.

Accepted values:

• AES: aes16, aes24, or aes32

• Blowfish: blf8, blf9, ..., or blf56

• DES: des8, des16, or des24

• none

-oldsec - Use the utility's original security attribute assignment.

-flexrec - (Supported in V11.5 and later) Add Hot Alter Table support to the file.

-noflexrec - (Supported in V11.5 and later) Remove Hot Alter Table support from the file.

-repairdata - Attempt repair if damaged data records are detected.

-callback - Enable notifications of compact progress.

Client-Side Usage # ctcmpcif DataFileName [-purge] [-updifil] [<UserId>]

[<UserPassword> [<ServerName>]]

Where:

-purge - purge duplicate records.

-updifil - update IFIL resources in the data file.

UserID, UserPassword, and ServerName are only needed for client versions of this utility.

FairCom recommends building this utility as a Single-user Standalone application.

ctcmpcif reads the IFIL structure from DataFileName and calls CompactIFileXtd() and

RebuildIFileXtd() to compact and rebuild DataFileName and its associated indices. If ctcmpcif

cannot extract the IFIL from the target file, it will ask for the name of another copy of the file from

which to extract the IFIL information.

Prior to c-treeACE V9.3, several option values were defined such as updateIFIL, purgeIFIL, and

badpartIFIL, that can be specified. These values are specified by adding them together. For

example: myifil.tfilno = updateIFIL + purgeIFIL. A new approach simplifies checking of these

options. The following option values are now specified in ctport.h:

#define updateIFILoption 0x0002

Utilities - Standalone

All Rights Reserved 70 www.faircom.com

#define purgeIFILoption 0x0004

#define badpartIFILoption 0x0008

#define redosrlIFILoption 0x0010

These values can now be OR-ed together and the negative of the result stored in the tfilno field of

the IFIL structure passed to the compact or rebuild function. For example, to indicate that you

want to assign new serial numbers, do the following:

myifil.tfilno = -redosrlIFILoption;

CMPIFIL(&myifil);

If you want to also use more than one option when compacting or rebuilding a file, OR them in to

the value and negate the result. For example,

/* assign new serial numbers and update IFIL resource. */

myifil.tfilno = -(redosrlIFILoption | updateIFILoption);

CMPIFIL(&myifil);

Note: This tool does not compact partitioned files. If you attempt to compact a partitioned file, the tool will return PCMP_ERR (954, compacting partitioned file not supported).

Changing Encryption Attributes

In V11 and later, the compact utility can optionally change the encryption attributes. To use this

option, OR in the setencryptIFILoption bit into the tfilno field of the IFIL structure whose address

you pass to the compact API function. When using this and other options, remember to negate

the tfilno value after you OR in the options. For example:

myifil.tfilno = -(redosrlIFILoption | setencryptIFILoption);

CMPIFIL(&myifil);

Specifying the Encryption Cipher

In V11 and later, the ctcmpcif utility supports an option to specify the encryption cipher for the

data and index files created by the compact operation. Usage:

-encrypt=cipher - Create the compacted file using the specified cipher:

• for AES, use aes16, aes24, or aes32

• for Blowfish, use blf8, blf9, ..., or blf56

• for DES, use des8, des16, or des24

• for Twofish, use twf16, twf24, or twf32

• for no encryption, use none

Note: If an index file does not exist, the original data file's encryption attributes are used

when creating that index file.

To change the encryption attributes of a file using the compact API function, you must add

the option CHANGE_ENCRYPTION_ON_COMPACT YES to ctsrvr.cfg. Otherwise, the operation

fails with error NSUP_ERR (454, not supported).

Environment Variable to Enable Advanced Encryption

In V11.5 and later, c-tree supports enabling advanced encryption at run time using an

environment variable. Set the environment variable CTREE_ADVANCED_ENCRYPTION to YES to

enable advanced encryption if it is supported. This environment variable can be used to allow

c-tree utilities to enable advanced encryption even if they haven't been updated yet to

Utilities - Standalone

All Rights Reserved 71 www.faircom.com

automatically enable advanced encryption when needed. Examples include the rebuild and

compact utilities, ctrbldif and ctcmpcif.

Note: If c-tree does not support advanced encryption and this environment variable is set, the

c-tree initialization will fail.

Considerations

Even without the -x8 option, some extended create block settings such as the huge file,

extended header, and 6-byte transaction number options, are always applied to new files.

The -x8 option requires all associated index files that are referenced in the data file's IFIL

structure to exist, as the utilities use OpenIFile() to open the data file and all associated index

files to read the extended create block values.

When an application calls the standalone version of the Xtd8 file compact or rebuild functions (for

example, CMPIFILX8() or RBLIFILX8()), index files created by the compact or rebuild no longer

have the 6-byte transaction number attribute enabled if the specified extended create block's

x8mode field has the ctNO6BTRAN bit set.

A rebuild or compact will fail with the new error code TFLN_ERR (943) when a client library

that supports the new rebuild or compact option format attempts to use this feature with a

c-treeACE Server that does not support this new format.

In V11 and later, the compact and rebuild API functions preserve the original files' encryption

attributes by default. If the index files don't exist when compact/rebuild are called, they will be

created with the data file's encryption attributes.

In V11 and later, the compact utility always deletes and recreates the index files after saving

the resources from the original index file. This provides the expected behavior of (possibly)

reducing the size of the index file.

See also

File Recovery

Updates in handling of security attributes (page 3)

Preventing Possible Data Loss with Compact & Rebuild Operations

Updates in handling of security attributes

In V10.3 and later, the ctrbldif utility assigns data file owner/group/permissions to index files and

ctcmpcif assigns original data file owner/group/permissions to compacted data/index files.

The rebuild and compact utilities now read the permission mask, owner, and group settings from

the original data file and after the rebuild or compact is completed, the utilities assign these same

attributes to the new files. It is desirable for the newly rebuilt or compacted files to preserve the

original security attributes as much as possible and the index file security attributes should match

the data file security attributes.

A command-line option has been added to the utilities to restore the previous security attribute

behavior. Use the -oldsec option to cause the rebuild and compact utilities to set the security

attributes as they did before this revision. For example:

Utilities - Standalone

All Rights Reserved 72 www.faircom.com

ctrbldif mark.dat -oldsec ADMIN ADMIN FAIRCOMS

The -oldsec option can be used if rebuild and compact are failing with error 455 (user does not

belong to group) if you delete an index then run the rebuild or compact utility on the data file using

a user account that does not belong to the group that is assigned to the data file.

Note: These changes only apply to the client and server versions of these utilities. Setting the security attributes is not supported in standalone mode, so the standalone rebuild and compact utilities behave as follows: 1) When the standalone mode rebuild utility creates new index files instead of reusing the new index files (for example if the original index files have been deleted before running the rebuild utility), the new index files are assigned a permission mask of zero (no restrictions on permissions), and the owner and group are unassigned (empty). 2) The standalone mode compact utility always preserves the security attributes of the data file. If the index files do not exist, the newly-created index files are assigned the same values as the standalone rebuild does when it creates new index files.

6.5 ctencrypt - Utility to Change Master Password

The c-treeACE advanced encryption feature uses a master password to encrypt the file-specific

advanced encryption key in c-tree data, index, and transaction log files that are encrypted using

advanced encryption. ctencrypt is a standalone utility that can be used to change this master

password for specified c-tree data, index, and transaction log files.

Usage ctencrypt <options> <command>

Available Options:

-n <sect> - Node sector size. The default is 64, which corresponds to PAGE_SIZE of 8192.

Available Commands (only one at a time may be specified):

-chgmpw <filelist> - Change master password for the files whose names are listed in the file

<filelist>. <filelist> is the name of a text file created by the end user that lists the names of the

files (data and index), one per line, that are to be processed.

ctencrypt requires a password verification file named ctsrvr.pvf that was created using the

current master password to exist in its working directory. ctencrypt prompts the user for the

current master password and for the new master password (prompting twice in order to confirm

that the new password was properly entered).

Note: ctencrypt does not change the master password file, ctsrvr.pvf. The ctcpvf utility will need to create a new file for server startup in coordination with the new password used to re-encrypt the encryption key for the files. Failure to do so will result in DCOD_ERR errors (606, failure to decode file) when opening files.

ctencrypt processes the specified files, indicating the status of each file and the total of

successful and failed operations. Note that the c-treeACE Server must be shut down while these

file modifications take place.

Utilities - Standalone

All Rights Reserved 73 www.faircom.com

ctencrypt creates a temporary directory named temp\ctencrypt.tmp.<process_id> to store its

transaction logs. This directory is normally deleted when ctencrypt shuts down.

Important: ctencrypt does not undo any changes in case of error. The files that it lists as successfully updated will use the new master password even if the utility failed to update other files.

Example File List

A semicolon can be specified at the start of a line to indicate a comment which is ignored.

; c-treeACE Advanced Encryption Conversion Listing File

; -----------------------------------------------------

; Created Wed Dec 01 01:38:00 2010

; transaction log files

L0000000.FCT

L0000002.FCA

L0000003.FCA

L0000004.FCA

L0000005.FCA

L0000006.FCS

L0000007.FCS

L0000008.FCS

L0000009.FCS

L0000010.FCT

; data files

mydatafile.dat

C:\My Documents\test.dat

vcusti

Note: All physical encrypted files, data and index files, must be specified in order to be modified. No attempt is made to determine associated files.

If the server was cleanly shutdown in such a manner that its transaction logs are no longer

necessary, then they will not need to be included as part of this password change. If you wish to

use the ctencrypt utility to modify any existing encrypted transaction logs (for example, archive

logs for replication), their names must be specified in the list file. ctencrypt does not attempt to

locate any transaction log files on its own.

Example Output c-tree file encryption utility

This utility requires a master password in order to start.

Please enter master password:

Enter new master password :

Confirm new master password :

Changing master password for the specified files...

[ OK ] SYSLOGDT.FCS

[ OK ] vcusti

[ OK ] L0000000.FCT

[ OK ] L0000002.FCA

[ OK ] L0000003.FCA

[ OK ] L0000004.FCA

[ OK ] L0000005.FCA

Utilities - Standalone

All Rights Reserved 74 www.faircom.com

[ OK ] L0000006.FCS

[ OK ] L0000007.FCS

[ OK ] L0000008.FCS

[ OK ] L0000009.FCS

[ OK ] L0000010.FCT

12 succeeded, 0 failed

Successfully changed master password for all specified files

Error Returns

Two new error codes have been added related new password management features:

BMPW_ERR (932) - The specified encryption master password is incorrect.

ICOD_ERR (933) - An encryption operation failed due to an unexpected internal error. See

CTSTATUS.FCS for details.

6.6 ctfdmp - Forward Dump Utility ctfdmp

Used to restore data to a given time following a ctrdmp restore.

ctfdmp takes an !RP <name> argument to set the point in time to stop the forward roll. This

argument is also used by the ctrdmp script option, as described in Rollback to New Restore

Points with ctrdmp (page 81). To incrementally roll forward from there, rename the previous

RSTPNT_CHKPNT*.FCS to S0000001.FCS (the start point for the ctfdmp), and supply a new

!RP and transaction logs.

Note: The ! prefix needs to be escaped when using the Unix Bash shell.

In V11 and later, the ctfdmp, ctldmp, and ctrdmp utilities display the c-treeACE version used to

compile them when they are run.

Environment Variable for Advanced Encryption Password

If this utility has advanced encryption enabled, it can read an encrypted password file instead of

being prompted to enter the master password. To enable this, set the environment variable

CTREE_MASTER_KEY_FILE to the name of the encrypted master password file.

See also

Maintaining Database Integrity (http://docs.faircom.com/doc/ctserver/8373.htm) in the c-tree

Server Administrator's Guide

ctrdmp - Dynamic Dump Recovery or System Rollback (page 80)

Rollback to New Restore Points with ctrdmp (page 81)

Utilities - Standalone

All Rights Reserved 75 www.faircom.com

6.7 ctfileid - Update File IDs

The Update File ID utility, ctfileid, provides a convenient and safe way to update the fileid

parameter of the file header. See the section Copying Server Controlled Files in the c-treeACE

Programmer's Reference Guide (http://docs.faircom.com/doc/ctreeplus/29354.htm) for details for

when this may be necessary. The file is opened exclusively, ensuring that the server does not

have it open. The syntax for this utility is shown below:

ctfileid file [-ioq] [-n <size>] [-s <svn>] [-u <uid>] [-p <upw>]

-i - Also update indices related to data file.

-o - Force open of corrupted files (ctOPENCRPT).

-q - Quiet (do not output to stdout).

-s <server name> - c-treeACE Server name.

-u <user ID> - User name.

-p <user password> - User password.

Note: ctfileid.c is located in ctree\samples\special\utils and replaces the previous informal and undocumented utilities, updateid.c and newid.c.

Standalone Usage

An additional option is available to set the node size in standalone mode:

-n <size> - Set node size (stand-alone only).

6.8 ctfixbin - Fixing Affected Tables

Based on the output of the ctchkbin utility, execute the ctfixbin utility on a particular table to set

the binflag property of CT_ARRAY and CT_2STRING fields to the appropriate value.

The syntax of ctfixbin is:

ctfixbin.exe table_name action [-s server] [-u username] [-a password] [-d database]

table_name is the name of a table to fix (without the .dat extension)

action is one of the following:

• 1 - set binflag to CTDB_BINARY_UNKNOWN

• 2 - set binflag to CTDB_BINARY_WITHOUT_LENGTH

• 3 - set binflag to CTDB_BINARY_WITH_LENGTH

-d database - Scan database. Default is ctreeSQL

-s server - Default is FAIRCOMS

-u username - Default is ADMIN

-a password - Default is ADMIN

Example ctfixbin.exe admin_tb13 2 –s FAIRCOMS –d ctreeSQL –u ADMIN –a ADMIN

Utilities - Standalone

All Rights Reserved 76 www.faircom.com

6.9 ctidmp - Examine Dump Files

Usage ctidmp [dump file name]

Description

The ctidmp utility lists the contents of a dynamic dump file or a specific extent of a dump broken

into multiple files with the !EXT_SIZE keyword. Compile and link this utility with a c-treeACE

Standalone Single-user TRANPROC library.

6.10 ctinfo - ISAM File Info

Usage ctinfo FileName [-isam] [-rdkeys] [<UserId> [<UserPassword> [<ServerName>]]]

Description

ctinfo retrieves IFIL and DODA structures from a c-treeACE file as well as XCREblk extended

header information if available. This utility is useful in both client-server and standalone mode.

-isam - Open the specified data file in ISAM mode (V10.3 and later). See below.

-rdkeys - If this option is enabled, ctinfo opens the data file and associated indexes at the

ISAM level instead of performing a low-level open, which avoids FRSKEY error: 26. Without

this opion, ctinfo does not cause c-treeACE Server to log replication diagnostics; an ISAM

level file open used by -rdkeys will cause the details to be logged

Note: The ISAM open requires the index files to exist and to be accessible, unlike the low-level open which requires only the data file to exist.

Authentication File

This utility supports the use of an encrypted password file. Encrypted password files keep user

IDs and passwords from plain view when the utility is used within a script file. They are created

with the ctcmdset utility. The plain text form of the file should be:

; User Id

USERID ADMIN

; User Password

PASSWD <pass>

Use the -a option to specify the name of the encrypted file.

Output

In V10.3 and later, the ctinfo utility displays the owner, group, and permissions for the specified

file. Example output:

File owner = ADMIN

File group = ADMIN

Utilities - Standalone

All Rights Reserved 77 www.faircom.com

Permission mask = 0x85e = {

owner: read write def delete

group: read

world: read

}

In V10.3 and later, the ctinfo -isam option causes the utility to open the specified data file in

ISAM mode. This option is useful for checking if a REPLICATE keyword enables replication for

the file.

In V11 and later, the ctinfo utility outputs the header record for fixed-length files or the header

key count for each logical index. For example:

Header Count

4776 keys in index 0

4776 keys in index 1

4776 keys in index 2

6.11 ctldmp - Transaction Log Dump

Usage ctldmp [ DATE mm/dd/yyyy ] [ TIME hh:mm:ss ] [ LOG number ]

Performs a partial dump of the transaction logs to assist the developer in problem resolution.

See also

Maintaining Database Integrity (http://docs.faircom.com/doc/ctserver/8373.htm) in the c-tree

Server Administrator's Guide

6.12 ctrbldif - IFIL-based Rebuild Utility

Usage

A rebuild utility using the IFIL definitions stored in the header of a file:

ctrbldif DataFileName [ -x8 ] [ -purge ] [ -updifil ] [ -<sectors> ]

[ -temppath=<temporary_path> ] [ -sortmem=<n> ]

[ <UserId> ] [ <UserPassword> ] [ <ServerName> ]

Description

ctrbldif reads the IFIL structure from DataFileName and calls RebuildIFileXtd() to rebuild

DataFileName and its associated indices.

-purge - Purge duplicate records.

-updifil - Update the IFIL resource within the data file.

Utilities - Standalone

All Rights Reserved 78 www.faircom.com

-sortmem=<N> - Use N KB of memory for sorting. This option can be used to increase the

rebuild speed for large files.

-x8 - Use extended create blocks read from data and index files.

-idxseg=<M>@<S> - If creating index, use M automatic segments of size S. Size is specified

in megabytes, or you can specify MB or GB as a suffix. For example: -idxseg=10@1GB

-skipdatascan - In V11.5 and later, if you know your datafile is in a good state, you can use

this option to skip the initial datafile validity scan for faster rebuilds.

-callback - In V11.5 and later: When used with a c-treeACE Server this will provide additional

feedback on the rebuild progress.

c-treeACE Standalone Options

-temppath= - directory path, <temporary_path>, to create temporary sort and purged record

files. (This standalone option is the equivalent of the TMP_PATH server configuration option.)

The default location is the current directory.

-<sectors> - sector size, <sectors>. (in multiples of 128). The sector parameter is especially

useful if you need to adjust a file’s PAGE_SIZE (index node size) to match the c-treeACE

Server. c-treeACE standalone models default to 16 sectors (2048 byte node size) while the

c-treeACE Server defaults to 64 sectors (8192 bytes).

c-treeACE Server Options

<UserID> : client user name to logon to a c-treeACE Server.

<UserPassword> : client user password to authenticate to a c-treeACE Server.

<ServerName> : c-treeACE Server name for a client to connect.

Environment Variable to Enable Advanced Encryption

In V11.5 and later, c-tree supports enabling advanced encryption at run time using an

environment variable. Set the environment variable CTREE_ADVANCED_ENCRYPTION to YES to

enable advanced encryption if it is supported. This environment variable can be used to allow

c-tree utilities to enable advanced encryption even if they haven't been updated yet to

automatically enable advanced encryption when needed. Examples include the rebuild and

compact utilities, ctrbldif and ctcmpcif.

Note: If c-tree does not support advanced encryption and this environment variable is set, the

c-tree initialization will fail.

Considerations

Even without the -x8 option, some extended create block settings such as the huge file,

extended header, and 6-byte transaction number options, are always applied to new files.

This option requires all associated index files that are referenced in the data file's IFIL

structure to exist, as the utilities use OpenIFile() to open the data file and all associated index

files to read the extended create block values.

When an application calls the standalone version of the Xtd8 file compact or rebuild functions

(for example, CMPIFILX8() or RBLIFILX8()), index files created by the compact or rebuild no

longer have the 6-byte transaction number attribute enabled if the specified extended create

block's x8mode field has the ctNO6BTRAN bit set.

Utilities - Standalone

All Rights Reserved 79 www.faircom.com

A rebuild or compact will fail with the new error code TFLN_ERR (943) when a client library

that supports the new rebuild or compact option format attempts to use this feature with a

c-treeACE Server that does not support this new format.

See Also:

Preventing Possible Data Loss with Compact & Rebuild Operations

Option to set index's automatic segment attributes

If a segmented index file was deleted and rebuilt using the ctrbldif utility or the rebuild API

function, the new index file was not segmented. The index file's segment attributes, which are

stored in the index file, were lost when the index file was deleted.

Beginning with V10.3, an option is provided with the rebuild and compact utilities that causes

index files that are created by the utilities to be created using automatic segments of the specified

size and maximum. The option is:

-idxseg=M@S

where M is the maximum number of segments and S is the segment size. S is interpreted as

megabytes by default. Two suffixes, MB and GB, are also supported. MB indicates that the value

is in megabytes and GB indicates that the value is in gigabytes.

Examples:

50 segments of 10 MB each:

ctrbldif test.dat -idxseg=50@10

100 segments of 300 MB each:

ctrbldif test.dat -idxseg=100@300MB

20 segments of 3 GB each:

ctrbldif test.dat -idxseg=20@3GB

Note: If the index files exist, the -idxseg option has no effect. It is only when the rebuild or compact utility creates new index files because the old index files do not exist that the -idxseg

option affects the automatic segment properties of the index files.

Updates in handling of security attributes

In V10.3 and later, the ctrbldif utility assigns data file owner/group/permissions to index files and

ctcmpcif assigns original data file owner/group/permissions to compacted data/index files.

The rebuild and compact utilities now read the permission mask, owner, and group settings from

the original data file and after the rebuild or compact is completed, the utilities assign these same

attributes to the new files. It is desirable for the newly rebuilt or compacted files to preserve the

Utilities - Standalone

All Rights Reserved 80 www.faircom.com

original security attributes as much as possible and the index file security attributes should match

the data file security attributes.

A command-line option has been added to the utilities to restore the previous security attribute

behavior. Use the -oldsec option to cause the rebuild and compact utilities to set the security

attributes as they did before this revision. For example:

ctrbldif mark.dat -oldsec ADMIN ADMIN FAIRCOMS

The -oldsec option can be used if rebuild and compact are failing with error 455 (user does not

belong to group) if you delete an index then run the rebuild or compact utility on the data file using

a user account that does not belong to the group that is assigned to the data file.

Note: These changes only apply to the client and server versions of these utilities. Setting the security attributes is not supported in standalone mode, so the standalone rebuild and compact utilities behave as follows: 1) When the standalone mode rebuild utility creates new index files instead of reusing the new index files (for example if the original index files have been deleted before running the rebuild utility), the new index files are assigned a permission mask of zero (no restrictions on permissions), and the owner and group are unassigned (empty). 2) The standalone mode compact utility always preserves the security attributes of the data file. If the index files do not exist, the newly-created index files are assigned the same values as the standalone rebuild does when it creates new index files.

6.13 ctrdmp - Dynamic Dump Recovery or System Rollback ctrdmp [ dumpscript ]

Used to restore dumps created with ctdump.

A successful ctrdmp completion always writes the following message to CTSTATUS.FCS:

DR: Successful Dump Restore Termination

A failed ctrdmp writes the following message to CTSTATUS.FCS when ctrdmp terminates

normally:

DR: Dump Restore Error Termination...: <cterr>

where <cterr> is the error code.

If for some reason ctrdmp terminates prematurely (for example, a fatal error causes ctrdmp to

terminate abnormally), the “Dump Restore Error Termination...” message might not be written to

CTSTATUS.FCS. In that case, ctrdmp might have written error messages to standard output or

to CTSTATUS.FCS before terminating that helps explain the reason for ctrdmp terminating

prematurely.

Note: A 32-bit ctrdmp could fail with error 75 if run on transaction logs created by a 64-bit c-treeACE Server, which might support more than 2048 connections.

In V11 and later, the ctfdmp, ctldmp, and ctrdmp utilities display the c-treeACE version used to

compile them when they are run.

Utilities - Standalone

All Rights Reserved 81 www.faircom.com

Restore Recovery Options

The ctrdmp utility now supports the RECOVER_DETAILS and RECOVER_MEMLOG transaction

recovery options (the same options that c-treeACE Server supports).

If you specify !RECOVER_DETAILS YES in your dump restore script, ctrdmp will log progress

messages to the file CTSTATUS.FCS as it performs its automatic recovery.

Environment Variable for Advanced Encryption Password

If this utility has advanced encryption enabled, it can read an encrypted password file instead of

being prompted to enter the master password. To enable this, set the environment variable

CTREE_MASTER_KEY_FILE to the name of the encrypted master password file.

See also

Maintaining Database Integrity (http://docs.faircom.com/doc/ctserver/8373.htm) in the c-tree

Server Administrator's Guide

Rollback to New Restore Points with ctrdmp

In V11 and later, ctrdmp is able to rollback to a Restore Point. Restore Points permit server

clients to establish quiet spots in the transaction log where there are no active transactions.

Prior to the V11 modifications, ctrdmp could either perform a dynamic dump recovery or rollback

to a specified date and time. ctrdmp has been extended such that, as an alternative to specifying

a date and time, the rollback script can provide the name of a Restore Point file.

A typical ctrdmp script file used for a rollback looks like:

!ROLLBACK

!DATE MM/DD/YYYY

!TIME HH:MM:SS

....

Now the script can be composed as follows:

!RP <Restore Point File Name>

....

The Restore Point File Name generated by the server is either of the following:

RSTPNT_NO_CHK.YYYYMMDD_HHMMSS.FCS for a Lightweight Restore Point

RSTPNT_CHKPNT.YYYYMMDD_HHMMSS.FCS for a Checkpoint Restore Point

Note that, as with the !ROLLBACK script keyword, the !RP keyword must be the first entry in the

script file.

See also

ctrdmp - Dynamic Dump Recovery or System Rollback (page 80)

ctfdmp - Forward Dump Utility (page 74)

Utilities - Standalone

All Rights Reserved 82 www.faircom.com

ctrdmp options to convert path separators to operating system's

native path separator

The dynamic dump restore utility, ctrdmp, supports options for converting path separators to the

operating system's native path separator. These options are useful when restoring a dynamic

dump that was created on an operating system that uses a different path separator. For example,

using ctrdmp on a Linux system to restore a dynamic dump that was created on a Windows

system.

!CONVERT_PATHSEP

The dynamic dump restore script option !CONVERT_PATHSEP instructs ctrdmp to convert path

separators to the native path separator. ctrdmp applies this conversion to:

1. filenames read from the dump stream file

2. filenames read from transaction logs that are included in the dynamic dump

3. data and index filenames in IFIL resources of all data files restored by ctrdmp

Note: If the file name begins with a drive letter (for example, C:) or a UNC reference (for example, \\machinename\sharename), it is not changed. In these cases, we recommend using

the !REDIRECT option in the dynamic dump restore script to replace these references with the

desired target directory names.

The dynamic dump restore script option !REDIRECT_IFIL instructs ctrdmp to apply the

!REDIRECT rules that are specified in the dump restore script to the data and index filenames in

the IFIL resources of the data files restored by ctrdmp.

An alternative to the !REDIRECT_IFIL option is to run the ctredirect utility after ctrdmp

completes.

Example

As an example, consider a backup made on a Windows system of the c-tree data and index files

accounts.dat and accounts.idx that are stored in the directory E:\mydata. In this example, the

data file name in the IFIL resource is E:\mydata\accounts.

Here is an example dynamic dump backup script:

!DUMP backup.fcd

!FILES

E:\mydata\accounts.*

!END

Below is an example dynamic dump restore script to run on a Unix system that uses a

!REDIRECT option to redirect E:\mydata to myrestoredir, which is a subdirectory in the directory

where ctrdmp is being run. it uses the !REDIRECT_IFIL option to update the IFIL resource in

accounts.dat based on the redirect rule:

!DUMP backup.fcd

!REDIRECT E:\mydata myrestoredir

!REDIRECT_IFIL

!CONVERT_PATHSEP

!FILES

E:\mydata\accounts.*

Utilities - Standalone

All Rights Reserved 83 www.faircom.com

!END

In this example, accounts.dat and accounts.idx are restored to the myrestoredir directory, and

then the data file name E:\mydata\accounts in accounts.dat is changed to myrestoredir/accounts.

If the !REDIRECT_IFIL option had not been used, only the path separators would have been

changed, so the data file name in the IFIL resource would have been changed to

E:/mydata/accounts.

Limitations: The byte ordering of the two systems must be the same so that ctrdmp can restore

the dump.

6.14 ctsbld - Superfile rebuild pre-pass

The c-treeACE Superfile Recover Utility reconstructs data file members in place and empties

index file members. Index file members must be rebuilt via ctrbld, RBLIFIL() or ctindx.

Usage ctsbld <superfile name>

Description

ctsbld processes the superfile in place. This utility “cleans” the data files and empties the index

files. This utility may also be incorporated into your application using the function

SuperfilePrepassXtd(). Afterward, the superfile must be processed by either ctrbld or the

RebuildIFile() function before it is usable. This utility is only operational in single-user mode. The

SuperfilePrepassXtd() function is available in single-user and client/server models.

6.15 ctsbldm - Rebuild Superfile Index Members

Usage ctsbldm <DataFileName> [<Optional PageSize>]

For example:

ctsbldm suphost!myfile.dat 16384

Description

Ordinarily, the procedure to rebuild a superfile is to use ctsbld to prepare the entire superfile,

making the data good and returning space used by the indices. Then each set of ISAM files is

rebuilt. This approach is used since a superfile entwines all of the member files and no

assumptions are made about the integrity of the members.

ctsbldm permits the indices associated with a non-corrupt superfile member data file to be rebuilt

without having to process the entire superfile. It assumes that the data file contains an IFIL

describing all the indices, that the data file is not corrupt, and that the superfile is in good shape

except for the indices in question.

One possible use for this utility is when recovery cannot repair an index. This rarely occurs, but

may be caused by a loop in the index leaf nodes. If this index is a member of a superfile, we can

Utilities - Standalone

All Rights Reserved 84 www.faircom.com

now attempt to rebuild just the indices, and not process the entire superfile. The utility forces all

indices associated with the data file to be rebuilt.

The utility operates by opening the data and index files, deleting the index files, and then

rebuilding the index files.

6.16 ctscmp - Superfile Compact Utility

Usage ctscmpi <filename> [-scanonly] [Y] [<sect>]

ctscmp <name of the superfile host to compact> [Y] [new_sect_size]

Arguments

<filename> The name of the superfile to compact or scan

-scanonly Scan the superfile only; do not compact it. The -scanonly option generates details

from the header, extended header, IFIL, and DODA. It outputs the number of key values,

active records, deleted records and resource records. Using this utility with the -scanonly

option is useful for comparing superfiles before and after compacting them.

Y An optional parameter; if specified, the utility compacts the file without prompting to confirm

(otherwise you will be prompted).

<sect> An optional sector size of the resulting file (sect*128 = page size) to use for the new

superfile. If <sect> is omitted, the new superfile is created using the same page size as the

original superfile.

Description

The superfile compact utility, ctscmp, compacts and rebuilds a superfile and all of its members

provided the required IFIL resources are present in the superfile data members. It creates a

compacted version of the file in place, using a temporary file named CTREE.TMP as a

destination and then renaming it.

This utility is designed for the Standalone Single-user model. It compacts and rebuilds a superfile

and all of its members provided the required IFIL structures are in place. It creates a compacted

version of the file in place, using a temporary file named CTREE.TMP as a destination and then

renaming it.

The utility supports processing data and index member names having extensions other than .dat

and .idx.

A “% complete” progress indicator has been added to the ctscmp utility.

The ctscmp utility uses a standard error and warning message format. Error messages begin

with the text ‘Error:’ and warning messages with the text ‘Warning:’, so errors and warnings can

easily be located in the ctscmp output.

There is an ISAM-based version of the superfile compact utility named ctscmpi. This version of

the superfile compact utility uses ISAM c-tree functions rather than low-level c-tree functions to

add records to the new compacted superfile. The advantage of using the ISAM approach is that

records are indexed as they are added, so the utility does not require a separate rebuild phase to

Utilities - Standalone

All Rights Reserved 85 www.faircom.com

repopulate the indexes as the ctscmp utility does. Using this technique can significantly reduce

the time required to compact a superfile.

The ctscmp utility returns a non-zero value when it fails. This can be useful for a script that calls

the utility to be able to detect when it fails.

6.17 ctsfex - Superfile Data Export Utility

The ctsfex utility exports data from a superfile to another superfile or to individual files identical to

the superfile members. This high-performance utility exports the data without index updates,

transaction control, or file extension. After the data export is completed, the indices are rebuilt

and transaction control and file extension properties are restored on the newly-created files. This

utility also supports a multi-threaded version allowing each thread to process a superfile member.

Usage:

ctsfex sf1 [-f sf2 | -d dir] [-cCrovV] [-t thds] [-e key]

[-m recs] [-n size] [-T <path>] [-ctscmp <args>]

[-s svn] [-u uid] [-p upw]

Where:

-f sf2 - Export to superfile sf2

-d dir - Export to standard files in directory dir

-c - Create the target files without exporting data.

-C - Create AND export data for _isp@ and .group tables only.

-r - Force replacement (overwrite) of existing files.

-o - Force open of a corrupted file using the ctOPENCRPT file mode.

-v - Open the superfile and its members to validate a superfile.

-V - Used in conjunction with -v, this option validates records with a read.

-m recs - Send record counter to stdout every recs records.

-e key - Encrypt the target files with key

-t threads - Maximum number of concurrent threads to use.

-T <path> - Specify the location of temporary files created by the rebuild operation.

-s server_name - Server name for connecting to the server.

-u userID - User ID for connecting to the server.

-p userpassword - User password for connecting to the server.

-ctscmp <args> - Invoke the superfile compact utility, ctscmp with <args>.

Standalone Usage

In standalone mode an additional option is available to specify the index node size:

-n size - Index node size to use (standalone mode only).

Utilities - Standalone

All Rights Reserved 86 www.faircom.com

6.18 ctsqlmgr - Migration Utility

The ctsqlmgr utility is used for migrating tables. This utility physically relocates data files for use

with c-treeACE SQL.

It is important to note the migrated new tables could very well not be accessible with your existing

ISAM application. If you have requirements to share data between existing ISAM applications and

c-treeACE SQL you should consider using the c-treeACE SQL Import Utility.

Usage: ctsqlmgr <original file> <destination file> [-s <sect>] [-m <memory KB>]

-s - The number of sectors.

-m - The amount of memory (in KB) to use during the rebuild process (50Mb default).

See Also

Migrating to c-treeACE SQL (http://docs.faircom.com/doc/sqlops/41034.htm) in the c-treeSQL

Server Operations and Utilities Guide

All Rights Reserved 87 www.faircom.com

7. Utilities for Stored Procedures,

User-Defined Functions & Triggers

To simplify the process of deploying SP, UDF, and triggers to multiple servers, these new

command-line utilities can be used to dump and deploy:

dbschema (page 87) - Dump utility option for exporting compiled SP, UDF, and triggers.

dbdeploy (page 87) - Deploy utility for loading exported SP, UDF, and triggers on other

servers.

7.1 dbschema – Option to dump SP, UDF, and triggers

A new option has been added to the dbschema utility that allows stored procedures,

user-defined functions, and triggers to be exported so they can be deployed to other c-treeACE

Servers using dbdeploy. The dbschema -b option is used to dump stored procedures, user

defined functions, and triggers in binary format compatible with dbdeploy:

Usage dbschema [-d] [-b] [-u username] [-a authentication] [-o outputfile]

[-t tablenamelist] [-p procedure_name_list]

[-f function_name_list] [-T trigger_name_list]

[dbsegment_name]

-d - Dump the data.

-b - Dump stored procedures, user-defined functions, or triggers in binary format so they can

be deployed using dbdeploy.

-o - Output file (default: screen).

7.2 dbdeploy – Utility to deploy SP, UDF, and triggers

A new SQL tool, dbdeploy, is used to deploy stored procedures, user defined functions, and

triggers to c-treeACE SQL servers that have been exported using the dbdump tool.

Usage

The syntax is as follows:

dbdeploy [-f] [-u username] [-a authentication] [-i inputfile]

[dbsegment_name]

-u - Username identifiable to the DBMS.

Utilities for Stored Procedures, User-Defined Functions & Triggers

All Rights Reserved 88 www.faircom.com

-a - Password for authentication.

-i - Input file.

-f - Force overwriting of existing items.

7.3 Password Security

The dbdeploy and dbdump command-line utilities are intended to be password-friendly.

However, our customers’ need for security is of great concern. Therefore, utility source code is

provided and can be compiled directly into existing customer application utilities such that existing

security controls can be leveraged.

7.4 Requirements to Develop and Deploy (JDK, JRE)

With the use of the dump and deploy utilities, it is no longer necessary to have both a JDK and

JRE on every server.

Develop: A JDK is required to develop and compile SP, UDF, and triggers on one server, but

is not required for servers with deployed procedures.

Deploy: A JRE is required on a server to run SP, UDF, and triggers.

Copyright Notice

Copyright © 1992-2017 FairCom Corporation. All rights reserved. No part of this publication may be stored in a retrieval

system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording or otherwise without

the prior written permission of FairCom Corporation. Printed in the United States of America.

Information in this document is subject to change without notice.

Trademarks

c-treeACE, c-treeRTG, c-treeAMS, c-tree Plus, c-tree, r-tree, FairCom and FairCom’s circular disc logo are trademarks of

FairCom, registered in the United States and other countries.

The following are third-party trademarks: AMD and AMD Opteron are trademarks of Advanced Micro Devices, Inc.

Macintosh, Mac, Mac OS, and Xcode are trademarks of Apple Inc., registered in the U.S. and other countries.

Embarcadero, the Embarcadero Technologies logos and all other Embarcadero Technologies product or service names

are trademarks, service marks, and/or registered trademarks of Embarcadero Technologies, Inc. and are protected by the

laws of the United States and other countries. Business Objects and the Business Objects logo, BusinessObjects, Crystal

Reports, Crystal Decisions, Web Intelligence, Xcelsius, and other Business Objects products and services mentioned

herein as well as their respective logos are trademarks or registered trademarks of Business Objects Software Ltd.

Business Objects is an SAP company. HP and HP-UX are registered trademarks of the Hewlett-Packard Company. AIX,

IBM, POWER6, POWER7, and pSeries are trademarks or registered trademarks of International Business Machines

Corporation in the United States, other countries, or both. Intel, Intel Core, Itanium, Pentium and Xeon are trademarks or

registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries. Microsoft, the .NET

logo, the Windows logo, Access, Excel, SQL Server, Visual Basic, Visual C++, Visual C#, Visual Studio, Windows,

Windows Server, and Windows Vista are either registered trademarks or trademarks of Microsoft Corporation in the

United States and/or other countries. Novell and SUSE are registered trademarks of Novell, Inc. in the United States and

other countries. Oracle and Java are registered trademarks of Oracle and/or its affiliates. QNX and Neutrino are

registered trademarks of QNX Software Systems Ltd. in certain jurisdictions. CentOS, Red Hat, and the Shadow Man logo

are registered trademarks of Red Hat, Inc. in the United States and other countries, used with permission. UNIX and

UnixWare are registered trademarks of The Open Group in the United States and other countries. Linux is a trademark of

Linus Torvalds in the United States, other countries, or both. Python and PyCon are trademarks or registered trademarks

of the Python Software Foundation. OpenServer is a trademark or registered trademark of Xinuos, Inc. in the U.S.A. and

other countries. Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. in the United States and other

countries.

Btrieve is a registered trademark of Actian Corporation.

ACUCOBOL-GT, MICRO FOCUS, RM/COBOL, and Visual COBOL are trademarks or registered trademarks of Micro

Focus (IP) Limited or its subsidiaries in the United Kingdom, United States and other countries.

isCOBOL and Veryant are trademarks or registered trademarks of Veryant in the United States and other countries.

All other trademarks, trade names, company names, product names, and registered trademarks are the property of their

respective holders.

Portions Copyright © 1991-2016 Unicode, Inc. All rights reserved.

Portions Copyright © 1998-2016 The OpenSSL Project. All rights reserved. This product includes software developed by

the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/).

Portions Copyright © 1995-1998 Eric Young ([email protected]). All rights reserved. This product includes cryptographic

software written by Eric Young ([email protected]). This product includes software written by Tim Hudson

([email protected]).

Portions © 1987-2017 Dharma Systems, Inc. All rights reserved. This software or web site utilizes or contains material

that is © 1994-2007 DUNDAS DATA VISUALIZATION, INC. and its licensors, all rights reserved.

Portions Copyright © 1995-2013 Jean-loup Gailly and Mark Adler.

5/17/2018

All Rights Reserved 90 www.faircom.com

8. Index

A Administrative Utilities - Client .................................. 2 Administrative Utilities - Standalone ....................... 41 ADMINISTRATOR OPTIONS ................................. 36

C Copyright Notice ................................................ lxxxix ct_tpc - TPC A Test ................................................ 49 ct_ver - Display c-treeACE version that created

file ....................................................................... 66 ctadmn - Server Administrator Utility ........................ 2 ctalgn - Change Alignment ..................................... 51 ctcfgset - Server Configuration File Encoding

Utility ................................................................... 41 ctchkbin - Checking for affected tables................... 66 ctclntrn Utility - Clean Transaction Mark ................. 67 ctcmdset - Configuration File Encoding Utility ........ 42 CTCMPC - File compaction .................................... 51 ctcmpcif - IFIL-based Compact Utility ................. 2, 68 ctcnfg - System Configuration Example ................. 52 ctcpvf - Master Password Verification File Utility .... 42 CTCV43 - Convert V4.3 Data File to c-tree

Format ................................................................. 52 ctcv67 - Extended File Conversion Utility ............... 52 ctdbpartidxent - Utility to Enable GUIx Key

Count Optimization ............................................... 4 ctdidx - Create flat key file ...................................... 55 ctdmpidx - Index Dump Utility ................................. 55 ctdump - Dynamic Dump Utility ................................ 5 ctencrypt - Utility to Change Master Password ...... 72 ctfchk - File Checksum Utility ................................. 43 ctfdmp - Forward Dump Utility ................................ 74 ctfilblkif - File Block Utility ......................................... 8 ctfileid - Update File IDs ..................................... 9, 75 ctfixbin - Fixing Affected Tables .............................. 75 ctflat - Create c-treeACE file from a flat file ............ 56 ctflush - File Flush Utility ........................................... 9 ctflvrfy - Index Verify Utility ..................................... 56 cthghtrn - Displays the high-water mark for

transactions......................................................... 44 ctidmp - Examine Dump Files ................................. 76 ctindx - Create index file from flat key file ............... 59 ctinfo - ISAM File Info ....................................... 46, 76 ctixmg - Incremental ISAM / Resource sample ...... 47 ctldmp - Transaction Log Dump ............................. 77 ctpass - Password Utility ........................................ 10 ctpathmigr - Change Internal Path Separators ....... 11 ctpkey - Print key utility ........................................... 60 ctpotp - Parameter to OTP conversion ................... 60 ctptoi - Parameter to IFIL conversion ..................... 60 ctquiet - Quiesce c-treeACE Utility ......................... 11

ctrbld - Parameter file rebuild utility ....................... 61 ctrbldif - IFIL-based Rebuild Utility ................... 14, 77 ctrdmp - Dynamic Dump Recovery or System

Rollback ............................................................. 80 ctrdmp options to convert path separators to

operating system's native path separator .......... 82 ctredirect - IFIL Update Utility for Redirected

Filenames........................................................... 44 ctsbld - Superfile rebuild pre-pass ......................... 83 ctsbldm - Rebuild Superfile Index Members .......... 83 ctscmp - Superfile Compact Utility ......................... 84 ctsfex - Superfile Data Export Utility ................ 48, 85 ctsfil - Superfile contents ........................................ 61 ctsqlcdb - c-treeACE SQL Database

Maintenance Utility ............................................. 16 ctsqlimp .................................................................. 17 ctsqlimp - SQL Import Utility .................................. 17 ctsqlmgr - Migration Utility ..................................... 86 ctsqlutl - c-treeSQL Maintenance Utility ................ 18 ctstat - Statistics Monitoring Utility ......................... 19 ctstop - Server Stop Utility ..................................... 21 ctsysm - Server Status Monitoring Utility ............... 22 cttpca - TPC A Test................................................ 49 cttrap - Communications Trap Playback utility ...... 23 cttrap - TRAP_COMM Utility .................................. 25 cttrnmod - Change Transaction Mode Utility ......... 27 ctunf1 - File Reformatting Utility ............................. 62 ctupdpad - Update the c-treeDB Pad Resource

Utility .................................................................. 63 ctvfyfil - File Verify Utility ........................................ 64 ctvfyidx - Index Verify Utility ................................... 63 ctvlqa - Variable-length quality assurance utility .... 49

D dbdeploy – Utility to deploy SP, UDF, and

triggers ............................................................... 87 dbdump - Data Unload Utility ................................. 30 dbload - Data Load Utility ...................................... 31 dbschema – Option to dump SP, UDF, and

triggers ............................................................... 87 dbschema - Schema Export Utility ......................... 32 deploy .................................................................... 87 develop (dump and deploy) ............................. 87, 88 dump ...................................................................... 87

F FairCom Command-Line Tools .................................1 FILE OPTIONS ...................................................... 39

G GROUP OPTIONS................................................. 38

I ISQL ................................................................. 34, 50

J JDK ........................................................................ 88

Index

All Rights Reserved 91 www.faircom.com

JRE ......................................................................... 88

O Option to set index's automatic segment

attributes ....................................................... 15, 79

P Password Security .................................................. 88

R Requirements to Develop and Deploy (JDK,

JRE) .................................................................... 88 Rollback to New Restore Points with ctrdmp ......... 81

S sa_admin - Command-line security

administration utility ............................................ 34 Scripting a Dynamic Dump ....................................... 6

U Updates in handling of security attributes3, 16, 71, 79 USER OPTIONS ..................................................... 36 Utilities - Client ........................................................ 46 Utilities - Low Level ................................................. 51 Utilities - Standalone ............................................... 66 Utilities for Stored Procedures, User-Defined

Functions & Triggers ........................................... 87