41.6.1Setting Up Oracle

 

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

41.6.2Supported Versions

 

See platform requirements for information on supported versions of Oracle.

41.6.3Setting 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_AG_ADDRESS_PID start with 1 increment by 50;

create sequence SEQ_AG_APP_REQUEST_PID start with 1 increment by 50;

create sequence SEQ_AG_APPL_PID start with 1 increment by 50;

create sequence SEQ_AG_ATTESTATION_PID start with 1 increment by 50;

create sequence SEQ_AG_CLASS_PID start with 1 increment by 50;

create sequence SEQ_AG_COUNTRY_PID start with 1 increment by 50;

create sequence SEQ_AG_DATA_PID start with 1 increment by 50;

create sequence SEQ_AG_DOCUMENT_PID start with 1 increment by 50;

create sequence SEQ_AG_DRAFT_PID start with 1 increment by 50;

create sequence SEQ_AG_MEMBER_PHONE_PID start with 1 increment by 50;

create sequence SEQ_AG_METADATA_PID start with 1 increment by 50;

create sequence SEQ_AG_NOTE_PID start with 1 increment by 50;

create sequence SEQ_AG_OAUTH_REDIRECT_PID start with 1 increment by 50;

create sequence SEQ_AG_PERMISSION_PID start with 1 increment by 50;

create sequence SEQ_AG_PHONE_PID start with 1 increment by 50;

create sequence SEQ_AG_PREREQUISITE_PID start with 1 increment by 50;

create sequence SEQ_AG_PROFILE_PID start with 1 increment by 50;

create sequence SEQ_AG_SANDBOX_CLIENT_PID start with 1 increment by 50;

create sequence SEQ_AG_SCOPE_PID start with 1 increment by 50;

create sequence SEQ_AG_SCREENSHOT_PID start with 1 increment by 50;

create sequence SEQ_AUDITEVT_HEADER_PID start with 1 increment by 50;

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_CACHE_SYNC_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_CDR_RESTORE_PID start with 1 increment by 50;

create sequence SEQ_HTTPSESSION_PID start with 1 increment by 50;

create sequence SEQ_ID_CODE_PID start with 1 increment by 50;

create sequence SEQ_METRICHEALTH_PID start with 1 increment by 50;

create sequence SEQ_MODPROC_PID start with 1 increment by 50;

create sequence SEQ_MODSTAT_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_NODEPROC_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_OA2RTOKLNCHRESID_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_OA2CLN_TOS_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_USER_PSN_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 AG_ADDRESS (
    PID number(19,0) not null,
    ADDRESS_LINE1 varchar2(200 char) not null,
    ADDRESS_LINE2 varchar2(200 char),
    CITY varchar2(200 char) not null,
    COUNTRY varchar2(200 char) not null,
    POSTAL_CODE varchar2(200 char) not null,
    REGION varchar2(200 char) not null,
    AG_PROFILE_PID number(19,0),
    primary key (PID)
);

create table AG_APP_REQUEST (
    PID number(19,0) not null,
    APP_DESCRIPTION varchar2(400 char),
    APP_DEVELOPER_NAME varchar2(200 char),
    APP_HOMEPAGE varchar2(200 char),
    APP_NAME varchar2(200 char) not null,
    CREATED_BY varchar2(200 char) not null,
    CREATED_DATE timestamp(6) not null,
    LAST_MODIFIED_BY varchar2(200 char) not null,
    LAST_MODIFIED_DATE timestamp(6) not null,
    MEMBER_COMMENT varchar2(200 char),
    COMPANY_NAME varchar2(200 char),
    EMAIL varchar2(200 char) not null,
    FIRST_NAME varchar2(200 char) not null,
    INDUSTRY varchar2(200 char),
    JOB_TITLE varchar2(200 char),
    LAST_NAME varchar2(200 char) not null,
    NOTE varchar2(400 char),
    REQUEST_STATUS varchar2(20 char) not null,
    SUBSCRIBE_ACCEPTED number(1,0),
    MODULE_PID number(19,0) not null,
    primary key (PID)
);

create table AG_APPL (
    PID number(19,0) not null,
    ATTESTATION_ACCEPTED number(1,0) not null,
    BACKEND_SERVICE number(1,0),
    CONFIDENTIAL number(1,0),
    CONFIDENTIAL_TYPE varchar2(20 char),
    JWK_SET_URL varchar2(4000 char),
    HOME_URL varchar2(200 char),
    LAUNCH_URL varchar2(200 char),
    LONG_DESC varchar2(4000 char) not null,
    APP_NAME varchar2(200 char) not null,
    OAUTH_REDIRECT_URL varchar2(200 char) not null,
    PRIVACY_POLICY_URL varchar2(200 char) not null,
    SHORT_DESC varchar2(200 char) not null,
    AG_STATUS varchar2(20 char) not null,
    TERMS_OF_SERVICE_URL varchar2(200 char) not null,
    VERSION_NUMBER number(19,0),
    CREATED_BY varchar2(200 char) not null,
    CREATED_DATE timestamp(6) not null,
    LAST_MODIFIED_BY varchar2(200 char) not null,
    LAST_MODIFIED_DATE timestamp(6) not null,
    IDENTIFIER varchar2(200 char),
    SEED varchar2(256 char),
    VIDEO_URL varchar2(200 char),
    VIDEO_URL_STATUS varchar2(20 char),
    JWK_SET_PID number(19,0),
    ATTESTATION_PID number(19,0),
    ICON_PID number(19,0),
    MODULE_PID number(19,0) not null,
    OAUTH2_CLIENT_PID number(19,0),
    PARENT_PID number(19,0),
    PROFILE_PID number(19,0),
    USER_PID number(19,0),
    primary key (PID)
);

create table AG_ATTESTATION (
    PID number(19,0) not null,
    ARCHIVE_DATE timestamp(6),
    CREATED_BY varchar2(200 char) not null,
    CREATED_DATE timestamp(6) not null,
    LAST_MODIFIED_BY varchar2(200 char) not null,
    LAST_MODIFIED_DATE timestamp(6) not null,
    TITLE varchar2(200 char) not null,
    HTML_PID number(19,0),
    MODULE_PID number(19,0) not null,
    PLAIN_HTML_PID number(19,0),
    primary key (PID)
);

create table AG_CLASS (
    PID number(19,0) not null,
    CLASSIFICATION varchar2(200 char) not null,
    AG_APPL_PID number(19,0),
    primary key (PID)
);

create table AG_COUNTRY (
    PID number(19,0) not null,
    ISO_CODE_ALPHA2 varchar2(2 char) not null,
    AG_APPL_PID number(19,0),
    primary key (PID)
);

create table AG_DATA (
    PID number(19,0) not null,
    DATA_LOB blob,
    DATA_BIN blob,
    primary key (PID)
);

create table AG_DOCUMENT (
    PID number(19,0) not null,
    FILEACTIVE number(1,0) not null,
    CREATED_BY varchar2(200 char) not null,
    CREATED_DATE timestamp(6) not null,
    LAST_MODIFIED_BY varchar2(200 char) not null,
    LAST_MODIFIED_DATE timestamp(6) not null,
    FILEDESC varchar2(200 char),
    FILENAME varchar2(200 char) not null,
    FILETYPE varchar2(200 char) not null,
    DOCUMENT_PID number(19,0) not null,
    AG_APPL_PID number(19,0),
    primary key (PID)
);

create table AG_DRAFT (
    PID number(19,0) not null,
    CREATED_BY varchar2(200 char) not null,
    CREATED_DATE timestamp(6) not null,
    LAST_MODIFIED_BY varchar2(200 char) not null,
    LAST_MODIFIED_DATE timestamp(6) not null,
    BACKEND_SERVICE number(1,0),
    DATA_HASH number(10,0),
    APP_NAME varchar2(200 char) not null,
    DRAFT_PID number(19,0) not null,
    MODULE_PID number(19,0) not null,
    SOURCE_APP_PID number(19,0),
    USER_PID number(19,0) not null,
    primary key (PID),
    constraint IDX_AG_DRAFT_APPNAME_USER unique (APP_NAME, USER_PID)
);

create table AG_MEMBER_PHONE (
    PID number(19,0) not null,
    COUNTRY_CODE varchar2(20 char) not null,
    PHONE_NUMBER varchar2(20 char) not null,
    PHONE_TYPE varchar2(20 char) not null,
    AG_APP_REQUEST_PID number(19,0),
    primary key (PID)
);

create table AG_METADATA (
    PID number(19,0) not null,
    METADATA_KEY varchar2(100 char) not null,
    METADATA_SEARCHABLE number(1,0) not null,
    METADATA_VALUE varchar2(4000 char) not null,
    AG_APPL_PID number(19,0),
    primary key (PID)
);

create table AG_NOTE (
    PID number(19,0) not null,
    CREATED_BY varchar2(200 char) not null,
    CREATED_DATE timestamp(6) not null,
    LAST_MODIFIED_BY varchar2(200 char) not null,
    LAST_MODIFIED_DATE timestamp(6) not null,
    MESSAGE varchar2(1500 char) not null,
    REASON varchar2(1000 char) not null,
    NOTE_TYPE varchar2(20 char),
    AG_APPL_PID number(19,0),
    primary key (PID)
);

create table AG_OAUTH_REDIRECT (
    PID number(19,0) not null,
    OAUTH_REDIRECT_URL varchar2(200 char) not null,
    AG_APPL_PID number(19,0),
    primary key (PID),
    constraint IDX_AG_OAUTH_REDIRECT_PID unique (OAUTH_REDIRECT_URL, PID)
);

create table AG_PERMISSION (
    PID number(19,0) not null,
    PERMISSION varchar2(200 char) not null,
    AG_APPL_PID number(19,0),
    primary key (PID)
);

create table AG_PHONE (
    PID number(19,0) not null,
    COUNTRY_CODE varchar2(20 char) not null,
    PHONE_NUMBER varchar2(20 char) not null,
    PHONE_TYPE varchar2(20 char) not null,
    AG_PROFILE_PID number(19,0),
    primary key (PID)
);

create table AG_PREREQUISITE (
    PID number(19,0) not null,
    PREREQUISITE varchar2(200 char) not null,
    AG_APPL_PID number(19,0),
    primary key (PID)
);

