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.