Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ fi

echo "${TABLESPACES}"

if [[ ${TABLESPACES} != *"TRIDATA_DATA "* ]]; then
echo "Creating TABLESPACE TRIDATA_DATA"
db2 "CREATE LARGE TABLESPACE TRIDATA_DATA IN DATABASE PARTITION GROUP IBMDEFAULTGROUP
if [[ ${TABLESPACES} != *"{ db2_schema }_DATA "* ]]; then
echo "Creating TABLESPACE { db2_schema }_DATA"
db2 "CREATE LARGE TABLESPACE { db2_schema }_DATA IN DATABASE PARTITION GROUP IBMDEFAULTGROUP
PAGESIZE 32768 MANAGED BY AUTOMATIC STORAGE
AUTORESIZE YES
INITIALSIZE 5000 M
Expand All @@ -180,18 +180,18 @@ if [[ ${TABLESPACES} != *"TRIDATA_DATA "* ]]; then
DROPPED TABLE RECOVERY ON;"
rc=$?
if [ $rc -ne "0" ]; then
echo "Unable to create TABLESPACE TRIDATA_DATA for some reason = $rc"
echo "Unable to create TABLESPACE { db2_schema }_DATA for some reason = $rc"
exit $rc
fi
else
echo "TABLESPACE TRIDATA_DATA already exists"
else
echo "TABLESPACE { db2_schema }_DATA already exists"
fi

db2 "SELECT * FROM SYSCAT.TABLESPACES WHERE TBSPACE = 'TRIDATA_DATA'"
db2 "SELECT * FROM SYSCAT.TABLESPACES WHERE TBSPACE = '{ db2_schema }_DATA'"

if [[ ${TABLESPACES} != *"TRIDATA_INDX "* ]]; then
echo "Creating TABLESPACE TRIDATA_INDX"
db2 "CREATE LARGE TABLESPACE TRIDATA_INDX IN DATABASE PARTITION GROUP IBMDEFAULTGROUP
if [[ ${TABLESPACES} != *"{ db2_schema }_INDX "* ]]; then
echo "Creating TABLESPACE { db2_schema }_INDX"
db2 "CREATE LARGE TABLESPACE { db2_schema }_INDX IN DATABASE PARTITION GROUP IBMDEFAULTGROUP
PAGESIZE 32768 MANAGED BY AUTOMATIC STORAGE
AUTORESIZE YES
INITIALSIZE 5000 M
Expand All @@ -205,14 +205,14 @@ if [[ ${TABLESPACES} != *"TRIDATA_INDX "* ]]; then
DROPPED TABLE RECOVERY ON;"
rc=$?
if [ $rc -ne "0" ]; then
echo "Unable to create TABLESPACE TRIDATA_INDX for some reason = $rc"
echo "Unable to create TABLESPACE { db2_schema }_INDX for some reason = $rc"
exit $rc
fi
else
echo "TABLESPACE TRIDATA_INDX already exists"
fi
else
echo "TABLESPACE { db2_schema }_INDX already exists"
fi

db2 "SELECT * FROM SYSCAT.TABLESPACES WHERE TBSPACE = 'TRIDATA_INDX'"
db2 "SELECT * FROM SYSCAT.TABLESPACES WHERE TBSPACE = '{ db2_schema }_INDX'"

if [[ ${TABLESPACES} != *"TRITEMP "* ]]; then
echo "Creating TABLESPACE TRITEMP"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ DATESTAMP=`date "+%Y-%m-%d-%H.%M.%S"`

# Database and schema configuration
DATABASE="BLUDB"
SCHEMA="TRIDATA"
SCHEMA={ db2_schema }

# Loop through all databases (in case there are multiple)
for db in `db2 list db directory | grep -B 5 Indirect | grep "Database name" | cut -d= -f2`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,12 @@ then
exit
fi