create table AG_PROFILE (
    PID number(19,0) not null,
    ABOUT_US varchar2(250 char),
    ARCHIVE_DATE timestamp(6),
    CREATED_BY varchar2(200 char) not null,
    CREATED_DATE timestamp(6) not null,
    LAST_MODIFIED_BY varchar2(200 char) not null,
    LAST_MODIFIED_DATE timestamp(6) not null,
    BUSINESS_NAME varchar2(200 char),
    DESIGNATION varchar2(200 char),
    DUNS_NUMBER varchar2(200 char),
    FULL_NAME varchar2(200 char) not null,
    INCORPORATED number(1,0),
    INDIVIDUAL number(1,0) not null,
    SALES_CONTACT varchar2(200 char),
    SUPPORT_CONTACT varchar2(200 char),
    SUPPORT_WEBPAGE varchar2(200 char),
    PROFILE_TYPE varchar2(20 char),
    WEBSITE_URL varchar2(200 char),
    MODULE_PID number(19,0) not null,
    USER_PID number(19,0) not null,
    primary key (PID)
);

create table AG_SANDBOX_CLIENT (
    PID number(19,0) not null,
    SEED varchar2(256 char),
    MODULE_PID number(19,0) not null,
    OAUTH2_CLIENT_PID number(19,0) not null,
    USER_PID number(19,0) not null,
    primary key (PID)
);

create table AG_SCOPE (
    PID number(19,0) not null,
    SCOPE varchar2(200 char) not null,
    SCOPE_TYPE varchar2(20 char),
    AG_APPL_PID number(19,0),
    primary key (PID)
);

create table AG_SCREENSHOT (
    PID number(19,0) not null,
    FILENAME varchar2(200 char) not null,
    POSITION number(10,0) not null,
    ASSET_STATUS varchar2(20 char) not null,
    SCREENSHOT_PID number(19,0) not null,
    AG_APPL_PID number(19,0),
    primary key (PID)
);

create table CDR_AUDIT_EVT (
    PID number(19,0) not null,
    EVT_ADDITIONAL_JSON clob,
    EVT_ADDITIONAL_JSON_VC clob,
    AUSER_TYPE number(10,0),
    HAVE_HEADERS number(1,0),
    REMOTE_ADDRESS varchar2(100 char),
    REQUEST_ID varchar2(128 char),
    HAVE_TARGET_MODULES number(1,0) not null,
    SOURCE_TRANSACTION_ID varchar2(128 char),
    HAVE_TARGET_RESOURCES number(1,0) not null,
    HAVE_TARGET_USERS number(1,0) not null,
    EVT_TIMESTAMP timestamp(6) not null,
    TRANSACTION_GUID varchar2(36 char),
    TYPE_DISPLAY varchar2(200 char) not null,
    USER_PID number(19,0),
    CLIENT_PID number(19,0),
    ENDPOINT_MODULE_PID number(19,0) not null,
    TYPE_PID number(19,0) not null,
    primary key (PID)
);

create table CDR_AUDIT_EVT_HEADER (
    PID number(19,0) not null,
    EVT_HEADER_NAME varchar2(100 char) not null,
    EVT_HEADER_VALUE varchar2(250 char),
    EVENT_PID number(19,0) not null,
    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,
    RES_VERSION number(19,0),
    RES_VERSION_STR varchar2(128 char),
    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,
    USER_PID number(19,0) not null,
    EVENT_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),
    constraint IDX_AUDITEVTTYPE_SYSTEM_CODE unique (SYSTEM_URL, CODEVAL)
);

create table CDR_CACHE_SYNC (
    PID number(19,0) not null,
    CACHE_ID varchar2(256 char) not null,
    MODULE_PID number(19,0) not null,
    UPDATED_TIME timestamp(6) not null,
    VERSION number(19,0) not null,
    primary key (PID),
    constraint IDX_CACHE_SYNC_ID unique (MODULE_PID, CACHE_ID)
);

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,
    TEMPLATE_CONTENT_VC clob,
    MODULE_PID number(19,0) not null,
    primary key (PID),
    constraint IDX_CDATEMPL_ID unique (TEMPLATE_ID)
);

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_DB_VERSION (
    DB_VERSION varchar2(100 char) not null,
    DB_INIT_TIME timestamp(6) not null,
    primary key (DB_VERSION)
);

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

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

create table CDR_IDENTIFICATION_CODES (
    PID number(19,0) not null,
    CDR_CODE varchar2(6 char) not null,
    CODE_STATUS varchar2(20 char) not null,
    EXPIRES_ON timestamp(6) not null,
    USER_PID number(19,0) not null,
    primary key (PID)
);

create table CDR_METRIC_HEALTH (
    PID number(19,0) not null,
    CUSTOM_HEALTHCHECK_NAME varchar2(256 char),
    ERROR_STRING varchar2(256 char),
    HEALTHCHECK_TYPE number(10,0) not null,
    IS_HEALTHY number(1,0) not null,
    HEALTHY_STRING varchar2(256 char),
    MODPROC_PID number(19,0) not null,
    primary key (PID),
    constraint IDX_METRICHC_MOD_TYPE_NAME unique (MODPROC_PID, HEALTHCHECK_TYPE, CUSTOM_HEALTHCHECK_NAME)
);

create table CDR_MODULE (
    PID number(19,0) not null,
    DELETED number(1,0) not null,
    MODULE_DISABLED number(1,0) not null,
    MATURITY number(10,0),
    MODULE_ID varchar2(50 char) not null,
    PORTVAL number(10,0),
    NODE_PID number(19,0) not null,
    PROTOTYPE_PID number(19,0) not null,
    primary key (PID),
    constraint IDX_MODULE_ID unique (NODE_PID, MODULE_ID)
);

create table CDR_MODULE_CFG_PROP (
    PID number(19,0) not null,
    VALUE_STRING varchar2(200 char),
    VALUE_EXTENDED clob,
    VALUE_EXTENDED_VC clob,
    MODULE_PID number(19,0) not null,
    PROTOTYPE_PID number(19,0) not null,
    primary key (PID),
    constraint IDX_CDR_MODULE_CDR_PROP_MODKEY unique (MODULE_PID, PROTOTYPE_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_PROCESS (
    PID number(19,0) not null,
    FIRST_MP number(1,0),
    MODULE_PID number(19,0) not null,
    NODEPROC_PID number(19,0) not null,
    RESTART_REQUIRED number(1,0) not null,
    MODULE_STATUS number(10,0) not null,
    MODULE_STATUS_DESC varchar2(200 char),
    STATUS_TIMESTAMP timestamp(6),
    primary key (PID),
    constraint IDX_MODPROC_NODEPROC_MOD unique (NODEPROC_PID, MODULE_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,
    CFG_MATURITY varchar2(200 char),
    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),
    constraint IDX_CDR_MODULE_PROT_CDG_MODKEY unique (PROTOTYPE_PID, CFG_KEY)
);

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),
    constraint IDX_MODULEPROTDEP_PROT_KEY unique (PROTOTYPE_PID, ENTRY_KEY)
);

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),
    constraint IDX_MODULEPROTOTYPE_TYPE unique (MODULE_TYPE)
);

create table CDR_MODULE_STATE (
    PID number(19,0) not null,
    STATE_TYPE number(10,0) not null,
    STATE_VAL varchar2(200 char),
    MODULE_PID number(19,0) not null,
    primary key (PID),
    constraint IDX_MODSTAT_MODTYPE unique (MODULE_PID, STATE_TYPE)
);

create table CDR_NODE (
    PID number(19,0) not null,
    IS_CONFIG_LOCKED number(1,0),
    IS_DELETED number(1,0),
    ENVIRONMENT_TYPE varchar2(16 char),
    NODE_ID varchar2(30 char) not null,
    IS_SECURITY_STRICT number(1,0),
    primary key (PID),
    constraint IDX_NODE_ID unique (NODE_ID)
);

create table CDR_NODE_MODULE_DIAGNOSTICS (
    DIAGNOSTICS_JSON clob,
    DIAGNOSTICS_JSON_VC clob,
    MODULE_PID number(19,0) not null,
    NODE_PID number(19,0) not null,
    primary key (MODULE_PID, NODE_PID)
);

create table CDR_NODE_PROCESS (
    PID number(19,0) not null,
    CREATED_TIME timestamp(6) not null,
    HEARTBEAT_TIME timestamp(6),
    KILLED_BY varchar2(20 char),
    NODE_PID number(19,0) not null,
    PROCESS_ID varchar2(20 char) not null,
    PROCESS_NAME varchar2(100 char),
    STARTED_TIME timestamp(6),
    NODE_STATUS number(10,0) not null,
    STOPPED_TIME timestamp(6),
    OPT_LOCK number(10,0) not null,
    primary key (PID),
    constraint IDX_NODEPROC_PROCID unique (PROCESS_ID)
);

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),
    constraint IDX_OA2TOKGRTTYP_TOK_GRNT_TYP unique (CLIENT_PID, GRANT_TYPE)
);

create table CDR_OA2_CLI_DET_AUTOAP_SCOPE (
    PID number(19,0) not null,
    SCOPE varchar2(764 char) not null,
    CLIENT_PID number(19,0) not null,
    primary key (PID),
    constraint IDX_OA2CLIDETAASCOPE_TOK_SCOP unique (CLIENT_PID, SCOPE)
);

create table CDR_OA2_CLI_DET_AUTOGRNT_SCOPE (
    PID number(19,0) not null,
    SCOPE varchar2(764 char) not null,
    CLIENT_PID number(19,0) not null,
    primary key (PID),
    constraint IDX_OA2CLIDETAGSCOPE_TOK_SCOP unique (CLIENT_PID, SCOPE)
);

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

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),
    constraint IDX_OA2CLIDETRRURI_TOK_SCO unique (CLIENT_PID, REDIR_URI)
);

