# SYSCS_UTIL.SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE

The `SYSCS_UTIL.SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE` system procedure backs up the database to a specified backup directory and enables the database for log archive mode.

#### Syntax

    SYSCS_UTIL.SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE
    (IN BACKUPDIR VARCHAR(32672), IN SMALLINT DELETE_ARCHIVED_LOG_FILES)

No result is returned from the procedure.

BACKUPDIR
  An input argument of type VARCHAR(32672) that specifies the path to a directory, where the backup should be stored. Relative paths are resolved based on the current user directory, user.dir, of the JVM where the database backup is occurring. Relative paths are not resolved based on the derby home directory. To avoid confusion, use the absolute path
DELETE_ARCHIVED_LOG_FILES
  If the input parameter value for the DELETE_ARCHIVED_LOG_FILES parameter is a non-zero value, online archived log files that were created before this backup will be deleted. The log files are deleted only after a successful backup.

#### JDBC example

The following example backs up the database to the `c:/backupdir` directory:

    CallableStatement cs = conn.prepareCall
    ("CALL SYSCS_UTIL.SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE(?, ?)");
    cs.setString(1, "c:/backupdir");
    cs.setInt(2, 0);
    cs.execute();

#### SQL examples

The following example backs up the database to the `c:/backupdir` directory, enables log archive mode, and does not delete any existing online archived log files:

    SYSCS_UTIL.SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE('c:/backupdir', 0)

The following example backs up the database to the `c:/backupdir` directory and, if this backup is successful, deletes existing online archived log files:

    SYSCS_UTIL.SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE('c:/backupdir', 1)

Parent topic: Built-in system procedures
Related reference
SYSCS_UTIL.SYSCS_COMPRESS_TABLE
SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE
SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS
SYSCS_UTIL.SYSCS_SET_STATISTICS_TIMING
SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY
SYSCS_UTIL.SYSCS_FREEZE_DATABASE
SYSCS_UTIL.SYSCS_UNFREEZE_DATABASE
SYSCS_UTIL.SYSCS_CHECKPOINT_DATABASE
SYSCS_UTIL.SYSCS_BACKUP_DATABASE
SYSCS_UTIL.SYSCS_BACKUP_DATABASE_NOWAIT
SYSCS_UTIL.SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE_NOWAIT
SYSCS_UTIL.SYSCS_DISABLE_LOG_ARCHIVE_MODE
SYSCS_UTIL.SYSCS_EXPORT_TABLE
SYSCS_UTIL.SYSCS_EXPORT_QUERY
SYSCS_UTIL.SYSCS_IMPORT_TABLE
SYSCS_UTIL.SYSCS_IMPORT_DATA