Online Help - Region 4: [CORE HL7 MSSQL] |
Database Maintenance in the DEMO Application
To Run Database Maintenance just follow the steps below.

Step 1: Click Run Schema Database Maintenance

Step 2: Click Start Maintenance Engine
Maintenance will start running and when you are finished or just want to stop, go to Step 3.

Step 3: Click Stop Maintenance
In the CORE HL7 SQL Schema we provide you with a database maintenance class object (COREHL7MSSQLMaintenance) which we recommend that you use to keep your Schema Tables size in check. This way you don't have to root around trying to reverse engineer how to properly remove messages from your tables without leaving orphan records OR running the risk of corrupting your Schema. Refer to the online help for detailed documentation on using the COREHL7MSSQLMaintenance object.
In a nutshell, to run maintenance we need to know 2 things:
1: How many days old does a message have to be to "qualify" to be purged.
2: Should we ONLY purge 'Processed' HL7 Messages.
By DAYS OLD we mean how many 24 hour periods have elapsed since the DateTime value in the LastLoaded data column in your HL7Data table.
By PROCESSED we mean that the numeric data column Processed in the HL7Data table has been set to a NON-ZERO value.
When a maintenance cycle is run it will select records from your HL7Data table which meet the criteria described above. Then it will iterate through those records 1 at a time and perform a database transaction which will do 2 things:
1: It will insert a shadow copy of the HL7 message record in the SchemaMaintenance table (which will remain there for 30 days)
2: Then the transaction will delete all records relating to that message from the Segment data tables as well as any relevant Warehouse tables and your .
The COREHL7MSSQLMaintenance object is a state machine class, meaning that you START it and it runs continuously until you STOP it.
IMPORTANT NOTE: IF you are creating or using SQL Schemas which will ALSO be used by the UltraPort SQL Schema Engine then you should insure that when YOU run a maintenance cycle that the SQL Schema Engine is NOT also running a maintenance cycle.