create table CDR_OA2_SERVER (
    PID number(19,0) not null,
    ARCHIVED_AT timestamp(6),
    AUDIENCE varchar2(500 char),
    AUTH_WELL_KNOWN_CONFIG_URL varchar2(500 char),
    CLIENT_AUTH_KS_ID varchar2(50 char),
    CLIENT_AUTH_METHOD varchar2(100 char),
    CUSTOM_TOKEN_PARAMS varchar2(500 char),
    FEDERATION_AUTH_SCRIPT_TEXT blob,
    FEDERATION_AUTH_SCRIPT_TXT_BIN blob,
    FEDERATION_AUTH_URL varchar2(500 char),
    FEDERATION_JWKS_URL varchar2(500 char),
    FEDERATION_REG_ID varchar2(500 char) not null,
    FEDERATION_REQ_SCOPES varchar2(500 char),
    FEDERATION_TOKEN_URL varchar2(500 char),
    FEDERATION_USER_INFO_URL varchar2(500 char),
    FEDERATION_USER_MAPPING_TEXT blob,
    FEDERATION_USR_MAPPING_TXT_BIN blob,
    FHIR_ENDPOINT_URL varchar2(500 char),
    ISS varchar2(200 char) not null,
    SERVER_NAME varchar2(200 char),
    NOTES varchar2(1000 char),
    ORGANIZATION_ID varchar2(500 char),
    RESPONSE_TYPE varchar2(500 char),
    INTRSPCT_CLIENT_ID varchar2(200 char),
    INTRSPCT_CLIENT_SCRT varchar2(200 char),
    JWKS_FILE varchar2(500 char),
    JWKS_TEXT clob,
    JWKS_TEXT_VC clob,
    MODULE_PID number(19,0) not null,
    primary key (PID),
    constraint IDX_OA2SERVER_FED_REG_ID unique (MODULE_PID, FEDERATION_REG_ID, ARCHIVED_AT),
    constraint IDX_OA2SERVER_MODULE_ISSURL unique (MODULE_PID, ISS, ARCHIVED_AT)
);

create table CDR_OAUTH2_ATOKEN (
    PID number(19,0) not null,
    EXPIRATION timestamp(6) not null,
    GRANT_TYPE varchar2(20 char),
    ID_TOKEN_BYTES blob,
    ID_TOKEN_BYTES_BIN blob,
    ID_TOKEN_VAL varchar2(1000 char),
    ISSUED timestamp(6) not null,
    REDIRECT_URI varchar2(200 char),
    TOKEN_HASH varchar2(150 char) not null,
    TOKEN_BYTES blob,
    TOKEN_BYTES_BIN blob,
    TOKEN_VAL varchar2(1000 char),
    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),
    constraint IDX_OA2ATOKADLNF_ATOKEN_ADNLNF unique (TOKEN_PID, INFO_KEY)
);

create table CDR_OAUTH2_ATOKEN_GRNTDA (
    PID number(19,0) not null,
    PERM_ARG varchar2(764 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(764 char) not null,
    TOKEN_PID number(19,0) not null,
    primary key (PID),
    constraint IDX_OA2ATOKSCP_ATOKEN_SCOPE unique (TOKEN_PID, SCOPE)
);

create table CDR_OAUTH2_ATOKEN_UDATA (
    ATOKEN_PID number(19,0) not null,
    TOKEN_KEY varchar2(256 char) not null,
    VAL blob,
    primary key (ATOKEN_PID, TOKEN_KEY)
);

create table CDR_OAUTH2_ATOKEN_UDATA_BIN (
    ATOKEN_PID number(19,0) not null,
    TOKEN_KEY varchar2(256 char) not null,
    VAL_BIN blob,
    primary key (ATOKEN_PID, TOKEN_KEY)
);

create table CDR_OAUTH2_AUTH_CODE (
    PID number(19,0) not null,
    OAUTH2_AUTHENTICATION blob,
    OAUTH2_AUTHENTICATION_BIN blob,
    CLIENT_ID varchar2(200 char) not null,
    CODE_VAL varchar2(100 char) not null,
    EXPIRATION timestamp(6) not null,
    PKCE_CHALLENGE varchar2(200 char),
    PKCE_CHALLENGE_TYPE varchar2(10 char),
    STATE_VAL varchar2(256 char),
    primary key (PID),
    constraint IDX_OA2AUTHCODE_CODE unique (CODE_VAL)
);

create table CDR_OAUTH2_CLIENT_DET_SCOPE (
    PID number(19,0) not null,
    SCOPE varchar2(764 char) not null,
    CLIENT_PID number(19,0) not null,
    primary key (PID),
    constraint IDX_OA2CLIDETSCOP_TOKEN_SCOPE unique (CLIENT_PID, SCOPE)
);

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),
    ARCHIVED_AT timestamp(6),
    ATTESTATION_ACCEPTED 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,
    JWKS_URL varchar2(4000 char),
    PUBLIC_JWKS blob,
    PUBLIC_JWKS_BIN blob,
    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),
    constraint IDX_OA2CLIENTDETAILS_CLI_MOD unique (MODULE_PID, CLIENT_ID, ARCHIVED_AT)
);

create table CDR_OAUTH2_CLIENT_PERM (
    PID number(19,0) not null,
    PERMISSION_TYPE varchar2(100 char) not null,
    PERMISSION_ARG varchar2(200 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(6) not null,
    primary key (JWT_ID)
);

create table CDR_OAUTH2_KEYSTORE (
    KEYSTORE_ID varchar2(50 char) not null,
    FILE_PATH varchar2(4000 char),
    JSON_KEYS varchar2(4000 char),
    primary key (KEYSTORE_ID)
);

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

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),
    constraint IDX_OA2RTOKADLNF_RTOKEN_ADNLNF unique (TOKEN_PID, INFO_KEY)
);

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

create table CDR_OAUTH2_RTOKEN_LNCHRESID (
    PID number(19,0) not null,
    RESOURCE_ID varchar2(64 char) not null,
    RESOURCE_TYPE varchar2(50 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),
    TOKEN_PID number(19,0) not null,
    primary key (PID),
    constraint IDX_OA2RTOKREQPRM_RTOKEN_PARM unique (TOKEN_PID, PARM_KEY)
);

create table CDR_OAUTH2_RTOKEN_SCOPE (
    PID number(19,0) not null,
    SCOPE varchar2(764 char) not null,
    TOKEN_PID number(19,0) not null,
    primary key (PID),
    constraint IDX_OA2RTOKSCP_RTOKEN_SCOPE unique (TOKEN_PID, SCOPE)
);

create table CDR_OAUTH2_RTOKEN_UDATA (
    TOKEN_PID number(19,0) not null,
    TOKEN_KEY varchar2(256 char) not null,
    VAL blob,
    primary key (TOKEN_PID, TOKEN_KEY)
);

create table CDR_OAUTH2_RTOKEN_UDATA_BIN (
    TOKEN_PID number(19,0) not null,
    TOKEN_KEY varchar2(256 char) not null,
    VAL_BIN blob,
    primary key (TOKEN_PID, TOKEN_KEY)
);

create table CDR_RESTORE (
    PID number(19,0) not null,
    CONFIGS clob,
    CONFIGS_VC clob,
    CREATED timestamp(6) not null,
    VERSION varchar2(50 char) not null,
    NODE_PID number(19,0) not null,
    USER_PID number(19,0),
    primary key (PID)
);

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

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),
    constraint IDX_USERDEFLNCHCTX_USER_CTYP unique (USER_PID, CONTEXT_TYPE)
);

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_OA2CLN_TOS (
    PID number(19,0) not null,
    CREATED_BY varchar2(200 char) not null,
    CREATED_DATE timestamp(6) not null,
    REVOKED_BY varchar2(200 char),
    REVOKED_DATE timestamp(6),
    VERSION varchar2(200 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(200 char),
    USER_PID number(19,0),
    primary key (PID)
);

create table CDR_USER_PSN (
    PID number(19,0) not null,
    CREATED_BY varchar2(200 char) not null,
    CREATED_DATE timestamp(6) not null,
    REVOKED_BY varchar2(200 char),
    REVOKED_DATE timestamp(6),
    USER_PID number(19,0) not null,
    VERSION varchar2(200 char) not null,
    primary key (PID)
);

create table CDR_USER_TFA_KEY (
    PID number(19,0) not null,
    CONFIRMED_AT timestamp(6),
    KEY_EXPIRES timestamp(6),
    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),
    constraint IDX_USERTFAKEY_USER unique (USER_PID)
);

create table CDR_XACT_LOG (
    PID number(19,0) not null,
    ADDITIONAL_JSON clob,
    INITIAL_TIMESTAMP timestamp(6) not null,
    EVT_OUTCOME number(10,0) not null,
    SRC_XACT_ID varchar2(128 char),
    EVT_SUBTYPE number(10,0) not null,
    SRC_GUID varchar2(36 char),
    EVT_TYPE number(10,0) not null,
    USER_PID number(19,0),
    CLIENT_PID number(19,0),
    CDR_ENDPOINT_MODULE_PID number(19,0),
    primary key (PID),
    constraint IDX_GUID unique (SRC_GUID)
);

create table CDR_XACT_LOG_STEP (
    STEP_PID number(19,0) not null,
    BODY_BYTES blob,
    BODY_BYTES_BIN 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(6) not null,
    STEP_TYPE number(10,0) not null,
    LOG_PID number(19,0) not null,
    primary key (STEP_PID)
);

create index IDX_AG_APPL_IDENTIFIER 
   on AG_APPL (IDENTIFIER);

create index IDX_AG_ATTEST_ARCHIVE_DATE 
   on AG_ATTESTATION (ARCHIVE_DATE);

create index IDX_AE_TGUID 
   on CDR_AUDIT_EVT (TRANSACTION_GUID);

create index IDX_CDRAUDITEVT_EVTTIMESTAMP 
   on CDR_AUDIT_EVT (EVT_TIMESTAMP);

create index IDX_AUDITEVT_HEADER_EVT 
   on CDR_AUDIT_EVT_HEADER (EVENT_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_TARGRES_RES_EVT 
   on CDR_AUDIT_EVT_TARGET_RES (RES_ID, EVENT_PID);

create index IDX_AUDITEVT_TARGUSR_EVT 
   on CDR_AUDIT_EVT_TARGET_USER (EVENT_PID);

create index IDX_HTTPSESSION_EXPIRY 
   on CDR_HTTP_SESSION (SES_EXPIRY);

create index IDX_HTTPSESSION_MODULE 
   on CDR_HTTP_SESSION (MODULE_PID);

create index IDX_MODSTAT_MOD 
   on CDR_MODULE_STATE (MODULE_PID);

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);

create index IDX_OA2ATOKGRNT_ATOKEN_PERM 
   on CDR_OAUTH2_ATOKEN_GRNTDA (TOKEN_PID, PERM_NAME);

create index IDX_OA2ATOKSCP_SCP 
   on CDR_OAUTH2_ATOKEN_SCOPE (SCOPE, TOKEN_PID);

create index IDX_OA2AUTHCODE_EXPIRATION 
   on CDR_OAUTH2_AUTH_CODE (EXPIRATION);

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);

create index IDX_OA2RTOKSCP_SCP 
   on CDR_OAUTH2_RTOKEN_SCOPE (SCOPE, TOKEN_PID);

