On this page:

21.4Setting Up Oracle

 

This page contains details on how to set up databases for use with Oracle.

21.4.1Supported Versions

 

Smile CDR has been tested against the following versions of Oracle:

  • Oracle 12c

21.4.2Setting up a Cluster Manager Database

 

To initialize a new Oracle database for the Cluster Manager, initialize a database with the following SQL:

create sequence SEQ_AUDITEVT_PID start with 1 increment by  50;
create sequence SEQ_AUDITEVT_TARGETMODULE_PID start with 1 increment by  50;
create sequence SEQ_AUDITEVT_TARGETRES_PID start with 1 increment by  50;
create sequence SEQ_AUDITEVT_TARGETUSER_PID start with 1 increment by  50;
create sequence SEQ_AUDITEVT_TYPE_PID start with 1 increment by  50;
create sequence SEQ_CDATEMPLATE_PID start with 1 increment by  50;
create sequence SEQ_CDATEMPLATEPARAM_PID start with 1 increment by  50;
create sequence SEQ_EMPILINKRUL_PID start with 1 increment by  50;
create sequence SEQ_EMPIMODRUL_PID start with 1 increment by  50;
create sequence SEQ_EMPIREVIEWQUEUE_PID start with 1 increment by  50;
create sequence SEQ_EMPISTDMTCHRUL_PID start with 1 increment by  50;
create sequence SEQ_FHIRSEARCHPARAM_PID start with 1 increment by  50;
create sequence SEQ_HTTPSESSION_PID start with 1 increment by  50;
create sequence SEQ_MODULE_CFGPROP_PID start with 1 increment by  50;
create sequence SEQ_MODULE_DEP_PID start with 1 increment by  50;
create sequence SEQ_MODULE_PID start with 1 increment by  50;
create sequence SEQ_MODULE_PROT_CFG_PID start with 1 increment by  50;
create sequence SEQ_MODULE_PROT_DEP_PID start with 1 increment by  50;
create sequence SEQ_MODULE_PROT_SUPPLIES_PID start with 1 increment by  50;
create sequence SEQ_MODULE_PROTOTYPE_PID start with 1 increment by  50;
create sequence SEQ_NODE_PID start with 1 increment by  50;
create sequence SEQ_OA2ATOKADNLINFO_PID start with 1 increment by  50;
create sequence SEQ_OA2ATOKEN_PID start with 1 increment by  50;
create sequence SEQ_OA2ATOKGRNTDA_PID start with 1 increment by  50;
create sequence SEQ_OA2ATOKSCP_PID start with 1 increment by  50;
create sequence SEQ_OA2AUTHCODE_PID start with 1 increment by  50;
create sequence SEQ_OA2CLIDETAASCOP_PID start with 1 increment by  50;
create sequence SEQ_OA2CLIDETAGSCOP_PID start with 1 increment by  50;
create sequence SEQ_OA2CLIDETAUTHGRNTTYP_PID start with 1 increment by  50;
create sequence SEQ_OA2CLIDETCLISEC_PID start with 1 increment by  50;
create sequence SEQ_OA2CLIDETREGREDIRURI_PID start with 1 increment by  50;
create sequence SEQ_OA2CLIENTDETAILS_PID start with 1 increment by  50;
create sequence SEQ_OA2CLIENTDETAILSSCOPE_PID start with 1 increment by  50;
create sequence SEQ_OA2CLIENTPERM_PID start with 1 increment by  50;
create sequence SEQ_OA2REFTOKEN_PID start with 1 increment by  50;
create sequence SEQ_OA2RTOKADNLINFO_PID start with 1 increment by  50;
create sequence SEQ_OA2RTOKGRNTDA_PID start with 1 increment by  50;
create sequence SEQ_OA2RTOKREQPRM_PID start with 1 increment by  50;
create sequence SEQ_OA2RTOKSCP_PID start with 1 increment by  50;
create sequence SEQ_OA2SERVER_PID start with 1 increment by  50;
create sequence SEQ_USER_PERM_PID start with 1 increment by  50;
create sequence SEQ_USER_PID start with 1 increment by  50;
create sequence SEQ_USERDEFLNCHCTX_PID start with 1 increment by  50;
create sequence SEQ_USERTFAKEY_PID start with 1 increment by  50;
create sequence SEQ_USROA2CLNTAPRVDSCP_PID start with 1 increment by  50;
create sequence SEQ_XACT_LOG_PID start with 1 increment by  50;
create sequence SEQ_XACT_LOG_STEP_PID start with 1 increment by  50;

    create table CDR_AUDIT_EVT (
       PID number(19,0) not null,
        AUSER_TYPE number(10,0),
        REMOTE_ADDRESS varchar2(100 char),
        HAVE_TARGET_MODULES number(1,0) not null,
        HAVE_TARGET_RESOURCES number(1,0) not null,
        HAVE_TARGET_USERS number(1,0) not null,
        EVT_TIMESTAMP timestamp not null,
        TYPE_DISPLAY varchar2(200 char) not null,
        CLIENT_PID number(19,0),
        ENDPOINT_MODULE_PID number(19,0) not null,
        TYPE_PID number(19,0) not null,
        USER_PID number(19,0),
        primary key (PID)
    );

    create table CDR_AUDIT_EVT_TARGET_MODULE (
       PID number(19,0) not null,
        EVENT_PID number(19,0) not null,
        MODULE_PID number(19,0) not null,
        primary key (PID)
    );

    create table CDR_AUDIT_EVT_TARGET_RES (
       PID number(19,0) not null,
        REQ_VAL_RESULT number(10,0),
        RES_ID varchar2(120 char) not null,
        TENANT_ID_STR varchar2(20 char),
        RES_VERSION number(19,0),
        EVENT_PID number(19,0) not null,
        PERS_MODULE_PID number(19,0) not null,
        primary key (PID)
    );

    create table CDR_AUDIT_EVT_TARGET_USER (
       PID number(19,0) not null,
        EVENT_PID number(19,0) not null,
        USER_PID number(19,0) not null,
        primary key (PID)
    );

    create table CDR_AUDIT_EVT_TYPE (
       PID number(19,0) not null,
        CODEVAL varchar2(200 char),
        SYSTEM_URL varchar2(200 char),
        primary key (PID)
    );

    create table CDR_CDA_TEMPLATE (
       PID number(19,0) not null,
        TEMPLATE_DESCRIPTION varchar2(250 char),
        TEMPLATE_ID varchar2(250 char) not null,
        TEMPLATE_CONTENT clob not null,
        MODULE_PID number(19,0) not null,
        primary key (PID)
    );

    create table CDR_CDA_TEMPLATE_PARAM (
       PID number(19,0) not null,
        TEMPLATE_PARAMETER_NAME varchar2(250 char) not null,
        TEMPLATE_PID number(19,0),
        primary key (PID)
    );

    create table CDR_CLUSTMGR_MODULE_MET_GAUGE (
       GAUGE_ID varchar2(100 char) not null,
        INTRVL number(10,0) not null,
        START_TIME timestamp not null,
        ISCOLLAPSED number(1,0) not null,
        GAUGE_VAL number(19,0) not null,
        MODULE_PID number(19,0) not null,
        primary key (GAUGE_ID, INTRVL, MODULE_PID, START_TIME)
    );

    create table CDR_CLUSTMGR_MODULE_METRIC_HC (
       HEALTHCHECK_ID varchar2(100 char) not null,
        ERROR_STRING varchar2(200 char),
        IS_HEALTHY number(1,0) not null,
        HEALTHY_STRING varchar2(200 char),
        MODULE_PID number(19,0) not null,
        primary key (HEALTHCHECK_ID, MODULE_PID)
    );

    create table CDR_CLUSTMGR_MODULE_METRIC_TMR (
       INTRVL number(10,0) not null,
        METER_ID varchar2(100 char) not null,
        START_TIME timestamp not null,
        ISCOLLAPSED number(1,0) not null,
        COUNTV number(19,0),
        RATE_15_MIN float not null,
        FIRST_SINCE_RS number(1,0) not null,
        RATE_5_MIN float not null,
        LATENCY_MAX number(10,0) default 0 not null,
        LATENCY_MEAN number(10,0) default 0 not null,
        LATENCY_MIN number(10,0) default 0 not null,
        RATE_1_MIN float not null,
        MODULE_PID number(19,0) not null,
        primary key (INTRVL, METER_ID, MODULE_PID, START_TIME)
    );

    create table CDR_DB_VERSION (
       DB_VERSION varchar2(100 char) not null,
        DB_INIT_TIME timestamp not null,
        primary key (DB_VERSION)
    );

    create table CDR_EMPI_LINK_RULE (
       PID number(19,0) not null,
        MAX_WEIGHT float,
        MIN_WEIGHT float,
        RULE_ORDER number(10,0) not null,
        RULE_OUTCOME varchar2(100 char) not null,
        MODULE_PID number(19,0) not null,
        REVIEW_QUEUE_PID number(19,0),
        primary key (PID)
    );

    create table CDR_EMPI_MODULE_RULE (
       PID number(19,0) not null,
        EID_SYSTEM varchar2(200 char) not null,
        MODULE_PID number(19,0) not null,
        primary key (PID)
    );

    create table CDR_EMPI_REVIEWQUEUE (
       PID number(19,0) not null,
        QUEUE_ID varchar2(200 char) not null,
        QUEUE_NAME varchar2(200 char) not null,
        RULE_ORDER number(10,0) not null,
        MODULE_PID number(19,0) not null,
        primary key (PID)
    );

    create table CDR_EMPI_STD_MATCH_RULE (
       PID number(19,0) not null,
        MATCH_ADDR_CITY varchar2(100 char) not null,
        MATCH_ADDR_COUNTRY varchar2(100 char) not null,
        MATCH_ADDR_PC varchar2(100 char) not null,
        MATCH_ADDR_STATE varchar2(100 char) not null,
        MATCH_BIRTHDATE varchar2(100 char) not null,
        MATCH_ADDR_GENDER varchar2(100 char) not null,
        MATCH_NAME_FAMANDGVN varchar2(100 char) not null,
        RULE_ORDER number(10,0) not null,
        RULE_WEIGHT float not null,
        MODULE_PID number(19,0) not null,
        primary key (PID)
    );

    create table CDR_FHIR_SEARCHPARAM (
       PID number(19,0) not null,
        SP_BASE varchar2(500 char) not null,
        SP_CODE varchar2(500 char) not null,
        SP_DESC varchar2(500 char),
        SP_FHIR_STATUS varchar2(255 char),
        LAST_UPDATED timestamp not null,
        LAST_USED timestamp,
        STAT_OVERALL_COUNT number(19,0),
        SP_PATH varchar2(500 char),
        STAT_RESOURCE_SPREAD double precision not null,
        SP_RES_ID varchar2(150 char),
        SP_SYNC_STATUS varchar2(255 char) not null,
        SP_TITLE varchar2(500 char),
        SP_TYPE varchar2(20 char),
        BUF_UNIQUE_RESOURCES blob,
        BUF_UNIQUE_VALUES blob,
        STAT_VALUE_SPREAD double precision not null,
        MODULE_PID number(19,0) not null,
        primary key (PID)
    );

    create table CDR_GLOBAL_GAUGE (
       ID varchar2(200 char) not null,
        VAL_DOUBLE double precision,
        VAL_LONG number(19,0),
        primary key (ID)
    );

    create table CDR_HTTP_SESSION (
       PID number(19,0) not null,
        SES_ATTRS blob not null,
        SES_EXPIRY timestamp not null,
        LAST_ACCESSED_TIME timestamp,
        MAX_INACTIVE number(19,0) not null,
        SES_ID varchar2(200 char) not null,
        MODULE_PID number(19,0) not null,
        primary key (PID)
    );

    create table CDR_MODULE (
       PID number(19,0) not null,
        DELETED number(1,0) not null,
        MODULE_DISABLED number(1,0) not null,
        MODULE_ID varchar2(30 char) not null,
        RESTART_REQUIRED number(1,0) not null,
        MASTER_MODULE_PID number(19,0),
        NODE_PID number(19,0) not null,
        PROTOTYPE_PID number(19,0) not null,
        primary key (PID)
    );

    create table CDR_MODULE_CFG_PROP (
       PID number(19,0) not null,
        VALUE_STRING varchar2(200 char),
        VALUE_EXTENDED clob,
        MODULE_PID number(19,0) not null,
        PROTOTYPE_PID number(19,0) not null,
        primary key (PID)
    );

    create table CDR_MODULE_DEP (
       PID number(19,0) not null,
        MODULE_PID number(19,0) not null,
        PROTOTYPE_PID number(19,0) not null,
        TARGET_PID number(19,0),
        primary key (PID)
    );

    create table CDR_MODULE_PROT_CFG (
       PID number(19,0) not null,
        IS_ADVANCED number(1,0) not null,
        CATEGORY_KEY varchar2(100 char) not null,
        DEFAULT_VALUE varchar2(200 char),
        DESC_KEY varchar2(200 char),
        ENUM_TYPE varchar2(200 char),
        CFG_INDEX number(10,0) not null,
        CFG_KEY varchar2(200 char) not null,
        NAME_KEY varchar2(200 char) not null,
        IS_OPTIONAL number(1,0) not null,
        CFG_TYPE varchar2(100 char) not null,
        PROTOTYPE_PID number(19,0) not null,
        primary key (PID)
    );

    create table CDR_MODULE_PROT_DEP (
       PID number(19,0) not null,
        DESCRIPTION_KEY varchar2(200 char) not null,
        ENTRY_KEY varchar2(200 char) not null,
        PROTOTYPE_PID number(19,0),
        primary key (PID)
    );

    create table CDR_MODULE_PROT_SUPPLIES (
       PID number(19,0) not null,
        ENTRY_KEY number(10,0) not null,
        PROTOTYPE_PID number(19,0),
        primary key (PID)
    );

    create table CDR_MODULE_PROTOTYPE (
       PID number(19,0) not null,
        MODULE_TYPE varchar2(200 char) not null,
        STOPPABLE number(1,0) not null,
        primary key (PID)
    );

    create table CDR_MODULE_STATUS (
       CONCEPTS_INDEXED_UNTIL timestamp,
        FULLTEXT_INDEXED_UNTIL timestamp,
        PORTVAL number(10,0),
        MODULE_STATUS number(10,0) not null,
        MODULE_STATUS_DESC varchar2(200 char),
        MODULE_PID number(19,0) not null,
        primary key (MODULE_PID)
    );

    create table CDR_NODE (
       PID number(19,0) not null,
        NODE_ID varchar2(30 char) not null,
        primary key (PID)
    );

    create table CDR_NODE_STATUS (
       IS_RUNNNING number(1,0) not null,
        STARTED_TIME timestamp,
        STOPPED_TIME timestamp,
        NODE_PID number(19,0) not null,
        primary key (NODE_PID)
    );

    create table CDR_OA2_CLI_DET_AUTH_GRNT_TYP (
       PID number(19,0) not null,
        GRANT_TYPE varchar2(100 char) not null,
        CLIENT_PID number(19,0) not null,
        primary key (PID)
    );

    create table CDR_OA2_CLI_DET_AUTOAP_SCOPE (
       PID number(19,0) not null,
        SCOPE varchar2(100 char) not null,
        CLIENT_PID number(19,0) not null,
        primary key (PID)
    );

    create table CDR_OA2_CLI_DET_AUTOGRNT_SCOPE (
       PID number(19,0) not null,
        SCOPE varchar2(100 char) not null,
        CLIENT_PID number(19,0) not null,
        primary key (PID)
    );

    create table CDR_OA2_CLI_DET_CLISEC (
       PID number(19,0) not null,
        SEC_ACTIVATION timestamp,
        SEC_CREATION timestamp,
        SEC_DESC varchar2(250 char),
        SEC_EXPIRATION timestamp,
        CLI_SECRET varchar2(250 char) not null,
        CLIENT_PID number(19,0) not null,
        primary key (PID)
    );

    create table CDR_OA2_CLI_DET_REG_REDIR_URI (
       PID number(19,0) not null,
        REDIR_URI varchar2(200 char) not null,
        CLIENT_PID number(19,0) not null,
        primary key (PID)
    );

    create table CDR_OA2_SERVER (
       PID number(19,0) not null,
        ISS varchar2(200 char) not null,
        SERVER_NAME varchar2(200 char),
        INTRSPCT_CLIENT_ID varchar2(200 char),
        INTRSPCT_CLIENT_SCRT varchar2(200 char),
        JWKS_FILE varchar2(200 char),
        JWKS_TEXT clob,
        MODULE_PID number(19,0) not null,
        primary key (PID)
    );

    create table CDR_OAUTH2_ATOKEN (
       PID number(19,0) not null,
        EXPIRATION timestamp not null,
        GRANT_TYPE varchar2(20 char),
        ID_TOKEN_VAL varchar2(1000 char),
        ISSUED timestamp not null,
        REDIRECT_URI varchar2(200 char),
        TOKEN_VAL varchar2(1000 char) not null,
        TOKEN_HASH varchar2(150 char) not null,
        CLIENT_PID number(19,0) not null,
        MODULE_PID number(19,0) not null,
        REFRESH_TOKEN_PID number(19,0),
        USER_PID number(19,0),
        primary key (PID)
    );

    create table CDR_OAUTH2_ATOKEN_ADNLINFO (
       PID number(19,0) not null,
        INFO_KEY varchar2(200 char) not null,
        INFO_VALUE varchar2(200 char) not null,
        TOKEN_PID number(19,0) not null,
        primary key (PID)
    );

    create table CDR_OAUTH2_ATOKEN_GRNTDA (
       PID number(19,0) not null,
        PERM_ARG varchar2(200 char),
        PERM_NAME varchar2(100 char) not null,
        TOKEN_PID number(19,0) not null,
        primary key (PID)
    );

    create table CDR_OAUTH2_ATOKEN_SCOPE (
       PID number(19,0) not null,
        SCOPE varchar2(100 char) not null,
        TOKEN_PID number(19,0) not null,
        primary key (PID)
    );

    create table CDR_OAUTH2_AUTH_CODE (
       PID number(19,0) not null,
        OAUTH2_AUTHENTICATION blob,
        CLIENT_ID varchar2(200 char) not null,
        CODE_VAL varchar2(100 char) not null,
        EXPIRATION timestamp not null,
        STATE_VAL varchar2(100 char),
        primary key (PID)
    );

    create table CDR_OAUTH2_CLIENT_DET_SCOPE (
       PID number(19,0) not null,
        SCOPE varchar2(100 char) not null,
        CLIENT_PID number(19,0) not null,
        primary key (PID)
    );

    create table CDR_OAUTH2_CLIENT_DETAILS (
       PID number(19,0) not null,
        ACCESS_TOKEN_VALIDITY_SECONDS number(10,0),
        ALWAYS_REQUIRE_APPROVAL number(1,0),
        CAN_INTROSPECT_ANY number(1,0),
        CAN_INTROSPECT_OWN number(1,0),
        CAN_REUSE_TOKENS number(1,0),
        CLIENT_ID varchar2(200 char) not null,
        CLIENT_NAME varchar2(200 char),
        CLIENT_SECRET varchar2(200 char),
        ENABLED number(1,0),
        FIXED_SCOPE number(1,0) not null,
        REFRESH_TOKEN_VALIDITY_SECONDS number(10,0),
        REMEMBER_APPROVED_SCOPES number(1,0),
        SECRET_CLIENT_CAN_CHANGE number(1,0),
        SECRET_REQUIRED number(1,0) not null,
        MODULE_PID number(19,0),
        primary key (PID)
    );

    create table CDR_OAUTH2_CLIENT_PERM (
       PID number(19,0) not null,
        PERMISSION_TYPE varchar2(100 char) not null,
        PERMISSION_ARG varchar2(100 char),
        CLIENT_PID number(19,0) not null,
        primary key (PID)
    );

    create table CDR_OAUTH2_JWT_UNIQ_ID (
       JWT_ID varchar2(500 char) not null,
        CONSUMED_TIMESTAMP timestamp not null,
        primary key (JWT_ID)
    );

    create table CDR_OAUTH2_REFRESH_TOKEN (
       PID number(19,0) not null,
        EXPIRATION timestamp,
        ISSUED timestamp not null,
        TOKEN_VAL varchar2(150 char) not null,
        CLIENT_PID number(19,0),
        USER_PID number(19,0),
        primary key (PID)
    );

    create table CDR_OAUTH2_RTOKEN_ADNLINFO (
       PID number(19,0) not null,
        INFO_KEY varchar2(200 char) not null,
        INFO_VALUE varchar2(200 char) not null,
        TOKEN_PID number(19,0) not null,
        primary key (PID)
    );

    create table CDR_OAUTH2_RTOKEN_GRNTDA (
       PID number(19,0) not null,
        PERM_ARG varchar2(200 char),
        PERM_NAME varchar2(100 char) not null,
        TOKEN_PID number(19,0) not null,
        primary key (PID)
    );

    create table CDR_OAUTH2_RTOKEN_REQPRM (
       PID number(19,0) not null,
        PARM_KEY varchar2(200 char) not null,
        PARM_VALUE varchar2(1600 char) not null,
        TOKEN_PID number(19,0) not null,
        primary key (PID)
    );

    create table CDR_OAUTH2_RTOKEN_SCOPE (
       PID number(19,0) not null,
        SCOPE varchar2(100 char) not null,
        TOKEN_PID number(19,0) not null,
        primary key (PID)
    );

    create table CDR_USER_DETAILS (
       PID number(19,0) not null,
        IS_ANON_ACCT number(1,0),
        CREDS_EXPIRE_ON timestamp,
        USER_DISABLED number(1,0) not null,
        EMAIL varchar2(200 char),
        EXPIRES_ON timestamp,
        IS_EXTERNAL number(1,0),
        FAMILY_NAME varchar2(200 char),
        GIVEN_NAME varchar2(200 char),
        LAST_ACTIVE timestamp,
        USER_LOCKED number(1,0) not null,
        NOTES clob,
        USER_PASSWORD varchar2(200 char),
        IS_SERVICE_ACCT number(1,0),
        IS_SYSTEM_USER number(1,0) not null,
        UPDATED_TS timestamp not null,
        USERNAME varchar2(200 char) not null,
        USERNAME_HAS_NAMESPACE number(1,0),
        MODULE_PID number(19,0) not null,
        primary key (PID)
    );

    create table CDR_USER_DETAILS_DEF_LNCH_CTX (
       PID number(19,0) not null,
        CONTEXT_TYPE varchar2(50 char) not null,
        RESOURCE_ID varchar2(64 char) not null,
        USER_PID number(19,0) not null,
        primary key (PID)
    );

    create table CDR_USER_DETAILS_OA2CLNAPRVSCP (
       PID number(19,0) not null,
        IS_APPROVED number(1,0) not null,
        SCOPE varchar2(100 char) not null,
        CLIENT_PID number(19,0) not null,
        USER_PID number(19,0) not null,
        primary key (PID)
    );

    create table CDR_USER_PERM (
       PID number(19,0) not null,
        PERMISSION_TYPE varchar2(100 char) not null,
        PERMISSION_ARG varchar2(100 char),
        USER_PID number(19,0),
        primary key (PID)
    );

    create table CDR_USER_TFA_KEY (
       PID number(19,0) not null,
        CONFIRMED_AT timestamp,
        KEY_EXPIRES timestamp,
        FAILED_VERIFS number(10,0),
        A_KEY varchar2(250 char) not null,
        A_STYLE varchar2(20 char) not null,
        OPTLOCK number(10,0) not null,
        USER_PID number(19,0) not null,
        primary key (PID)
    );

    create table CDR_XACT_LOG (
       PID number(19,0) not null,
        INITIAL_TIMESTAMP timestamp not null,
        EVT_OUTCOME number(10,0) not null,
        SRC_XACT_ID varchar2(128 char),
        EVT_SUBTYPE number(10,0) not null,
        EVT_TYPE number(10,0) not null,
        CLIENT_PID number(19,0),
        CDR_ENDPOINT_MODULE_PID number(19,0),
        USER_PID number(19,0),
        primary key (PID)
    );

    create table CDR_XACT_LOG_STEP (
       STEP_PID number(19,0) not null,
        BODY_BYTES blob,
        BODY_TYPE number(10,0),
        LOCAL_HOST varchar2(100 char),
        LOCAL_PORT number(10,0),
        EVT_OUTCOME number(10,0),
        PROCESSING_TIME number(19,0),
        REMOTE_HOST varchar2(100 char),
        REMOTE_PORT number(10,0),
        REQUEST_URL_STR varchar2(250 char),
        REQ_VAL_RESULT number(10,0),
        REQUEST_VERB varchar2(7 char),
        RESPONSE_STATUS number(5,0),
        SUBSCRIPTION_ID varchar2(77 char),
        LOG_TIMESTAMP timestamp not null,
        STEP_TYPE number(10,0) not null,
        LOG_PID number(19,0) not null,
        primary key (STEP_PID)
    );
