The steps described below are to be executed under database user ldasdb. Please visit IBM DB2 web site for details IBM DB2 web site for DB2 specifics.
If DB2 software has not been installed, follow the directions in this link to install DB2 software. Otherwise skip this step.
The link /ldcg/IBMdb2 points to the current IBM installation include and library files to be used in compilation of LDAS software and running of utilities invoking db2 clients.
Any time a new IBMdb2 installation is performed, the headers and shared libraries in /ldcg/IBMdb2 must be updated to point to the new installation.
As user install, perform the following steps:
mkdir IBMdb2-8.2.1 mkdir IBMdb2-8.2.1/IBMdb2 mkdir IBMdb2-8.2.1/IBMdb2/include mkdir IBMdb2-8.2.1/IBMdb2/lib
cd ~ldasdb/sqllib/include
sftp install@gateway
> cd /ldcg/stow_pkgs/IBMdb2-8.2.1/IBMdb2/include
> puts *
or
cp ~ldasdb/sqllib/include/* /ldcg/stow_pkgs/IBMdb2-8.2.1/IBMdb2/include
cd ~ldasdb/sqllib/lib
sftp install@gateway
> cd /ldcg/stow_pkgs/IBMdb2-8.2.1/IBMdb2/lib
> puts *
or
cp ~ldasdb/sqllib/lib/* /ldcg/stow_pkgs/IBMdb2-8.2.1/IBMdb2/lib
cd /ldcg/stow_pkgs stow -D IBMdb2-8.1.5 stow IBMdb2-8.2.1
The following modifications to the configuration parameters are recommended for running DB2 with LDAS system:
db2 > UPDATE DBM CFG USING SYSTEM_GROUP LDAS
db2 > UPDATE DBM CFG USING QUERY_HEAP_SZ 40000
db2 > update database configuration for <your database> using logsecond 100
db2 > update database configuration for <your database> using locklist 400This command is done by createall script when it is used to create a new database.
For platforms that can support multiple threads, the following is recommended in the IBM DB2 documentation to reduce contention and potential deadlocks in applications accessing the database:
You can set the database parameter via the db2 client:
db2 => update database configuration for ldas_tst using locktimeout 10
If the database manager has not been started yet, following the directions in this link for starting the database manager. Otherwise skip this step.
After you have created the database as described under Create database, check this link for steps to follow when making changes to an LDAS database.
If the IBM DB2 software has been updated or databases have been restored, you can follow these steps to validate LDAS database functionality is intact.
To create database tables in db2, create the directory for holding the database
files by doing mkdir
db2 => create database <dbname> on <directory> alias <dbname>
e.g. The sql and shell scripts mentioned below can be obtained by downloading
the package db2-table-0.n.m.tar.gz
where n and m are major and minor version numbers, e.g. db2-table-0.2.4.
To unpack the package, use the command `gzip -dc db2-table-0.n.m.tar.gz | tar xf- '.
This will create the sub-directory db2-table-0.n.m with the scripts in it.
To create database triggers in db2, run the listed sql scripts below with db2
client utility db2 in command mode:
db2 -f <script-file> (one of the following)
Create database
mkdir /usr1/databases
(if the above directory does not exist )
db2 => create database dev_test on /usr1/databases alias dev_test
Create LDAS tables
The two simplest ways to create all of the LDAS database tables are
/ldas/bin/createLDASdb new_db /usr1/databases
Database Connection Information
Database server = DB2/SUN 8.2.1
SQL authorization ID = LDASDB
Local database alias = dev_test
./createall dev_test
createall invokes
This script issues a revoke command to deny permissions on a table
and then issues the new permissions.
echo table runlist;
revoke all on table runlist from public;
grant select on table runlist to public;
The revoke command will report errors the very first it
is ran on a table since the table does not have the necessary permissions:
table process
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0556N An attempt to revoke a privilege from "PUBLIC" was denied because
"PUBLIC" does not hold this privilege. SQLSTATE=42504
DB20000I The SQL command completed successfully.
but the second command of granting permissions should complete successfully.
DB20000I The SQL command completed successfully.
db2 'connect to <dbname> user <dbuser> using <dbuser-password>'
The following scripts can be used to retrieve data from all tables created by the shell script createall:
e.g. db2 -tf selectall.sql
To terminate db2 connection, enter:
db2 terminate.
To make your database known to your LDAS system, LDAS resources files
must be configured, either by editing them or by running programs
to generate the configuration files. This process must be done as
user ldas instead of user ldasdb for proper file ownership.
The following resource files must be configured:
This file is used by the utility db2utils to build the database web pages at the sites
under the
LDAS database link (the example shown is for site ldas-dev).
In addition, this file is also used by the scripts dbUniqueIds and dbDsnames
described below to generate site information for the metadataAPI.
Make a copy of this file from /ldas/bin/LDASdb2utils.rsc to /ldas_outgoing.
Edit the following variables in the file to reflect the db2 paths of your installation:
Make sure environment DB2INSTANCE is set to your database user by doing
This file keeps track of the database users and their passwords for each database at the site.
When the screen comes up with the list of databases at your site, enter the
logins ( or use the defaults ) and passwords ( echoed with * ) and hit
the APPLY button. When completed, it displays a message that the
LDASdsnames.ini file has been created. The LDASdsname
contains the following lines for each database
This is done in the LDAS database web pages resource file: /ldas_outgoing/cntlmonAPI/LDASdb2utils.rsc
The database user name and password have to be defined for the utility db2utils
( started by cntlmonAPI ) to connect to the database and retrieve information to build the web pages.
Edit the LDASdb2utils.rsc file again to put in the password from
the LDASdsnames.ini file and to set your database machine name:
This file contains the variable to tell the metadataAPI which database to open
as default.
Copy this file from the ldas installation ldas-0.0/bin to the run directory
/ldas_outgoing. Enter your database name as the default database for your domain
on the line below:
The following variable should be set to the database instance in
the managerAPI's resource file /ldas_outgoing/LDASmanager.rsc
In the LDAS build process, the path of the IBM db2 library should have been resolved
with the expansion of @DB2_LIBS_DIR@ variable to the actual path of the IBM db2 directory.
e.g. in the LDASmanager rsc file:
should become the following in the build target:
and the runLDAS script should have the actual DB2 path in the build target:
If you need to hard code the IBM DB2 path, you can edit the LDASmanager.rsc file
to have the actual IBM DB2 path e.g. if path is /usr/IBMdb2/V8.2.1/lib, in
LDASmanager.rsc file:
For systems running on linux, LDAS must be build to link with the IBM db2 libraries.
See How to build LDAS
for more details.
If you are using the cmonClient package, either from the ldas installation
or locally on your system with the gzip tar package, you should edit the cmonClient.rsc
file to include your database name.
If you have more than one database, only one of them can be set as the
default database. But add the names of the other databases to the
list of dbname arrays in the above files.
This is only needed if you want to use the cmonClient
to start your LDAS system for the first time so it has to know
about the site databases. Once cmonClient connects to
the LDAS cntlmonAPI server, the site database information will be downloaded to
the client.
After the resources files are configured, you must reboot your LDAS system
to have the changes in effect. The metadataAPI log indicates which database
it has inserted to based on the specification in the -database option of the
user command or use the
default database if the -database option is not specified e.g.
You can now use LIGO tool GUILD to submit queries or submit LDAS commands via the
cmonClient LDAS Test Panel.
Suggestions or Comments? Please Contact mlei@ligo.caltech.edu
How to link a database to your LDAS system
;## path of db2 client
set ::db2 "/usr2/ldasdb/sqllib/bin/db2"
;## path of database directory
set ::dbdir "/usr1/databases"
setenv DB2INSTANCE <dbuser>
in csh or
set DB2INSTANCE=<dbuser> ; export DB2INSTANCE
in Bourne shell.
cd /ldas_outgoing
/ldas/bin/dbDsnames
array set <your dbname> { login { ldasdb <encoded password> } }
and a line showing all databases at your site:
array set ::site_dbnames { ldas-dev { dev_1 ldas_tst dev_test } }
;## database user password
set ::dblock <encoded-password>
set ::host
set ::DATABASE_NAME dev_test
;## desc=database user Id
set ::DB2INSTANCE ldasdb
and also in the LDAS startup script runLDAS:
/usr/bin/env HOST=dataserver PATH=@prefix@/bin:/ldcg/bin:${PATH} LD_LIBRARY_PATH=
@prefix@/lib:@DB2_LIBS_DIR@:/ldcg/lib:${LD_LIBRARY_PATH}
DB2INSTANCE=ldasdb
/bin/nohup managerAPI $1 1>manager.log 2>&1 &
set ::LD_LIBRARY_PATH ${::LDAS}/lib:/ldcg/lib:@DB2_LIBS_DIR@
;## desc=dynamic load lib path ! mod=no
set ::LD_LIBRARY_PATH ${::LDAS}/lib:/ldcg/lib:/ldcg/IBMdb2/lib
/usr/bin/env HOST=dataserver PATH=/ldas/bin:/ldcg/bin:${PATH}
LD_LIBRARY_PATH=/ldas/lib:/ldcg/IBMdb2/lib:/ldcg/lib:${LD_LIBRARY_PATH}
DB2INSTANCE=ldasdb
/bin/nohup managerAPI $1 1>manager.log 2>&1 &
;## desc=dynamic load lib path ! mod=no
set ::LD_LIBRARY_PATH ${::LDAS}/lib:/ldcg/lib:/usr/IBMdb2/V8.2.1/lib
;## desc=ldas dsnames at each site
array set ::dbnames { <your domain> { <dbname1> ...} }
array set ::dbnames { ldas-dev { dev_test dev_1 ldas_tst } }
750200312 LDAS-DEV16969219 metadata::submitInsertReaper putMetaData inserted 6 rows into ldas_tst database
table process at the rate of 216.08306 rows/sec, took walltime 0.02777 secs
750200312 LDAS-DEV16969219 metadata::submitInsertReaper putMetaData inserted 100 rows into ldas_tst database
table gds_trigger at the rate of 2223.40804 rows/sec, took walltime 0.04498 secs
Last modified Oct 14th, 2003