Examining methods and best practices for reliable statistics
Presented by Patrick Labbett for NAEO
Follow the presentation live!
I build things for the call center and answering service industries.
Explaining why you should care.
MDR/CTE are specific to Infinity platforms.
The primary database for billing statistics
Provides insight into what happened on an individual call
How do MDR and CTE get their data?
I recommend using SQL when possible.
Runs as a system service. The GUI is a separate program. This allows data capture after reboot without requiring a user to be logged into the machine.
(You also need a database for each capture program you have running)
If ServerA or ServerB fails, you are still capturing on the other.
Free guide to SQL HA Groups
(You'll need the secret word from attending the webinar)
Use Basic Availability Groups to replace it. Included with Windows Server Standard 2019 and SQL Server Standard 2019.
Instead of Principal/Mirror/Witness, you have Replica servers and listeners
Quick tip for virtual environments:
Try to place the two SQL servers and two app servers on different physical hosts.
Physical Host A
Physical Host B
MDR Capture Server A
MDR Capture Server B
SQL Server A
SQL Server B
AG Listener A
AG Listener B
AG Replica 1
AG Replica 2
Powered by Windows Failover Cluster
Each table is structured differently based on it's purpose.
mCallEnd and mCallSegment are structured similar, except mCallSegment includes an mCallEnd record for each step of the call, not just the final completed call.
Each table is structured identically.
Using the Call and CallOrder field, a timeline of call events can be created. The best example of this is the popular CTE Call Progress Report.
MDR
Number of minutes that have passed since 1900
CTE
Number of seconds that have passed since 1900
An EPOCH is an instant in time that is used for reference in calendar systems
UNIX/POSIX epoch: January 1st, 1970 00:00 UTC
NT time epoch: January 1st, 1601
Microsoft COM, Google Sheets, Excel: 0 January 1900
Because of how calendar systems interact with each other and with leap years, 0 January 1900 and 31 December 1899 are logically equivalent, but may be represented as December 30 1899.
NT time epoch: January 1st, 1601
What is special about this date?
Remember Y2K?
Systems that used 1900 as the epoch and counted by years with 2-digits of storage would lose their precision.
In 2038, dates using the Unix Epoch stored as a signed 32-bit integer will lose their precision.
Only 18 more years!
What we've configured so far is high availability of our statistics in two separate databases.
But what if capture does fail, and one database has more or less records than the other due to this outage?
Written by Mike Liebowitz
Works with a Primary/Secondary database
Uses temp tables to sync differences
Can be ran as a command line program
Download MDR Check right from the NAEO website
SQL Server has built in features that we can leverage to keep our databases in sync.
It's a lot more complicated and requires some knowledge of T-SQL and SQL server
-- Add a linked server
USE [master]
GO
EXEC master.dbo.sp_addlinkedserver
@server = N'SERVER\INSTANCE',
@srvproduct=N'SQL Server' ;
GO
-- Test it!
SELECT name FROM [SERVER\INSTANCE].master.sys.databases ;
GO
DECLARE @DaysToSync INT; SET @DaysToSync = -60;
-- Insert into mdr2 mAlarmCapture
INSERT INTO [mdr2].[dbo].[malarmcapture]
SELECT [recid],
[timestamp],
[call],
[account],
[billing],
[client],
[orgaccount],
[orgbilling],
[orgclient],
[acpacketrec],
[acswitchrec],
[acschedrec]
FROM [mdr].[dbo].[malarmcapture]
WHERE Dateadd(minute, [mdr].[dbo].[malarmcapture].[timestamp], '12/31/1899')
>= Dateadd(day, @DaysToSync, Getdate())
AND NOT EXISTS (SELECT [recid],
[timestamp],
[call],
[account],
[billing],
[client],
[orgaccount],
[orgbilling],
[orgclient],
[acpacketrec],
[acswitchrec],
[acschedrec]
FROM [mdr2].[dbo].[malarmcapture]
WHERE [mdr2].[dbo].[malarmcapture].[recid]
= [mdr].[dbo].[malarmcapture].[recid]);
-- Insert into mdr mAlarmCapture
INSERT INTO [mdr].[dbo].[malarmcapture]
SELECT [recid],
[timestamp],
[call],
[account],
[billing],
[client],
[orgaccount],
[orgbilling],
[orgclient],
[acpacketrec],
[acswitchrec],
[acschedrec]
FROM [mdr2].[dbo].[malarmcapture]
WHERE Dateadd(minute, [mdr2].[dbo].[malarmcapture].[timestamp], '12/31/1899')
>=
Dateadd(day, @DaysToSync, Getdate())
AND NOT EXISTS (SELECT [recid],
[timestamp],
[call],
[account],
[billing],
[client],
[orgaccount],
[orgbilling],
[orgclient],
[acpacketrec],
[acswitchrec],
[acschedrec]
FROM [mdr].[dbo].[malarmcapture]
WHERE [mdr].[dbo].[malarmcapture].[recid] =
[mdr2].[dbo].[malarmcapture].[recid]);
Using Linked Servers, we can adapt the T-SQL to sync records across linked servers.
DECLARE @DaysToSync INT; SET @DaysToSync = -60;
-- Insert into mdr2 mAlarmCapture
INSERT INTO [mdr2].[dbo].[malarmcapture]
SELECT [recid],
[timestamp],
[call],
...
FROM [mdr].[dbo].[malarmcapture]
WHERE Dateadd(minute, [mdr].[dbo].[malarmcapture].[timestamp], '12/31/1899')
>= Dateadd(day, @DaysToSync, Getdate())
AND NOT EXISTS (SELECT [recid],
[timestamp],
[call],
...
FROM [linkedserver].[mdr2].[dbo].[malarmcapture]
WHERE [linkedserver].[mdr2].[dbo].[malarmcapture].[recid]
= [mdr].[dbo].[malarmcapture].[recid]);
Typically used for ongoing maintenance like index rebuilds, database optimization, backups, and more.
Run jobs using SQL Server Integration Services Package
By default, SQL Server Agent is set to manual during installation. Make sure you turn it on in order to take advantage of Maintenance Plans.
You should set this service to run as Automatic (Delayed Startup)
Because there's always a tradeoff.