DB2_SCHEMA="${DB2_SCHEMA:-TRIDATA}"
role=`db2 get db cfg for $1 | grep "HADR database role" | cut -d= -f2 |sed 's/ //g'`
if [ "$role" != "STANDBY" ]; then
db2 connect to $1
if [ $? -eq 0 ]; then
schemalist=(`db2 connect to $1 >/dev/null;db2 -x "select SCHEMANAME from syscat.SCHEMATA where SCHEMANAME in ('MAXIMO','TRIDATA','TRIRIGADC')"`)
schemalist=(`db2 connect to $1 >/dev/null;db2 -x "select SCHEMANAME from syscat.SCHEMATA where SCHEMANAME in ('MAXIMO','${DB2_SCHEMA}','TRIRIGADC')"`)
i=0
while [[ $i -lt ${#schemalist[*]} ]]
do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ spec:
if [[ "$MAS_APP_ID" == "manage" ]]; then
export DB2_SCHEMA="MAXIMO"
elif [[ "$MAS_APP_ID" == "facilities" ]]; then
export DB2_SCHEMA="TRIDATA"
export DB2_SCHEMA="{{ .Values.facilities_db2_schema | default "TRIDATA" }}"
fi

if [[ "$MAS_APP_ID" == "manage" ]]; then
Expand Down Expand Up @@ -603,7 +603,7 @@ spec:
FACILITIES_TABLESPACES_PATH=/tmp/db2-scripts-facilities-updated/create-tablespaces.sh
FACILITIES_SCHEMA_PATH=/tmp/db2-scripts-facilities-updated/create-schema.sh
sed "s/{ db2_dbname }/$DB2_DBNAME/g; s/{ db2_user }/$DB2_USER/g;" /tmp/db2-scripts-facilities/db2config.sh.j2 > ${FACILITIES_DB2_SETUP_PATH}
sed "s/{ db2_dbname }/$DB2_DBNAME/g;" /tmp/db2-scripts-facilities/create-tablespaces.sh.j2 > ${FACILITIES_TABLESPACES_PATH}
sed "s/{ db2_dbname }/$DB2_DBNAME/g; s/{ db2_schema }/$DB2_SCHEMA/g;" /tmp/db2-scripts-facilities/create-tablespaces.sh.j2 > ${FACILITIES_TABLESPACES_PATH}
sed "s/{ db2_dbname }/$DB2_DBNAME/g; s/{ db2_user }/$DB2_USER/g; s/{ db2_schema }/$DB2_SCHEMA/g;" /tmp/db2-scripts-facilities/create-schema.sh.j2 > ${FACILITIES_SCHEMA_PATH}

echo ""
Expand All @@ -617,7 +617,7 @@ spec:
echo ""
echo "Copying runstats_volatile.sh to /mnt/backup/bin in c-${DB2_INSTANCE_NAME}-db2u-0"
echo "--------------------------------------------------------------------------------"
cp /tmp/db2-scripts-facilities/runstats_volatile.sh /tmp/runstats_volatile.sh
sed "s/{ db2_schema }/$DB2_SCHEMA/g;" /tmp/db2-scripts-facilities/runstats_volatile.sh > /tmp/runstats_volatile.sh
oc cp /tmp/runstats_volatile.sh ${DB2_NAMESPACE}/c-${DB2_INSTANCE_NAME}-db2u-0:/tmp/runstats_volatile.sh -c db2u || exit $?
oc exec -n ${DB2_NAMESPACE} c-${DB2_INSTANCE_NAME}-db2u-0 -- su -lc "sudo rm -f ${INSTHOME}/bin/runstats_volatile.sh && sudo mv /tmp/runstats_volatile.sh ${INSTHOME}/bin/runstats_volatile.sh && sudo chmod +x ${INSTHOME}/bin/runstats_volatile.sh && sudo chown db2inst1:db2iadm1 ${INSTHOME}/bin/runstats_volatile.sh" db2inst1 || exit $?
# Execute db2configdb.sh
Expand Down
1 change: 1 addition & 0 deletions instance-applications/120-ibm-db2u-database/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ instance_id: xxx
db2_instance_name: xxx
db2_namespace: xxxx
db2_instance_home_path: /mnt/blumeta0/home/db2inst1
facilities_db2_schema: "TRIDATA"

sm_aws_access_key_id: xxx
sm_aws_secret_access_key: xxxx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ data:
import sys
import re
import time
tririga_schema = os.getenv("TRIRIGA_SCHEMA", "TRIDATA")


# Initialization of
mas_application_id = os.getenv("MAS_APP_ID")
Expand Down Expand Up @@ -283,8 +285,8 @@ data:
("MAXTEMP", "MAXTEMPBP"),
]
facilities_tablespaces = [
("TRIDATA_DATA", "TRIBUFPOOL"),
("TRIDATA_INDX", "TRIBUFPOOLINDEX"),
(f"{tririga_schema}_DATA", "TRIBUFPOOL"),
(f"{tririga_schema}_INDX", "TRIBUFPOOLINDEX"),
("TRITEMP", "TRITEMPBP"),
("DEDICATED_DATA", "DEDICATEDBPDATA"),
("DEDICATED_INDEX", "DEDICATEDBPINDX"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
E.g. passing in a new environment variable.
Included in $_job_hash (see below).
*/}}
{{- $_job_version := "v2" }}
{{- $_job_version := "v3" }}

{{- /*
10 char hash appended to the job name taking into account $_job_config_values, $_job_version and $_cli_image_digest
Expand Down Expand Up @@ -165,6 +165,8 @@ spec:
- name: DB2_DATABASE_CONFIG
value: {{ .Values.db2_database_db_config | toJson | quote }}
{{- end }}
- name: TRIRIGA_SCHEMA

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this change is required in RDS as well, then corresponding cli and tekton files should also be updated

value: {{ .Values.facilities_db2_schema | default "TRIDATA" | quote }}
volumeMounts:
- name: dbs-rds-secret-store
mountPath: /etc/mas/dbs-rds-creds/
Expand Down
7 changes: 6 additions & 1 deletion instance-applications/120-ibm-dbs-rds-database/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,9 @@ backup:
# Full backup configuration (Sundays at 2 AM)
full:
enabled: true
schedule: "0 2 * * 0" # Cron: Every Sunday at 2 AM
schedule: "0 2 * * 0" # Cron: Every Sunday at 2 AM

# TRIRIGA schema name for the Facilities application.
# Only change this if the source system uses a non-standard schema name.
# Defaults to TRIDATA — existing deployments are unaffected.
facilities_db2_schema: "TRIDATA"
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,8 @@ run_sanity_test: false
# customization_archive_secret_names:
# - secret_name: ""
# username: ""
# password: ""
# password: ""


# Facilities (TRIRIGA) schema name. Defaults to TRIDATA.
# tririga_db_schema: "TRIDATA"
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,12 @@ spec:
{{- end }}
{{- end }}
{{- else }}


debug_mas_rds_databases: "EMPTY - No RDS databases configured for manage"
{{- end }}
{{- end }}


{{- if (eq $value.mas_app_id "facilities") }}
{{- if not (empty $.Values.ibm_dbs_rds_databases) }}
Expand All @@ -196,6 +199,9 @@ spec:
{{- end }}
{{- end }}
{{- end }}
{{- if $value.tririga_db_schema }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this tririga_db_schema value and where is it coming from?

tririga_db_schema: {{ $value.tririga_db_schema }}
{{- end }}
{{- end }}

{{- if (eq $value.mas_app_id "iot") }}
Expand Down
Loading