create index IDX_NID_CR_VER 
   on CDR_RESTORE (NODE_PID, CREATED, VERSION);

create index FK_CDR_RESTORE_NODE 
   on CDR_RESTORE (NODE_PID);

create index FK_CDR_RESTORE_USER 
   on CDR_RESTORE (USER_PID);

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);

create index IDX_USERDEFLNCHCTX_USER 
   on CDR_USER_DETAILS_DEF_LNCH_CTX (USER_PID);

create index IDX_USROA2CLNTAPRVDSCP_CLNTUSR 
   on CDR_USER_DETAILS_OA2CLNAPRVSCP (CLIENT_PID, USER_PID);

create index IDX_USER_OA2CLN_TOS_USRCLNT 
   on CDR_USER_OA2CLN_TOS (USER_PID, CLIENT_PID);

create index IDX_USER_PERM_PERM_USER 
   on CDR_USER_PERM (PERMISSION_TYPE, USER_PID);

create index IDX_USER_PSN_USR 
   on CDR_USER_PSN (USER_PID, VERSION, CREATED_DATE, REVOKED_DATE);

create index IDX_XACTLOG_INITTS 
   on CDR_XACT_LOG (INITIAL_TIMESTAMP);

create index IDX_XACTID 
   on CDR_XACT_LOG (SRC_XACT_ID);

create index IDX_XACTLOGSTEP_LOGID 
   on CDR_XACT_LOG_STEP (LOG_PID);

alter table AG_ADDRESS 
   add constraint FK_AG_ADDRESS_AG_PROFILE 
   foreign key (AG_PROFILE_PID) 
   references AG_PROFILE;

alter table AG_APP_REQUEST 
   add constraint FK_AG_APP_REQUEST_MODULE 
   foreign key (MODULE_PID) 
   references CDR_MODULE;

alter table AG_APPL 
   add constraint FK_AG_APPL_JWK_SET 
   foreign key (JWK_SET_PID) 
   references AG_DATA;

alter table AG_APPL 
   add constraint FK_AG_APPL_AG_ATTESTATION 
   foreign key (ATTESTATION_PID) 
   references AG_ATTESTATION;

alter table AG_APPL 
   add constraint FK_AG_APPL_ICON 
   foreign key (ICON_PID) 
   references AG_DATA;

alter table AG_APPL 
   add constraint FK_AG_APPL_MODULE 
   foreign key (MODULE_PID) 
   references CDR_MODULE;

alter table AG_APPL 
   add constraint FK_AG_APPL_OAUTH2_CLIENT 
   foreign key (OAUTH2_CLIENT_PID) 
   references CDR_OAUTH2_CLIENT_DETAILS;

alter table AG_APPL 
   add constraint FK_AG_APPL_PARENT_PID 
   foreign key (PARENT_PID) 
   references AG_APPL;

alter table AG_APPL 
   add constraint FK_AG_APPL_AG_PROFILE 
   foreign key (PROFILE_PID) 
   references AG_PROFILE;

alter table AG_APPL 
   add constraint FK_AG_APPL_USER 
   foreign key (USER_PID) 
   references CDR_USER_DETAILS;

alter table AG_ATTESTATION 
   add constraint FK_AG_ATTESTATION_HTML 
   foreign key (HTML_PID) 
   references AG_DATA;

alter table AG_ATTESTATION 
   add constraint FK_AG_ATTESTATION_MODULE 
   foreign key (MODULE_PID) 
   references CDR_MODULE;

alter table AG_ATTESTATION 
   add constraint FK_AG_ATTESTATION_PLAIN_HTML 
   foreign key (PLAIN_HTML_PID) 
   references AG_DATA;

alter table AG_CLASS 
   add constraint FK_AG_CLASS_AG_APPL 
   foreign key (AG_APPL_PID) 
   references AG_APPL;

alter table AG_COUNTRY 
   add constraint FK_AG_COUNTRY_AG_APPL 
   foreign key (AG_APPL_PID) 
   references AG_APPL;

alter table AG_DOCUMENT 
   add constraint FK_AG_DOCUMENT_DATA_BLOB 
   foreign key (DOCUMENT_PID) 
   references AG_DATA;

alter table AG_DOCUMENT 
   add constraint FK_AG_DOCUMENT_AG_APPL 
   foreign key (AG_APPL_PID) 
   references AG_APPL;

alter table AG_DRAFT 
   add constraint FK_AG_DRAFT_DATA_BLOB 
   foreign key (DRAFT_PID) 
   references AG_DATA;

alter table AG_DRAFT 
   add constraint FK_AG_DRAFT_MODULE 
   foreign key (MODULE_PID) 
   references CDR_MODULE;

alter table AG_DRAFT 
   add constraint FK_AG_DRAFT_SOURCE_APP_PID 
   foreign key (SOURCE_APP_PID) 
   references AG_APPL;

alter table AG_DRAFT 
   add constraint FK_AG_DRAFT_USER 
   foreign key (USER_PID) 
   references CDR_USER_DETAILS;

alter table AG_MEMBER_PHONE 
   add constraint FK_AG_MEMBER_PHONE_APP_REQUEST 
   foreign key (AG_APP_REQUEST_PID) 
   references AG_APP_REQUEST;

alter table AG_METADATA 
   add constraint FK_AG_METADATA_AG_APPL 
   foreign key (AG_APPL_PID) 
   references AG_APPL;

alter table AG_NOTE 
   add constraint FK_AG_NOTE_AG_APPL 
   foreign key (AG_APPL_PID) 
   references AG_APPL;

alter table AG_OAUTH_REDIRECT 
   add constraint FK_AG_OAUTH_REDIRECT_AG_APPL 
   foreign key (AG_APPL_PID) 
   references AG_APPL;

alter table AG_PERMISSION 
   add constraint FK_AG_PERMISSION_AG_APPL 
   foreign key (AG_APPL_PID) 
   references AG_APPL;

alter table AG_PHONE 
   add constraint FK_AG_PHONE_AG_PROFILE 
   foreign key (AG_PROFILE_PID) 
   references AG_PROFILE;

alter table AG_PREREQUISITE 
   add constraint FK_AG_PREREQUISITE_AG_APPL 
   foreign key (AG_APPL_PID) 
   references AG_APPL;

alter table AG_PROFILE 
   add constraint FK_AG_PROFILE_MODULE 
   foreign key (MODULE_PID) 
   references CDR_MODULE;

alter table AG_PROFILE 
   add constraint FK_AG_PROFILE_USER 
   foreign key (USER_PID) 
   references CDR_USER_DETAILS;

alter table AG_SANDBOX_CLIENT 
   add constraint FK_AG_SANDBOX_CLIENT_MODULE 
   foreign key (MODULE_PID) 
   references CDR_MODULE;

alter table AG_SANDBOX_CLIENT 
   add constraint FK_AG_CLIENT_OAUTH2_CLIENT 
   foreign key (OAUTH2_CLIENT_PID) 
   references CDR_OAUTH2_CLIENT_DETAILS;

alter table AG_SANDBOX_CLIENT 
   add constraint FK_AG_SANDBOX_CLIENT_USER 
   foreign key (USER_PID) 
   references CDR_USER_DETAILS;

alter table AG_SCOPE 
   add constraint FK_AG_SCOPE_AG_APPL 
   foreign key (AG_APPL_PID) 
   references AG_APPL;

alter table AG_SCREENSHOT 
   add constraint FK_AG_SCREENSHOT_DATA_BLOB 
   foreign key (SCREENSHOT_PID) 
   references AG_DATA;

alter table AG_SCREENSHOT 
   add constraint FK_AG_SCREENSHOT_AG_APPL 
   foreign key (AG_APPL_PID) 
   references AG_APPL;

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_HEADER 
   add constraint FK_AUDITEVT_HEADER_EVT 
   foreign key (EVENT_PID) 
   references CDR_AUDIT_EVT;

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_CACHE_SYNC 
   add constraint FK_CACHE_MODULE 
   foreign key (MODULE_PID) 
   references CDR_MODULE;

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_HTTP_SESSION 
   add constraint FK_HTTPSESSION_MODULE 
   foreign key (MODULE_PID) 
   references CDR_MODULE;

alter table CDR_IDENTIFICATION_CODES 
   add constraint FK_IDCODE_USER 
   foreign key (USER_PID) 
   references CDR_USER_DETAILS;

alter table CDR_METRIC_HEALTH 
   add constraint FK_HEALTH_MODP 
   foreign key (MODPROC_PID) 
   references CDR_MODULE_PROCESS;

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_PROCESS 
   add constraint FK_MODPROC_MODULE 
   foreign key (MODULE_PID) 
   references CDR_MODULE;

alter table CDR_MODULE_PROCESS 
   add constraint FK_MODPROC_NODEPROC 
   foreign key (NODEPROC_PID) 
   references CDR_NODE_PROCESS;

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_STATE 
   add constraint FK_MODSTAT_MODULE 
   foreign key (MODULE_PID) 
   references CDR_MODULE;

alter table CDR_NODE_MODULE_DIAGNOSTICS 
   add constraint FK_MULTI_NODE_MODULE_PID 
   foreign key (MODULE_PID) 
   references CDR_MODULE;

alter table CDR_NODE_MODULE_DIAGNOSTICS 
   add constraint FK_MULTI_NODE_PID 
   foreign key (NODE_PID) 
   references CDR_NODE;

alter table CDR_NODE_PROCESS 
   add constraint FK_NODEPROCESS_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_ATOKEN_UDATA 
   add constraint FK_OA2ATOKUD_TOKEN 
   foreign key (ATOKEN_PID) 
   references CDR_OAUTH2_ATOKEN;