create index IDX_AUDITEVT_TARGMOD_EVT on CDR_AUDIT_EVT_TARGET_MODULE (EVENT_PID);
create index IDX_AUDITEVT_TARGRES_EVT on CDR_AUDIT_EVT_TARGET_RES (EVENT_PID);
create index IDX_AUDITEVT_TARGUSR_EVT on CDR_AUDIT_EVT_TARGET_USER (EVENT_PID);

    alter table CDR_AUDIT_EVT_TYPE 
       add constraint IDX_AUDITEVTTYPE_SYSTEM_CODE unique (SYSTEM_URL, CODEVAL);
create index IDX_CDR_TEMPLATE_ID on CDR_CDA_TEMPLATE (TEMPLATE_ID);

    alter table CDR_CDA_TEMPLATE 
       add constraint IDX_CDATEMPL_ID unique (TEMPLATE_ID);
create index IDX_MODMETGAUGE_COLLAPSED on CDR_CLUSTMGR_MODULE_MET_GAUGE (ISCOLLAPSED);
create index IDX_MODMETGAUGE_STARTTIME on CDR_CLUSTMGR_MODULE_MET_GAUGE (START_TIME);
create index IDX_MODMETGAUGE_INTERVLSTRTTM on CDR_CLUSTMGR_MODULE_MET_GAUGE (INTRVL, START_TIME);
create index IDX_MODMETTMR_COLLAPSED on CDR_CLUSTMGR_MODULE_METRIC_TMR (ISCOLLAPSED);
create index IDX_MODMETTMR_STARTTIME on CDR_CLUSTMGR_MODULE_METRIC_TMR (START_TIME);
create index IDX_MODMETTMR_INTERVLSTRTTM on CDR_CLUSTMGR_MODULE_METRIC_TMR (INTRVL, START_TIME);

    alter table CDR_EMPI_MODULE_RULE 
       add constraint IDX_EMPIMODRUL_MOD unique (MODULE_PID);
