Database Maintenance

Certain tables in the ResourceXpress database are updated with new records on a regular basis. Some of these tables store vital application information, such as Bookings records, while others record device and 3rd party booking system activity which can be useful when troubleshooting a problem.

Having too many records in the database can lead to application performance issues, it can also lead to a large quota of storage being consumed by the database. Scheduled maintenance on the ResourceXpress database is therefore strongly recommended to ensure performance is not affected and storage limits are not reached.

Plan and Decide

Some planning and decision-making will be required before configuring and executing the database maintenance tasks described below. Consideration should be made to how you consume and report data in ResourceXpress and how troubleshooting could be affected when records are deleted.

Database maintenance requires a two-step approach. First, you configure the actions to take for each maintainable table and second, you configure and schedule the job to carry out the maintenance.

Table 1.0 lists the database tables that can be maintained with descriptions of the records held in those tables.

Table 1.0 - Target Tables

Table Name

Description

Potential Growth

Table Name

Description

Potential Growth

dbo.ConnectivityLog

Records Room Screen connectivity events.

Each Room Screen profile creates 1 record every 60 seconds.

To calculate the amount of records generated in a 24 hour period you can multiply the number of room screen devices in your environment by 1440

60 Room Screens would be 60 * 1440 = 86,400 records in a 24 hour period.*

dbo.BookingSystemConnectivityLog

Any Room Screen profile integrated to a 3rd party booking system will have a corresponding Booking System record when an event is written to the ConnectivityLog

Each Room Screen profile with an active 3rd party booking system integration creates 1 record every 60 seconds.

The same formula detailed in the ConnectivityLog table can be used to estimate the number of generated records

dbo.QubiActivityLog

Connections to the application from a Qubi 2, Qubi 3 or TD-0350 desk device are stored here.

Each of the listed desk devices will create 1 record every 60 seconds.

The same formula detailed in the ConnectivityLog table can be used to estimate the number of generated records

dbo.Bookings

Local bookings and 3rd party booking system records.

Each booking either created locally in the application or synchronized from a 3rd party booking system will create 1 record per configured profile.

dbo.ResourceMessages

Admin configured resource messages that are broadcast to Room Screens and Kiosks

Resource Messages records still persist in the database even after the configured expiry date has passed. If the message is deleted from the admin console it is also removed from the database.

dbo.EquipmentProblems

Any “Call for Help” reports for faulty equipment or other resources made from Room Screens or Kiosks.

Equipment Problem records persist in the database even when the problem has been closed in the admin console.

dbo.AuditLog
v2023.1

Logs the audit information for the admin console

This depends on the changes done in the admin console.

dbo.GraphSubscription
v2023.1

Logs Graph subscriptions for every profile. This is used for sending un-subscription request in case if there is a new subscription available for a resource.

This depends on the number of Exchange/Office 365 profiles.

dbo.SchedulerInfo
v2023.1

Store the success profiles, failure profiles, total profiles run by scheduler and their updated time.

This depends on the schedule interval. If it is set to 5, then the table has 144 records per day.

dbo.UserLoginHistory
v2023.1

Log the user logged-in time, IP address, Device Type, Login Type and OS Version.

This depends on the number of users logged in to Kiosk, Maps, Admin Console, Mobile, Outlook Add-In.

*Records are not generated when the profile is in Energy Saving Mode

Available Maintenance Actions

There are four available actions for each of the above tables

Delete

The delete action will remove all records from the live target table. Records will not be archived and cannot be retrieved.

Deleting will improve performance and reduce the size of the database.

Archive

The archive option will move the records from the live table to an archive table. Records in an archive table cannot be viewed from the application UI but can be queried directly from the database.

When archiving, you specify the number of days worth of records to retain in the archive table.

Archiving will improve performance as the records do not interfere with application lookups however they still take up the same amount of storage space.

Take No Action

No records will be deleted or archived from the live table.

No performance or storage benefits apply to this option.

Configuring Maintenance Actions

Configuring the available maintenance actions is carried out in the ResourceXpress database and involves executing SQL queries to set your desired configuration.

Table 1.1 describes the available actions and their respective SQL values.

Table 1.2 shows the relevant SQL column names and the values configured by default.

Table 1.1 - SQL Values

Action Description

SQL Value

Action Description

SQL Value

Delete

0

Archive

Any positive number i.e. 1, 2, 3 etc. The number configured will be the number of days records will be archived

Take No Action

NULL

Table 1.2 - Column Names and Default Values

Column Name

Default Value

Column Name

Default Value

ConnectivityLogDaysToKeep

We recommend that at least 1 day of Connectivity Log Records are kept

0 Delete all records

BookingSystemConnectivityLogDaysToKeep

0 Delete all records

QubiActivityLogDaysToKeep

1 Archive for 1 day

BookingDaysToKeep

NULL Take no action

ResourceMessagesDaysToKeep

NULL Take no action

EquipmentProblemsDaysToKeep

NULL Take no action

