Merging Two Databases Using the Historical Data Viewer in MAX for Lookout and the LabVIEW DSC Module 6.1
Note The DSC Module 7.0 has a new version of the Historical Data Viewer. Refer to the document linked below to view the procedure for merging two Citadel databases with the Historical Data Viewer that ships with the DSC Module 7.0. Visit the Upgrade Advisor (linked below) to upgrade LabVIEW and the DSC Module.
You might want to merge Citadel databases because:
- you have multiple Lookout or DSC Module applications running on more than one computer. Even though you would have independent databases for each of the applications, you might also like to have a merged database that contains data from both databases.
- you have a redundant Lookout system. If the main computer fails, the redundant computer takes over and starts to log data, to a local directory in most cases. The result is two historical databases that compliment each other, and probably you will want to merge these databases in order to access all of the historical data from both computers at once.
For this tutorial, a simple Lookout application was developed and some data was saved in two different Citadel databases. The main database will be located on a computer named AE03, which is the local computer on which we'll merge the databases. The remote database is located on another computer named VGCOMP (the remote computer). The database on the local computer is being saved in the c:\data directory. This database contains the values of three Pot objects, but is missing values from 12:00:30 PM to 12:04:19 PM. The database on the remote computer has the value of these three Pots, but from 12:00:40 PM to 12:03:00 PM. As you can see, these databases complement each other.
Figure 1. The primary database on the AE03 computer - Pot1 values

[+] Enlarge Image
Figure 2. Secondary database on the VGCOMP computer - Pot1 values

[+] Enlarge Image
Steps to Merge Two Databases
1. Copy the remote Citadel database directory to the local computer. The name for the database copied from the remote computer used for this tutorial is remotedatabasenew.
IMPORTANT: To manually copy a database directory, you must stop the DSC Module Tag Engine or Lookout, and the Logos services. Refer to the document linked below to learn how to stop the services. If you create a copy while the service is running, you might get an inconsistent copy of the database.
2. Launch MAX so that you can create a new database link to the database copied from the remote computer.
3. Right-click the Historical Data category in MAX and select Create New.
Figure 3. Create a new database

4. Select Citadel Database and click Next.
Figure 4. Create a Citadel database

5. Define the path to the database and click Finish.
Figure 5. Enter values in the Create New Wizard

[+] Enlarge Image
6. Right-click the computer name of the copied database and change it from VGComp to AE03. This changes the names of the traces on the database copied from the remote computer. The idea is to have the same trace names on both databases that you are merging. Otherwise, the traces logged in the process named LabVIEW on the computer VGComp have the prefix \\VGComp\LabVIEW\ and the traces logged in the process named LabVIEW on the computer AE03 have the prefix \\AE03\LabVIEW\. These traces could not be merged with different names.
Figure 6. Rename the copied database

[+] Enlarge Image
7. Create a New View for the copied database by right-clicking the database and selecting New View.
Figure 7. Create a New View

[+] Enlarge Image
8. Select the traces that you want to have in this view. Highlight the computer name and click the >> button. Then click OK.
Figure 8. Add traces to the New View

[+] Enlarge Image
Now you have a view of the traces in the database copied from the remote computer, and you are ready to merge this database with the original database located on the local computer (c:\data).
9. Archive the Data View for the database copied from the remote computer into the local database directory. Right-click the New View that you just created and select Archive to merge the data in this view with the data in the database originally located on the local computer (for this tutorial, c:\data). If you want to keep the original database on the local computer intact, create a backup of it first.
Figure 9. Archive the new Data View

10. Enter the target database folder (c:\data) and click the Start button.
Figure 10. Enter values in the Archive data dialog box

The traces in the Data View for the database copied from the remote computer contained in c:\dataremotenew are merged with the database contained in the c:\data directory, which was the original database located on the local computer.
After archiving the data, you can create a new database link and Data View to see the merged traces.
Figure 11. The merged database on VGCOMP machine

[+] Enlarge Image
The data from the secondary database filled the gap in the primary database.
Related Links:
Upgrade Advisor
Merging Two Databases in LabVIEW DSC Using the New Historical VIs
Reader Comments | Submit a comment »
Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).
