Tag Archives: K2 Databases

Error Starting Host Server: Invalid Object Name ‘GroupProvider’ – K2 Upgrade from 0807 KB00690 to 4.5 KB001370

On upgrading K2 at a client recently (0807 KB00690 to 4.5 KB001370), I found that the host server refused to start and gave the following error:

“Error Starting Host Server: Invalid Object Name ‘GroupProvider'”. After some web searches, I found that this is a known issue that can occur when upgrading to 4.5 1370. In order to resolve this issue, the following script must first be run on the HostServer database:

Use [K2HostServer]
DELETE FROM LicensedUsers
WHERE LicensedUsers.CredentialID NOT IN (SELECT CredentialID FROM SecurityCredentialCache)

Once this script has been executed, run the HostserverAlter.sql script located in the following location:

C:\Program Files (x86)\K2 Blackpearl\Setup\Configuration\Scripts

In my case, the K2 server then started up successfully.

K2 blackpearl Legacy Database Backup Script

Although the newest releases of K2 blackpearl and blackpoint (version 4.6 and newer) consolidate all of the 14 databases that were initially used by K2 (these are  now separated using different schemas), it is still necessary in some cases to make a backup of all 14 legacy databases, very often excluding the “K2” prefix of some of the newer releases. I have created a script that creates 14 separate “.bak” files for each of the legacy databases and places them in a predefined folder. This script is an extension of Johan Liebenberg’s script located here: Backing up the K2 blackpearl Databases

DECLARE @path VARCHAR(256) -- path for backup files
DECLARE @fileName VARCHAR(256) -- filename for backup
DECLARE @fileDate VARCHAR(20) -- used for file name

-- specify database backup directory
SET @path = 'C:\Backup\'

-- specify filename format
SELECT @fileDate = CONVERT(VARCHAR(20),GETDATE(),112)

SET @fileName = @path + 'Categories' + '_' + @fileDate + '.BAK'
BACKUP DATABASE Categories
TO DISK = @fileName

SET @fileName = @path + 'Dependencies' + '_' + @fileDate + '.BAK'
BACKUP DATABASE Dependencies
TO DISK = @fileName

SET @fileName = @path + 'EnvironmentSettings' + '_' + @fileDate + '.BAK'
BACKUP DATABASE EnvironmentSettings
TO DISK = @fileName

SET @fileName = @path + 'EventBus' + '_' + @fileDate + '.BAK'
BACKUP DATABASE EventBus
TO DISK = @fileName

SET @fileName = @path + 'EventBusScheduler' + '_' + @fileDate + '.BAK'
BACKUP DATABASE EventBusScheduler
TO DISK = @fileName

SET @fileName = @path + 'HostServer' + '_' + @fileDate + '.BAK'
BACKUP DATABASE HostServer
TO DISK = @fileName

SET @fileName = @path + 'K2Server' + '_' + @fileDate + '.BAK'
BACKUP DATABASE K2Server
TO DISK = @fileName

SET @fileName = @path + 'K2ServerLog' + '_' + @fileDate + '.BAK'
BACKUP DATABASE K2ServerLog
TO DISK = @fileName

SET @fileName = @path + 'K2SQLUM' + '_' + @fileDate + '.BAK'
BACKUP DATABASE K2SQLUM
TO DISK = @fileName

SET @fileName = @path + 'SmartBox' + '_' + @fileDate + '.BAK'
BACKUP DATABASE SmartBox
TO DISK = @fileName

SET @fileName = @path + 'SmartBroker' + '_' + @fileDate + '.BAK'
BACKUP DATABASE SmartBroker
TO DISK = @fileName

SET @fileName = @path + 'SmartFunctions' + '_' + @fileDate + '.BAK'
BACKUP DATABASE SmartFunctions
TO DISK = @fileName

SET @fileName = @path + 'WebWorkflow' + '_' + @fileDate + '.BAK'
BACKUP DATABASE WebWorkflow
TO DISK = @fileName

SET @fileName = @path + 'Workspace' + '_' + @fileDate + '.BAK'
BACKUP DATABASE Workspace
TO DISK = @fileName
GO

Further information on K2 database consolidation can be found here.

K2 Issue – Symmetric Keys Missing After Database Move and Upgrade

When creating a new K2 environment, it is often easiest to backup and move the K2 database(s) across to the new environment’s SQL server and reconfiguring the database(s) to contain the new environment information rather than to redeploy all existing processes, SmartObjects and solutions into the new environment (which can often cause quite a headache with differing SmartObject GUIDs etc).

What can happen sometimes, however, is the symmetric keys used by K2 for single sign-on and other authentication purposes, go missing. Recently this happened to me when upgrading from 0807 to 4.5. This was reported in the configuration analysis after the upgrade with multiple errors similar to the following:

“Symmetric key for the <Insert Database Name here> database has not been detected.”

In order to recreate the symmetric keys for the databases where they are missing and resolve the issue, first stop the K2 server service, make a backup of all K2 database(s), and run the following scripts on each database listed in error in the configuration analysis:

DROP SYMMETRIC KEY SCSSOKey
DROP CERTIFICATE SCHostServerCert
DROP MASTER KEY

If the above commands fail, don’t fret, this just means that the symmetric keys indeed do not exist, which is why we will then run the following commands to replace them:

CREATE MASTER KEY ENCRYPTION BY PASSWORD = ‘*CONTACT K2 SUPPORT FOR KEY*’

CREATE CERTIFICATE SCHostServerCert 
WITH SUBJECT = 'Host Server Certificate', START_DATE = '01/01/2007', EXPIRY_DATE = '01/01/2017' 
CREATE SYMMETRIC KEY SCSSOKey WITH ALGORITHM = TRIPLE_DES 
ENCRYPTION BY CERTIFICATE SCHostServerCert 

The above set of commands should succeed, resulting in the required symmetric keys being recreated for the databases.

Once you have run these commands successfully, re-analyse the nodes in the configuration analysis and you should see that they no longer display in error.