Databases

From SRB

This is a general overview of how database systems are used as the MCAT in SRB system.

Storage Resouce Broker servers (SRBs) communicate with other SRBs. Not all SRBs need to be MCAT-enabled but at least one SRB in the system has to be MetaData Catalog(MCAT)-enabled to store the Meta-data (the data about the data). Many sites choose to install the SRB with the MCAT-enabled SRB hosted at SDSC. But for a completely stand-alone SRB system, you will need an MCAT-enabled SRB.

The MCAT software is a library that interfaces to a database management system (a DBMS: Oracle, DB2, Postgres, or Sybase). To build and install an MCAT, you need to build the library, and initialize the database. Of course, this will require proper authentication at DBMS level. Errors can occur at various levels, and it can be difficult for a novice to differentiate between them, but the following decriptions should be of some help.

In most cases, the DBMS is client/server too. A typical Oracle installation on Linux will be the Oracle client software, which talks to the Oracle server on another host were the actual database exists.

The following describes using Oracle on a Linux system as an example.

To use Oracle, the following environment variables must be set. These could be in your .login or .cshrc file. In my case, I kept them in a separate file that I sourced when I wanted to work with Oracle. This is also needed before starting the SRB server so that it too can interact with the MCAT database.

Contents of setora:
:
set path=($path /usr/local/apps/Oracle/bin)
setenv ORACLE_SID dev7
setenv ORACLE_HOME /usr/local/apps/Oracle
setenv LD_LIBRARY_PATH /usr/local/apps/Oracle/lib
setenv ORACLE_BASE /usr/local/apps/Oracle
setenv ORACLE_TERM xsun5
setenv ORACLE_PATH /usr/local/apps/Oracle/bin
setenv ORACLE_PAGER /usr/local/bin/less

  The .../Oracle/bin directory is added to the path so that Oracle
  commands, such as sqlplus can be found.

  ORACLE_SID is the System ID, meaning the particular instance of a
  database.  'dev7' was used for testing, instead of 'MCAT'.  

  [dev7 is used in the MdasConfig file and on command-lines, so this
  this ORACLE_SID environment variable might not be used.]

You also need to have an Oracle user set up.  For testing at SDSC,
we would use 'srbtester'.

On Linux at SDSC, we had to use the full name of the database
instance, including the domain (dev7.sdsc.edu).  This was due to how
Linux had been installed here.  Normally, the short name (dev7) would
have been enough.

For interactive use, the command line I would use was:
  sqlplus srbtester@dev7.sdsc.edu
at which point it would prompt for srbtester's password.


Tests and troubleshooting for installing (using Oracle as an example):

1) Basic DBMS communication/authentication test

   Run sqlplus as described above with your DBMS System ID, userid and
   password.  A successful login confirms that your DBMS is running
   properly, the database instance is created, your userid is created,
   and you have the matching userid password.

2) Use the following interactive sqlplus command, after the above
   connect/login, to confirm that your database instance is set up
   properly:

   select table_name from tabs;

   This will show you how many tables are defined.  The table 'tabs',
   in Oracle, is a special table that provides some access to the user
   table definitions.

   If you've just created a new instance for testing, the result from this
   select command should be 0.  This means that no tables are defined
   in the instance.

   If you've inserted the normal SRB/MCAT tables, then the result
   should be 83 (it should list various table names and then end with
   '83 rows selected.').  In the current version of the SRB/MCAT there
   are 83 tables.



---

Example MdasConfig contents:

zuri (45) % more MdasConfig
MDASDBTYPE        oracle
MDASSCHEMENAME    srbtester.
MDASDBNAME        dev7
MDASINSERTSFILE  /projects/diglib/srb/SRB1_1_8rel/data/mdas_inserts
METADATA_FKREL_FILE metadata.fkrel
DB2INSTANCE       db2v2
DB2PASSWORD        xxxxxx
DB2USER            srbtesterhttp://boothcam.sdsc.edu
DB2LOGFILE       /projects/diglib/srb/SRB1_1_8rel/data/db2logfile
DBHOME        /usr/local/apps/Oracle
zuir (46) %

Note that the period after the username for the MDASSCHEMENAME is
required.

I was using dev7 database instance for testing.  MDASDBNAME would normally be
MCAT.

The Oracle password and userid are in the DB2PASSWORD and DB2USER
fields (here we use the same fieldname for both DB2, Oracle and other
DBMSes).  The actual password in normally in the xxxxxx area.