Sample Storage Management System for the IARC …Sample Storage Management System for the IARC...
Transcript of Sample Storage Management System for the IARC …Sample Storage Management System for the IARC...
Sample Storage Management System
for the IARC Biobank:
Installation and Developments
Author: L.Alteyrac (IARC/ITS)
Last Update: 2010-07-22
SMS Installation and Developments
Table of Contents
1 - Introduction ...........................................................................................................4
2 - Installation of Oracle Database ............................................................................42.1 - Server ..........................................................................................................................................4
2.2 - Oracle Database 10g .................................................................................................................4
2.3 - Patch p4547817 (10.2.0.2) installation ...................................................................................4
2.4 - Patch Oracle CPU Oct 2006 installation ...............................................................................4
2.5 - Patch p5337014 (10.2.0.3) installation ...................................................................................5
3 - Database creation ..................................................................................................53.1 - DBCA ..........................................................................................................................................5
3.2 - NETCA .....................................................................................................................................15
3.3 - Database Control ....................................................................................................................15
4 - Database objects ..................................................................................................154.1 - Tablespaces ..............................................................................................................................15
4.2 - Roles .........................................................................................................................................174.2.1 - SAMI_ADMIN .............................................................................................................184.2.2 - PUBLIC_READER ......................................................................................................184.2.3 - CREATE_USER_DATA ...............................................................................................184.2.4 - UPDATE_USER_DATA ...............................................................................................194.2.5 - DELETE_USER_DATA ...............................................................................................194.2.6 - MANAGE_USER .........................................................................................................194.2.7 - MANAGE_SAMI .........................................................................................................19
4.3 - Users .........................................................................................................................................204.3.1 - Administrator ................................................................................................................204.3.2 - Users .............................................................................................................................204.3.3 - User DLOADER ...........................................................................................................20
4.4 - Tables model ............................................................................................................................214.4.1 - Main user tables ............................................................................................................22
4.4.1.1 -Table SAMI_CONSTANTS....................................................................................234.4.1.2 -Table SAMI_MENUS.............................................................................................234.4.1.3 -Table SAMI_USERS..............................................................................................244.4.1.4 -Table SAMI_USERS_DATAGROUPS..................................................................244.4.1.5 -Table SAMI_JOBTYPES_DETAILS.....................................................................244.4.1.6 -Table SAMI_PROJECTS........................................................................................254.4.1.7 -Table SAMI_CONTAINERS_TYPES....................................................................254.4.1.8 -Table SAMI_CONTAINERS..................................................................................264.4.1.9 -Table SAMI_CONTAINERS_TEMP.....................................................................264.4.1.10 -Table SAMI_CONTAINERS_MOVEMENTS.....................................................274.4.1.11 -Table SAMI_SAMPLES.......................................................................................27
2010-07-22 2/42
SMS Installation and Developments
4.4.1.12 -Table SAMI_SAMPLES_TEMP..........................................................................294.4.1.13 -Table SAMI_SAMPLES_MOVEMENTS............................................................304.4.1.14 -Table SAMI_ALIQUOTS.....................................................................................31
4.4.2 - Sys tables ......................................................................................................................314.4.2.1 -Table SYS.SAMI_SERVERS.................................................................................324.4.2.2 -Table SYS.SAMI_SYS_USER_AUDIT.................................................................324.4.2.3 -Table SYS.SAMI_USER_AUDIT..........................................................................32
4.5 - Triggers ....................................................................................................................................334.5.1 - SAMI_ACCESS_CONTROL .......................................................................................334.5.2 - TG_GET_CONTAINER_ID ........................................................................................334.5.3 - TG_GET_SAMPLE_ID ...............................................................................................334.5.4 - TG_GET_ALIQUOT_ID .............................................................................................334.5.5 - TG_CHECK_SAMPLE_NATURE ..............................................................................344.5.6 - TG_INSERT_CONTAINER .........................................................................................34
4.6 - Packages ...................................................................................................................................344.6.1 - USERS_ADMIN ..........................................................................................................344.6.2 - SAMIP_BARCODES ...................................................................................................344.6.3 - SAMIP_CONTAINERS_UTILS ..................................................................................344.6.4 - SAMIP_SAMPLES_UTILS .........................................................................................344.6.5 - SAMIP_UTILS .............................................................................................................34
4.7 - Synonyms .................................................................................................................................354.7.1 - Tables synonyms ...........................................................................................................354.7.2 - Synonyms for packages ................................................................................................35
4.8 - Library .....................................................................................................................................36
4.9 - Webutil .....................................................................................................................................36
4.10 - Directories ..............................................................................................................................36
5 - Audit .....................................................................................................................375.1 - Connections control ................................................................................................................37
5.2 - Oracle Audit ............................................................................................................................37
6 - GUI : Oracle Forms&Reports ...........................................................................376.1 - Configuration ..........................................................................................................................37
6.1.1 - Oracle JInitiator Plugin .................................................................................................376.1.2 - Icons ..............................................................................................................................38
6.2 - Forms ........................................................................................................................................38
6.3 - Library .....................................................................................................................................38
7 - Database administration .....................................................................................397.1 - Maintenance ............................................................................................................................39
7.2 - Backup ......................................................................................................................................397.2.1 - Archivelog mode ...........................................................................................................39
7.3 - Recovery Catalog ....................................................................................................................39
8 - Acknowledgements ..............................................................................................40
2010-07-22 3/42
SMS Installation and Developments
1 - Introduction
This document gives informations about the design and the developments of Sample Storage Management System (SMS) for Biobanks, developed by and for IARC. This web application is called SAMI, for SAmple Management for IARC. The source code is under GNU GPL Licence.
All the codes to create database objects are available in the folder SMS_Source_Codes, on the web site: http://www-gcs.iarc.fr/sms.php .
2 - Installation of Oracle Database
2.1 - Server
RAM: 4GoIntel(R) Xeon(TM) CPU 3.00GHzLinux RedHat Red Hat Enterprise Linux ES release 4 (kernel 2.6.9-42.0.3.ELsmp)System disk (OS and Oracle engine): 30GData disk: 122G
2.2 - Oracle Database 10g
Parameters chosen during Oracle Database 10g installation:➢ Basic Installation➢ No starter database option➢ "Standard Edition" installation type
2.3 - Patch p4547817 (10.2.0.2) installation
$> unzip p4547817_10202_LINUX.zip$> cd Disk1/$> ./runInstaller
2.4 - Patch Oracle CPU Oct 2006 installation
$> unzip p5490848_10202_LINUX.zip$> cd 5490848$> $ORACLE_HOME/OPatch/opatch apply
2010-07-22 4/42
SMS Installation and Developments
2.5 - Patch p5337014 (10.2.0.3) installation
$ unzip p5337014_10203_LINUX.zip$> cd Disk1/$> ./runInstaller
3 - Database creation
3.1 - DBCA
The Oracle tool DBCA is used to create the database.
2010-07-22 5/42
SMS Installation and Developments
2010-07-22 6/42
SMS Installation and Developments
2010-07-22 7/42
SMS Installation and Developments
2010-07-22 8/42
SMS Installation and Developments
2010-07-22 9/42
SMS Installation and Developments
2010-07-22 10/42
SMS Installation and Developments
2010-07-22 11/42
SMS Installation and Developments
2010-07-22 12/42
SMS Installation and Developments
2010-07-22 13/42
SMS Installation and Developments
2010-07-22 14/42
SMS Installation and Developments
3.2 - NETCA
If the Oracle installation is the first one on the server, a listener has to be created via the netca tool. Its name is by default LISTENER. If a listener already exists, its configuration just needs to be updated.
The Oracle Tool NETCA is also used to check the connection on the SMS database (see "Local Net Service Name configuration")
3.3 - Database Control
$> export SID=<sms_db_sid>$> emctl start dbconsole
NB:
The port for the dbconsole is opened by adding a line into the file /etc/sysconfig/iptables, ie:-A RH-Firewall-1-INPUT -p tcp -m tcp --dport <port> --tcp-flags SYN,RST,ACK SYN -j ACCEPT
[root]$ service iptables restart
4 - Database objects
4.1 - Tablespaces
The tablespace TSD_SAMI is created with the Database Control web interface.
2010-07-22 15/42
SMS Installation and Developments
2010-07-22 16/42
SMS Installation and Developments
Two datafiles are created for this tablespace :
NB: the corresponding SQL code is :
CREATE SMALLFILE TABLESPACE "TSD_SAMI" DATAFILE '/oracleDB/oradata/samidb/tsdsami1.dbf' SIZE 512M AUTOEXTEND ON NEXT 8K MAXSIZE 2048M , '/oracleDB/oradata/samidb/tsdsami2.dbf' SIZE 512M AUTOEXTEND ON NEXT 8K MAXSIZE 2048M LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO
A temporary tablespace TSD_SAMI_TEMP is also created.
4.2 - Roles
List of the roles defined in the database:
2010-07-22 17/42
SMS Installation and Developments
4.2.1 - SAMI_ADMIN
All system privileges like create user, create all types of objects, ... These privileges are added to the role with a sql script (see Appendix A)
4.2.2 - PUBLIC_READER
Role: connect
Object privileges: select on tables:
SAMI_ALIQUOTS
SAMI_CONSTANTS
SAMI_CONTAINERS
SAMI_CONTAINERS_MOVEMENTS
SAMI_CONTAINERS_TYPES
SAMI_MENUS
SAMI_PROJECTS
SAMI_SAMPLES
SAMI_SAMPLES_MOVEMENTS
SAMI_USERS
SAMI_USERS_DATAGROUPS
4.2.3 - CREATE_USER_DATA
Object privileges: insert on tables :
SAMI_ALIQUOTS
SAMI_CONTAINERS
SAMI_CONTAINERS_TYPES
SAMI_PROJECTS
SAMI_SAMPLES
SAMI_SAMPLES_MOVEMENTS
SAMI_SAMPLES_TEMP
2010-07-22 18/42
SMS Installation and Developments
4.2.4 - UPDATE_USER_DATA
Object privileges: update on tables:
SAMI_ALIQUOTS
SAMI_CONTAINERS
SAMI_CONTAINERS_MOVEMENTS
SAMI_CONTAINERS_TYPES
SAMI_PROJECTS
SAMI_SAMPLES
SAMI_SAMPLES_MOVEMENTS
SAMI_SAMPLES_TEMP
4.2.5 - DELETE_USER_DATA
Object privileges: delete on tables:
SAMI_ALIQUOTS
SAMI_CONTAINERS
SAMI_CONTAINERS_TYPES
SAMI_PROJECTS
SAMI_SAMPLES
SAMI_SAMPLES_MOVEMENTS
SAMI_SAMPLES_TEMP
4.2.6 - MANAGE_USER
System privileges: alter user, create user and drop user
Object privileges: delete, insert and update on SAMI_USERS
4.2.7 - MANAGE_SAMI
Delete, Insert and Update on SAMI_CONSTANTS and SAMI_MENUS
2010-07-22 19/42
SMS Installation and Developments
4.3 - Users
4.3.1 - Administrator
The main user, pensami, is created through the Database Control web interface .
General :Tablespace = TSD_SAMITemporary Tablespace = TSD_SAMI_TEMP
Roles :Connect : admin option checkedRoles added : DBA, JAVASYSPRIV, RESOURCE, SAMI_ADMIN (see 4.2), all with Admin option checked
System Privileges :UNLIMITED TABLESPACE added, with admin optionCREATE USER granted directly to pensami even if it's included into the SAMI_ADMIN role, because the privileges from a role are disabled when procedures are executed (ie the procedures from the USERS_ADMIN package needs CREATE USER privilege)
CREATE ROLEGRANT ANY ROLE (same reason as CREATE USER)
4.3.2 - Users
Users are created through the interface (form SAMI_USERS): the "create user" and the "grant" commands are automatically done by the package USERS_ADMIN.
4.3.3 - User DLOADER
The user dloader is used to insert samples batches into the database, through Oracle SQL Loader.
The user is created on the database server:
[root]$ adduser dloader
The file .bash_profile is updated to set the Oracle variables: ORACLE_HOME, ORACLE_BASE and ORACLE_SID.dloader is added to oinstall group, which is set as its primary group.
The ops$dloader is created in the database.NB: the database parameter os_authent_prefix is fixed to ops$
2010-07-22 20/42
SMS Installation and Developments
4.4 - Tables model
The tables containing SMS data (samples, containers, main informations) are part of the main users's schema.
Three other tables are in the sys schema.
2010-07-22 21/42
SMS Installation and Developments
4.4.1 - Main user tables
2010-07-22 22/42
SMS Installation and Developments
The SQL code to create these tables is in the file sami_tables.sql in the folder SMS_Source_Codes.
4.4.1.1 - Table SAMI_CONSTANTS
This table contains useful constants for the system (for example, the list of sample natures, the list of possible container status, ...).
OBJECT VARCHAR2(50) Not null
VARIABLE VARCHAR2(50)
VALUE VARCHAR2(100)
DATAGROUP VARCHAR2(20)
USERSTAMP VARCHAR2(20)
TIMESTAMP DATE
COMMENTS VARCHAR2(255)
4.4.1.2 - Table SAMI_MENUS
This table contains the list of the application forms. In the Graphical User Interface (GUI), this list is displayed in a menu on the left of the screens, and clicking on one entry opens the corresponding form.
NAME VARCHAR2(30) Not null
FORM VARCHAR2(30)
USERSTAMP VARCHAR2(30)
TIMESTAMP DATE
COMMENTS VARCHAR2(255)
POSITION NUMBER
2010-07-22 23/42
SMS Installation and Developments
4.4.1.3 - Table SAMI_USERS
The information on the SMS users is stored in this table.
USERID VARCHAR2(20) Primary key
FIRSTNAME VARCHAR2(30)
LASTNAME VARCHAR2(30)
LOCATION VARCHAR2(40)
PHONE VARCHAR2(20)
EMAIL VARCHAR2(40)
DATAGROUP VARCHAR2(20) main datagroup of the user
JOBTYPE VARCHAR2(20) Not null / default value : USER
USERSTAMP VARCHAR2(20)
TIMESTAMP DATE
STATUS VARCHAR2(20)
COMMENTS VARCHAR2(255)
4.4.1.4 - Table SAMI_USERS_DATAGROUPS
This table contains the list of the datagroups associated with the users : one user can belong to one or more datagroups.
USERID VARCHAR2(20) Not null
DATAGROUP VARCHAR2(20) Not null
COMMENTS VARCHAR2(255)
USERSTAMP VARCHAR2(20)
TIMESTAMP DATE
4.4.1.5 - Table SAMI_JOBTYPES_DETAILS
This table lists the Oracle Roles granted to the different SAMI jobtypes. One user has one jobtype, and this information can be retrieved in the SAMI_USERS table.
JOBTYPE VARCHAR2(20) Not null
ROLE VARCHAR2(30) Not null
COMMENT VARCHAR2(255)
2010-07-22 24/42
SMS Installation and Developments
USERSTAMP VARCHAR2(20)
TIMESTAMP DATE
4.4.1.6 - Table SAMI_PROJECTS
The project code is not generated automatically but choosen by the user in the GUI. If the code already exists, an error message is displayed and the user has to choose an other code. Each study is defined by a unique 3 letters code which enables to store 17576 studies.
CODE_PROJECT CHAR(3) Primary key
NAME VARCHAR2(40) Not null
MANAGER VARCHAR2(30)
DATAGROUP VARCHAR2(20)
USERSTAMP VARCHAR2(20)
TIMESTAMP DATE
COMMENTS VARCHAR2(255)
INTERNAL_CODE_PROJECT VARCHAR2(10)
4.4.1.7 - Table SAMI_CONTAINERS_TYPES
This table contains the descriptions of all available types of containers. Each type of container is described with its capacity and is identified by a unique 2 letters code which allows to store 676 different container types (range from single plate to shelf, freezer, tank…)
CODE CHAR(2) Primary key
CONTAINER_TYPE VARCHAR2(50) Not null
CHILD_CONTAINER_TYPE VARCHAR2(50)
PARENT_CONTAINER_TYPE VARCHAR2(50)
CONTAINER_LEVEL VARCHAR2(3)
CONTAINER_CAPACITY NUMBER(5,2)
CONTAINER_CAPACITY_UNIT VARCHAR2(10)
DATAGROUP VARCHAR2(20)
USERSTAMP VARCHAR2(20)
TIMESTAMP DATE
COMMENTS VARCHAR2(255)
2010-07-22 25/42
SMS Installation and Developments
4.4.1.8 - Table SAMI_CONTAINERS
The Container_ID is automatically generated by the trigger TG_GET_CONTAINER_ID. It is composed by the Type_code of the container (2 letters), 1 digit and 5 alphanumeric characters (figures and letters, except I and O to avoid confusion with 1 and 0). This enables to store about 454 million containers for each container type – the table contains also important information on capacity and status (empty, partially filled or full).
CONTAINER_ID VARCHAR2(10) Primary key
NAME VARCHAR2(50) Name must be unique for a same hierarchy
PARENT_CONTAINER_ID VARCHAR2(10)
TYPE_CODE CHAR(2) Not null
CONTAINER_LEVEL VARCHAR2(3)
BARCODE VARCHAR2(10)
CONTAINER_CAPACITY NUMBER
CONTAINER_CAPACITY_UNIT VARCHAR2(10)
STATUS VARCHAR2(10)
POSITION VARCHAR2(10)
DATAGROUP VARCHAR2(20)
USERSTAMP VARCHAR2(20)
TIMESTAMP DATE
COMMENTS VARCHAR2(255)
ANCESTOR_ID VARCHAR2(10)
4.4.1.9 - Table SAMI_CONTAINERS_TEMP
This table is used during the process to import containers from an Excel file.
NAME VARCHAR2(50)
PARENT_CONTAINER_NAME VARCHAR2(50)
TYPE_CODE CHAR(2)
CONTAINER_LEVEL VARCHAR2(3)
BARCODE VARCHAR2(10)
CONTAINER_CAPACITY VARCHAR2(50)
2010-07-22 26/42
SMS Installation and Developments
CONTAINER_CAPACITY_UNIT VARCHAR2(10)
STATUS VARCHAR2(10)
POSITION VARCHAR2(10)
DATAGROUP VARCHAR2(20)
USERSTAMP VARCHAR2(20)
TIMESTAMP DATE
COMMENTS VARCHAR2(255)
ANCESTOR_ID VARCHAR2(10)
LINE_NUMBER NUMBER
FILE_NAME VARCHAR2(200)
4.4.1.10 - Table SAMI_CONTAINERS_MOVEMENTS
This table provide information on types of container movements, dates and operators.
OBJECT_ID VARCHAR2(10) Not null
DATE_MOV DATE
INITIAL_LOCATION VARCHAR2(10)
DESTINATION VARCHAR2(10)
DATAGROUP VARCHAR2(20)
USERSTAMP VARCHAR2(20)
TIMESTAMP DATE
COMMENTS VARCHAR2(255)
OPERATOR VARCHAR2(20)
DATE_MOV_TXT VARCHAR2(20)
4.4.1.11 - Table SAMI_SAMPLES
The Sample_id is automatically built by the trigger TG_GET_SAMPLE_ID. The id is composed of 3 characters for the project plus 5 for the id. These 5 characters can be figures or upper letters (except I and O to avoid confusion with 1 and 0). This system allows more than 45 millions of available ids for each project (10 figures + 24 letters = 34^5). The table also hosts information on other specific identifiers, some data on subjects such as sex, age, origin, data on quantities and most importantly information on the location within the biobank (container ID). Samples can also be linked through their unique identifiers to more complete and more complex epidemiological databases containing the full range of individual and pathological information available.
2010-07-22 27/42
SMS Installation and Developments
SAMPLE_ID VARCHAR2(10) Primary key
PARENT_SAMPLE_ID VARCHAR2(10)
NAME VARCHAR2(40)
OLD_ID VARCHAR2(30)
SAMPLE_TYPE VARCHAR2(20)
PROJECT CHAR(3)
EXT_ID_1 VARCHAR2(40)
EXT_ID_2 VARCHAR2(40)
EXT_BASE_LINK VARCHAR2(40)
SEX CHAR(1)
AGE NUMBER(3,0)
ORIGIN VARCHAR2(50)
TREATMENT VARCHAR2(200)
NATURE VARCHAR2(30)
LOCATION VARCHAR2(10) container_id of the lowest level / Not null
INITIAL_QUANTITY NUMBER(15,0)
INITIAL_QUANT_UNIT VARCHAR2(10)
INITIAL_CONCENTRATION NUMBER(10,3)
INITIAL_CONC_UNIT VARCHAR2(10)
RECEPTION_DATE DATE
RECEPTION_CONDITION VARCHAR2(100)
DATAGROUP VARCHAR2(20)
USERSTAMP VARCHAR2(20)
TIMESTAMP DATE
COMMENTS VARCHAR2(255)
CURRENT_QUANTITY NUMBER(15,0)
COUNTRY VARCHAR2(40)
RECEPTION_DATE_TXT VARCHAR2(20)
SAMPLING_DATE DATE
2010-07-22 28/42
SMS Installation and Developments
4.4.1.12 - Table SAMI_SAMPLES_TEMP
The import of samples by batch is done with Oracle SQLLoader, which launches the data in this temporary table.
SAMPLE_ID_TEMP VARCHAR2(10) Not null / automatic sequence
NAME VARCHAR2(40)
PARENT_SAMPLE_ID VARCHAR2(10)
OLD_ID VARCHAR2(30)
SAMPLE_TYPE VARCHAR2(20)
PROJECT CHAR(3)
EXT_ID_1 VARCHAR2(40)
EXT_ID_2 VARCHAR2(40)
EXT_BASE_LINK VARCHAR2(40)
COUNTRY VARCHAR2(40)
SEX CHAR(1)
AGE NUMBER(3,0)
ORIGIN VARCHAR2(50)
TREATMENT VARCHAR2(200)
NATURE VARCHAR2(30)
INITIAL_QUANTITY NUMBER(15,0)
INITIAL_QUANT_UNIT VARCHAR2(10)
INITIAL_CONCENTRATION NUMBER(10,3)
INITIAL_CONC_UNIT VARCHAR2(10)
RECEPTION_DATE_TXT VARCHAR2(20)
RECEPTION_CONDITION VARCHAR2(100)
DATAGROUP VARCHAR2(20)
COMMENTS VARCHAR2(255)
LOC_NAME VARCHAR2(50)
LOC_PARENT_NAME VARCHAR2(50)
LOC_TYPE CHAR(2)
LOC_LEVEL VARCHAR2(3)
LOC_BARCODE VARCHAR2(10)
LOC_CAPACITY NUMBER
LOC_CAPACITY_UNIT VARCHAR2(10)
2010-07-22 29/42
SMS Installation and Developments
LOC_STATUS VARCHAR2(10)
LOC_POSITION VARCHAR2(10)
LOC_DATAGROUP VARCHAR2(20)
LOC_COMMENT VARCHAR2(255)
USERSTAMP VARCHAR2(20) Database user
TIMESTAMP DATE Sysdate
LINE_NUMBER NUMBER Line number in the imported file
FILE_NAME VARCHAR2(200) Name of the imported file
CURRENT_QUANTITY NUMBER
SAMPLING_DATE DATE
LOC_PARENT_ID VARCHAR2(10) Updated by check_location procedure
LOC_ID VARCHAR2(10) Updated by samip_samples_utils package
4.4.1.13 - Table SAMI_SAMPLES_MOVEMENTS
This table provide information on types of sample movements, dates and operators.
OBJECT_ID VARCHAR2(10) Not null
QUANTITY NUMBER
QUANTITY_UNIT VARCHAR2(10)
DATE_MOV DATE
INITIAL_LOCATION VARCHAR2(10)
DESTINATION VARCHAR2(10)
TREATMENT VARCHAR2(50)
DECONGELATION CHAR(1)
DECONG_DURATION VARCHAR2(40)
DATAGROUP VARCHAR2(20)
USERSTAMP VARCHAR2(20)
TIMESTAMP DATE
COMMENTS VARCHAR2(255)
OPERATOR VARCHAR2(20)
DATE_MOV_TXT VARCHAR2(20)
2010-07-22 30/42
SMS Installation and Developments
4.4.1.14 - Table SAMI_ALIQUOTS
Each aliquot derived from a sample is annotated with the same range of information as described in the “Samples” table.ALIQUOT_ID VARCHAR2(10) Primary key
PARENT_SAMPLE_ID VARCHAR2(10) Not null
PARENT_NAME VARCHAR2(40)
PROJECT CHAR(3) Not null – mandatory to generate aliquot_id
TREATMENT VARCHAR2(200)
NATURE VARCHAR2(30)
LOCATION VARCHAR2(10)
INITIAL_QUANTITY NUMBER(15,0)
INITIAL_QUANT_UNIT VARCHAR2(10)
RECEPTION_DATE DATE
RECEPTION_CONDITION VARCHAR2(100)
DATAGROUP VARCHAR2(20)
USERSTAMP VARCHAR2(20)
TIMESTAMP DATE
COMMENTS VARCHAR2(255)
CURRENT_QUANTITY NUMBER(15,0)
RECEPTION_DATE_TXT VARCHAR2(20)
ALIQUOT_NB NUMBER
4.4.2 - Sys tables
2010-07-22 31/42
SMS Installation and Developments
The SQL code to create these tables is in the file sami_sys_tables.sql in the folder SMS_Source_Codes.
4.4.2.1 - Table SYS.SAMI_SERVERS
This table contains the information on the servers of the SMS platform, for the Oracle ApplicationServer (Type=OAS) and the Oracle Database server (Type=DBserver). These data are required bythe SAMI_ACCESS_CONTROL trigger.
HOSTNAME VARCHAR2(30 BYTE) Not null
IP VARCHAR2(15 BYTE) Not null
TYPE VARCHAR2(30 BYTE) Not null / OAS or DBServer
USERSTAMP VARCHAR2(30 BYTE)
TIMESTAMP DATE
4.4.2.2 - Table SYS.SAMI_SYS_USER_AUDIT
The data of this table are written by the SAMI_ACCESS_CONTROL trigger.
SESSION_ID NUMBER(8,0)
CLIENT_USERNAME VARCHAR2(30 BYTE)
CLIENT_HOSTNAME VARCHAR2(30 BYTE)
CLIENT_IP VARCHAR2(15 BYTE)
PROGRAM VARCHAR2(40 BYTE)
LOGON_TIME DATE
LOGOFF_TIME DATE
ACCESS_GRANTED CHAR(1 BYTE)
DB_USERNAME VARCHAR2(20 BYTE)
4.4.2.3 - Table SYS.SAMI_USER_AUDIT
The data of this table are written by the SAMI_ACCESS_CONTROL trigger, and by the main form of the SMS GUI.
SESSION_ID NUMBER(8,0)
CLIENT_USERNAME VARCHAR2(30 BYTE)
2010-07-22 32/42
SMS Installation and Developments
CLIENT_HOSTNAME VARCHAR2(30 BYTE)
CLIENT_IP VARCHAR2(15 BYTE)
PROGRAM VARCHAR2(40 BYTE)
LOGON_TIME DATE
LOGOFF_TIME DATE
ACCESS_GRANTED CHAR(1 BYTE)
DB_USERNAME VARCHAR2(20 BYTE)
4.5 - Triggers
4.5.1 - SAMI_ACCESS_CONTROL
This trigger is in the sys schema. It controls the access to the SMS database by accepting or rejecting connections just after logon on database, depending on the following criteria:- if the program used to access the database is not the Oracle Forms web application, the connection is rejected except if the user is a system user (Oracle system accounts: SYS, SYSTEM, SYSMAN, DBSNMP).- if the user is OPS$DLOADER and the program Oracle SQLLoader, the access is granted.
The system users connections are recorded in the table SAMI_SYS_USER_AUDIT, the usersconnections in the table SAMI_USER_AUDIT (by the trigger code, or directly by theSAMI_MAIN form if the connection is done from the Oracle Forms web application).
4.5.2 - TG_GET_CONTAINER_ID
This trigger generates the Container_id for a new container before its insertion into the SAMI_CONTAINERS table.
4.5.3 - TG_GET_SAMPLE_ID
The Sample_ID inserted into the table SAMI_SAMPLES is generated by this trigger before the insertion of a new sample.
4.5.4 - TG_GET_ALIQUOT_ID
The Aliquot_ID inserted into the table SAMI_ALIQUOTS is generated by this trigger before the insertion of a new aliquot.
2010-07-22 33/42
SMS Installation and Developments
4.5.5 - TG_CHECK_SAMPLE_NATURE
Before the insertion of a new sample, its nature is checked: it should be uppercase if the nature is DNA or RBC, and in case of a nature with two words, the first letter of the first word should be uppercase and the rest lowercase.
4.5.6 - TG_INSERT_CONTAINER
Before the insertion of a new container, this trigger checks the type_code in the SAMI_CONTAINER_TYPES table, and if it doesn't exist, it sends an email to the administrator.
4.6 - Packages
The code of the packages is in the files sami_packages_spec.sql and sami_packages_body.sql in the SMS_Source_Codes folder.
4.6.1 - USERS_ADMIN
This package contains the procedures used to create a user and to grant him roles.
4.6.2 - SAMIP_BARCODES
This package is used to generate and print barcodes.
4.6.3 - SAMIP_CONTAINERS_UTILS
Procedures for the insertion of containers: check the data, insert them into the SAMI_CONTAINERS table, update the status in the hierarchy of containers, ...
4.6.4 - SAMIP_SAMPLES_UTILS
Procedures for the insertion of samples: check the data, insert them into the SAMI_SAMPLEStable.
4.6.5 - SAMIP_UTILS
Useful procedures for the SMS application:- send email to admin or to users- execute shell script on the database server- format and convert dates.
2010-07-22 34/42
SMS Installation and Developments
4.7 - Synonyms
4.7.1 - Tables synonyms
The synonyms for the tables are named SAMIS_*
Synonym Table
SAMIS_ALIQUOTS SAMI_ALIQUOTS
SAMIS_CONSTANTS SAMI_CONSTANTS
SAMIS_CONTAINERS SAMI_CONTAINERS
SAMIS_CONTAINERS_MOVEMENTS SAMI_CONTAINERS_MOVEMENTS
SAMIS_CONTAINERS_TEMP SAMI_CONTAINERS_TEMP
SAMIS_CONTAINERS_TYPES SAMI_CONTAINERS_TYPES
SAMIS_MENUS SAMI_MENUS
SAMIS_PROJECTS SAMI_PROJECTS
SAMIS_SAMPLES SAMI_SAMPLES
SAMIS_SAMPLES_MOVEMENTS SAMI_SAMPLES_MOVEMENTS
SAMIS_SAMPLES_TEMP SAMI_SAMPLES_TEMP
SAMIS_SYS_USER_AUDIT SYS.SAMI_SYS_USER_AUDIT
SAMIS_USERS SAMI_USERS
SAMIS_USERS_DATAGROUPS SAMI_DATAGROUPS
SAMIS_USER_AUDIT SYS_SAMI_USER_AUDIT
4.7.2 - Synonyms for packages
The synonyms for the packages are named SAMIS_PKG_*
Synonym Package
SAMIS_PKG_BARCODES SAMIP_BARCODES
SAMIS_PKG_USERS_ADMIN USERS_ADMIN
SAMIS_PKG_SAMPLES_UTILS SAMIP_SAMPLES_UTILS
SAMIS_PKG_UTILS SAMIP_UTILS
SAMIS_PKG_CONTAINERS_UTILS SAMIP_CONTAINERS_UTILS
2010-07-22 35/42
SMS Installation and Developments
4.8 - Library
To be able to launch shell commands on the database server (to print barcodes or to use Oracle SQLLoader for example), a library has been created in the $ORACLE_HOME/lib folder. The code of this library is available in the file iarc_shell.c
This c file is compiled with the following command (executed on the database server by the user oracle ):[oracle]$ make -f $ORACLE_HOME/rdbms/demo/demo_rdbms.mk extproc_nocallback \SHARED_LIBNAME=iarc_shell.so OBJS=iarc_shell.o
The command used to create the library in the database is:CREATE or replace LIBRARY iarc_shell_lib IS '<$ORACLE_HOME>/lib/iarc_shell.so';
NB: $ORACLE_HOME has to be specified (complete path)
4.9 - Webutil
The installation of the webutil package into the database is done by executing in sqlplus the script create_webutil_db.sql, available in the Oracle DevSuite Home (folder "webutil_106").
Then, a grant execute has to be done on webutil_db to public, and a synonym is created:
grant execute on webutil_db to public ;create public synonym webutil_db for webutil_db ;
4.10 - Directories
Three specific Oracle directories are created in the database: two for the barcodes (Eltron and Brady) and one for the CSV files (import of samples).
create directory BARCODES_ELTRON as '<path>/barcodesELTRON';
grant read, write on directory BARCODES_ELTRON to public ;
create directory BARCODES_BRADY as '<path>/barcodesBRADY';
grant read, write on directory BARCODES_BRADY to public ;
create directory CSV_DIR as '<path>/ImportFiles';
grant read, write on directory CSV_DIR to public;
2010-07-22 36/42
SMS Installation and Developments
5 - Audit
5.1 - Connections control
As described in §4.5.1, the access to the SMS application is controlled by a trigger (SAMI_ACCESS_CONTROL). This trigger uses three tables, to retrieve informations on the platform and to record audit informations (see §4.4.2). Insert and update are granted on SAMI_USER_AUDIT to public, so the informations of a simple user connection can be inserted into the audit table:
grant insert, update on sami_user_audit to public ;
Two public synonyms are also created :
create public synonym SAMIS_SYS_USER_AUDIT for sys.sami_sys_user_audit ;create public synonym SAMIS_USER_AUDIT for sys.sami_user_audit ;
As all lot of informations are recorded in the audit tables SAMI_SYS_USER_AUDIT and SAMI_USER_AUDIT, a procedure is written in the sys schema to purge these tables: PURGE_AUDIT_TABLES. It saves the old records in a file on the database server, send an email to warn the administrator if some unsuccessful connections attempts have been detected.The job PURGE_AUDIT_TABLES_JOB is set up from the dbconsole and execute this procedure once a day, with 14 (days) as parameter.
5.2 - Oracle Audit
PURGE_AUDIT_TRAIL_JOBCall the procedure PURGE_AUDIT_TRAIL (sys.aud$)
6 - GUI : Oracle Forms&Reports
6.1 - Configuration
A specific configuration file (.env) has been created on the Oracle Application Server (OAS). This file is called sms.env and is located in the SMS_Config_Application_Server folder.
6.1.1 - Oracle JInitiator Plugin
The specific Oracle Forms configuration uses Oracle JInitiator plug-in, however, the Sun Java plug-in would also be suitable.
2010-07-22 37/42
SMS Installation and Developments
6.1.2 - Icons
- forms.conf : one line added :
AliasMatch ^/forms/sami/(..*) "D:\Sami/jars/$1"
NB: FR10g.<oas_hostname> needs to be restarted.
- property archive_jini and archive : /forms/sami/sami_icons.jar added
- the Jar sami_icons.jar containing the gif icons is created and copied onto OAS server.
6.2 - Forms
SAMI_MAIN: main screen
SAMI_ABOUT: informations about the application
SAMI_CHANGE_PASSWORD: to change user's password
SAMI_CHANGE_DATAGROUP: to change user's datagroup
SAMI_USERS: to add a user, and list existing users
SAMI_PROJECTS: to add, search and list projects
SAMI_CONTAINERS_TYPES: add, search and list containers types
SAMI_CONTAINERS: add, search, list and visualize containers
SAMI_SAMPLES: add, search, list samples
SAMI_ALIQUOTS: add, search, list aliquots
SAMI_MOVEMENTS: add, search and list movements for samples and containers
SAMI_BARCODES: print samples and containers barcodes, on Eltron or Brady printer
SAMI_GRAPHS: display some graphs
6.3 - Library
SAMI_LIB created and added to the Forms.conf
NB: the registry key FORMS_PATH of Dev Suite has to be updated to include the directory containing the libraries for SAMI.
HKEY_LOCAL_MACHINE\SOFTWARE\Oracle\Key_DevSuiteHome10g\FORMS_PATH
2010-07-22 38/42
SMS Installation and Developments
7 - Database administration
7.1 - Maintenance
Cron tasks (defined in the file /etc/crontab):
- the scripts for the backups are executed once a day
- the first day of the month: a script is executed to rotate the log of the listener
7.2 - Backup
7.2.1 - Archivelog mode
Archivelog mode activated, to allow hot backups:
SQL> SELECT LOG_MODE FROM SYS.V$DATABASE;
LOG_MODE
------------
NOARCHIVELOG
SQL> shutdown immediate
SQL> startup mount
SQL> alter database archivelog;
SQL> alter database open;
7.3 - Recovery Catalog
A new database is created with the dbca tool, to have a recovery catalog.
A new Tablespace "TOOLS" for the recovery catalog is created with OEM : 1 datafile, size 50MB, autoextend, max size 2GB
User catman created :
SQL> create user catman identified by *****
2 temporary tablespace TEMP
2010-07-22 39/42
SMS Installation and Developments
3 default tablespace TOOLS
4 quota unlimited on TOOLS ;
$ rman
RMAN> create catalog ;
$ rman target / catalog catman/****@catdb
RMAN> register database ;
8 - Acknowledgements
We would like to thank biospecimen managers from the various research groups at IARC for their help during the scoping and testing phase.
2010-07-22 40/42
SMS Installation and Developments - Appendix
APPENDIX
List of privileges for the role SAMI_ADMIN :
GRANT ALTER ANY CLUSTER TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT ALTER ANY INDEX TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT ALTER ANY MATERIALIZED VIEW TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT ALTER ANY PROCEDURE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT ALTER ANY ROLE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT ALTER ANY SEQUENCE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT ALTER ANY TABLE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT ALTER ANY TRIGGER TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT ALTER ANY TYPE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT ALTER DATABASE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT ALTER PROFILE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT ALTER RESOURCE COST TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT ALTER ROLLBACK SEGMENT TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT ALTER SESSION TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT ALTER SYSTEM TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT ALTER TABLESPACE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT ALTER USER TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT ANALYZE ANY TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT AUDIT ANY TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT AUDIT SYSTEM TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT BACKUP ANY TABLE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT BECOME USER TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT COMMENT ANY TABLE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT CREATE ANY CLUSTER TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT CREATE ANY DIRECTORY TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT CREATE ANY INDEX TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT CREATE ANY LIBRARY TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT CREATE ANY MATERIALIZED VIEW TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT CREATE ANY PROCEDURE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT CREATE ANY SEQUENCE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT CREATE ANY SYNONYM TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT CREATE ANY TABLE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT CREATE ANY TRIGGER TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT CREATE ANY TYPE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT CREATE ANY VIEW TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT CREATE CLUSTER TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT CREATE DATABASE LINK TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT CREATE MATERIALIZED VIEW TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT CREATE PROCEDURE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT CREATE PROFILE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT CREATE PUBLIC DATABASE LINK TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT CREATE PUBLIC SYNONYM TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT CREATE ROLE TO SAMI_ADMIN WITH ADMIN OPTION ;
2010-07-22 41/42
SMS Installation and Developments - Appendix
GRANT CREATE ROLLBACK SEGMENT TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT CREATE SEQUENCE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT CREATE SESSION TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT CREATE SYNONYM TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT CREATE TABLE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT CREATE TABLESPACE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT CREATE TRIGGER TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT CREATE TYPE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT CREATE USER TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT CREATE VIEW TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT DELETE ANY TABLE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT DROP ANY CLUSTER TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT DROP ANY DIRECTORY TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT DROP ANY INDEX TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT DROP ANY LIBRARY TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT DROP ANY MATERIALIZED VIEW TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT DROP ANY PROCEDURE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT DROP ANY ROLE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT DROP ANY SEQUENCE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT DROP ANY SYNONYM TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT DROP ANY TABLE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT DROP ANY TRIGGER TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT DROP ANY TYPE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT DROP ANY VIEW TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT DROP PROFILE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT DROP PUBLIC DATABASE LINK TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT DROP PUBLIC SYNONYM TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT DROP ROLLBACK SEGMENT TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT DROP TABLESPACE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT DROP USER TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT EXECUTE ANY LIBRARY TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT EXECUTE ANY PROCEDURE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT FORCE ANY TRANSACTION TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT FORCE TRANSACTION TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT GRANT ANY PRIVILEGE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT GRANT ANY ROLE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT INSERT ANY TABLE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT LOCK ANY TABLE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT MANAGE TABLESPACE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT RESTRICTED SESSION TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT SELECT ANY DICTIONARY TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT SELECT ANY SEQUENCE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT SELECT ANY TABLE TO SAMI_ADMIN WITH ADMIN OPTION ;GRANT UPDATE ANY TABLE TO SAMI_ADMIN WITH ADMIN OPTION ;
2010-07-22 42/42