create index IDX_FHIRSP_SP_RES_ID on CDR_FHIR_SEARCHPARAM (MODULE_PID, SP_RES_ID);
create index IDX_FHIRSP_BASE on CDR_FHIR_SEARCHPARAM (MODULE_PID, SP_BASE);
create index IDX_FHIRSP_CODE on CDR_FHIR_SEARCHPARAM (MODULE_PID, SP_CODE);
create index IDX_FHIRSP_OVERALLCOUNT on CDR_FHIR_SEARCHPARAM (MODULE_PID, STAT_OVERALL_COUNT);
create index IDX_FHIRSP_RESSPREAD on CDR_FHIR_SEARCHPARAM (MODULE_PID, STAT_RESOURCE_SPREAD);
create index IDX_FHIRSP_TYPE on CDR_FHIR_SEARCHPARAM (MODULE_PID, SP_TYPE);
create index IDX_FHIRSP_VALSPREAD on CDR_FHIR_SEARCHPARAM (MODULE_PID, STAT_VALUE_SPREAD);
create index IDX_FHIRSP_LASTUPDATED on CDR_FHIR_SEARCHPARAM (MODULE_PID, LAST_UPDATED);
create index IDX_FHIRSP_LASTUSED on CDR_FHIR_SEARCHPARAM (MODULE_PID, LAST_USED);
create index IDX_HTTPSESSION_EXPIRY on CDR_HTTP_SESSION (SES_EXPIRY);
create index IDX_HTTPSESSION_MODULE on CDR_HTTP_SESSION (MODULE_PID);

    alter table CDR_HTTP_SESSION 
       add constraint IDX_HTTPSESSION_ID unique (SES_ID);

    alter table CDR_MODULE 
       add constraint IDX_MODULE_ID unique (NODE_PID, MODULE_ID);

    alter table CDR_MODULE_CFG_PROP 
       add constraint IDX_CDR_MODULE_CDR_PROP_MODKEY unique (MODULE_PID, PROTOTYPE_PID);

    alter table CDR_MODULE_PROT_CFG 
       add constraint IDX_CDR_MODULE_PROT_CDG_MODKEY unique (PROTOTYPE_PID, CFG_KEY);

    alter table CDR_MODULE_PROT_DEP 
       add constraint IDX_MODULEPROTDEP_PROT_KEY unique (PROTOTYPE_PID, ENTRY_KEY);

    alter table CDR_MODULE_PROTOTYPE 
       add constraint IDX_MODULEPROTOTYPE_TYPE unique (MODULE_TYPE);

    alter table CDR_NODE 
       add constraint IDX_NODE_ID unique (NODE_ID);

    alter table CDR_OA2_CLI_DET_AUTH_GRNT_TYP 
       add constraint IDX_OA2TOKGRTTYP_TOK_GRNT_TYP unique (CLIENT_PID, GRANT_TYPE);

    alter table CDR_OA2_CLI_DET_AUTOAP_SCOPE 
       add constraint IDX_OA2CLIDETAASCOPE_TOK_SCOP unique (CLIENT_PID, SCOPE);

    alter table CDR_OA2_CLI_DET_AUTOGRNT_SCOPE 
       add constraint IDX_OA2CLIDETAGSCOPE_TOK_SCOP unique (CLIENT_PID, SCOPE);

    alter table CDR_OA2_CLI_DET_CLISEC 
       add constraint IDX_OA2CLIDETCLISEC_SECRET unique (CLIENT_PID, CLI_SECRET);

    alter table CDR_OA2_CLI_DET_REG_REDIR_URI 
       add constraint IDX_OA2CLIDETRRURI_TOK_SCO unique (CLIENT_PID, REDIR_URI);

    alter table CDR_OA2_SERVER 
       add constraint IDX_OA2SERVER_MODULE_ISSURL unique (MODULE_PID, ISS);
create index IDX_OA2ATOKEN_TOKEN_HASH on CDR_OAUTH2_ATOKEN (TOKEN_HASH);
create index IDX_OA2ATOKEN_USER on CDR_OAUTH2_ATOKEN (USER_PID);
create index IDX_OA2ATOKEN_EXPIRATION on CDR_OAUTH2_ATOKEN (EXPIRATION);

    alter table CDR_OAUTH2_ATOKEN_ADNLINFO 
       add constraint IDX_OA2ATOKADLNF_ATOKEN_ADNLNF unique (TOKEN_PID, INFO_KEY);

    alter table CDR_OAUTH2_ATOKEN_SCOPE 
       add constraint IDX_OA2ATOKSCP_ATOKEN_SCOPE unique (TOKEN_PID, SCOPE);
create index IDX_OA2AUTHCODE_EXPIRATION on CDR_OAUTH2_AUTH_CODE (EXPIRATION);

    alter table CDR_OAUTH2_AUTH_CODE 
       add constraint IDX_OA2AUTHCODE_CODE unique (CODE_VAL);

    alter table CDR_OAUTH2_CLIENT_DET_SCOPE 
       add constraint IDX_OA2CLIDETSCOP_TOKEN_SCOPE unique (CLIENT_PID, SCOPE);

    alter table CDR_OAUTH2_CLIENT_DETAILS 
       add constraint IDX_OA2CLIENTDETAILS_CLI_MOD unique (MODULE_PID, CLIENT_ID);