alter table CDR_OAUTH2_ATOKEN_UDATA_BIN 
   add constraint FK_OA2ATOKUDBIN_TOKEN 
   foreign key (ATOKEN_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_LNCHRESID 
   add constraint FK_OA2RTOKLNCHRESID_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_OAUTH2_RTOKEN_UDATA 
   add constraint FK_OA2RTOKUD_TOKEN 
   foreign key (TOKEN_PID) 
   references CDR_OAUTH2_REFRESH_TOKEN;

alter table CDR_OAUTH2_RTOKEN_UDATA_BIN 
   add constraint FK_OA2RTOKUDBIN_TOKEN 
   foreign key (TOKEN_PID) 
   references CDR_OAUTH2_REFRESH_TOKEN;

alter table CDR_RESTORE 
   add constraint FK_CDR_RESTORE_NODE 
   foreign key (NODE_PID) 
   references CDR_NODE;

alter table CDR_RESTORE 
   add constraint FK_CDR_RESTORE_USER 
   foreign key (USER_PID) 
   references CDR_USER_DETAILS;

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_OA2CLN_TOS 
   add constraint FK_USER_OA2CLN_TOS_CLIENT 
   foreign key (CLIENT_PID) 
   references CDR_OAUTH2_CLIENT_DETAILS;

alter table CDR_USER_OA2CLN_TOS 
   add constraint FK_USER_OA2CLN_TOS_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_PSN 
   add constraint FK_USER_PSN_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;

41.6.4Setting 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_BLKIMJOB_PID start with 1 increment by 50;

create sequence SEQ_BLKIMJOBFILE_PID start with 1 increment by 50;

create sequence SEQ_CDH_LB_REF start with 1 increment by 50;

create sequence SEQ_CDH_LB_SUB_GROUP start with 1 increment by 50;

create sequence SEQ_CDH_LB_WL start with 1 increment by 50;

create sequence SEQ_CDH_LB_WL_SUBS 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_EMPI_LINK_ID start with 1 increment by 50;

create sequence SEQ_FORCEDID_ID start with 1 increment by 50;

create sequence SEQ_HFJ_REVINFO start with 1 increment by 50;

create sequence SEQ_HISTORYTAG_ID start with 1 increment by 50;

create sequence SEQ_IDXCMBTOKNU_ID start with 1 increment by 50;

create sequence SEQ_IDXCMPSTRUNIQ_ID start with 1 increment by 50;

create sequence SEQ_NPM_PACK start with 1 increment by 50;

create sequence SEQ_NPM_PACKVER start with 1 increment by 50;

create sequence SEQ_NPM_PACKVERRES 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_QUANTITY_NRML 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 BT2_JOB_INSTANCE (
    ID varchar2(100 char) not null,
    JOB_CANCELLED number(1,0) not null,
    CMB_RECS_PROCESSED number(10,0),
    CMB_RECS_PER_SEC float(53),
    CREATE_TIME timestamp(6) not null,
    CUR_GATED_STEP_ID varchar2(100 char),
    DEFINITION_ID varchar2(100 char) not null,
    DEFINITION_VER number(10,0) not null,
    END_TIME timestamp(6),
    ERROR_COUNT number(10,0) not null,
    ERROR_MSG varchar2(500 char),
    EST_REMAINING varchar2(100 char),
    FAST_TRACKING number(1,0),
    PARAMS_JSON varchar2(2000 char),
    PARAMS_JSON_LOB clob,
    PARAMS_JSON_VC clob,
    PROGRESS_PCT float(53) not null,
    REPORT clob,
    REPORT_VC clob,
    START_TIME timestamp(6),
    STAT varchar2(20 char) not null,
    TOT_ELAPSED_MILLIS number(10,0),
    CLIENT_ID varchar2(200 char),
    USER_NAME varchar2(200 char),
    UPDATE_TIME timestamp(6),
    WARNING_MSG varchar2(4000 char),
    WORK_CHUNKS_PURGED number(1,0) not null,
    primary key (ID)
);

create table BT2_WORK_CHUNK (
    ID varchar2(100 char) not null,
    CREATE_TIME timestamp(6) not null,
    END_TIME timestamp(6),
    ERROR_COUNT number(10,0) not null,
    ERROR_MSG varchar2(500 char),
    INSTANCE_ID varchar2(100 char) not null,
    DEFINITION_ID varchar2(100 char) not null,
    DEFINITION_VER number(10,0) not null,
    NEXT_POLL_TIME timestamp(6),
    POLL_ATTEMPTS number(10,0),
    RECORDS_PROCESSED number(10,0),
    SEQ number(10,0) not null,
    CHUNK_DATA clob,
    CHUNK_DATA_VC clob,
    START_TIME timestamp(6),
    STAT varchar2(20 char) not null,
    TGT_STEP_ID varchar2(100 char) not null,
    UPDATE_TIME timestamp(6),
    WARNING_MSG varchar2(4000 char),
    primary key (ID)
);

create table CDH_LB_REF (
    PID number(19,0) not null,
    EXPIRES timestamp(6),
    LB_RES_ID number(19,0) not null,
    ORDER_DATE timestamp(6),
    ROOT_RES_ID number(19,0) not null,
    RULE_SYSTEM varchar2(200 char) not null,
    RULE_VALUE varchar2(200 char) not null,
    SUBS_RES_ID number(19,0) not null,
    TRACK_PARAM varchar2(200 char),
    TRACK_SUBPARAM varchar2(200 char),
    primary key (PID),
    constraint IDX_CDH_LB_REF_UNIQ unique (RULE_SYSTEM, RULE_VALUE, ROOT_RES_ID, SUBS_RES_ID, LB_RES_ID)
);

create table CDH_LB_SUB_GROUP (
    PID number(19,0) not null,
    SUBS_GROUP varchar2(200 char) not null,
    SUBS_ID varchar2(200 char) not null,
    SUBS_RES_ID number(19,0) not null,
    primary key (PID),
    constraint IDX_CDH_LB_SUB_ID_GROUP unique (SUBS_RES_ID, SUBS_GROUP)
);

create table CDH_LB_WL (
    PID number(19,0) not null,
    SUBSCRIBER_TYPE varchar2(200 char) not null,
    WATCHLIST_SYSTEM varchar2(200 char) not null,
    WATCHLIST_VALUE varchar2(200 char) not null,
    primary key (PID),
    constraint IDX_CDH_LB_WL_WATCHLIST_TOKEN unique (WATCHLIST_SYSTEM, WATCHLIST_VALUE)
);

create table CDH_LB_WL_SUBS (
    PID number(19,0) not null,
    SEED_STATUS number(10,0) not null,
    SUBS_ID varchar2(200 char) not null,
    SUBS_RES_ID number(19,0) not null,
    WATCHLIST_ID number(19,0) not null,
    primary key (PID),
    constraint IDX_CDH_LB_WL_SUBS_WATCHLIST unique (WATCHLIST_ID, SUBS_RES_ID)
);

create table HFJ_BINARY_STORAGE_BLOB (
    BLOB_ID varchar2(200 char) not null,
    BLOB_DATA blob,
    CONTENT_TYPE varchar2(100 char) not null,
    BLOB_HASH varchar2(128 char),
    PUBLISHED_DATE timestamp(6) not null,
    RESOURCE_ID varchar2(100 char) not null,
    BLOB_SIZE number(19,0) not null,
    STORAGE_CONTENT_BIN blob,
    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(6) not null,
    EXP_TIME timestamp(6),
    JOB_ID varchar2(36 char) not null,
    REQUEST varchar2(1024 char) not null,
    EXP_SINCE timestamp(6),
    JOB_STATUS varchar2(10 char) not null,
    STATUS_MESSAGE varchar2(500 char),
    STATUS_TIME timestamp(6) not null,
    OPTLOCK number(10,0) not null,
    primary key (PID),
    constraint IDX_BLKEX_JOB_ID unique (JOB_ID)
);

create table HFJ_BLK_IMPORT_JOB (
    PID number(19,0) not null,
    BATCH_SIZE number(10,0) not null,
    FILE_COUNT number(10,0) not null,
    JOB_DESC varchar2(500 char),
    JOB_ID varchar2(36 char) not null,
    ROW_PROCESSING_MODE varchar2(20 char) not null,
    JOB_STATUS varchar2(10 char) not null,
    STATUS_MESSAGE varchar2(500 char),
    STATUS_TIME timestamp(6) not null,
    OPTLOCK number(10,0) not null,
    primary key (PID),
    constraint IDX_BLKIM_JOB_ID unique (JOB_ID)
);

create table HFJ_BLK_IMPORT_JOBFILE (
    PID number(19,0) not null,
    JOB_CONTENTS blob,
    JOB_CONTENTS_VC clob,
    FILE_DESCRIPTION varchar2(500 char),
    FILE_SEQ number(10,0) not null,
    TENANT_NAME varchar2(200 char),
    JOB_PID number(19,0) not null,
    primary key (PID)
);

create table HFJ_FORCED_ID (
    PID number(19,0) not null,
    PARTITION_DATE date,
    PARTITION_ID number(10,0),
    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,
    PARTITION_DATE date,
    PARTITION_ID number(10,0),
    TAG_ID number(19,0),
    RES_VER_PID number(19,0) not null,
    RES_ID number(19,0) not null,
    RES_TYPE varchar2(40 char) not null,
    primary key (PID),
    constraint IDX_RESHISTTAG_TAGID unique (RES_VER_PID, TAG_ID)
);

create table HFJ_IDX_CMB_TOK_NU (
    PID number(19,0) not null,
    PARTITION_DATE date,
    PARTITION_ID number(10,0),
    HASH_COMPLETE number(19,0) not null,
    IDX_STRING varchar2(500 char) not null,
    RES_ID number(19,0),
    primary key (PID)
);

create table HFJ_IDX_CMP_STRING_UNIQ (
    PID number(19,0) not null,
    PARTITION_DATE date,
    PARTITION_ID number(10,0),
    HASH_COMPLETE number(19,0),
    HASH_COMPLETE_2 number(19,0),
    IDX_STRING varchar2(500 char) not null,
    RES_ID number(19,0),
    primary key (PID),
    constraint IDX_IDXCMPSTRUNIQ_STRING unique (IDX_STRING)
);

create table HFJ_PARTITION (
    PART_ID number(10,0) not null,
    PART_DESC varchar2(200 char),
    PART_NAME varchar2(200 char) not null,
    primary key (PART_ID),
    constraint IDX_PART_NAME unique (PART_NAME)
);

create table HFJ_RES_LINK (
    PID number(19,0) not null,
    PARTITION_DATE date,
    PARTITION_ID number(10,0),
    SRC_PATH varchar2(500 char) not null,
    SRC_RESOURCE_ID number(19,0) not null,
    SOURCE_RESOURCE_TYPE varchar2(40 char) not null,
    TARGET_RES_PARTITION_DATE date,
    TARGET_RES_PARTITION_ID number(10,0),
    TARGET_RESOURCE_ID number(19,0),
    TARGET_RESOURCE_TYPE varchar2(40 char) not null,
    TARGET_RESOURCE_URL varchar2(200 char),
    TARGET_RESOURCE_VERSION number(19,0),
    SP_UPDATED timestamp(6),
    primary key (PID)
);

create table HFJ_RES_PARAM_PRESENT (
    PID number(19,0) not null,
    PARTITION_DATE date,
    PARTITION_ID number(10,0),
    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(6),
    UPDATE_THRESHOLD_HIGH timestamp(6) not null,
    UPDATE_THRESHOLD_LOW timestamp(6),
    primary key (PID)
);

create table HFJ_RES_SEARCH_URL (
    RES_SEARCH_URL varchar2(768 char) not null,
    PARTITION_ID number(10,0) not null,
    CREATED_TIME timestamp(6) not null,
    PARTITION_DATE date,
    RES_ID number(19,0) not null,
    primary key (RES_SEARCH_URL, PARTITION_ID)
);

create table HFJ_RES_TAG (
    PID number(19,0) not null,
    PARTITION_DATE date,
    PARTITION_ID number(10,0),
    TAG_ID number(19,0),
    RES_ID number(19,0),
    RES_TYPE varchar2(40 char) not null,
    primary key (PID),
    constraint IDX_RESTAG_TAGID unique (RES_ID, TAG_ID)
);

create table HFJ_RES_VER (
    PID number(19,0) not null,
    PARTITION_DATE date,
    PARTITION_ID number(10,0),
    RES_DELETED_AT timestamp(6),
    RES_VERSION varchar2(7 char),
    HAS_TAGS number(1,0) not null,
    RES_PUBLISHED timestamp(6) not null,
    RES_UPDATED timestamp(6) not null,
    RES_ENCODING varchar2(5 char) not null,
    REQUEST_ID varchar2(16 char),
    RES_TEXT blob,
    RES_ID number(19,0) not null,
    RES_TEXT_VC clob,
    RES_TYPE varchar2(40 char) not null,
    RES_VER number(19,0) not null,
    SOURCE_URI varchar2(100 char),
    primary key (PID),
    constraint IDX_RESVER_ID_VER unique (RES_ID, RES_VER)
);

create table HFJ_RES_VER_PROV (
    RES_VER_PID number(19,0) not null,
    PARTITION_DATE date,
    PARTITION_ID number(10,0),
    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,
    PARTITION_DATE date,
    PARTITION_ID number(10,0),
    RES_DELETED_AT timestamp(6),
    RES_VERSION varchar2(7 char),
    HAS_TAGS number(1,0) not null,
    RES_PUBLISHED timestamp(6) not null,
    RES_UPDATED timestamp(6) not null,
    FHIR_ID varchar2(64 char),
    SP_HAS_LINKS number(1,0) not null,
    HASH_SHA256 varchar2(64 char),
    SP_INDEX_STATUS number(19,0),
    RES_LANGUAGE varchar2(20 char),
    SP_CMPSTR_UNIQ_PRESENT number(1,0),
    SP_CMPTOKS_PRESENT number(1,0),
    SP_COORDS_PRESENT number(1,0) not null,
    SP_DATE_PRESENT number(1,0) not null,
    SP_NUMBER_PRESENT number(1,0) not null,
    SP_QUANTITY_NRML_PRESENT number(1,0) not null,
    SP_QUANTITY_PRESENT number(1,0) not null,
    SP_STRING_PRESENT number(1,0) not null,
    SP_TOKEN_PRESENT number(1,0) not null,
    SP_URI_PRESENT number(1,0) not null,
    RES_TYPE varchar2(40 char) not null,
    SEARCH_URL_PRESENT number(1,0),
    RES_VER number(19,0) not null,
    primary key (RES_ID),
    constraint IDX_RES_TYPE_FHIR_ID unique (RES_TYPE, FHIR_ID)
);

create table HFJ_RESOURCE_MODIFIED (
    RES_ID varchar2(256 char) not null,
    RES_VER varchar2(8 char) not null,
    CREATED_TIME timestamp(6) not null,
    RESOURCE_TYPE varchar2(40 char) not null,
    SUMMARY_MESSAGE varchar2(4000 char) not null,
    primary key (RES_ID, RES_VER)
);

create table HFJ_REVINFO (
    REV number(19,0) not null,
    REVTSTMP timestamp(6),
    primary key (REV)
);

create table HFJ_SEARCH (
    PID number(19,0) not null,
    CREATED timestamp(6) not null,
    SEARCH_DELETED number(1,0),
    EXPIRY_OR_NULL timestamp(6),
    FAILURE_CODE number(10,0),
    FAILURE_MESSAGE varchar2(500 char),
    LAST_UPDATED_HIGH timestamp(6),
    LAST_UPDATED_LOW timestamp(6),
    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_PARAM_MAP blob,
    SEARCH_PARAM_MAP_BIN blob,
    SEARCH_QUERY_STRING clob,
    SEARCH_QUERY_STRING_HASH number(10,0),
    SEARCH_QUERY_STRING_VC clob,
    SEARCH_TYPE number(10,0) not null,
    SEARCH_STATUS varchar2(10 char) not null,
    TOTAL_COUNT number(10,0),
    SEARCH_UUID varchar2(48 char) not null,
    OPTLOCK_VERSION number(10,0),
    primary key (PID),
    constraint IDX_SEARCH_UUID unique (SEARCH_UUID)
);

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),
    constraint IDX_SEARCHRES_ORDER unique (SEARCH_PID, SEARCH_ORDER)
);

