Dumping Databases

From InterBase
Jump to: navigation, search

Go Up to Invoking Service Tasks with isc_service_start( )


Use the cluster identifier isc_action_svc_dump to request that the Services Manager perform a dump operation. This is a programmatic method to invoke the gbak tool as a thread in the ibserver process.

You must specify the absolute full path of the database primary file, and the dump output file or files. Because the Services Manager executes dump tasks on the server host, the Services Manager reads and writes dump files on the server host. The Services Manager also creates files in the context of the server.

Note: Paths of dump files are relative to the server. Because the Services Manager executes dump tasks on the server host, the Services Manager reads and writes dump files on the server host. The Services Manager also creates files in the context of the server.
Services API Database Dump Arguments
Action Argument Purpose Argument length Argument value

isc_action_svc_dump

isc_spb_dbname

Path of the primary file of the database, from the server’s point of view

2 bytes + string

String

isc_spb_dmp_create

Request to execute an Online Dump operation and create an online dump database from a source database. This is passed as a standalone option value to isc_spb_options. This operation is equivalent to the "gbak -dump" command.

0

0

isc_spb_dmp_file

Path of a dump output file; you can specify multiple output files.

2 bytes + string

String

isc_spb_dmp_length

Length in bytes of the dump output file; you must specify one length value for each output file except the last

2 bytes + string

String

isc_spb_dmp_overwrite

Overwrite existing dump file; absence connotes incremental update of existing dump file.

This parameter should be provided just by itself in the SPB byte array. This is an optional argument.

0 byte

0

Starting a database dump service in C/C++:

char request[100],*x, *p = request;

/* Identify cluster */

*p++ = isc_action_svc_dump;

/* Argument for database filename */

*p++ = isc_spb_dbname;

ADD_SPB_LENGTH(p, strlen(argv[1]));

for (x = argv[1]; *x; ) *p++ = *x++;

/* Argument for dump output filename */

*p++ = isc_spb_dmp_file;

ADD_SPB_LENGTH(p, strlen(argv[2]));

for (x = argv[2]; *x; ) *p++ = *x++;

/* Argument to request overwrite of existing dump */

*p++ = isc_spb_dmp_overwrite;

if (isc_service_start(status, &service_handle, NULL, p - request, request)) {

isc_print_status(status);

isc_service_detach(status, service_handle);

exit(1);

}

The Online/Incremental Dump Operations:

Refer to <interbase>/examples/start_dump.c for sample applications for the online/incremental dump operations.

The following is an InterBase Service database dump sample and the usage is:

start_dump <server_host> <instance> <dbfile> <dumpfile>

An absolute path is required for <dbfile> and <dumpfile>

Advance To: