This section describes the standard procedure to follow when making changes to an existing online LDAS database system.
The steps described below are to be executed under database user ldasdb.
Some minor changes to the tables can be done online via db2 client, e.g. drop or add
a foreign keys, add new tables, update configuration parameters.
Changes that require the database to be offline, e.g. rebuilding it:
follow the following steps:
Check that there are no clients connected to DB2 server:
To ensure the database can be restored in case of catastrophy e.g.
accidentally dropping a table and losing all the data,
make a temporary backup of the database as follows:
e.g. backup to a partition /usr1/databases/backup
Connect to the database you desire to change via db2 client.
Below are some examples of changing the table schema or database configuration. For more
details of DB2 commands, check the IBM DB2 command reference on the web.
Caution: DO NOT DROP AND ADD A TABLE IF THERE IS EXISTING DATA IN THE TABLE
db2 'update database configuration for ldas_tst using locklist 400'
Enter the user names and passwords foreach database and hit APPLY to create the new LDASdsnames.ini file.
See Create Database for details on linking LDAS to the database.
This section describes some performance tuning we have successfully applied to the LDAS database.
For tables with ** in the REORG column, they can be reorganized as follows:
Reorganizing a table:
Reorganizing indexes of a table
Reorganizing a system table:
Make changes to LDAS database
db2 => list applications
Auth Id Application Appl. Application Id DB # of
Name Handle Name Agents
-------- -------------- ---------- ------------------------------ -------- -----
LDASDB metadataAPI 97 *LOCAL.ldasdb.020522160516 LDAS_TST 1
LDASDBRO metadataAPI 101 *LOCAL.ldasdb.020522160517 LDAS_TST 1
LDASDB metadataAPI 96 *LOCAL.ldasdb.020522160503 CIT_TEST 1
LDASDBRO metadataAPI 100 *LOCAL.ldasdb.020522160504 CIT_TEST 1
LDASDB db2bp 91 *LOCAL.ldasdb.020522160531 CIT_TEST 1
To remove these applications off the database, you can:
db2 force applications ( 91, 97, 101 )
where 91, 97 and 101 are the application handles shown by 'list applications'.
db2 'list applications'
SQL1611W No data was returned by Database System Monitor. SQLSTATE=00000
db2 'backup database tst_test to /usr1/databases/backup'
Backup successful. The timestamp for this backup image is : 20040223132847
ldasdb@metaserver ~]$ db2 'connect to ldas_tst'
Database Connection Information
Database server = DB2/LINUX 8.2.1
SQL authorization ID = LDASDB
Local database alias = LDAS_TST
db2 'alter table process add column insertion_time TIMESTAMP WITH DEFAULT CURRENT TIMESTAMP;
db2 'alter table segment drop FOREIGN KEY SEGMENT_FK_SEGDEF ;'
db2 'alter table add foreign key SEGMENT_FK_PID (process_id,creator_db) references process(process_id,creator_db);
db2 'drop table calib_info'
db2 '-tf /ldas/doc/db2/doc/text/calib_info.sql'
db2 '-tf grant.sql'
db2 'restore database tst_test from /usr1/databases/backup taken at 20040223132847'
SQL2539W Warning! Restoring to an existing database that is the same as the backup image database.
The database files will be deleted.
Do you want to continue ? (y/n) y
DB20000I The RESTORE DATABASE command completed successfully.
cd /ldas_outgoing/metadataAPI
/ldas/bin/dbDsnames

set ::DATABASE_NAME cit_test
Performance tuning
db2 'connect to ldas_tst'
db2 'reorgchk update statistics on table all' > out &
tail -f out
Table statistics:
F1: 100 * OVERFLOW / CARD < 5
F2: 100 * (Effective Space Utilization of Data Pages) > 70
F3: 100 * (Required Pages / Total Pages) > 80
SCHEMA NAME CARD OV NP FP ACTBLK TSIZE F1 F2 F3 REORG
----------------------------------------------------------------------------------------
LDASDB CALIB_INFO - - - - - - - - - ---
LDASDB COINC_SNGL - - - - - - - - - ---
LDASDB EXTTRIG_SEARCH - - - - - - - - - ---
LDASDB FILTER - - - - - - - - - ---
LDASDB FILTER_PARAMS - - - - - - - - - ---
LDASDB FRAMESET - - - - - - - - - ---
LDASDB FRAMESET_CHANLIST - - - - - - - - - ---
LDASDB FRAMESET_LOC - - - - - - - - - ---
LDASDB FRAMESET_WRITER - - - - - - - - - ---
LDASDB GDS_TRIGGER 47 0 3 1920 - 8554 0 0 0 -**
...
ldasdb:ldas:metaserver.ldas-dev:~> db2 'reorg table search_summary'
DB20000I The REORG command completed successfully.
ldasdb:ldas:metaserver.ldas-dev:~> db2 'reorg indexes all for table gds_trigger'
DB20000I The REORG command completed successfully.
ldasdb:ldas:metaserver.ldas-dev:~> db2 'reorg table sysibm.SYSINDEXES'
DB20000I The REORG command completed successfully.
See DB2 documentation