Author: Roman Savochenko
It is often needed to transfer configuration from one OpenSCADA project to another. And, more often it is necessary to make a partial transfer, for example, the transfer of certain developments that could be useful in the new project.
Generally, it should be noted that any developments with the slightest hint, and the prospect of re-use should be standardized and maintained in the separate, own libraries and databases. It is not recommended to change the default configurations and elements of the standard libraries, and save your own, new libraries and elements in the databases of standard libraries. This will subsequently allow you to painlessly update the standard libraries, and to simply use the developments of your previous projects.
1 Easy transfer of the DB with libraries and configuration
If you took into account the above recommendations and all of your uniform developments are contained in the separate database, then the entire transfer process will be to copy the database and connect it to a new project.
The procedure of DB copying is different for different types of databases and you should read about it in the DB documentation. In the OpenSCADA distros it is commonly used the SQLite database, as separate files *.db. Сopying of the SQLite database, respectively, is the simple copying of the the required database file from the database directory of the old project to the database directory of the new one.
Connection is made by creating a new database object in the module of the required DB type of the database subsystem and its subsequent configuration (in details). After the creation, configuration, and the enabling of database you can immediately download the configuration from it by clicking the "Load system from this DB" on the form of the database object.
2 Separation of the desired configuration
If the desired configuration is contained in a common database or in the database of standard libraries, you need to move it to the separate database. You can move the configuration either to a separate database with your libraries or to the export database. Export database, unlike a library one, only serves to transfer the configuration and will subsequently be deleted. In any case, you must create a new database for the desired database type, like the connection procedure above. To transfer you should use a database type that you plan to use in the new project. Usually, it is better to use the SQLite database type for the transfer, because of the simple copying procedure for it. However, if you use a network database, the procedure may change to the simple connection of the library or export database to a new project.
Next, you must separate the configuration in unifying or export libraries, if it can not be directly stored in a database. For example, certain templates of parameters or parameters of the data acquisition controllers, visual elements of the widgets libraries etc. You can separate by creating a library of export or by the unification of the element, such as a library of templates, or the controller of the data acquisition parameters, library of widgets etc. For the newly created library as the database should be specified the previously created unifying or export database. Further you should copy the necessary elements from the original library to unifying/export via a standard copy function. After copying the unifying/export library must be saved.
If it is necessary to transfer the configuration element with a separate DB property or the entire libraries the operation of creating an intermediate library and the further copying can be omitted. It is enough in the DB field to specify the previously created a unifying or export database and save the element.
Further actions, namely the simple transfer of the database, are implemented in accordance with the previous section.
When you transfer the configuration by exporting it is necessary to implement the reverse process of copying from the export libraries to the local libraries of a new project and deleting of the export database.
3 Low-level copy of the DB contents
To transfer you can make selectively copying of the database tables with the configuration by selecting the tables' objects in the database object, the copy command, the selecting of the object of a new database and insert command (in details). However, it is necessary to know the structure of the database, about which you can read by this link.