Script install quantum.migratorcmd.exe --INSTALL

Hi everyone,

 

I've been facing challenges with the script-based installation of Identity Manager using the quantum.migratorcmd.exe tool. However, everything proceeds smoothly when I use the Configuration Wizard for installation.

From what I understand, the quantum.migratorcmd.exe does not create the OneIM database; it needs to be manually created along with all its configurations. I have constructed this using SQL commands. Additionally, I compared a database installed via the Wizard with one I created manually and found that the settings are identical. Below is the script for creating the database and applying the necessary settings:

--Create the database and adding Install account to db_owner group:

DECLARE @DBName NVARCHAR(128) = N'OneIM';

DECLARE @LoginName NVARCHAR(50) = N'OIM_Install';

DECLARE @SQL NVARCHAR(MAX);

 

-- Check if the database exists; if not, create it

IF NOT EXISTS (SELECT * FROM sys.databases WHERE name = @DBName)

BEGIN

    SET @SQL = N'CREATE DATABASE ' + QUOTENAME(@DBName);

    EXEC sp_executesql @SQL;

END

 

-- Wait for the database to be created (optional, might be needed for immediate subsequent operations)

WAITFOR DELAY '00:00:05'; -- Waits for 5 seconds; adjust as necessary

 

-- Dynamic SQL to create the user and add to db_owner within the new database

SET @SQL = N'USE ' + QUOTENAME(@DBName) + N'; ' +

           N'IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = ' + QUOTENAME(@LoginName, '''') + N') ' +

           N'BEGIN ' +

           N'CREATE USER ' + QUOTENAME(@LoginName) + N' FOR LOGIN ' + QUOTENAME(@LoginName) + N'; ' +

           N'ALTER ROLE db_owner ADD MEMBER ' + QUOTENAME(@LoginName) + N'; ' +

           N'END';

 

EXEC sp_executesql @SQL;

 

 

--Adding the database to a Memory File group:

DECLARE @DBName NVARCHAR(128) = N'OneIM';

DECLARE @SQL NVARCHAR(MAX);

 

SET @SQL = N'ALTER DATABASE ' + QUOTENAME(@DBName) +

           N' ADD FILEGROUP ' + QUOTENAME(@DBName + '_InMemory') + N' CONTAINS MEMORY_OPTIMIZED_DATA';

EXEC sp_executesql @SQL;

 

SET @SQL = N'ALTER DATABASE ' + QUOTENAME(@DBName) +

           N' ADD FILE (NAME = N''' + @DBName + '_InMemory_File'',

                       FILENAME = N''C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\DATA\' + @DBName + '_InMemory_File'')

            TO FILEGROUP ' + QUOTENAME(@DBName + '_InMemory');

EXEC sp_executesql @SQL;

 

--This script will configure all settings in the database, as specified in the documentation.

DECLARE @DBName NVARCHAR(128) = 'OneIM';
DECLARE @SQL NVARCHAR(MAX);
DECLARE @CompatibilityLevel INT = 150; -- For SQL Server 2019
DECLARE @RecoveryModel VARCHAR(50) = 'SIMPLE';

-- Check and Set Recovery Model
SET @SQL = 'IF NOT EXISTS (SELECT 1 FROM sys.databases WHERE name = @DBName AND recovery_model_desc = @RecoveryModel)
BEGIN
ALTER DATABASE [' + @DBName + '] SET RECOVERY SIMPLE;
END';
EXEC sp_executesql @SQL, N'@DBName NVARCHAR(128), @RecoveryModel VARCHAR(50)', @DBName, @RecoveryModel;

-- Check and Set Compatibility Level
SET @SQL = 'IF NOT EXISTS (SELECT 1 FROM sys.databases WHERE name = @DBName AND compatibility_level = @CompatibilityLevel)
BEGIN
ALTER DATABASE [' + @DBName + '] SET COMPATIBILITY_LEVEL = ' + CAST(@CompatibilityLevel AS VARCHAR(10)) + ';
END';
EXEC sp_executesql @SQL, N'@DBName NVARCHAR(128), @CompatibilityLevel INT', @DBName, @CompatibilityLevel;

-- Check and Set READ_COMMITTED_SNAPSHOT
SET @SQL = 'IF NOT EXISTS (SELECT 1 FROM sys.databases WHERE name = @DBName AND is_read_committed_snapshot_on = 1)
BEGIN
ALTER DATABASE [' + @DBName + '] SET READ_COMMITTED_SNAPSHOT ON;
END';
EXEC sp_executesql @SQL, N'@DBName NVARCHAR(128)', @DBName;

