mco_disk_backup

Perform a file backup for a persistent database.

For an overview see page File Backup

Prototype

    MCO_RET	mco_disk_backup(	/*IN*/ mco_db_h db,
                    /*IN*/ char const* db_backup_path,
                    /*IN*/ char const* log_backup_path);

Arguments

Description

This function allows applications to copy the database and log file for a persistent database. The database can then be "restored" by simply specifying these backup files in the device definition and opening the database in the normal way. Note that the application performing a file backup must use log type REDO_LOG.

The file_backup_delay parameter passed to mco_db_open_dev() can be adjusted to specify the delay in milliseconds between writing backup blocks in order to minimize backup impact on performance.

Return Codes

*These errors indicate a file system failure or possibly invalid file names.

Example

    const char * dbname = "SimpleDb";

    int main(int argc, char* argv[])
    {
        mco_db_h db;
        MCO_RET rc;
        mco_device_t       dev[4];
        mco_db_params_t    db_params;
        char * db_file = "SimpleDb_backup.dbs";
        char * log_file = "SimpleDb_backup.log";

        ...
        rc = mco_db_open_dev( dbname, simple_get_dictionary(), dev, 4, &db_params );

        if ( MCO_S_OK != rc )
        {
            rc = mco_db_connect(  dbname, &db );
            ...
            rc = mco_disk_backup( db, db_file, log_file);

            ...
        }
    }

Files

Header file:
mco.h
Source file:
mcodisk.c
Library:
libmcovtdsk.a