# EssCopyDatabase

Description

EssCopyDatabase() copies an existing database, either on the client or the server, to a new database, including all associated databases and objects. If the database is copied on the server, the new database is started.

Syntax

    ESS_FUNC_M EssCopyDatabase (hCtx, hSrcCtx, SrcApp, DestApp, SrcDb, DestDb);

ESS_HCTX_T | hCtx
ESS_HCTX_T | hSrcCtx
ESS_STR_T | SrcApp
ESS_STR_T | DestApp;
ESS_STR_T | SrcDb;
ESS_STR_T | DestDb

Parameters

hCtx | Essbase API context handle.
hSrcCtx | Not used - should be same as hCtx.
SrcApp | Name of source application.
DestApp | Name of destination application.
SrcDb | Name of existing database to copy.
DestDb | Name of new database.

Return Value

None.

Notes

- Copying a client database copies the local database directory and contents.
- This function can only be used to copy a client database to another database on the client, or a server database to another database on the same server. Use EssCopyObject() to copy a database between different servers.

Access

For a server database, the caller must have database Create/Delete/Edit privilege (ESS_PRIV_DBCREATE), and database designer privilege on the source database to be copied (ESS_PRIV_DBDESIGN).

Example

    ESS_FUNC_M

    ESS_CopyDatabase(ESS_HCTX_T hCtx)

    {

       ESS_FUNC_M     sts = ESS_STS_NOERR;

       ESS_HCTX_T    hSrcCtx;

       ESS_STR_T     SrcApp;

       ESS_STR_T     DestApp;

       ESS_STR_T     SrcDb;

       ESS_STR_T     DestDb;

       hSrcCtx = hCtx;

       SrcApp  = "Sample";

       DestApp = "NewSamp";

       SrcDb   = "Basic";

       DestDb  = "NewBasic";

       sts = EssCopyDatabase(hCtx, hSrcCtx, SrcApp,

             DestApp, SrcDb, DestDb);

       return(sts);

    }

See Also

EssCopyApplication()
EssCopyObject()