create table HFJ_SPIDX_COORDS (
    SP_ID number(19,0) not null,
    PARTITION_DATE date,
    PARTITION_ID number(10,0),
    HASH_IDENTITY number(19,0),
    SP_MISSING number(1,0) not null,
    SP_NAME varchar2(100 char),
    RES_ID number(19,0) not null,
    RES_TYPE varchar2(100 char),
    SP_UPDATED timestamp(6),
    SP_LATITUDE float(53),
    SP_LONGITUDE float(53),
    primary key (SP_ID)
);

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

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

create table HFJ_SPIDX_QUANTITY (
    SP_ID number(19,0) not null,
    PARTITION_DATE date,
    PARTITION_ID number(10,0),
    HASH_IDENTITY number(19,0),
    SP_MISSING number(1,0) not null,
    SP_NAME varchar2(100 char),
    RES_ID number(19,0) not null,
    RES_TYPE varchar2(100 char),
    SP_UPDATED timestamp(6),
    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 float(53),
    primary key (SP_ID)
);

create table HFJ_SPIDX_QUANTITY_NRML (
    SP_ID number(19,0) not null,
    PARTITION_DATE date,
    PARTITION_ID number(10,0),
    HASH_IDENTITY number(19,0),
    SP_MISSING number(1,0) not null,
    SP_NAME varchar2(100 char),
    RES_ID number(19,0) not null,
    RES_TYPE varchar2(100 char),
    SP_UPDATED timestamp(6),
    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 float(53),
    primary key (SP_ID)
);

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

create table HFJ_SPIDX_TOKEN (
    SP_ID number(19,0) not null,
    PARTITION_DATE date,
    PARTITION_ID number(10,0),
    HASH_IDENTITY number(19,0),
    SP_MISSING number(1,0) not null,
    SP_NAME varchar2(100 char),
    RES_ID number(19,0) not null,
    RES_TYPE varchar2(100 char),
    SP_UPDATED timestamp(6),
    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,
    PARTITION_DATE date,
    PARTITION_ID number(10,0),
    HASH_IDENTITY number(19,0),
    SP_MISSING number(1,0) not null,
    SP_NAME varchar2(100 char),
    RES_ID number(19,0) not null,
    RES_TYPE varchar2(100 char),
    SP_UPDATED timestamp(6),
    HASH_URI number(19,0),
    SP_URI varchar2(500 char),
    primary key (SP_ID)
);

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

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,
    TAG_USER_SELECTED number(1,0),
    TAG_VERSION varchar2(30 char),
    primary key (TAG_ID)
);

create table MPI_LINK (
    PID number(19,0) not null,
    PARTITION_DATE date,
    PARTITION_ID number(10,0),
    CREATED timestamp(6) not null,
    EID_MATCH number(1,0),
    GOLDEN_RESOURCE_PID number(19,0) not null,
    NEW_PERSON number(1,0),
    LINK_SOURCE number(10,0) not null,
    MATCH_RESULT number(10,0) not null,
    TARGET_TYPE varchar2(40 char),
    PERSON_PID number(19,0) not null,
    RULE_COUNT number(19,0),
    SCORE float(53),
    TARGET_PID number(19,0) not null,
    UPDATED timestamp(6) not null,
    VECTOR number(19,0),
    VERSION varchar2(16 char) not null,
    primary key (PID),
    constraint IDX_EMPI_PERSON_TGT unique (PERSON_PID, TARGET_PID)
);

create table MPI_LINK_AUD (
    PID number(19,0) not null,
    REV number(19,0) not null,
    REVTYPE number(3,0),
    PARTITION_DATE date,
    PARTITION_ID number(10,0),
    CREATED timestamp(6),
    EID_MATCH number(1,0),
    GOLDEN_RESOURCE_PID number(19,0),
    NEW_PERSON number(1,0),
    LINK_SOURCE number(10,0),
    MATCH_RESULT number(10,0),
    TARGET_TYPE varchar2(40 char),
    PERSON_PID number(19,0),
    RULE_COUNT number(19,0),
    SCORE float(53),
    TARGET_PID number(19,0),
    UPDATED timestamp(6),
    VECTOR number(19,0),
    VERSION varchar2(16 char),
    primary key (REV, PID)
);

create table NPM_PACKAGE (
    PID number(19,0) not null,
    CUR_VERSION_ID varchar2(200 char),
    PACKAGE_DESC varchar2(512 char),
    PACKAGE_ID varchar2(200 char) not null,
    UPDATED_TIME timestamp(6) not null,
    primary key (PID),
    constraint IDX_PACK_ID unique (PACKAGE_ID)
);

create table NPM_PACKAGE_VER (
    PID number(19,0) not null,
    PKG_AUTHOR varchar2(512 char),
    AUTHOR_UPPER varchar2(512 char),
    CURRENT_VERSION number(1,0) not null,
    PKG_DESC varchar2(512 char),
    DESC_UPPER varchar2(512 char),
    FHIR_VERSION varchar2(10 char) not null,
    FHIR_VERSION_ID varchar2(20 char) not null,
    PACKAGE_ID varchar2(200 char) not null,
    PACKAGE_SIZE_BYTES number(19,0) not null,
    SAVED_TIME timestamp(6) not null,
    UPDATED_TIME timestamp(6) not null,
    VERSION_ID varchar2(200 char) not null,
    PACKAGE_PID number(19,0) not null,
    BINARY_RES_ID number(19,0) not null,
    primary key (PID),
    constraint IDX_PACKVER unique (PACKAGE_ID, VERSION_ID)
);

