The Identity Manager's GUI version of the Compiler, DBCompiler.exe, requests for a new Database ID to be generated if the compiler detects that the Database is a restored.
After accepting the request prompt and a successful completion of the compilation, the front end tools (e.g. Designer, Manager, etc) can be used again. However, if the restored Database is compiled by the Command line version of the compiler, the DBCompilerCMD.exe, even after a successful compilation of the restored Database, the user will still be prompted by the front end tools to recompile the the Database.
The parameter options used for the command line is suggested in the Identity Manager Operation Guide
DBCompilerCMD.exe /conn="Data Source=ONEIM01\ONEIM;Initial Catalog=OneIM811R;User ID=sa;Password=Password:1" /Auth="Module=DialogUser;User=viadmin;Password=Password:3" /LogLevel=Info
The command line DBCompilerCMD.exe seems to have failed to compile the restored Database because unlike the GUI version, the command line version of the compiler does not enforce the creation of a new Database ID (e.g UID_Database) and as a result post the completion of the compilation with the command line compiler, the front end tools will still detect that the Database is still in a restored state and will prompt the user to recompile the Database.
It is still possible to automate the creation of a Database ID and use the the command line compiler. To achieve this a script is required to achieve the steps that is performed by the GUI version of the DB compiler. In the GUI version of the DB compiler, the following steps are carried out in case of a restored Database before compiling. Do always perform a full backup of the SQL Database before running any scripts.
Check if the value in DialogDataBase.DataOrigin is correct by comparing it's value with the result of the function :
The restored Database results from step 1 will show a different value in DialogDataBase.DataOrigin compared to the result of dbo.QBM_FGIDBDataOrigin() function . This tells the GUI compiler that the Database has been restored and the user gets the additional prompt dialog to change the Database ID (e.g UID_Database). After user accepted the request, the value in DialogDataBase.DataOrigin will be corrected with the following SQL update statement :
update DialogDatabase set DataOrigin = dbo.QBM_FGIDBDataOrigin() where IsMainDatabase = 1
After step 2, the GUI will update the Database ID (e.g. UID_Database) with a new ID with the following SQL statement:
declare @newPK varchar(38) = newid()
exec QBM_PTriggerDisable 'DialogDatabase'
update DialogDatabase set UID_Database = @newPK, XObjectKey = dbo.QBM_FCVElementToObjectKey1('DialogDataBase', 'UID_DialogDataBase', @newPK) where IsMainDatabase = 1
exec QBM_PTriggerEnable 'DialogDatabase'
The command line version of the compiler (DBCompilerCMD.exe) is not able to accomplish the above steps and there is no parameter to enforce the above steps. If there is a requirement to use the command line compiler on a restored Database then the only solution is to create a script that will execute the steps as per what is executed by the GUI compiler as above, with reference to the code segments. The final execution step for the script will be the command line for DBCompilerCMD.exe with the necessary parameters