ConnectivityLogArchiveDaysToKeep

0 Take no action

BookingSystemConnectivityLogArchiveDaysToKeep

0 Take no action

QubiActivityLogArchiveDaysToKeep

1 Archive for 1 day

BookingArchiveDaysToKeep

NULL Take no action

ResourceMessagesArchiveDaysToKeep

NULL Take no action

EquipmentProblemsArchiveDaysToKeep

NULL Take no action

GraphSubscriptionDaysToKeep v2023.1

3 = Archive for 3 days

SchedulerInfoDaysToKeep v2023.1

1 = Archive for 1 day

AuditLogDaysToKeep v2023.1

NULL = Take no action

AuditLogArchiveDaysToKeep v2023.1

NULL = Take no action

UserLoginHistoryDaysToKeep v2023.1

NULL = Take no action

UserLoginHistoryArchiveDaysToKeep v2023.1

NULL = Take no action

To view the currently applied configuration execute the query

select * from dbo.ArchiveSetting

To change the maintenance action on any column you can run the below update query against the ResourceXpress database.

update dbo.ArchiveSetting set <column_name> = <value> where TenantId = 1

Example Queries

Archive Device Connectivity Log Records for 5 days

update dbo.ArchiveSetting set ConnectivityLogDaysToKeep = 5 where TenantId = 1

Keep all Qubi Activity Log records (not recommended)

Delete all Booking records

The maintenance actions configured in these columns will be carried out when the maintenance job executes. For example, if you configure the Booking option to 0 (delete) and the maintenance job runs at 2:00 am, all booking records will be deleted at that time.

Once you have configured your desired values you can move on to configuring the maintenance job itself.

Configuring the Maintenance Job

Option 1 - SQL Agent Job - MSSQL Server Only

If your ResourceXpress database is hosted on a dedicated SQL Server instance we recommend carrying out database maintenance as an SQL Agent Job.

Connect to the SQL Server using SQL Server Management Studio

Expand SQL Server Agent, right-click the Jobs folder, and select New Job…

On the General page populate the Name, Category, and Description fields then click OK

Select the Steps page and click New…

On the General page add a Step name, select the Type as Transact-SQL script (T-SQL) and ensure the correct Database is selected.

Add the below content into the Command window

On the Advanced page drop down the option On success action and select Go to the next step then click OK to save the step

On the Steps page click New… again to create a second step

On the General page add a Step name, select the Type as Transact-SQL script (T-SQL) and ensure the correct Database is selected.

Add the below content into the Command window

On the Advanced page drop down the option On success action and select Quit the job reporting success then click OK to save the step

The two steps will now be listed

Select the Schedules page and click New…

Add a Name and configure the schedule options to your requirements. We recommend running the maintenance job daily at 2:00 am to avoid working hours. Once configured click OK.

Select the Notifications page and check the option Write to the Windows Application event log, from the dropdown options select When the job fails.

Click OK to save the maintenance job.

ResourceXpress Database Maintenance for MSSQL Server has now been configured.

Expand the Jobs folder to view the newly created job. If the system has been running for some time you can run the job immediately instead of waiting for the first scheduled run by right-clicking and selecting Start Job at Step…

Option 2 - Windows Task Scheduler & PowerShell - SQL Express Edition

SQL Server Agent jobs are not supported on a SQL Express Edition instance, if you’re running SQL Express please use the below steps to configure Database Maintenance.

First, create the application directory shown below on the ResourceXpress Server

C:\Program Files (x86)\QED\RxDBMaintenance

Create a new text document and name it RxDBMaintenance.ps1

Copy the below content into the new file and replace the following values in the $connectionString line

  • <SQL-SERVER\INSTANCE> = Your SQL Server instance name e.g. SQLSRV01\SQLEXPRESS

  • <database_name> = your ResourceXpress database name e.g. express

Save and close the file.

Open Windows Task Scheduler

In the Actions pane select Create Task…, configure the General Settings as below

Move on to the Triggers tab and configure the desired schedule. We recommend running the maintenance job daily at 2:00 am to avoid working hours. Click OK.

Click New… in the Actions tab and configure the required options.

The Program/script path should point to PowerShell.exe

In the Add arguments field add -File “C:\Program Files (x86)\QED\RxDBMaintenance\RxDBMaintenance.ps1

Click OK.

Configure the Settings tab then click OK to save the task.

ResourceXpress Database Maintenance for SQL Express Edition has now been configured.

The new job will be listed in the Task Scheduler Library. If the system has been running for some time you can run the job immediately instead of waiting for the first scheduled run by right-clicking and selecting Run

Logs

The number of records deleted and or archived are recorded in the database in the ArchiveLog table, to view the logs execute the below SQL query against the ResourceXpress database.


Document Updates

V2023.3

Two values have been removed from the $spList.

  • Removed DeleteGraphSubscription

  • Removed DeleteSchedulerInfo

 

The following macros are not currently supported in the footer:
  • style