create table NPM_PACKAGE_VER_RES (
    PID number(19,0) not null,
    CANONICAL_URL varchar2(200 char),
    CANONICAL_VERSION varchar2(200 char),
    FILE_DIR varchar2(200 char),
    FHIR_VERSION varchar2(10 char) not null,
    FHIR_VERSION_ID varchar2(20 char) not null,
    FILE_NAME varchar2(200 char),
    RES_SIZE_BYTES number(19,0) not null,
    RES_TYPE varchar2(40 char) not null,
    UPDATED_TIME timestamp(6) not null,
    PACKVER_PID number(19,0) not null,
    BINARY_RES_ID number(19,0) not null,
    primary key (PID)
);

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),
    constraint IDX_CS_CODESYSTEM unique (CODE_SYSTEM_URI)
);

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),
    constraint IDX_CODESYSTEM_AND_VER unique (CODESYSTEM_PID, CS_VERSION_ID)
);

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

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),
    VAL_VC clob,
    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,
    VER varchar2(200 char),
    primary key (PID),
    constraint IDX_CONCEPT_MAP_URL unique (URL, VER)
);

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(500 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),
    CONCEPT_MAP_URL varchar2(200 char),
    TARGET_DISPLAY varchar2(500 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_BIN blob,
    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,
    EXPANDED_AT timestamp(6),
    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,
    VER varchar2(200 char),
    primary key (PID),
    constraint IDX_VALUESET_URL unique (URL, VER)
);

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),
    INDEX_STATUS number(19,0),
    VALUESET_ORDER number(10,0) not null,
    SOURCE_DIRECT_PARENT_PIDS clob,
    SOURCE_DIRECT_PARENT_PIDS_VC clob,
    SOURCE_PID number(19,0),
    SYSTEM_URL varchar2(200 char) not null,
    SYSTEM_VER varchar2(200 char),
    VALUESET_PID number(19,0) not null,
    primary key (PID),
    constraint IDX_VS_CONCEPT_CSCD unique (VALUESET_PID, SYSTEM_URL, CODEVAL),
    constraint IDX_VS_CONCEPT_ORDER unique (VALUESET_PID, VALUESET_ORDER)
);

create index IDX_BT2JI_CT 
   on BT2_JOB_INSTANCE (CREATE_TIME);

create index IDX_BT2WC_II_SEQ 
   on BT2_WORK_CHUNK (INSTANCE_ID, SEQ);

create index IDX_BT2WC_II_SI_S_SEQ_ID 
   on BT2_WORK_CHUNK (INSTANCE_ID, TGT_STEP_ID, STAT, SEQ, ID);

create index IDX_CDH_LB_REF_RULE_SUBS 
   on CDH_LB_REF (RULE_SYSTEM, RULE_VALUE, SUBS_RES_ID);

create index IDX_CDH_LB_REF_TRACK_PARAM 
   on CDH_LB_REF (TRACK_PARAM);

create index IDX_CDH_LB_REF_TRACK_SUBPARAM 
   on CDH_LB_REF (TRACK_SUBPARAM);

create index IDX_CDH_LB_REF_EXPIRES 
   on CDH_LB_REF (EXPIRES);

create index FK_LB_RES 
   on CDH_LB_REF (LB_RES_ID);

create index FK_LB_SUBS 
   on CDH_LB_REF (SUBS_RES_ID);

create index FK_LB_ROOT 
   on CDH_LB_REF (ROOT_RES_ID);

create index IDX_CDH_LB_SUB_GROUP_GROUP 
   on CDH_LB_SUB_GROUP (SUBS_GROUP);

create index IDX_CDH_LB_SUB_GROUP_ID 
   on CDH_LB_SUB_GROUP (SUBS_ID);

create index FK_LB_WL_SUBS 
   on CDH_LB_WL_SUBS (SUBS_RES_ID);

create index IDX_BLKEX_EXPTIME 
   on HFJ_BLK_EXPORT_JOB (EXP_TIME);

create index IDX_BLKIM_JOBFILE_JOBID 
   on HFJ_BLK_IMPORT_JOBFILE (JOB_PID);

create index IDX_RESHISTTAG_RESID 
   on HFJ_HISTORY_TAG (RES_ID);

create index IDX_IDXCMBTOKNU_STR 
   on HFJ_IDX_CMB_TOK_NU (IDX_STRING);

create index IDX_IDXCMBTOKNU_HASHC 
   on HFJ_IDX_CMB_TOK_NU (HASH_COMPLETE, RES_ID, PARTITION_ID);

create index IDX_IDXCMBTOKNU_RES 
   on HFJ_IDX_CMB_TOK_NU (RES_ID);

create index IDX_IDXCMPSTRUNIQ_RESOURCE 
   on HFJ_IDX_CMP_STRING_UNIQ (RES_ID);

create index IDX_RL_SRC 
   on HFJ_RES_LINK (SRC_RESOURCE_ID);

create index IDX_RL_TGT_v2 
   on HFJ_RES_LINK (TARGET_RESOURCE_ID, SRC_PATH, SRC_RESOURCE_ID, TARGET_RESOURCE_TYPE, PARTITION_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);

create index IDX_RESSEARCHURL_RES 
   on HFJ_RES_SEARCH_URL (RES_ID);

create index IDX_RESSEARCHURL_TIME 
   on HFJ_RES_SEARCH_URL (CREATED_TIME);

create index IDX_RES_TAG_RES_TAG 
   on HFJ_RES_TAG (RES_ID, TAG_ID, PARTITION_ID);

create index IDX_RES_TAG_TAG_RES 
   on HFJ_RES_TAG (TAG_ID, RES_ID, PARTITION_ID);

create index IDX_RESVER_TYPE_DATE 
   on HFJ_RES_VER (RES_TYPE, RES_UPDATED, RES_ID);

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, RES_ID);

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_RESVERPROV_RES_PID 
   on HFJ_RES_VER_PROV (RES_PID);

create index IDX_RES_DATE 
   on HFJ_RESOURCE (RES_UPDATED);

create index IDX_RES_FHIR_ID 
   on HFJ_RESOURCE (FHIR_ID);

create index IDX_RES_TYPE_DEL_UPDATED 
   on HFJ_RESOURCE (RES_TYPE, RES_DELETED_AT, RES_UPDATED, PARTITION_ID, RES_ID);

create index IDX_RES_RESID_UPDATED 
   on HFJ_RESOURCE (RES_ID, RES_UPDATED, PARTITION_ID);

create index IDX_SEARCH_RESTYPE_HASHS 
   on HFJ_SEARCH (RESOURCE_TYPE, SEARCH_QUERY_STRING_HASH, CREATED);

create index IDX_SEARCH_CREATED 
   on HFJ_SEARCH (CREATED);

create index FK_SEARCHINC_SEARCH 
   on HFJ_SEARCH_INCLUDE (SEARCH_PID);

create index IDX_SP_COORDS_HASH_V2 
   on HFJ_SPIDX_COORDS (HASH_IDENTITY, SP_LATITUDE, SP_LONGITUDE, RES_ID, PARTITION_ID);

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_V2 
   on HFJ_SPIDX_DATE (HASH_IDENTITY, SP_VALUE_LOW, SP_VALUE_HIGH, RES_ID, PARTITION_ID);

create index IDX_SP_DATE_HASH_HIGH_V2 
   on HFJ_SPIDX_DATE (HASH_IDENTITY, SP_VALUE_HIGH, RES_ID, PARTITION_ID);

create index IDX_SP_DATE_ORD_HASH_V2 
   on HFJ_SPIDX_DATE (HASH_IDENTITY, SP_VALUE_LOW_DATE_ORDINAL, SP_VALUE_HIGH_DATE_ORDINAL, RES_ID, PARTITION_ID);

create index IDX_SP_DATE_ORD_HASH_HIGH_V2 
   on HFJ_SPIDX_DATE (HASH_IDENTITY, SP_VALUE_HIGH_DATE_ORDINAL, RES_ID, PARTITION_ID);

create index IDX_SP_DATE_RESID_V2 
   on HFJ_SPIDX_DATE (RES_ID, HASH_IDENTITY, SP_VALUE_LOW, SP_VALUE_HIGH, SP_VALUE_LOW_DATE_ORDINAL, SP_VALUE_HIGH_DATE_ORDINAL, PARTITION_ID);

create index IDX_SP_NUMBER_HASH_VAL_V2 
   on HFJ_SPIDX_NUMBER (HASH_IDENTITY, SP_VALUE, RES_ID, PARTITION_ID);

create index IDX_SP_NUMBER_RESID_V2 
   on HFJ_SPIDX_NUMBER (RES_ID, HASH_IDENTITY, SP_VALUE, PARTITION_ID);

create index IDX_SP_QUANTITY_HASH_V2 
   on HFJ_SPIDX_QUANTITY (HASH_IDENTITY, SP_VALUE, RES_ID, PARTITION_ID);

create index IDX_SP_QUANTITY_HASH_UN_V2 
   on HFJ_SPIDX_QUANTITY (HASH_IDENTITY_AND_UNITS, SP_VALUE, RES_ID, PARTITION_ID);

create index IDX_SP_QUANTITY_HASH_SYSUN_V2 
   on HFJ_SPIDX_QUANTITY (HASH_IDENTITY_SYS_UNITS, SP_VALUE, RES_ID, PARTITION_ID);

create index IDX_SP_QUANTITY_RESID_V2 
   on HFJ_SPIDX_QUANTITY (RES_ID, HASH_IDENTITY, HASH_IDENTITY_SYS_UNITS, HASH_IDENTITY_AND_UNITS, SP_VALUE, PARTITION_ID);

create index IDX_SP_QNTY_NRML_HASH_V2 
   on HFJ_SPIDX_QUANTITY_NRML (HASH_IDENTITY, SP_VALUE, RES_ID, PARTITION_ID);

create index IDX_SP_QNTY_NRML_HASH_UN_V2 
   on HFJ_SPIDX_QUANTITY_NRML (HASH_IDENTITY_AND_UNITS, SP_VALUE, RES_ID, PARTITION_ID);

create index IDX_SP_QNTY_NRML_HASH_SYSUN_V2 
   on HFJ_SPIDX_QUANTITY_NRML (HASH_IDENTITY_SYS_UNITS, SP_VALUE, RES_ID, PARTITION_ID);

