SET LOG

The SET LOG command allows Database Administrators (with SYSADM authority or higher) to suspend logging system operation during an administrative session, and change the path where location log files are stored.

Invocation

SET LOG is an executable XDB Server utility command that can be issued interactively or embedded in a host language. SET LOG can be dynamically prepared.

Authorization

Database Administrator, Install or SYSADM authority is required to turn the logging system on or off or to set the path where logging files are stored.

Syntax

SET LOG {ON | OFF}
SET LOG FOR location-name TO path-name WITH {MOVE | COPY}
SET LOG FOR location-name TO path-name 
         ( ROLLFORWARD [OFF | ON] |
           LOG FILE SIZE n        |
           ROLLFORWARD {OFF | ON} LOG FILE SIZE n }
    WITH RESTART}
SET LOG FOR location-name 
         ( ROLLFORWARD [OFF | ON] |
           LOG FILE SIZE n        |
           ROLLFORWARD {OFF | ON} LOG FILE SIZE n }
    WITH REPLACE}

Parameters:

location-name Identifies an existing XDB Server location.
path-name New path for the location log files.
n An integer specifying the new maximum size (in kilobytes) of an individual log file..

Description

The XDB Server automatically maintains a series of log files for each XDB Server location for use in recovery. This new logging system is normally always defaulted to on. The SET LOG command accommodates the location structure of the XDB Server. Log files operate on a specified XDB Server location, recording all changes made to any objects in that location. The directory path where the log files are stored can be changed using the TO path-name option.

Log files record all changes made to the location since the last back up. In the event of a media failure, the log files can be replayed against a backup copy of the location tables, reconstructing the location data to the state immediately preceding the system failure.

The SET LOG command automatically commits the current transaction. See the Server Administration Guide for more information about backup and recovery options.

Interactive SQL

If you have SYSADM authority or higher and exclusive use of the location, you can temporarily turn the logging system off. When issued from SQLWizard, the SET LOG OFF command temporarily suspends logging for the location during the remainder of the current session. Turning logging off for a particular location is a temporary expedient for an exclusive user that does not want to incur the overhead of logging during administrative tasks.

Logging is turned off for the current session, only. Logging can be activated again in the current session by issuing a SET LOG ON command. Exiting the session toggles the status of location logging back to on (the default). The next session that accesses the location therefore has logging turned on. Setting the logging system on or off from an interactive SQL session does not affect the logging configuration settings in your XDBSRVCO.INI file.

ROLLFORWARD [ OFF | ON ]

If set to Off, this keyword deletes old, unneeded logs automatically. If set to On, this keyword keeps log files.

MOVE

This keyword copies (deleting the originals) all logs files from the named location to the path indicated by path-name, and also changes the current log path for the location to the new path named.

COPY

This keyword copies all logs files from the named location to the path indicated by path-name, and also changes the current log path for the location to the new path named.

RESTART

This keyword closes all log files on the current location log file path and opens new log files in the path indicated by path-name. The log path for the named location is also changed to the new path.

REPLACE

This keyword replaces all log files in the current log file path with new log files. The log path for the log file location stays the same.

Discontinued Commands

Because XDB Server Version 5.0 and above no longer support Forward or Backward logs, the old SET FORWARD LOG and SET BACKWARD LOG commands have been discontinued and replaced with the new SET LOG command. The FWDLOGON field in the SYSXDB.SYSLOCALS system table is no longer used.

Comments

If you are setting the value of LOG FILE SIZE or ROLLFORWARD, you cannot specify WITH COPY or WITH MOVE. If the TO path has not been specified, you must specify WITH REPLACE; in this case, the old logs will be removed and replaced with new logs. If the TO path is specified, you must specify WITH RESTART when moving the logs; in this case, the old logs will be left in the old path and the new log files will be created in the new path.

The XDBSTAT.LOGINFO table is available in all local locations. Querying this table gives the current settings for the log files in that particular location. The columns within the table are:

LOG_PATH Contains the path to the log files for the location.
LOG_STATE Shows the state of the logs as either CLEAN or DIRTY to indicate whether a transaction has modified the log files.
LOG_VERSION Internal XDB logging version.
ROLLFORWARD_STATUS Shows either OFF or ON, where OFF means that logs no longer required for transaction rollback will be purged at the next checkpoint, and ON means that logs will never be purged by the XDB Server.
LOG_FILE_SIZE Maximum size in bytes of an individual log file. New log files will be created once this limit has been reached.

ExampleS:

The SET LOG command only requires the name of the location when changing the log file path using the MOVE, COPY or RESTART keywords. To turn OFF logging for the current location, issue the following command:

SET LOG OFF

To turn logging back ON for the current location, issue the following command:

SET LOG ON

You can also use the SET LOG command to change the directory where the location's log files will be stored. For example:

SET LOG FOR tutorial TO d:\recover WITH COPY
SET LOG FOR tutorial TO d:\log-path2 WITH MOVE
SET LOG FOR tutorial TO d:\log-path2 WITH RESTART