Developer Reference : Platform Management : Distributed Tuning Interface (DTI) Guide : Distributed Tuning Interface Reference : PvCopyDatabase()
 
PvCopyDatabase()
Copies a database to a new database, adjusting the referential integrity if needed.
Header File: catalog.h (See also Header Files)
Function First Available In Library: w3dbav90.dll (Windows), libpsqldti.so (Linux), libpsqldti.dylib (macOS) (See also Link Libraries)
Syntax
BTI_API PvCopyDatabase(
   BTI_LONG           hConnection,
   BTI_CHAR_PTR       dbName,
   BTI_CHAR_PTR       newdbName,
   BTI_CHAR_PTR       newdictPath,
   BTI_CHAR_PTR       newdataPath);
Arguments
 
In
hConnection
Connection handle that identifies the server. Connection handles are obtained with the PvConnectServer() function.
In
dbName
Name of the database to copy.
In
newdbName
Name of the new database.
In
newdictPath
Dictionary path of the new database.
In
newdataPath
Data path. Pass an empty string to use the default data path (that is, the same as the dictionary path)
If you want to create a new database that consists of MicroKernel Engine data files located in multiple paths, specify this parameter as a semicolon (;) delimited list. For example: C:\data\path1;C:\data\path2
Return Values
 
P_OK
The operation was successful.
P_E_INVALID_HANDLE
Invalid connection handle.
P_E_NULL_PTR
Call with NULL pointer
P_E_ACCESS_RIGHT
Insufficient access right for the operation
P_E_DICTIONARY_ALREADY_EXISTS
Cannot create dictionary because it already exists.
P_E_SHARED_DDF_EXIST
The dictionary path is being used by another database.
P_E_DUPLICATE_NAME
Named database already exists on the server.
P_E_FAIL
Failed for other reasons.
Remarks
The following preconditions must be met:
DTI session started by calling PvStart()
Connection established by PvConnectServer() or if you are performing the operation on a local machine, P_LOCAL_DB_CONNECTION may be used as the connection handle.
Example
BTI_LONG connectionHandle = P_LOCAL_DB_CONNECTION;
BTI_CHAR_PTR newdataPath = “c:\\data\\gallery2”;
BTI_CHAR_PTR newdictPath = “c:\\data\\gallery2”;
BTI_CHAR_PTR databaseName = “Gallery”;
BTI_CHAR_PTR newdatabaseName = “GalleryCopy”;
BTI_SINT status = 0;
BTI_CHAR_PTR server = “MyServer”;
BTI_CHAR_PTR user = “Administrator”;
BTI_CHAR_PTR pwd = “Admin”;
//only need to connect to server if it is remote
//otherwise can pass P_LOCAL_DB_CONNECTION for the handle
 
status = PvCopyDatabase(
connectionHandle,
databaseName,
newdatabaseName
dictPath,
dataPath);
See Also
PvStart()
PvConnectServer()
PvCreateDatabase()
PvGetDbFlags()
PvModifyDatabase()
PvDropDatabase()
PvDisconnect()
PvStop()