Nama ERP DocsNama ERP Docs
Home
Namasoft.com
Data Model
GitHub
Home
Namasoft.com
Data Model
GitHub
  • Home

    • Search
    • Guides

      • Entity Flows
      • الفواتير والضرائب والخصومات
      • Supply Chain
      • e-commerce integration (Magento)
      • .
    • Examples
    • Reprocessing Transactions

      • Reprocessing Quantity, Cost, and Stock Ages
      • Accounting Utilities - Ledger and Debt Ages Reprocessing
      • Queries to Check for (and Fix) Cost And Qty Problems
      • Inventory Related Utility Queries
      • Manufacturing Utilities
      • Fixed Assets Module Utilities
      • Real Estate Utilities
      • Database Related Operations
      • Suggest Indexes for Large Detail Tables
      • General Purpose Utility Queries
      • Replication Utilities
      • .
    • Frequently Asked Questions
    • AI Generated Entity Flows Documentation

      • Core
      • Accounting Module
      • AI Module
      • Contracting Module
      • CRM Module
      • EGTax Reader Module
      • Freight Management System Module
      • Hospital Management System Module
      • HR Module
      • e-commerce Integration Module
      • Manufacturing Module
      • POS Module
      • Real Estate Module
      • Service Center Module
      • Supply Chain Module
      • .
    • Release Notes

      • 2016
      • 2017
      • 2018
      • 2019
      • 2020
      • 2021
      • 2022
      • 2025
      • .
    • Video Tutorials

      • Supply Chain Videos
      • Report Wizard Videos
      • Human Resources Videos
      • .

Replication Utilities

Replication Clean Up

Details
update m set messageSent = 1 from SiteOutMessage m left join ReplicationSite rs on rs.code = m.siteCode where rs.inActive = 1 and m.messageSent = 0

    WHILE exists (select top 1 id from SiteOutMessage where messageSent = 1)
BEGIN
BEGIN TRANSACTION x;
delete top (10000) from SiteOutMessage where messageSent = 1;
Commit transaction x;
END;
go
WHILE exists (select top 1 toDel.id from OutBusMessage toDel left join SiteOutMessage som on som.messageId = toDel.id where som.id is null and toDel.messageSent = 1 and toDel.sequence < (select max(sequence) from OutBusMessage ))
BEGIN
BEGIN TRANSACTION x;
delete top (1000) toDel from OutBusMessage toDel left join SiteOutMessage som on som.messageId = toDel.id where som.id is null and toDel.messageSent = 1 and toDel.sequence < (select max(sequence) from OutBusMessage );
Commit transaction x;
END;
go
WHILE exists (select top 1 id from InBusMessage where status = 'Executed')
BEGIN
BEGIN TRANSACTION x;
delete top (10000) from InBusMessage where status = 'Executed'
Commit transaction x;

END;
go

Take Backup and Restore It in Branch Steps

  • PREPARE BACKUP and COPY IT TO BRANCH
  • STOP TOMCAT IN BRANCH
  • RESTORE BACKUP IN BRANCH
  • STOP TOMCAT IN HEAD OFFICE
  • Run The Following in Head Office
Details
update ReplicationStatistics set lastSentMessage = 1, waitingReadCount = 0 , remoteFailuresCount = 0 , localFailuresCount = 0,
lastReceivedMessage = 0 
where siteCode = 'branchcode'
  • Run The Following In Branch
Details
delete from SiteOutMessage
delete from OutBusMessage
delete from InBusMessage

update ReplicationStatistics set lastSentMessage = 1, waitingReadCount = 0 , remoteFailuresCount = 0 , localFailuresCount = 0,
lastReceivedMessage = 0 
where siteCode = 'headoffice'
  • START TOMCAT in HEAD OFFICE and in BRANCH
  • RECOMMIT ANY THING IN BRANCH and MAKE SURE THE MESSAGE IS RECEIVED IN HEAD OFFICE
  • RECOMMIT ANY THING IN HEAD OFFICE and MAKE SURE THE MESSAGE IS RECEIVED IN BRANCH
Edit On github
Last Updated:: 5/26/25, 3:09 PM
Prev
General Purpose Utility Queries
Next
.