create index IDX_OA2JWTUNIQID_TIMESTAMP on CDR_OAUTH2_JWT_UNIQ_ID (CONSUMED_TIMESTAMP);
create index IDX_OA2REFTOKEN_USER on CDR_OAUTH2_REFRESH_TOKEN (USER_PID);
create index IDX_OA2REFTOKEN_EXPIRATION on CDR_OAUTH2_REFRESH_TOKEN (EXPIRATION);

    alter table CDR_OAUTH2_REFRESH_TOKEN 
       add constraint IDX_OA2REFTOKEN_TOKEN unique (TOKEN_VAL);

    alter table CDR_OAUTH2_RTOKEN_ADNLINFO 
       add constraint IDX_OA2RTOKADLNF_RTOKEN_ADNLNF unique (TOKEN_PID, INFO_KEY);

    alter table CDR_OAUTH2_RTOKEN_REQPRM 
       add constraint IDX_OA2RTOKREQPRM_RTOKEN_PARM unique (TOKEN_PID, PARM_KEY);

    alter table CDR_OAUTH2_RTOKEN_SCOPE 
       add constraint IDX_OA2RTOKSCP_RTOKEN_SCOPE unique (TOKEN_PID, SCOPE);
create index IDX_USER_FAMILYNAME on CDR_USER_DETAILS (MODULE_PID, FAMILY_NAME);
create index IDX_USER_GIVENNAME on CDR_USER_DETAILS (MODULE_PID, GIVEN_NAME);

    alter table CDR_USER_DETAILS 
       add constraint IDX_USERDET_MODULE_USERNAME unique (MODULE_PID, USERNAME);
create index IDX_USERDEFLNCHCTX_USER on CDR_USER_DETAILS_DEF_LNCH_CTX (USER_PID);

    alter table CDR_USER_DETAILS_DEF_LNCH_CTX 
       add constraint IDX_USERDEFLNCHCTX_USER_CTYP unique (USER_PID, CONTEXT_TYPE);
create index IDX_USROA2CLNTAPRVDSCP_CLNTUSR on CDR_USER_DETAILS_OA2CLNAPRVSCP (CLIENT_PID, USER_PID);

    alter table CDR_USER_TFA_KEY 
       add constraint IDX_USERTFAKEY_USER unique (USER_PID);
create index IDX_XACTLOG_INITTS on CDR_XACT_LOG (INITIAL_TIMESTAMP);
create index IDX_XACTLOGSTEP_LOGID on CDR_XACT_LOG_STEP (LOG_PID);

    alter table CDR_AUDIT_EVT 
       add constraint FK_AUDITEVT_CLIENT 
       foreign key (CLIENT_PID) 
       references CDR_OAUTH2_CLIENT_DETAILS;

    alter table CDR_AUDIT_EVT 
       add constraint FK_AUDITEVT_ENDPOINTMODULE 
       foreign key (ENDPOINT_MODULE_PID) 
       references CDR_MODULE;

    alter table CDR_AUDIT_EVT 
       add constraint FK_AUDITEVT_TYPE 
       foreign key (TYPE_PID) 
       references CDR_AUDIT_EVT_TYPE;

    alter table CDR_AUDIT_EVT 
       add constraint FK_AUDITEVT_USER 
       foreign key (USER_PID) 
       references CDR_USER_DETAILS;

    alter table CDR_AUDIT_EVT_TARGET_MODULE 
       add constraint FK_AUDITEVT_TARGETMODULE_EVT 
       foreign key (EVENT_PID) 
       references CDR_AUDIT_EVT;

    alter table CDR_AUDIT_EVT_TARGET_MODULE 
       add constraint FK_AUDITEVT_TARGETMOD_MODULE 
       foreign key (MODULE_PID) 
       references CDR_MODULE;

    alter table CDR_AUDIT_EVT_TARGET_RES 
       add constraint FK_AUDITEVT_TARGETRES_EVT 
       foreign key (EVENT_PID) 
       references CDR_AUDIT_EVT;

    alter table CDR_AUDIT_EVT_TARGET_RES 
       add constraint FK_AUDITEVT_TARGETRES_PERSMOD 
       foreign key (PERS_MODULE_PID) 
       references CDR_MODULE;

    alter table CDR_AUDIT_EVT_TARGET_USER 
       add constraint FK_AUDITEVT_TARGETUSER_EVT 
       foreign key (EVENT_PID) 
       references CDR_AUDIT_EVT;

    alter table CDR_AUDIT_EVT_TARGET_USER 
       add constraint FK_AUDITEVT_TARGETUSER_USER 
       foreign key (USER_PID) 
       references CDR_USER_DETAILS;

    alter table CDR_CDA_TEMPLATE 
       add constraint FK_CDA_MODULE 
       foreign key (MODULE_PID) 
       references CDR_MODULE;

    alter table CDR_CDA_TEMPLATE_PARAM 
       add constraint FK_CDATEMPLATE_PID 
       foreign key (TEMPLATE_PID) 
       references CDR_CDA_TEMPLATE;

    alter table CDR_CLUSTMGR_MODULE_MET_GAUGE 
       add constraint FK_CLUSTMGR_MODMETGAUGE_MOD 
       foreign key (MODULE_PID) 
       references CDR_MODULE;

    alter table CDR_CLUSTMGR_MODULE_METRIC_HC 
       add constraint FK_CLUSTMGR_MODMET_MOD 
       foreign key (MODULE_PID) 
       references CDR_MODULE;

    alter table CDR_CLUSTMGR_MODULE_METRIC_TMR 
       add constraint FK_CLUSTMGR_MODULEMETTMR_MOD 
       foreign key (MODULE_PID) 
       references CDR_MODULE;

    alter table CDR_EMPI_LINK_RULE 
       add constraint FK_EMPILINKRUL_MODULE 
       foreign key (MODULE_PID) 
       references CDR_MODULE;

    alter table CDR_EMPI_LINK_RULE 
       add constraint FK_EMPILINKRUL_REVIEW_QUEUE 
       foreign key (REVIEW_QUEUE_PID) 
       references CDR_EMPI_REVIEWQUEUE;

    alter table CDR_EMPI_MODULE_RULE 
       add constraint FK_EMPIMODRUL_MODULE 
       foreign key (MODULE_PID) 
       references CDR_MODULE;

    alter table CDR_EMPI_REVIEWQUEUE 
       add constraint FK_EMPIREVIEWQUEUE_MODULE 
       foreign key (MODULE_PID) 
       references CDR_MODULE;

    alter table CDR_EMPI_STD_MATCH_RULE 
       add constraint FK_EMPISTDMTCHRUL_MODULE 
       foreign key (MODULE_PID) 
       references CDR_MODULE;

    alter table CDR_FHIR_SEARCHPARAM 
       add constraint FK_FHIRSEARCHPARAM_MODULE 
       foreign key (MODULE_PID) 
       references CDR_MODULE;

    alter table CDR_HTTP_SESSION 
       add constraint FK_HTTPSESSION_MODULE 
       foreign key (MODULE_PID) 
       references CDR_MODULE;

    alter table CDR_MODULE 
       add constraint FK_MODULE_MASTERMOD 
       foreign key (MASTER_MODULE_PID) 
       references CDR_MODULE;

    alter table CDR_MODULE 
       add constraint FK_MODULE_NODE 
       foreign key (NODE_PID) 
       references CDR_NODE;

    alter table CDR_MODULE 
       add constraint FK_MODULE_PROTOTYPE 
       foreign key (PROTOTYPE_PID) 
       references CDR_MODULE_PROTOTYPE;

    alter table CDR_MODULE_CFG_PROP 
       add constraint FK_MODULECFGPROP_MODULE 
       foreign key (MODULE_PID) 
       references CDR_MODULE;

    alter table CDR_MODULE_CFG_PROP 
       add constraint FK_MODULECFGPROP_PROTOTYPE 
       foreign key (PROTOTYPE_PID) 
       references CDR_MODULE_PROT_CFG;

    alter table CDR_MODULE_DEP 
       add constraint FK_MODULEDEP_MODULE 
       foreign key (MODULE_PID) 
       references CDR_MODULE;

    alter table CDR_MODULE_DEP 
       add constraint FK_MODULEDEP_PROTOTYPE 
       foreign key (PROTOTYPE_PID) 
       references CDR_MODULE_PROT_DEP;

    alter table CDR_MODULE_DEP 
       add constraint FK_MODULEDEP_TARGET 
       foreign key (TARGET_PID) 
       references CDR_MODULE;

    alter table CDR_MODULE_PROT_CFG 
       add constraint FK_CDR_MODULEPROTCFG_PROT 
       foreign key (PROTOTYPE_PID) 
       references CDR_MODULE_PROTOTYPE;

    alter table CDR_MODULE_PROT_DEP 
       add constraint FK_MODULE_PROT_DEP_PROT 
       foreign key (PROTOTYPE_PID) 
       references CDR_MODULE_PROTOTYPE;

    alter table CDR_MODULE_PROT_SUPPLIES 
       add constraint FK_MODULE_PROT_SUPPLIES_PROT 
       foreign key (PROTOTYPE_PID) 
       references CDR_MODULE_PROTOTYPE;

    alter table CDR_MODULE_STATUS 
       add constraint FK_MODULESTATUS_MODULE 
       foreign key (MODULE_PID) 
       references CDR_MODULE;

    alter table CDR_NODE_STATUS 
       add constraint FK_NODESTATUS_NODE 
       foreign key (NODE_PID) 
       references CDR_NODE;

    alter table CDR_OA2_CLI_DET_AUTH_GRNT_TYP 
       add constraint FK_OA2CLIDETAUTHGRNTTY_CLI 
       foreign key (CLIENT_PID) 
       references CDR_OAUTH2_CLIENT_DETAILS;

    alter table CDR_OA2_CLI_DET_AUTOAP_SCOPE 
       add constraint FK_OA2CLIDETAUTOAPPSCOP_CLI 
       foreign key (CLIENT_PID) 
       references CDR_OAUTH2_CLIENT_DETAILS;

    alter table CDR_OA2_CLI_DET_AUTOGRNT_SCOPE 
       add constraint FK_OA2CLIDETAUTOGRNTPSCOP_CLI 
       foreign key (CLIENT_PID) 
       references CDR_OAUTH2_CLIENT_DETAILS;

    alter table CDR_OA2_CLI_DET_CLISEC 
       add constraint FK_OA2CLIDETCLISEC_CLI 
       foreign key (CLIENT_PID) 
       references CDR_OAUTH2_CLIENT_DETAILS;

    alter table CDR_OA2_CLI_DET_REG_REDIR_URI 
       add constraint FK_OA2CLIDETREGREDURI_CLI 
       foreign key (CLIENT_PID) 
       references CDR_OAUTH2_CLIENT_DETAILS;

    alter table CDR_OA2_SERVER 
       add constraint FK_OA2SERVER_MODULE 
       foreign key (MODULE_PID) 
       references CDR_MODULE;

    alter table CDR_OAUTH2_ATOKEN 
       add constraint FK_OA2ATOKEN_CLIENT 
       foreign key (CLIENT_PID) 
       references CDR_OAUTH2_CLIENT_DETAILS;

    alter table CDR_OAUTH2_ATOKEN 
       add constraint FK_OA2ATOKEN_MODULE 
       foreign key (MODULE_PID) 
       references CDR_MODULE;

    alter table CDR_OAUTH2_ATOKEN 
       add constraint FK_OA2ATOKEN_REF_TOK 
       foreign key (REFRESH_TOKEN_PID) 
       references CDR_OAUTH2_REFRESH_TOKEN;

    alter table CDR_OAUTH2_ATOKEN 
       add constraint FK_OA2ATOKEN_USER 
       foreign key (USER_PID) 
       references CDR_USER_DETAILS;

    alter table CDR_OAUTH2_ATOKEN_ADNLINFO 
       add constraint FK_OA2ATOKADNLINFO_TOKEN 
       foreign key (TOKEN_PID) 
       references CDR_OAUTH2_ATOKEN;

    alter table CDR_OAUTH2_ATOKEN_GRNTDA 
       add constraint FK_OA2ATOKGRNTDA_TOKEN 
       foreign key (TOKEN_PID) 
       references CDR_OAUTH2_ATOKEN;

    alter table CDR_OAUTH2_ATOKEN_SCOPE 
       add constraint FK_OA2ATOKSCP_TOKEN 
       foreign key (TOKEN_PID) 
       references CDR_OAUTH2_ATOKEN;

    alter table CDR_OAUTH2_CLIENT_DET_SCOPE 
       add constraint FK_OA2CLIDETSCOP_CLIENT 
       foreign key (CLIENT_PID) 
       references CDR_OAUTH2_CLIENT_DETAILS;

    alter table CDR_OAUTH2_CLIENT_DETAILS 
       add constraint FK_OA2CLIENTDETAILS_MODULE 
       foreign key (MODULE_PID) 
       references CDR_MODULE;

    alter table CDR_OAUTH2_CLIENT_PERM 
       add constraint FK_OA2CLIENTPERM_CLIENT 
       foreign key (CLIENT_PID) 
       references CDR_OAUTH2_CLIENT_DETAILS;

    alter table CDR_OAUTH2_REFRESH_TOKEN 
       add constraint FK_OA2REFTOKEN_CLIENT 
       foreign key (CLIENT_PID) 
       references CDR_OAUTH2_CLIENT_DETAILS;

    alter table CDR_OAUTH2_REFRESH_TOKEN 
       add constraint FK_OA2REFTOKEN_USER 
       foreign key (USER_PID) 
       references CDR_USER_DETAILS;

    alter table CDR_OAUTH2_RTOKEN_ADNLINFO 
       add constraint FK_OA2RTOKADNLINFO_TOKEN 
       foreign key (TOKEN_PID) 
       references CDR_OAUTH2_REFRESH_TOKEN;

    alter table CDR_OAUTH2_RTOKEN_GRNTDA 
       add constraint FK_OA2RTOKGRNTDA_TOKEN 
       foreign key (TOKEN_PID) 
       references CDR_OAUTH2_REFRESH_TOKEN;

    alter table CDR_OAUTH2_RTOKEN_REQPRM 
       add constraint FK_OA2RTOKREQPRM_TOKEN 
       foreign key (TOKEN_PID) 
       references CDR_OAUTH2_REFRESH_TOKEN;

    alter table CDR_OAUTH2_RTOKEN_SCOPE 
       add constraint FK_OA2RTOKSCP_TOKEN 
       foreign key (TOKEN_PID) 
       references CDR_OAUTH2_REFRESH_TOKEN;

    alter table CDR_USER_DETAILS 
       add constraint FK_USERDETAILS_MODULE 
       foreign key (MODULE_PID) 
       references CDR_MODULE;

    alter table CDR_USER_DETAILS_DEF_LNCH_CTX 
       add constraint FK_USERDEFLNCHCTX_USER 
       foreign key (USER_PID) 
       references CDR_USER_DETAILS;

    alter table CDR_USER_DETAILS_OA2CLNAPRVSCP 
       add constraint FK_USROA2CLNTAPRVDSCP_CLIENT 
       foreign key (CLIENT_PID) 
       references CDR_OAUTH2_CLIENT_DETAILS;

    alter table CDR_USER_DETAILS_OA2CLNAPRVSCP 
       add constraint FK_USROA2CLNTAPRVDSCP_USER 
       foreign key (USER_PID) 
       references CDR_USER_DETAILS;

    alter table CDR_USER_PERM 
       add constraint FK_USERPERM_USER 
       foreign key (USER_PID) 
       references CDR_USER_DETAILS;

    alter table CDR_USER_TFA_KEY 
       add constraint FK_USERTFAKEY_USER 
       foreign key (USER_PID) 
       references CDR_USER_DETAILS;

    alter table CDR_XACT_LOG 
       add constraint FK_TRANSIT_CLIENT 
       foreign key (CLIENT_PID) 
       references CDR_OAUTH2_CLIENT_DETAILS;

    alter table CDR_XACT_LOG 
       add constraint FK_XACTLOGSTEP_MODULE 
       foreign key (CDR_ENDPOINT_MODULE_PID) 
       references CDR_MODULE;

    alter table CDR_XACT_LOG 
       add constraint FK_TRANSIT_EVENT 
       foreign key (USER_PID) 
       references CDR_USER_DETAILS;

    alter table CDR_XACT_LOG_STEP 
       add constraint FK_XACTLOGSTEP_XACTLOG 
       foreign key (LOG_PID) 
       references CDR_XACT_LOG;

