Database Update Wizard
Database Update Wizard: Running a Script
The Database Update Wizard can work with Data Transfer and Update Schema statements in script files. When working with the Database Update Wizard, users choose the Run Script command and the wizard will execute the script.
Script files can be chained together such that one script file can incorporate the commands from other script files. For example, you could have four individual script files for updating four types of data (say Space, Building Operations, SDS, and Lease data) and then have another script file that calls the first four, one after the other. This enables you to break updates into smaller components, but still execute them together if desired.
This command is handy for users who are applying Archibus add-on products and feature changes. You can separately develop sets of updates, but execute them together.
This topic has the following sections:
Also see these topics:
Note: When running a script, you may find that the Database Update Wizard times out on slow servers after 30 minutes. To ensure that the script runs fully, you can change the session timeout from the default 30 minutes to 60 minutes and then restart the application server. In the /webapp/WEB-INF/web.xml file and edit <session-config><session-timeout>30</session-timeout>
to <session-config><session-timeout>60</session-timeout>
.
Starting the Run Script option
- Start the wizard: System / Add-In Manager / Run Database Update Wizard
- Select “Run Script” option and click Next.
Example script
--INSERT INTO bl(bl_id,name) values('mytest','test'); DELETE FROM bl WHERE bl_id='mytest'; INSERT INTO bl(bl_id,name) values('mybldg','test'); --COMMENT ${import.file('D:/test.csv')}; ${refresh.data.dictionary}; ${alter.table('zone',true)}; ${recreate.table('ac',false)}; ${refresh.data.dictionary}; ${reload.workflow.rules};
Scripts can call other scripts using a command, such as:
${run.script('D:/abcd/my-script-01.duw'} ... (other commands such as ${import.file('D:/test.csv')}; ) ${run.script('D:/abcd/my-script-02.duw'} ... (other commands such as ${import.file('D:/test.csv')}; ) ... etc.
Load the file
The supported file extensions are: duw, sql, txt. There are three ways for the files to be executed:
Server file
This loads the supported files from \projects\users\public\dt\database-update\personalized-database
- “Refresh” button reloads the files from location
- “Select File” will load the contents into “Script File” text area
Local file
You can choose the file using the Browse button.
Input text area (Script File)
Just type the commands into text area.
- You can highlight a portion of the script and click “Run Script”. Then only the selected highlighted code will be executed.
- The “Script file” input box is editable.
Message log
For a command that is executed in the message log, you will see a message. There are two situations:
The command executes successfully and you see a message depending on the command type:
- Skip comment (applies to commented lines)
- Sql command executed successfully (applies to SQL commands)
- X record(s) inserted, Y record(s) updated, Z record(s) with error (applies to data transfer files imports)
- Table(s) {} were updated. Please check the log for details (applies to update schema statements)
- Archibus workflow rules reloaded successfully (applies to ${reload.workflow.rules})
- Archibus Data Dictionary reloaded successfully (applies to ${refresh.data.dictionary})
An error message displays. This happens when:
- there is an SQL error. The message log displays the database engine error.
- the command is not supported. The system displays a message.
- a data transfer file is not found. The system displays an explicit message.