Dynamically clone database

Posted by Patrick Tingen on 29-Feb-2016 00:55

Before I start inventing a wheel, it might be wise to ask if there is one around already. What I would like to do is to create a program that can create a local database by cloning the structure of a database that is currently connected. 

The reason is that this is handy for database changes. When we want to do database changes, we start out with an empty local copy of the development database. We do our changes there and then build a delta.df. To create this local database, I would like to create a small program that creates the database with its areas and then copies the schema into it, including sequences. 

Does anybody have anything willing to share? Beware that it /might/ eventually end up as part of the DataDigger, but if that happens, it will be with full credentials of course :)

All Replies

Posted by Riverside Software on 29-Feb-2016 02:19

If a command-line is OK, you can use PCTCreateBase ( github.com/.../PCTCreateBase ) to create a local DB which is either a copy of an existing one, or from a ST + DF file (usually stored in your code repository).

Posted by Patrick Tingen on 29-Feb-2016 02:34

I would like to use command line as a last resort. In our old development environment we had such a command-line driven tool, but most of the times it just failed. You had to start it and then refrain from doing ANYTHING on your computer or else the process would stop responding. This could be avoided by running the prowin32 process in windows xp mode but that was beyond where I drew the line.

Posted by Riverside Software on 29-Feb-2016 03:02

Having to refrain from doing anything suggests that this tool was poorly written :)

PCT is not the only option to do that, but your use case of doing local changes to the DB, then creating an incremental DF to be pushed in the repo (and then published to remote DB) has already been implemented with PCT, and really simple scripts.

Posted by Tim Kuehn on 29-Feb-2016 07:50

Look into the DB API that PSC created when multi-tenancy came out - it has a lot of functionality to support creating a new database and other dba-ish activity.

This thread is closed