21.4.3Setting up a FHIR Storage (Relational) Database

 

To initialize a new Oracle database for FHIR Storage (Relational), initialize a database with the following SQL:

create sequence SEQ_BLKEXCOL_PID start with 1 increment by  50;
create sequence SEQ_BLKEXCOLFILE_PID start with 1 increment by  50;
create sequence SEQ_BLKEXJOB_PID start with 1 increment by  50;
create sequence SEQ_CNCPT_MAP_GRP_ELM_TGT_PID start with 1 increment by  50;
create sequence SEQ_CODESYSTEM_PID start with 1 increment by  50;
create sequence SEQ_CODESYSTEMVER_PID start with 1 increment by  50;
create sequence SEQ_CONCEPT_DESIG_PID start with 1 increment by  50;
create sequence SEQ_CONCEPT_MAP_GROUP_PID start with 1 increment by  50;
create sequence SEQ_CONCEPT_MAP_GRP_ELM_PID start with 1 increment by  50;
create sequence SEQ_CONCEPT_MAP_PID start with 1 increment by  50;
create sequence SEQ_CONCEPT_PC_PID start with 1 increment by  50;
create sequence SEQ_CONCEPT_PID start with 1 increment by  50;
create sequence SEQ_CONCEPT_PROP_PID start with 1 increment by  50;
create sequence SEQ_FORCEDID_ID start with 1 increment by  50;
create sequence SEQ_HISTORYTAG_ID start with 1 increment by  50;
create sequence SEQ_IDXCMPSTRUNIQ_ID start with 1 increment by  50;
create sequence SEQ_RES_REINDEX_JOB start with 1 increment by  50;
create sequence SEQ_RESLINK_ID start with 1 increment by  50;
create sequence SEQ_RESOURCE_HISTORY_ID start with 1 increment by  50;
create sequence SEQ_RESOURCE_ID start with 1 increment by  50;
create sequence SEQ_RESPARMPRESENT_ID start with 1 increment by  50;
create sequence SEQ_RESTAG_ID start with 1 increment by  50;
create sequence SEQ_SEARCH start with 1 increment by  50;
create sequence SEQ_SEARCH_INC start with 1 increment by  50;
create sequence SEQ_SEARCH_RES start with 1 increment by  50;
create sequence SEQ_SPIDX_COORDS start with 1 increment by  50;
create sequence SEQ_SPIDX_DATE start with 1 increment by  50;
create sequence SEQ_SPIDX_NUMBER start with 1 increment by  50;
create sequence SEQ_SPIDX_QUANTITY start with 1 increment by  50;
create sequence SEQ_SPIDX_STRING start with 1 increment by  50;
create sequence SEQ_SPIDX_TOKEN start with 1 increment by  50;
create sequence SEQ_SPIDX_URI start with 1 increment by  50;
create sequence SEQ_SUBSCRIPTION_ID start with 1 increment by  50;
create sequence SEQ_TAGDEF_ID start with 1 increment by  50;
create sequence SEQ_VALUESET_C_DSGNTN_PID start with 1 increment by  50;
create sequence SEQ_VALUESET_CONCEPT_PID start with 1 increment by  50;
create sequence SEQ_VALUESET_PID start with 1 increment by  50;

    create table HFJ_BINARY_STORAGE_BLOB (
       BLOB_ID varchar2(200 char) not null,
        BLOB_DATA blob not null,
        CONTENT_TYPE varchar2(100 char) not null,
        BLOB_HASH varchar2(128 char),
        PUBLISHED_DATE timestamp not null,
        RESOURCE_ID varchar2(100 char) not null,
        BLOB_SIZE number(10,0),
        primary key (BLOB_ID)
    );

    create table HFJ_BLK_EXPORT_COLFILE (
       PID number(19,0) not null,
        RES_ID varchar2(100 char) not null,
        COLLECTION_PID number(19,0) not null,
        primary key (PID)
    );

    create table HFJ_BLK_EXPORT_COLLECTION (
       PID number(19,0) not null,
        TYPE_FILTER varchar2(1000 char),
        RES_TYPE varchar2(40 char) not null,
        OPTLOCK number(10,0) not null,
        JOB_PID number(19,0) not null,
        primary key (PID)
    );

    create table HFJ_BLK_EXPORT_JOB (
       PID number(19,0) not null,
        CREATED_TIME timestamp not null,
        EXP_TIME timestamp not null,
        JOB_ID varchar2(36 char) not null,
        REQUEST varchar2(500 char) not null,
        EXP_SINCE timestamp,
        JOB_STATUS varchar2(10 char) not null,
        STATUS_MESSAGE varchar2(500 char),
        STATUS_TIME timestamp not null,
        OPTLOCK number(10,0) not null,
        primary key (PID)
    );

    create table HFJ_FORCED_ID (
       PID number(19,0) not null,
        FORCED_ID varchar2(100 char) not null,
        RESOURCE_PID number(19,0) not null,
        RESOURCE_TYPE varchar2(100 char) default '',
        primary key (PID)
    );

    create table HFJ_HISTORY_TAG (
       PID number(19,0) not null,
        TAG_ID number(19,0),
        RES_ID number(19,0) not null,
        RES_TYPE varchar2(40 char) not null,
        RES_VER_PID number(19,0) not null,
        primary key (PID)
    );

    create table HFJ_IDX_CMP_STRING_UNIQ (
       PID number(19,0) not null,
        IDX_STRING varchar2(200 char) not null,
        RES_ID number(19,0),
        primary key (PID)
    );

    create table HFJ_RES_LINK (
       PID number(19,0) not null,
        SRC_PATH varchar2(200 char) not null,
        SRC_RESOURCE_ID number(19,0) not null,
        SOURCE_RESOURCE_TYPE varchar2(40 char) not null,
        TARGET_RESOURCE_ID number(19,0),
        TARGET_RESOURCE_TYPE varchar2(40 char) not null,
        TARGET_RESOURCE_URL varchar2(200 char),
        SP_UPDATED timestamp,
        primary key (PID)
    );

    create table HFJ_RES_PARAM_PRESENT (
       PID number(19,0) not null,
        HASH_PRESENCE number(19,0),
        SP_PRESENT number(1,0) not null,
        RES_ID number(19,0) not null,
        primary key (PID)
    );

    create table HFJ_RES_REINDEX_JOB (
       PID number(19,0) not null,
        JOB_DELETED number(1,0) not null,
        REINDEX_COUNT number(10,0),
        RES_TYPE varchar2(100 char),
        SUSPENDED_UNTIL timestamp,
        UPDATE_THRESHOLD_HIGH timestamp not null,
        UPDATE_THRESHOLD_LOW timestamp,
        primary key (PID)
    );

    create table HFJ_RES_TAG (
       PID number(19,0) not null,
        TAG_ID number(19,0),
        RES_ID number(19,0),
        RES_TYPE varchar2(40 char) not null,
        primary key (PID)
    );

    create table HFJ_RES_VER (
       PID number(19,0) not null,
        RES_DELETED_AT timestamp,
        RES_VERSION varchar2(7 char),
        HAS_TAGS number(1,0) not null,
        RES_PUBLISHED timestamp not null,
        RES_UPDATED timestamp not null,
        RES_ENCODING varchar2(5 char) not null,
        RES_TEXT blob,
        RES_ID number(19,0),
        RES_TYPE varchar2(40 char) not null,
        RES_VER number(19,0) not null,
        FORCED_ID_PID number(19,0),
        primary key (PID)
    );

    create table HFJ_RES_VER_PROV (
       RES_VER_PID number(19,0) not null,
        REQUEST_ID varchar2(16 char),
        SOURCE_URI varchar2(100 char),
        RES_PID number(19,0) not null,
        primary key (RES_VER_PID)
    );

    create table HFJ_RESOURCE (
       RES_ID number(19,0) not null,
        RES_DELETED_AT timestamp,
        RES_VERSION varchar2(7 char),
        HAS_TAGS number(1,0) not null,
        RES_PUBLISHED timestamp not null,
        RES_UPDATED timestamp not null,
        SP_HAS_LINKS number(1,0),
        HASH_SHA256 varchar2(64 char),
        SP_INDEX_STATUS number(19,0),
        RES_LANGUAGE varchar2(20 char),
        SP_CMPSTR_UNIQ_PRESENT number(1,0),
        SP_COORDS_PRESENT number(1,0),
        SP_DATE_PRESENT number(1,0),
        SP_NUMBER_PRESENT number(1,0),
        SP_QUANTITY_PRESENT number(1,0),
        SP_STRING_PRESENT number(1,0),
        SP_TOKEN_PRESENT number(1,0),
        SP_URI_PRESENT number(1,0),
        RES_PROFILE varchar2(200 char),
        RES_TYPE varchar2(40 char) not null,
        RES_VER number(19,0),
        FORCED_ID_PID number(19,0),
        primary key (RES_ID)
    );

    create table HFJ_SEARCH (
       PID number(19,0) not null,
        CREATED timestamp not null,
        SEARCH_DELETED number(1,0),
        EXPIRY_OR_NULL timestamp,
        FAILURE_CODE number(10,0),
        FAILURE_MESSAGE varchar2(500 char),
        LAST_UPDATED_HIGH timestamp,
        LAST_UPDATED_LOW timestamp,
        NUM_BLOCKED number(10,0),
        NUM_FOUND number(10,0) not null,
        PREFERRED_PAGE_SIZE number(10,0),
        RESOURCE_ID number(19,0),
        RESOURCE_TYPE varchar2(200 char),
        SEARCH_LAST_RETURNED timestamp not null,
        SEARCH_PARAM_MAP blob,
        SEARCH_QUERY_STRING clob,
        SEARCH_QUERY_STRING_HASH number(10,0),
        SEARCH_TYPE number(10,0) not null,
        SEARCH_STATUS varchar2(10 char) not null,
        TOTAL_COUNT number(10,0),
        SEARCH_UUID varchar2(36 char) not null,
        OPTLOCK_VERSION number(10,0),
        primary key (PID)
    );

    create table HFJ_SEARCH_INCLUDE (
       PID number(19,0) not null,
        SEARCH_INCLUDE varchar2(200 char) not null,
        INC_RECURSE number(1,0) not null,
        REVINCLUDE number(1,0) not null,
        SEARCH_PID number(19,0) not null,
        primary key (PID)
    );

    create table HFJ_SEARCH_RESULT (
       PID number(19,0) not null,
        SEARCH_ORDER number(10,0) not null,
        RESOURCE_PID number(19,0) not null,
        SEARCH_PID number(19,0) not null,
        primary key (PID)
    );

    create table HFJ_SPIDX_COORDS (
       SP_ID number(19,0) not null,
        SP_MISSING number(1,0),
        SP_NAME varchar2(100 char) not null,
        RES_ID number(19,0),
        RES_TYPE varchar2(100 char) not null,
        SP_UPDATED timestamp,
        HASH_IDENTITY number(19,0),
        SP_LATITUDE double precision,
        SP_LONGITUDE double precision,
        primary key (SP_ID)
    );

    create table HFJ_SPIDX_DATE (
       SP_ID number(19,0) not null,
        SP_MISSING number(1,0),
        SP_NAME varchar2(100 char) not null,
        RES_ID number(19,0),
        RES_TYPE varchar2(100 char) not null,
        SP_UPDATED timestamp,
        HASH_IDENTITY number(19,0),
        SP_VALUE_HIGH timestamp,
        SP_VALUE_LOW timestamp,
        primary key (SP_ID)
    );

    create table HFJ_SPIDX_NUMBER (
       SP_ID number(19,0) not null,
        SP_MISSING number(1,0),
        SP_NAME varchar2(100 char) not null,
        RES_ID number(19,0),
        RES_TYPE varchar2(100 char) not null,
        SP_UPDATED timestamp,
        HASH_IDENTITY number(19,0),
        SP_VALUE number(19,2),
        primary key (SP_ID)
    );

    create table HFJ_SPIDX_QUANTITY (
       SP_ID number(19,0) not null,
        SP_MISSING number(1,0),
        SP_NAME varchar2(100 char) not null,
        RES_ID number(19,0),
        RES_TYPE varchar2(100 char) not null,
        SP_UPDATED timestamp,
        HASH_IDENTITY number(19,0),
        HASH_IDENTITY_AND_UNITS number(19,0),
        HASH_IDENTITY_SYS_UNITS number(19,0),
        SP_SYSTEM varchar2(200 char),
        SP_UNITS varchar2(200 char),
        SP_VALUE number(19,2),
        primary key (SP_ID)
    );

    create table HFJ_SPIDX_STRING (
       SP_ID number(19,0) not null,
        SP_MISSING number(1,0),
        SP_NAME varchar2(100 char) not null,
        RES_ID number(19,0),
        RES_TYPE varchar2(100 char) not null,
        SP_UPDATED timestamp,
        HASH_EXACT number(19,0),
        HASH_IDENTITY number(19,0),
        HASH_NORM_PREFIX number(19,0),
        SP_VALUE_EXACT varchar2(200 char),
        SP_VALUE_NORMALIZED varchar2(200 char),
        primary key (SP_ID)
    );

    create table HFJ_SPIDX_TOKEN (
       SP_ID number(19,0) not null,
        SP_MISSING number(1,0),
        SP_NAME varchar2(100 char) not null,
        RES_ID number(19,0),
        RES_TYPE varchar2(100 char) not null,
        SP_UPDATED timestamp,
        HASH_IDENTITY number(19,0),
        HASH_SYS number(19,0),
        HASH_SYS_AND_VALUE number(19,0),
        HASH_VALUE number(19,0),
        SP_SYSTEM varchar2(200 char),
        SP_VALUE varchar2(200 char),
        primary key (SP_ID)
    );

    create table HFJ_SPIDX_URI (
       SP_ID number(19,0) not null,
        SP_MISSING number(1,0),
        SP_NAME varchar2(100 char) not null,
        RES_ID number(19,0),
        RES_TYPE varchar2(100 char) not null,
        SP_UPDATED timestamp,
        HASH_IDENTITY number(19,0),
        HASH_URI number(19,0),
        SP_URI varchar2(254 char),
        primary key (SP_ID)
    );

    create table HFJ_SUBSCRIPTION_STATS (
       PID number(19,0) not null,
        CREATED_TIME timestamp not null,
        RES_ID number(19,0),
        primary key (PID)
    );

    create table HFJ_TAG_DEF (
       TAG_ID number(19,0) not null,
        TAG_CODE varchar2(200 char),
        TAG_DISPLAY varchar2(200 char),
        TAG_SYSTEM varchar2(200 char),
        TAG_TYPE number(10,0) not null,
        primary key (TAG_ID)
    );

    create table TRM_CODESYSTEM (
       PID number(19,0) not null,
        CODE_SYSTEM_URI varchar2(200 char) not null,
        CURRENT_VERSION_PID number(19,0),
        CS_NAME varchar2(200 char),
        RES_ID number(19,0),
        primary key (PID)
    );

    create table TRM_CODESYSTEM_VER (
       PID number(19,0) not null,
        CS_DISPLAY varchar2(200 char),
        CODESYSTEM_PID number(19,0),
        CS_VERSION_ID varchar2(200 char),
        RES_ID number(19,0) not null,
        primary key (PID)
    );

    create table TRM_CONCEPT (
       PID number(19,0) not null,
        CODEVAL varchar2(500 char) not null,
        CODESYSTEM_PID number(19,0),
        DISPLAY varchar2(400 char),
        INDEX_STATUS number(19,0),
        PARENT_PIDS clob,
        CODE_SEQUENCE number(10,0),
        CONCEPT_UPDATED timestamp,
        primary key (PID)
    );

    create table TRM_CONCEPT_DESIG (
       PID number(19,0) not null,
        LANG varchar2(500 char),
        USE_CODE varchar2(500 char),
        USE_DISPLAY varchar2(500 char),
        USE_SYSTEM varchar2(500 char),
        VAL varchar2(2000 char) not null,
        CS_VER_PID number(19,0),
        CONCEPT_PID number(19,0),
        primary key (PID)
    );

    create table TRM_CONCEPT_MAP (
       PID number(19,0) not null,
        RES_ID number(19,0),
        SOURCE_URL varchar2(200 char),
        TARGET_URL varchar2(200 char),
        URL varchar2(200 char) not null,
        primary key (PID)
    );

    create table TRM_CONCEPT_MAP_GROUP (
       PID number(19,0) not null,
        CONCEPT_MAP_URL varchar2(200 char),
        SOURCE_URL varchar2(200 char) not null,
        SOURCE_VS varchar2(200 char),
        SOURCE_VERSION varchar2(200 char),
        TARGET_URL varchar2(200 char) not null,
        TARGET_VS varchar2(200 char),
        TARGET_VERSION varchar2(200 char),
        CONCEPT_MAP_PID number(19,0) not null,
        primary key (PID)
    );

    create table TRM_CONCEPT_MAP_GRP_ELEMENT (
       PID number(19,0) not null,
        SOURCE_CODE varchar2(500 char) not null,
        CONCEPT_MAP_URL varchar2(200 char),
        SOURCE_DISPLAY varchar2(400 char),
        SYSTEM_URL varchar2(200 char),
        SYSTEM_VERSION varchar2(200 char),
        VALUESET_URL varchar2(200 char),
        CONCEPT_MAP_GROUP_PID number(19,0) not null,
        primary key (PID)
    );

    create table TRM_CONCEPT_MAP_GRP_ELM_TGT (
       PID number(19,0) not null,
        TARGET_CODE varchar2(500 char) not null,
        CONCEPT_MAP_URL varchar2(200 char),
        TARGET_DISPLAY varchar2(400 char),
        TARGET_EQUIVALENCE varchar2(50 char),
        SYSTEM_URL varchar2(200 char),
        SYSTEM_VERSION varchar2(200 char),
        VALUESET_URL varchar2(200 char),
        CONCEPT_MAP_GRP_ELM_PID number(19,0) not null,
        primary key (PID)
    );

    create table TRM_CONCEPT_PC_LINK (
       PID number(19,0) not null,
        CHILD_PID number(19,0),
        CODESYSTEM_PID number(19,0) not null,
        PARENT_PID number(19,0),
        REL_TYPE number(10,0),
        primary key (PID)
    );

    create table TRM_CONCEPT_PROPERTY (
       PID number(19,0) not null,
        PROP_CODESYSTEM varchar2(500 char),
        PROP_DISPLAY varchar2(500 char),
        PROP_KEY varchar2(500 char) not null,
        PROP_TYPE number(10,0) not null,
        PROP_VAL varchar2(500 char),
        PROP_VAL_LOB blob,
        CS_VER_PID number(19,0),
        CONCEPT_PID number(19,0),
        primary key (PID)
    );

    create table TRM_VALUESET (
       PID number(19,0) not null,
        EXPANSION_STATUS varchar2(50 char) not null,
        VSNAME varchar2(200 char),
        RES_ID number(19,0),
        TOTAL_CONCEPT_DESIGNATIONS number(19,0) default 0 not null,
        TOTAL_CONCEPTS number(19,0) default 0 not null,
        URL varchar2(200 char) not null,
        primary key (PID)
    );

    create table TRM_VALUESET_C_DESIGNATION (
       PID number(19,0) not null,
        VALUESET_CONCEPT_PID number(19,0) not null,
        LANG varchar2(500 char),
        USE_CODE varchar2(500 char),
        USE_DISPLAY varchar2(500 char),
        USE_SYSTEM varchar2(500 char),
        VAL varchar2(2000 char) not null,
        VALUESET_PID number(19,0) not null,
        primary key (PID)
    );

    create table TRM_VALUESET_CONCEPT (
       PID number(19,0) not null,
        CODEVAL varchar2(500 char) not null,
        DISPLAY varchar2(400 char),
        VALUESET_ORDER number(10,0) not null,
        SYSTEM_URL varchar2(200 char) not null,
        VALUESET_PID number(19,0) not null,
        primary key (PID)
    );
