{"id":542,"date":"2014-09-07T13:00:47","date_gmt":"2014-09-07T11:00:47","guid":{"rendered":"http:\/\/www.rocworks.at\/wordpress\/?p=542"},"modified":"2014-09-07T18:23:59","modified_gmt":"2014-09-07T16:23:59","slug":"542","status":"publish","type":"post","link":"https:\/\/www.rocworks.at\/wordpress\/?p=542","title":{"rendered":"WinCC OA history data replication (RDBSyncForward) HowTo&#8230;"},"content":{"rendered":"<p>It is possible to use the RDBSyncForward feature to replicate history data to a second Oracle database.<\/p>\n<p>WinCC OA primarily writes the history data to the first database. Values are replicated from the first database to the second database by Oracle-Packages (part of WinCC OA). When the first database goes down then WinCC OA will continue to write history data to the second database. When the first database gets up and running again then WinCC OA will switch back to the first database and the history data which was written to the second database will be replicated from the second database to the first database.<\/p>\n<p>The bi-directional replication is done asynchronously (periodically)! If one database crashes some history data may be lost.<\/p>\n<p><strong>Prepare two RDB configuration files <\/strong><\/p>\n<p>RDB_config_DB1.sql and RDB_config_DB2.sql.<\/p>\n<p>Use RDB_config_template.sql: C:\\Siemens\\Automation\\WinCC_OA\\3.12\\data\\RDBSetup\\ora\\RDB_config_template.sql<\/p>\n<p>Example configuration file with ASM is shown at the end.<br \/>\nThe following lines are important for the data replication.<\/p>\n<p>RDB_config_DB1.sql:<br \/>\n<code><br \/>\ndefine whatpackage = 'fwd'<br \/>\ndefine connect_first = '&amp;connect_identifier'<br \/>\ndefine connect_second = 'DB2'<br \/>\ndefine whatinstall = '3'<br \/>\ndefine syncjob_intval = 1<br \/>\n<\/code><\/p>\n<p>RDB_config_DB2.sql:<br \/>\n<code><br \/>\ndefine whatpackage = 'fwd'<br \/>\ndefine connect_first = '&amp;connect_identifier'<br \/>\ndefine connect_second = 'DB1'<br \/>\ndefine whatinstall = '3'<br \/>\ndefine syncjob_intval = 1<br \/>\n<\/code><\/p>\n<p><strong>Prepare the TNSNAMES.ORA<\/strong><br \/>\nIt must contain both databases and must be deployed to the WinCC OA server(s) and to the database servers!<br \/>\nAn TNSNAMES.ORA example you will find below.<\/p>\n<p><strong>Change to RDBSetup directory<\/strong><br \/>\nC:\\Siemens\\Automation\\WinCC_OA\\3.12\\data\\RDBSetup\\ora<\/p>\n<p><strong>Execute the RDB-Manager-Setup-Script for the first Oracle-Database.<\/strong><br \/>\n<code>&gt; win_install.bat\/unix_intall.sh _DB1<\/code><\/p>\n<p>E<strong>xecute the RDB-Manager-Setup-Scriptfor the second Oracle-Database.<\/strong><br \/>\n<code>&gt; win_install.bat\/unix_intall.sh _DB2<\/code><\/p>\n<p><strong>Change to sync subdirectory<\/strong> C:\\Siemens\\Automation\\WinCC_OA\\3.12\\data\\RDBSetup\\ora\\sync<\/p>\n<p><strong>Execute the sync setup for database 1<\/strong><br \/>\n<code>&gt; sync_setup _DB1 ..\\<\/code><\/p>\n<p><strong>Execute the sync setup for database 2<\/strong><br \/>\n<code>&gt; sync_setup _DB2 ..\\<\/code><\/p>\n<p><strong>Check arc_log table for (error)messages<\/strong><br \/>\n<code>select * from arc_log order by arc_log_id desc<\/code><\/p>\n<p><strong>Adapt WinCC OA config file<\/strong><br \/>\nImportant for the data replication is the following configuration:<br \/>\n[ValueArchiveRDB]<br \/>\nDb = &#8220;DB1,DB2&#8221;<\/p>\n<p><strong>RDB archive group configuration<\/strong><br \/>\nIn WinCC OA go to system management \/ database \/ RDB archive groups and set the check box &#8220;forwarding&#8221; for the archive groups you wanna sync.<\/p>\n<p><strong>WinCC OA config file<\/strong><br \/>\n<code><br \/>\n[general]<br \/>\nuseRDBArchive = 1<br \/>\nuseRDBGroups = 1<\/p>\n<p>[ValueArchiveRDB]<br \/>\nDbUser = \"RDBSYNC\"<br \/>\nDbPass = \"manager\"<br \/>\nDbType = \"ORACLE\"<br \/>\nDb = \"DB1,DB2\"<br \/>\nwriteWithBulk = 1<\/p>\n<p>[ctrl]<br \/>\nqueryRDBdirect = 1<br \/>\nCtrlDLL = \"CtrlADO\"<br \/>\nCtrlDLL = \"CtrlRDBArchive\"<br \/>\nCtrlDLL = \"CtrlRDBCompr\"<\/p>\n<p>[ui]<br \/>\nqueryRDBdirect = 1<br \/>\nCtrlDLL = \"CtrlADO\"<br \/>\nCtrlDLL = \"CtrlRDBArchive\"<br \/>\nCtrlDLL = \"CtrlRDBCompr\"<br \/>\n<\/code><\/p>\n<p><strong>TNSNAMES.ORA<\/strong><br \/>\n<code><br \/>\nDB1 =<br \/>\n(DESCRIPTION =<br \/>\n(ADDRESS = (PROTOCOL = TCP)(HOST = Linux-DB-01)(PORT = 1521))<br \/>\n(CONNECT_DATA = (SERVICE_NAME = DB1))<br \/>\n)<\/p>\n<p>DB2 =<br \/>\n(DESCRIPTION =<br \/>\n(ADDRESS = (PROTOCOL = TCP)(HOST = Linux-DB-02)(PORT = 1521))<br \/>\n(CONNECT_DATA = (SERVICE_NAME = DB2))<br \/>\n)<br \/>\n<\/code><\/p>\n<p><strong>RDB_config_DB1.sql<\/strong><br \/>\n<code><br \/>\ndefine connect_identifier = 'DB1'<br \/>\ndefine sysdba_user = 'SYS'<br \/>\ndefine yesno_newuser = 'yes'<br \/>\ndefine schema_user = 'RDBSYNC'<br \/>\ndefine app_user = 'RDBSYNCAPP'<br \/>\ndefine use_rman = 'rman'<br \/>\ndefine os_sys = 'unix'<br \/>\ndefine zip_backup = 'no'<br \/>\ndefine sequence_start = 100000<br \/>\ndefine sequence_maxvalue = 199999<br \/>\ndefine path_dbfile = '+DATA\/WINCCOA\/RDBSYNC\/'<br \/>\ndefine path_tempdbfile = '+DATA\/WINCCOA\/RDBSYNC\/'<br \/>\ndefine path_oraclebin = '\/u01\/app\/oracle\/product\/12.1.0\/dbhome_1\/bin\/'<br \/>\ndefine instance_name = 'DB1'<br \/>\ndefine host_name = 'linux-db-01'<br \/>\ndefine path_backup = '\/u01\/app\/oracle\/fast_recovery_area\/DB1\/winccoa\/'<br \/>\ndefine path_alert = '+DATA\/WINCCOA\/RDBSYNC\/'<br \/>\ndefine path_event = '+DATA\/WINCCOA\/RDBSYNC\/'<br \/>\ndefine mytimezone = 'Europe\/Vienna'<br \/>\ndefine asm_instance = '+ASM'<br \/>\ndefine service_name = 'DB1'<br \/>\ndefine number_db_storage = 1<\/p>\n<p>define whatpackage = 'fwd'<br \/>\ndefine connect_first = '&amp;connect_identifier'<br \/>\ndefine connect_second = 'DB2'<br \/>\ndefine whatinstall = '3'<br \/>\ndefine syncjob_intval = 1<br \/>\n<\/code><\/p>\n<p><strong>RDB_config_DB2.sql<\/strong><br \/>\n<code><br \/>\ndefine connect_identifier = 'DB2'<br \/>\ndefine sysdba_user = 'SYS'<br \/>\ndefine yesno_newuser = 'yes'<br \/>\ndefine schema_user = 'RDBSYNC'<br \/>\ndefine app_user = 'RDBSYNCAPP'<br \/>\ndefine use_rman = 'rman'<br \/>\ndefine os_sys = 'unix'<br \/>\ndefine zip_backup = 'no'<br \/>\ndefine sequence_start = 100000<br \/>\ndefine sequence_maxvalue = 199999<br \/>\ndefine path_dbfile = '+DATA\/WINCCOA\/RDBSYNC\/'<br \/>\ndefine path_tempdbfile = '+DATA\/WINCCOA\/RDBSYNC\/'<br \/>\ndefine path_oraclebin = '\/u01\/app\/oracle\/product\/12.1.0\/dbhome_1\/bin\/'<br \/>\ndefine instance_name = 'DB2'<br \/>\ndefine host_name = 'linux-db-02'<br \/>\ndefine path_backup = '\/u01\/app\/oracle\/fast_recovery_area\/DB1\/winccoa\/'<br \/>\ndefine path_alert = '+DATA\/WINCCOA\/RDBSYNC\/'<br \/>\ndefine path_event = '+DATA\/WINCCOA\/RDBSYNC\/'<br \/>\ndefine mytimezone = 'Europe\/Vienna'<br \/>\ndefine asm_instance = '+ASM'<br \/>\ndefine service_name = 'DB2'<br \/>\ndefine number_db_storage = 1<\/p>\n<p>define whatpackage = 'fwd'<br \/>\ndefine connect_first = '&amp;connect_identifier'<br \/>\ndefine connect_second = 'DB1'<br \/>\ndefine whatinstall = '3'<br \/>\ndefine syncjob_intval = 1<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>It is possible to use the RDBSyncForward feature to replicate history data to a second Oracle database. WinCC OA primarily writes the history data to the first database. Values are replicated from the first database to the second database by &hellip; <a href=\"https:\/\/www.rocworks.at\/wordpress\/?p=542\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-542","post","type-post","status-publish","format-standard","hentry","category-wincc-oa"],"_links":{"self":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/542","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=542"}],"version-history":[{"count":20,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/542\/revisions"}],"predecessor-version":[{"id":580,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/542\/revisions\/580"}],"wp:attachment":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=542"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=542"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=542"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}