-- Additional settings like In-Memory OLTP configurations
-- Check and add a filegroup for In-Memory OLTP if it doesn't exist
SET @SQL = 'IF NOT EXISTS (SELECT 1 FROM sys.filegroups WHERE type = ''FX'' AND name = @DBName + ''_InMem'')
BEGIN
ALTER DATABASE [' + @DBName + ']
ADD FILEGROUP [' + @DBName + '_InMem] CONTAINS MEMORY_OPTIMIZED_DATA;

ALTER DATABASE [' + @DBName + ']
ADD FILE (name = ''' + @DBName + '_InMemory_File'', filename = ''path_to_file'')
TO FILEGROUP [' + @DBName + '_InMem];
END';
EXEC sp_executesql @SQL, N'@DBName NVARCHAR(128)', @DBName;

 

I've installed all Machine Roles on the server and same modules as in the command bellow, noting that this is a DEMO environment, so everything is set up on the same server. Now, let's move on to using the quantum.migratorcmd.exe --Install command (I've omitted the password in this command for security reasons).

quantum.migratorcmd.exe --INSTALL /Admin=Mode=create;Login=OneIM_Admin;Password=; /Connection="Data Source=localhost;Initial Catalog=OneIM;User ID=OIM_Install;Password=" /system=MSSQL /Module="QER,SAP,ATT,ADS,RMS" /destination="C:\OIM\IdentityManager.9.2\OneIdentityManager.9.2" /loglevel="Trace" /password="" /Edition="STE" /Group="GroupName=CCCCustomGroup" /DialogDatabase=CustomerName="CustomInstall;ProductionLevel=2"

 

Everything works fine, but when I open the LaunchPad, I encounter the following error:

[1218004] Either you have connected to an old database or to a database that is not correctly configured.
at VI.CommonDialogs.ConnectionDialogControl.<>c__DisplayClass102_0.<_CheckForUpdates>b__0()
at VI.CommonDialogs.AutoUpdateControl.CheckForUpdates(ConnectData conData)
at VI.Update.UpdateHandler.CheckForUpdates()

Crash report

2024-04-11 00:02:59 SqlLog Opening database session in mode ReadWrite
2024-04-11 00:02:59 SqlLog Raw data for unique database id: 'WIN-UAP839PND1S|ONEIM|5|2024-04-10T23:12:32.5630000'
2024-04-11 00:02:59 SqlLog Computed hash value for unique database id: CRf/+lwCZUOCPTQR2Br/qmPP/K7wjUoB
2024-04-11 00:02:59 SqlLog Opening database session in mode ReadOnly
2024-04-11 00:02:59 SqlLog (6 ms) - select changecontext, changecounter from DialogSemaphor with (nolock) where ChangeContext > ' '
2024-04-11 00:02:59 SqlLog (2 ms) - select ModuleName, DisplayValue from QBMModuleDef where isnull(ModuleName, N'') <> N'CCC'
2024-04-11 00:03:00 SqlLog (785 ms) - select changecontext, changecounter from DialogSemaphor with (nolock) where ChangeContext > ' '
2024-04-11 00:03:00 SqlLog (11 ms) - select distinct c.uid_configparm, c.uid_parentconfigparm, c.fullpath, c.value, o.preprocessorstring
from DialogConfigParm c with (nolock)
left outer join DialogConfigParmOption o with (nolock)
on c.UID_ConfigParm = o.UID_ConfigParm
and c.Value = o.OptionValue
where c.enabled = 1
order by fullpath
2024-04-11 00:03:00 SqlLog (< 1 ms) - select changecontext, changecounter from DialogSemaphor with (nolock) where ChangeContext > ' '
2024-04-11 00:03:00 StopWatch Getting Tables/global from cache. done in 75ms.
2024-04-11 00:03:00 SqlLog (73 ms) -
select t.tablename, t.displaypattern, t.isdeactivatedbypreprocessor,
t.tabletype, tBase.TableName, t.uid_dialogtable, t.UsageType, t.uid_dialogimage, t.displayname,
t.TransportSingleUser,
datalength(t.OnSavingScript) as HasOnSaving,
datalength(t.OnSavedScript) as HasOnSaved,
0,
datalength(t.OnLoadedScript) HasOnLoaded,
datalength(t.OnDiscardingScript) as HasOnDiscarding,
datalength(t.OnDiscardedScript) as HasOnDiscarded,
t.DefaultDisplayFKList, tProxy.TableName, t.ismntable, t.istransportdisabled,
t.ElementColor, t.IsResident, t.DisplayPatternLong, t.IsModuleGuidAllowed, t.IsModuleGuidDefault,
t.DeleteDelayDays, t.ScopeReferenceColumns, t.TransportWhereClause, t.IsMAllTable,
t.PendingChangeBehavior, t.DisplayNameSingular, datalength(t.DeleteDelayScript) as HasDeleteDelayScript
from dialogtable t with (nolock)
left outer join DialogTable tBase with (nolock) on t.UID_DialogTableBase = tBase.UID_DialogTable
left outer join DialogTable tProxy with (nolock) on t.UID_DialogTableUnion = tProxy.UID_DialogTable
where t.tablename = N'DialogDatabase'
2024-04-11 00:03:00 SqlLog (5 ms) -
select
c.uid_dialogcolumn, c.columnname,
c.minlen as minlen,
c.maxlen as maxlen,
c.format as format,
c.isalternatepkmember, c.DateTimeDetail, c.isuid, c.ispkmember,
datalength(c.FormatScript) as fmt,
c.hasdefaultvalue, c.iscrypted, c.MultiLanguageFlag, c.caption,
c.isdeactivatedbypreprocessor, c.customcomment, b.columnname,
c.IndexWeight, c.ismultivalued, c.syntaxtype,
c.IsNoAutoExtendPermissions, c.haslimitedvalues, c.countdigits,
c.IsNoAutoTrim, c.commentary, c.istoignoreonexport, c.istoignoreonimport,
c.IsCustomConfigurable, 0,
datalength(c.Template) as tmpl,
c.IsOverwritingTemplate as IsOverwritingTemplate,
c.SortOrder, c.IsFilterDesignerEnabled, c.ColumnGroup, c.IsParentConnectColumn,
c.IsDynamicFK, u.columnname, c.HasBitMaskConfig, c.IsMultiLineContent,
c.TemplateLimitationInternal, c.TemplateLimitationException,
c.BitMaskConfigOrder, c.IsBlobExternal, c.IsDescriptionColumn, c.IsHierarchyDisplay, c.IsForeignKey,
c.DoNotLogChanges, c.UID_DialogTable, c.IsMAllKeyMember,
datalength(c.CanSeeScript) as HasCanSeeScript, datalength(c.CanEditScript) as HasCanEditScript,
c.IsElementProperty, c.IsToWatch, c.IsToWatchDelete, c.MultiValueSpecification
from dialogcolumn c with (nolock)
left outer join dialogcolumn b with (nolock) on c.uid_basecolumn = b.uid_dialogcolumn
left outer join dialogcolumn u with (nolock) on c.uid_dialogcolumnunionview = u.uid_dialogcolumn
where c.UID_DialogTable in ('QBM-T-DialogDatabase')
2024-04-11 00:03:00 SqlLog (2 ms) - select UID_DialogColumn, KeyValue, KeyDisplay from QBMColumnLimitedValue
where UID_DialogColumn in ('QBM-90D553B20D2743219872C6B531812E47', 'QBM-3767D3DE447D9B5F068BB837B3106992')
and IsInActive = 0
order BY OrderNumber
2024-04-11 00:03:00 SqlLog (1 ms) - select UID_DialogColumn, BitPosition, KeyDisplay from QBMColumnBitMaskConfig
where UID_DialogColumn in ('QBM-7C1E7EDF9AFB43BDA4FCB857E3E7C431')
and IsInActive = 0
order BY UID_DialogColumn, BitPosition
2024-04-11 00:03:00 SqlLog (3 ms) - select tc.UID_DialogTable, t.Assembly, t.FullTypeName
from DialogCustomizer c with (nolock)
join QBMClrType t with (nolock) on t.UID_QBMClrType = c.UID_QBMClrType
join DialogTableHasCustomizer tc with (nolock) on tc.UID_Customizer = c.UID_Customizer
where (tc.UID_DialogTable in ('QBM-T-DialogDatabase')) and (c.IsDeactivatedByPreProcessor = 0)
order by c.SortOrder

2024-04-11 00:03:00 SqlLog (5 ms) - select
g.UID_QBMUniqueGroup, g.Ident_QBMUniqueGroup, g.IgnoreEmptyValues,
c.UID_DialogColumn, g.UID_DialogTable, g.ViolationMessage
from QBMUniqueGroup g
join QBMUniqueGroupHasColumn ghc on ghc.UID_QBMUniqueGroup = g.UID_QBMUniqueGroup
join DialogColumn c on ghc.ObjectKeyDialogColumn = c.XObjectKey
where g.UID_DialogTable in ('QBM-T-DialogDatabase')
order by g.Ident_QBMUniqueGroup
2024-04-11 00:03:00 SqlLog (2 ms) - select UID_DialogTableBase, tablename from dialogtable with (nolock) where (UID_DialogTableBase in ('QBM-T-DialogDatabase')) and (isdeactivatedbypreprocessor = 0)
2024-04-11 00:03:00 StopWatch Getting Table/DialogDatabase from cache. done in 132ms.
2024-04-11 00:03:00 StopWatch Getting Schema/DialogDatabase from cache. done in 139ms.
2024-04-11 00:03:00 SqlLog (7 ms) - select ConnectionProvider, ConnectionString, CustomerName, CustomerPrefix, DataOrigin, Description, EditionDescription, EditionName, EditionVersion, ElementColor, FESimulationStarted, IsDBSchedulerDisabled, IsJobServiceDisabled, IsMainDatabase, LastMigrationDate, LicenceID, ModuleOwner, ProductionLevel, ProductionLevelAddOn, PublicKey, SingleUserProcess, SingleUserStart, UID_Database, UID_DialogAuthentifier, UID_DialogCountryDefault, UID_DialogCultureDefault, UpdatePhase, XDateInserted, XDateUpdated, XMarkedForDeletion, XObjectKey, XTouched, XUserInserted, XUserUpdated from DialogDatabase where (IsMainDatabase = 1)
2024-04-11 00:03:00 SqlLog (3 ms) - select max( AccessLevel ) from
(
select isnull(IS_SRVROLEMEMBER('sysadmin'), 0) * 9 as AccessLevel
union all
select isnull(IS_SRVROLEMEMBER('dbcreator'), 0) * 8 as AccessLevel
union all
select isnull(IS_MEMBER('db_owner'), 0) * 7 as AccessLevel
union all
select isNull(IS_MEMBER('OneIMConfigRoleDB'), 0) * 5 as AccessLevel
union all
select IsNull(IS_MEMBER('OneIMUserRoleDB'), 0) * 3 as AccessLevel
) as AccessLevels
2024-04-11 00:03:00 Update Check for updates
2024-04-11 00:03:00 Update Locked: False
2024-04-11 00:03:00 Update DB revision: 9362628, working dir revision: 1729845140
2024-04-11 00:03:00 Update Initializing Update.exe
2024-04-11 00:03:00 Update Try getting updater.
2024-04-11 00:03:00 SqlLog (1 ms) - select 1 where exists (select 1 from QBM_VTablesForSoftwareUpdate where (Tablename = N'QBMFileRevision'))
2024-04-11 00:03:00 SqlLog (5 ms) - select KeyWord, KeywordFlagCS, Risk from dbo.QBM_FTSQLKeywords(0)
2024-04-11 00:03:00 SqlLog (3 ms) - select HashValue from QBMFileRevision where (filename = N'Update.zip')
2024-04-11 00:03:00 SqlLog (4 ms) - select FileContent from QBMFileRevision where (UID_QBMFileRevision = 'Update.zip') or (FileName = N'Update.zip')
2024-04-11 00:03:00 Update No Update.zip found.
2024-04-11 00:03:00 Update Either you have connected to an old database or to a database that is not correctly configured.

 

I can compile the database afterward, but it has no effect; the error remains the same.

Currently, my workaround involves installing the database with the configuration wizard as a "base installation" and then creating a backup of it. I can then restore the database using SQL commands and address the auto-update error with the following SQL command:

 

UPDATE DialogDatabase

           SET SingleUserProcess = 0, SingleUserStart = NULL

           WHERE IsMainDatabase = 1

After compiling the database, everything starts working correctly.

The purpose of this approach is to find an easy method to restore the database in a demo environment, and my current solution seems effective. However, I am still eager to understand why the quantum.migratorcmd.exe --Install command fails to function as expected.

-------

Update, it seems that the database works with when starting Launcpad from the installation media... What can then be wrong? 

Top Replies