create index IDX_BLKEX_EXPTIME on HFJ_BLK_EXPORT_JOB (EXP_TIME);

    alter table HFJ_BLK_EXPORT_JOB 
       add constraint IDX_BLKEX_JOB_ID unique (JOB_ID);

    alter table HFJ_FORCED_ID 
       add constraint IDX_FORCEDID_RESID unique (RESOURCE_PID);

    alter table HFJ_FORCED_ID 
       add constraint IDX_FORCEDID_TYPE_FID unique (RESOURCE_TYPE, FORCED_ID);

    alter table HFJ_HISTORY_TAG 
       add constraint IDX_RESHISTTAG_TAGID unique (RES_VER_PID, TAG_ID);
create index IDX_IDXCMPSTRUNIQ_RESOURCE on HFJ_IDX_CMP_STRING_UNIQ (RES_ID);

    alter table HFJ_IDX_CMP_STRING_UNIQ 
       add constraint IDX_IDXCMPSTRUNIQ_STRING unique (IDX_STRING);
create index IDX_RL_TPATHRES on HFJ_RES_LINK (SRC_PATH, TARGET_RESOURCE_ID);
create index IDX_RL_SRC on HFJ_RES_LINK (SRC_RESOURCE_ID);
create index IDX_RL_DEST on HFJ_RES_LINK (TARGET_RESOURCE_ID);
create index IDX_RESPARMPRESENT_RESID on HFJ_RES_PARAM_PRESENT (RES_ID);
create index IDX_RESPARMPRESENT_HASHPRES on HFJ_RES_PARAM_PRESENT (HASH_PRESENCE);

    alter table HFJ_RES_TAG 
       add constraint IDX_RESTAG_TAGID unique (RES_ID, TAG_ID);