create index IDX_SP_QNTY_NRML_RESID_V2 
   on HFJ_SPIDX_QUANTITY_NRML (RES_ID, HASH_IDENTITY, HASH_IDENTITY_SYS_UNITS, HASH_IDENTITY_AND_UNITS, SP_VALUE, PARTITION_ID);

create index IDX_SP_STRING_HASH_IDENT_V2 
   on HFJ_SPIDX_STRING (HASH_IDENTITY, RES_ID, PARTITION_ID);

create index IDX_SP_STRING_HASH_NRM_V2 
   on HFJ_SPIDX_STRING (HASH_NORM_PREFIX, SP_VALUE_NORMALIZED, RES_ID, PARTITION_ID);

create index IDX_SP_STRING_HASH_EXCT_V2 
   on HFJ_SPIDX_STRING (HASH_EXACT, RES_ID, PARTITION_ID);

create index IDX_SP_STRING_RESID_V2 
   on HFJ_SPIDX_STRING (RES_ID, HASH_NORM_PREFIX, PARTITION_ID);

create index IDX_SP_TOKEN_HASH_V2 
   on HFJ_SPIDX_TOKEN (HASH_IDENTITY, SP_SYSTEM, SP_VALUE, RES_ID, PARTITION_ID);

create index IDX_SP_TOKEN_HASH_S_V2 
   on HFJ_SPIDX_TOKEN (HASH_SYS, RES_ID, PARTITION_ID);

create index IDX_SP_TOKEN_HASH_SV_V2 
   on HFJ_SPIDX_TOKEN (HASH_SYS_AND_VALUE, RES_ID, PARTITION_ID);

create index IDX_SP_TOKEN_HASH_V_V2 
   on HFJ_SPIDX_TOKEN (HASH_VALUE, RES_ID, PARTITION_ID);

create index IDX_SP_TOKEN_RESID_V2 
   on HFJ_SPIDX_TOKEN (RES_ID, HASH_SYS_AND_VALUE, HASH_VALUE, HASH_SYS, HASH_IDENTITY, PARTITION_ID);

create index IDX_SP_URI_HASH_URI_V2 
   on HFJ_SPIDX_URI (HASH_URI, RES_ID, PARTITION_ID);

create index IDX_SP_URI_HASH_IDENTITY_V2 
   on HFJ_SPIDX_URI (HASH_IDENTITY, SP_URI, RES_ID, PARTITION_ID);

create index IDX_SP_URI_COORDS 
   on HFJ_SPIDX_URI (RES_ID);

create index IDX_TAG_DEF_TP_CD_SYS 
   on HFJ_TAG_DEF (TAG_TYPE, TAG_CODE, TAG_SYSTEM, TAG_ID, TAG_VERSION, TAG_USER_SELECTED);

create index IDX_EMPI_MATCH_TGT_VER 
   on MPI_LINK (MATCH_RESULT, TARGET_PID, VERSION);

create index IDX_EMPI_GR_TGT 
   on MPI_LINK (GOLDEN_RESOURCE_PID, TARGET_PID);

create index FK_EMPI_LINK_TARGET 
   on MPI_LINK (TARGET_PID);

create index IDX_EMPI_TGT_MR_LS 
   on MPI_LINK (TARGET_TYPE, MATCH_RESULT, LINK_SOURCE);

create index IDX_EMPI_TGT_MR_SCORE 
   on MPI_LINK (TARGET_TYPE, MATCH_RESULT, SCORE);

create index FK_NPM_PKV_PKG 
   on NPM_PACKAGE_VER (PACKAGE_PID);

create index FK_NPM_PKV_RESID 
   on NPM_PACKAGE_VER (BINARY_RES_ID);

create index IDX_PACKVERRES_URL 
   on NPM_PACKAGE_VER_RES (CANONICAL_URL);

create index FK_NPM_PACKVERRES_PACKVER 
   on NPM_PACKAGE_VER_RES (PACKVER_PID);

create index FK_NPM_PKVR_RESID 
   on NPM_PACKAGE_VER_RES (BINARY_RES_ID);

create index FK_TRMCODESYSTEM_RES 
   on TRM_CODESYSTEM (RES_ID);

create index FK_TRMCODESYSTEM_CURVER 
   on TRM_CODESYSTEM (CURRENT_VERSION_PID);

create index FK_CODESYSVER_RES_ID 
   on TRM_CODESYSTEM_VER (RES_ID);

create index FK_CODESYSVER_CS_ID 
   on TRM_CODESYSTEM_VER (CODESYSTEM_PID);

create index IDX_CONCEPT_INDEXSTATUS 
   on TRM_CONCEPT (INDEX_STATUS);

create index IDX_CONCEPT_UPDATED 
   on TRM_CONCEPT (CONCEPT_UPDATED);

create index FK_CONCEPTDESIG_CONCEPT 
   on TRM_CONCEPT_DESIG (CONCEPT_PID);

create index FK_CONCEPTDESIG_CSV 
   on TRM_CONCEPT_DESIG (CS_VER_PID);

create index FK_TRMCONCEPTMAP_RES 
   on TRM_CONCEPT_MAP (RES_ID);

create index FK_TCMGROUP_CONCEPTMAP 
   on TRM_CONCEPT_MAP_GROUP (CONCEPT_MAP_PID);

create index IDX_CNCPT_MAP_GRP_CD 
   on TRM_CONCEPT_MAP_GRP_ELEMENT (SOURCE_CODE);

create index FK_TCMGELEMENT_GROUP 
   on TRM_CONCEPT_MAP_GRP_ELEMENT (CONCEPT_MAP_GROUP_PID);

create index IDX_CNCPT_MP_GRP_ELM_TGT_CD 
   on TRM_CONCEPT_MAP_GRP_ELM_TGT (TARGET_CODE);

create index FK_TCMGETARGET_ELEMENT 
   on TRM_CONCEPT_MAP_GRP_ELM_TGT (CONCEPT_MAP_GRP_ELM_PID);

create index FK_TERM_CONCEPTPC_CHILD 
   on TRM_CONCEPT_PC_LINK (CHILD_PID);

create index FK_TERM_CONCEPTPC_PARENT 
   on TRM_CONCEPT_PC_LINK (PARENT_PID);

create index FK_TERM_CONCEPTPC_CS 
   on TRM_CONCEPT_PC_LINK (CODESYSTEM_PID);

create index FK_CONCEPTPROP_CONCEPT 
   on TRM_CONCEPT_PROPERTY (CONCEPT_PID);

create index FK_CONCEPTPROP_CSV 
   on TRM_CONCEPT_PROPERTY (CS_VER_PID);

create index FK_TRMVALUESET_RES 
   on TRM_VALUESET (RES_ID);

create index FK_TRM_VALUESET_CONCEPT_PID 
   on TRM_VALUESET_C_DESIGNATION (VALUESET_CONCEPT_PID);

create index FK_TRM_VSCD_VS_PID 
   on TRM_VALUESET_C_DESIGNATION (VALUESET_PID);

alter table BT2_WORK_CHUNK 
   add constraint FK_BT2WC_INSTANCE 
   foreign key (INSTANCE_ID) 
   references BT2_JOB_INSTANCE;

alter table CDH_LB_REF 
   add constraint FK_LB_RES 
   foreign key (LB_RES_ID) 
   references HFJ_RESOURCE;

alter table CDH_LB_REF 
   add constraint FK_LB_ROOT 
   foreign key (ROOT_RES_ID) 
   references HFJ_RESOURCE;

alter table CDH_LB_REF 
   add constraint FK_LB_SUBS 
   foreign key (SUBS_RES_ID) 
   references HFJ_RESOURCE;

alter table CDH_LB_SUB_GROUP 
   add constraint FK_LB_GP_SUBS 
   foreign key (SUBS_RES_ID) 
   references HFJ_RESOURCE;

alter table CDH_LB_WL_SUBS 
   add constraint FK_LB_WL_SUBS 
   foreign key (SUBS_RES_ID) 
   references HFJ_RESOURCE;

alter table CDH_LB_WL_SUBS 
   add constraint FK_LB_WL_ID 
   foreign key (WATCHLIST_ID) 
   references CDH_LB_WL;

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_BLK_IMPORT_JOBFILE 
   add constraint FK_BLKIMJOBFILE_JOB 
   foreign key (JOB_PID) 
   references HFJ_BLK_IMPORT_JOB;

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_CMB_TOK_NU 
   add constraint FK_IDXCMBTOKNU_RES_ID 
   foreign key (RES_ID) 
   references HFJ_RESOURCE;

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_SEARCH_URL 
   add constraint FK_RES_SEARCH_URL_RESOURCE 
   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 FK_RESOURCE_HISTORY_RESOURCE 
   foreign key (RES_ID) 
   references HFJ_RESOURCE;

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_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 FK_SP_DATE_RES 
   foreign key (RES_ID) 
   references HFJ_RESOURCE;

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

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

alter table HFJ_SPIDX_QUANTITY_NRML 
   add constraint FK_SP_QUANTITYNM_RES 
   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 FK_SP_TOKEN_RES 
   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 MPI_LINK 
   add constraint FK_EMPI_LINK_GOLDEN_RESOURCE 
   foreign key (GOLDEN_RESOURCE_PID) 
   references HFJ_RESOURCE;

alter table MPI_LINK 
   add constraint FK_EMPI_LINK_PERSON 
   foreign key (PERSON_PID) 
   references HFJ_RESOURCE;

alter table MPI_LINK 
   add constraint FK_EMPI_LINK_TARGET 
   foreign key (TARGET_PID) 
   references HFJ_RESOURCE;

alter table MPI_LINK_AUD 
   add constraint FKaow7nxncloec419ars0fpp58m 
   foreign key (REV) 
   references HFJ_REVINFO;

alter table NPM_PACKAGE_VER 
   add constraint FK_NPM_PKV_PKG 
   foreign key (PACKAGE_PID) 
   references NPM_PACKAGE;

alter table NPM_PACKAGE_VER 
   add constraint FK_NPM_PKV_RESID 
   foreign key (BINARY_RES_ID) 
   references HFJ_RESOURCE;

alter table NPM_PACKAGE_VER_RES 
   add constraint FK_NPM_PACKVERRES_PACKVER 
   foreign key (PACKVER_PID) 
   references NPM_PACKAGE_VER;

alter table NPM_PACKAGE_VER_RES 
   add constraint FK_NPM_PKVR_RESID 
   foreign key (BINARY_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;