create index IDX_RESVER_TYPE_DATE on HFJ_RES_VER (RES_TYPE, RES_UPDATED);
create index IDX_RESVER_ID_DATE on HFJ_RES_VER (RES_ID, RES_UPDATED);
create index IDX_RESVER_DATE on HFJ_RES_VER (RES_UPDATED);

    alter table HFJ_RES_VER 
       add constraint IDX_RESVER_ID_VER unique (RES_ID, RES_VER);
create index IDX_RESVERPROV_SOURCEURI on HFJ_RES_VER_PROV (SOURCE_URI);
create index IDX_RESVERPROV_REQUESTID on HFJ_RES_VER_PROV (REQUEST_ID);
create index IDX_RES_DATE on HFJ_RESOURCE (RES_UPDATED);
create index IDX_RES_LANG on HFJ_RESOURCE (RES_TYPE, RES_LANGUAGE);
create index IDX_RES_PROFILE on HFJ_RESOURCE (RES_PROFILE);
create index IDX_RES_TYPE on HFJ_RESOURCE (RES_TYPE);
create index IDX_INDEXSTATUS on HFJ_RESOURCE (SP_INDEX_STATUS);
create index IDX_SEARCH_LASTRETURNED on HFJ_SEARCH (SEARCH_LAST_RETURNED);
create index IDX_SEARCH_RESTYPE_HASHS on HFJ_SEARCH (RESOURCE_TYPE, SEARCH_QUERY_STRING_HASH, CREATED);

    alter table HFJ_SEARCH 
       add constraint IDX_SEARCH_UUID unique (SEARCH_UUID);

    alter table HFJ_SEARCH_RESULT 
       add constraint IDX_SEARCHRES_ORDER unique (SEARCH_PID, SEARCH_ORDER);
create index IDX_SP_COORDS_HASH on HFJ_SPIDX_COORDS (HASH_IDENTITY, SP_LATITUDE, SP_LONGITUDE);
create index IDX_SP_COORDS_UPDATED on HFJ_SPIDX_COORDS (SP_UPDATED);
create index IDX_SP_COORDS_RESID on HFJ_SPIDX_COORDS (RES_ID);
create index IDX_SP_DATE_HASH on HFJ_SPIDX_DATE (HASH_IDENTITY, SP_VALUE_LOW, SP_VALUE_HIGH);
create index IDX_SP_DATE_UPDATED on HFJ_SPIDX_DATE (SP_UPDATED);
create index IDX_SP_DATE_RESID on HFJ_SPIDX_DATE (RES_ID);
create index IDX_SP_NUMBER_HASH_VAL on HFJ_SPIDX_NUMBER (HASH_IDENTITY, SP_VALUE);
create index IDX_SP_NUMBER_UPDATED on HFJ_SPIDX_NUMBER (SP_UPDATED);
create index IDX_SP_NUMBER_RESID on HFJ_SPIDX_NUMBER (RES_ID);
create index IDX_SP_QUANTITY_HASH on HFJ_SPIDX_QUANTITY (HASH_IDENTITY, SP_VALUE);
create index IDX_SP_QUANTITY_HASH_UN on HFJ_SPIDX_QUANTITY (HASH_IDENTITY_AND_UNITS, SP_VALUE);
create index IDX_SP_QUANTITY_HASH_SYSUN on HFJ_SPIDX_QUANTITY (HASH_IDENTITY_SYS_UNITS, SP_VALUE);
create index IDX_SP_QUANTITY_UPDATED on HFJ_SPIDX_QUANTITY (SP_UPDATED);
create index IDX_SP_QUANTITY_RESID on HFJ_SPIDX_QUANTITY (RES_ID);
create index IDX_SP_STRING_HASH_IDENT on HFJ_SPIDX_STRING (HASH_IDENTITY);
create index IDX_SP_STRING_HASH_NRM on HFJ_SPIDX_STRING (HASH_NORM_PREFIX, SP_VALUE_NORMALIZED);
create index IDX_SP_STRING_HASH_EXCT on HFJ_SPIDX_STRING (HASH_EXACT);
create index IDX_SP_STRING_UPDATED on HFJ_SPIDX_STRING (SP_UPDATED);
create index IDX_SP_STRING_RESID on HFJ_SPIDX_STRING (RES_ID);
create index IDX_SP_TOKEN_HASH on HFJ_SPIDX_TOKEN (HASH_IDENTITY);
create index IDX_SP_TOKEN_HASH_S on HFJ_SPIDX_TOKEN (HASH_SYS);
create index IDX_SP_TOKEN_HASH_SV on HFJ_SPIDX_TOKEN (HASH_SYS_AND_VALUE);
create index IDX_SP_TOKEN_HASH_V on HFJ_SPIDX_TOKEN (HASH_VALUE);
create index IDX_SP_TOKEN_UPDATED on HFJ_SPIDX_TOKEN (SP_UPDATED);
create index IDX_SP_TOKEN_RESID on HFJ_SPIDX_TOKEN (RES_ID);
create index IDX_SP_URI on HFJ_SPIDX_URI (RES_TYPE, SP_NAME, SP_URI);
create index IDX_SP_URI_HASH_IDENTITY on HFJ_SPIDX_URI (HASH_IDENTITY, SP_URI);
create index IDX_SP_URI_HASH_URI on HFJ_SPIDX_URI (HASH_URI);
create index IDX_SP_URI_RESTYPE_NAME on HFJ_SPIDX_URI (RES_TYPE, SP_NAME);
create index IDX_SP_URI_UPDATED on HFJ_SPIDX_URI (SP_UPDATED);
create index IDX_SP_URI_COORDS on HFJ_SPIDX_URI (RES_ID);

    alter table HFJ_SUBSCRIPTION_STATS 
       add constraint IDX_SUBSC_RESID unique (RES_ID);

    alter table HFJ_TAG_DEF 
       add constraint IDX_TAGDEF_TYPESYSCODE unique (TAG_TYPE, TAG_SYSTEM, TAG_CODE);

    alter table TRM_CODESYSTEM 
       add constraint IDX_CS_CODESYSTEM unique (CODE_SYSTEM_URI);
create index IDX_CONCEPT_INDEXSTATUS on TRM_CONCEPT (INDEX_STATUS);
create index IDX_CONCEPT_UPDATED on TRM_CONCEPT (CONCEPT_UPDATED);

    alter table TRM_CONCEPT 
       add constraint IDX_CONCEPT_CS_CODE unique (CODESYSTEM_PID, CODEVAL);

    alter table TRM_CONCEPT_MAP 
       add constraint IDX_CONCEPT_MAP_URL unique (URL);
create index IDX_CNCPT_MAP_GRP_CD on TRM_CONCEPT_MAP_GRP_ELEMENT (SOURCE_CODE);
create index IDX_CNCPT_MP_GRP_ELM_TGT_CD on TRM_CONCEPT_MAP_GRP_ELM_TGT (TARGET_CODE);

    alter table TRM_VALUESET 
       add constraint IDX_VALUESET_URL unique (URL);
create index IDX_VALUESET_C_DSGNTN_VAL on TRM_VALUESET_C_DESIGNATION (VAL);

    alter table TRM_VALUESET_CONCEPT 
       add constraint IDX_VS_CONCEPT_CS_CD unique (VALUESET_PID, SYSTEM_URL, CODEVAL);

    alter table TRM_VALUESET_CONCEPT 
       add constraint IDX_VS_CONCEPT_ORDER unique (VALUESET_PID, VALUESET_ORDER);

    alter table HFJ_BLK_EXPORT_COLFILE 
       add constraint FK_BLKEXCOLFILE_COLLECT 
       foreign key (COLLECTION_PID) 
       references HFJ_BLK_EXPORT_COLLECTION;

    alter table HFJ_BLK_EXPORT_COLLECTION 
       add constraint FK_BLKEXCOL_JOB 
       foreign key (JOB_PID) 
       references HFJ_BLK_EXPORT_JOB;

    alter table HFJ_FORCED_ID 
       add constraint FK_FORCEDID_RESOURCE 
       foreign key (RESOURCE_PID) 
       references HFJ_RESOURCE;

    alter table HFJ_HISTORY_TAG 
       add constraint FKtderym7awj6q8iq5c51xv4ndw 
       foreign key (TAG_ID) 
       references HFJ_TAG_DEF;

    alter table HFJ_HISTORY_TAG 
       add constraint FK_HISTORYTAG_HISTORY 
       foreign key (RES_VER_PID) 
       references HFJ_RES_VER;

    alter table HFJ_IDX_CMP_STRING_UNIQ 
       add constraint FK_IDXCMPSTRUNIQ_RES_ID 
       foreign key (RES_ID) 
       references HFJ_RESOURCE;

    alter table HFJ_RES_LINK 
       add constraint FK_RESLINK_SOURCE 
       foreign key (SRC_RESOURCE_ID) 
       references HFJ_RESOURCE;

    alter table HFJ_RES_LINK 
       add constraint FK_RESLINK_TARGET 
       foreign key (TARGET_RESOURCE_ID) 
       references HFJ_RESOURCE;

    alter table HFJ_RES_PARAM_PRESENT 
       add constraint FK_RESPARMPRES_RESID 
       foreign key (RES_ID) 
       references HFJ_RESOURCE;

    alter table HFJ_RES_TAG 
       add constraint FKbfcjbaftmiwr3rxkwsy23vneo 
       foreign key (TAG_ID) 
       references HFJ_TAG_DEF;

    alter table HFJ_RES_TAG 
       add constraint FK_RESTAG_RESOURCE 
       foreign key (RES_ID) 
       references HFJ_RESOURCE;

    alter table HFJ_RES_VER 
       add constraint FKh20i7lcbchkaxekvwg9ix4hc5 
       foreign key (FORCED_ID_PID) 
       references HFJ_FORCED_ID;

    alter table HFJ_RES_VER_PROV 
       add constraint FK_RESVERPROV_RES_PID 
       foreign key (RES_PID) 
       references HFJ_RESOURCE;

    alter table HFJ_RES_VER_PROV 
       add constraint FK_RESVERPROV_RESVER_PID 
       foreign key (RES_VER_PID) 
       references HFJ_RES_VER;

    alter table HFJ_RESOURCE 
       add constraint FKhjgj8cp879gfxko25cx5o692r 
       foreign key (FORCED_ID_PID) 
       references HFJ_FORCED_ID;

    alter table HFJ_SEARCH_INCLUDE 
       add constraint FK_SEARCHINC_SEARCH 
       foreign key (SEARCH_PID) 
       references HFJ_SEARCH;

    alter table HFJ_SPIDX_COORDS 
       add constraint FKc97mpk37okwu8qvtceg2nh9vn 
       foreign key (RES_ID) 
       references HFJ_RESOURCE;

    alter table HFJ_SPIDX_DATE 
       add constraint FK17s70oa59rm9n61k9thjqrsqm 
       foreign key (RES_ID) 
       references HFJ_RESOURCE;

    alter table HFJ_SPIDX_NUMBER 
       add constraint FKcltihnc5tgprj9bhpt7xi5otb 
       foreign key (RES_ID) 
       references HFJ_RESOURCE;

    alter table HFJ_SPIDX_QUANTITY 
       add constraint FKn603wjjoi1a6asewxbbd78bi5 
       foreign key (RES_ID) 
       references HFJ_RESOURCE;

    alter table HFJ_SPIDX_STRING 
       add constraint FK_SPIDXSTR_RESOURCE 
       foreign key (RES_ID) 
       references HFJ_RESOURCE;

    alter table HFJ_SPIDX_TOKEN 
       add constraint FK7ulx3j1gg3v7maqrejgc7ybc4 
       foreign key (RES_ID) 
       references HFJ_RESOURCE;

    alter table HFJ_SPIDX_URI 
       add constraint FKgxsreutymmfjuwdswv3y887do 
       foreign key (RES_ID) 
       references HFJ_RESOURCE;

    alter table HFJ_SUBSCRIPTION_STATS 
       add constraint FK_SUBSC_RESOURCE_ID 
       foreign key (RES_ID) 
       references HFJ_RESOURCE;

    alter table TRM_CODESYSTEM 
       add constraint FK_TRMCODESYSTEM_CURVER 
       foreign key (CURRENT_VERSION_PID) 
       references TRM_CODESYSTEM_VER;

    alter table TRM_CODESYSTEM 
       add constraint FK_TRMCODESYSTEM_RES 
       foreign key (RES_ID) 
       references HFJ_RESOURCE;

    alter table TRM_CODESYSTEM_VER 
       add constraint FK_CODESYSVER_CS_ID 
       foreign key (CODESYSTEM_PID) 
       references TRM_CODESYSTEM;

    alter table TRM_CODESYSTEM_VER 
       add constraint FK_CODESYSVER_RES_ID 
       foreign key (RES_ID) 
       references HFJ_RESOURCE;

    alter table TRM_CONCEPT 
       add constraint FK_CONCEPT_PID_CS_PID 
       foreign key (CODESYSTEM_PID) 
       references TRM_CODESYSTEM_VER;

    alter table TRM_CONCEPT_DESIG 
       add constraint FK_CONCEPTDESIG_CSV 
       foreign key (CS_VER_PID) 
       references TRM_CODESYSTEM_VER;

    alter table TRM_CONCEPT_DESIG 
       add constraint FK_CONCEPTDESIG_CONCEPT 
       foreign key (CONCEPT_PID) 
       references TRM_CONCEPT;

    alter table TRM_CONCEPT_MAP 
       add constraint FK_TRMCONCEPTMAP_RES 
       foreign key (RES_ID) 
       references HFJ_RESOURCE;

    alter table TRM_CONCEPT_MAP_GROUP 
       add constraint FK_TCMGROUP_CONCEPTMAP 
       foreign key (CONCEPT_MAP_PID) 
       references TRM_CONCEPT_MAP;

    alter table TRM_CONCEPT_MAP_GRP_ELEMENT 
       add constraint FK_TCMGELEMENT_GROUP 
       foreign key (CONCEPT_MAP_GROUP_PID) 
       references TRM_CONCEPT_MAP_GROUP;

    alter table TRM_CONCEPT_MAP_GRP_ELM_TGT 
       add constraint FK_TCMGETARGET_ELEMENT 
       foreign key (CONCEPT_MAP_GRP_ELM_PID) 
       references TRM_CONCEPT_MAP_GRP_ELEMENT;

    alter table TRM_CONCEPT_PC_LINK 
       add constraint FK_TERM_CONCEPTPC_CHILD 
       foreign key (CHILD_PID) 
       references TRM_CONCEPT;

    alter table TRM_CONCEPT_PC_LINK 
       add constraint FK_TERM_CONCEPTPC_CS 
       foreign key (CODESYSTEM_PID) 
       references TRM_CODESYSTEM_VER;

    alter table TRM_CONCEPT_PC_LINK 
       add constraint FK_TERM_CONCEPTPC_PARENT 
       foreign key (PARENT_PID) 
       references TRM_CONCEPT;

    alter table TRM_CONCEPT_PROPERTY 
       add constraint FK_CONCEPTPROP_CSV 
       foreign key (CS_VER_PID) 
       references TRM_CODESYSTEM_VER;

    alter table TRM_CONCEPT_PROPERTY 
       add constraint FK_CONCEPTPROP_CONCEPT 
       foreign key (CONCEPT_PID) 
       references TRM_CONCEPT;

    alter table TRM_VALUESET 
       add constraint FK_TRMVALUESET_RES 
       foreign key (RES_ID) 
       references HFJ_RESOURCE;

    alter table TRM_VALUESET_C_DESIGNATION 
       add constraint FK_TRM_VALUESET_CONCEPT_PID 
       foreign key (VALUESET_CONCEPT_PID) 
       references TRM_VALUESET_CONCEPT;

    alter table TRM_VALUESET_C_DESIGNATION 
       add constraint FK_TRM_VSCD_VS_PID 
       foreign key (VALUESET_PID) 
       references TRM_VALUESET;

    alter table TRM_VALUESET_CONCEPT 
       add constraint FK_TRM_VALUESET_PID 
       foreign key (VALUESET_PID) 
       references TRM_VALUESET;