Skip to content

Upgrade 11g server timezone to match Instant Client 21.15 #30

Upgrade 11g server timezone to match Instant Client 21.15

Upgrade 11g server timezone to match Instant Client 21.15 #30

Workflow file for this run

name: test_11g
on:
push:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
ruby: [
'4.0',
# '3.4',
# '3.3',
# '3.2',
# ruby-head,
# ruby-debug,
# truffleruby,
# truffleruby-head
]
env:
ORACLE_HOME: /opt/oracle/instantclient_21_15
LD_LIBRARY_PATH: /opt/oracle/instantclient_21_15
NLS_LANG: AMERICAN_AMERICA.AL32UTF8
TNS_ADMIN: ./ci/network/admin
DATABASE_NAME: XE
TZ: Europe/Riga
DATABASE_SYS_PASSWORD: Oracle18
DATABASE_VERSION: 11.2.0.2
services:
oracle:
image: gvenzl/oracle-xe:11
ports:
- 1521:1521
env:
TZ: Europe/Riga
ORACLE_PASSWORD: Oracle18
options: >-
--health-cmd healthcheck.sh
--health-interval 10s
--health-timeout 5s
--health-retries 10
steps:
- uses: actions/checkout@v6
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Create symbolic link for libaio library compatibility
run: |
sudo ln -s /usr/lib/x86_64-linux-gnu/libaio.so.1t64 /usr/lib/x86_64-linux-gnu/libaio.so.1
- name: Download Oracle instant client
run: |
wget -q https://download.oracle.com/otn_software/linux/instantclient/2115000/instantclient-basic-linux.x64-21.15.0.0.0dbru.zip
wget -q https://download.oracle.com/otn_software/linux/instantclient/2115000/instantclient-sqlplus-linux.x64-21.15.0.0.0dbru.zip
wget -q https://download.oracle.com/otn_software/linux/instantclient/2115000/instantclient-sdk-linux.x64-21.15.0.0.0dbru.zip
- name: Install Oracle instant client
run: |
sudo mkdir -p /opt/oracle/
sudo unzip -q instantclient-basic-linux.x64-21.15.0.0.0dbru.zip -d /opt/oracle
sudo unzip -qo instantclient-sqlplus-linux.x64-21.15.0.0.0dbru.zip -d /opt/oracle
sudo unzip -qo instantclient-sdk-linux.x64-21.15.0.0.0dbru.zip -d /opt/oracle
echo "/opt/oracle/instantclient_21_15" >> $GITHUB_PATH
- name: Install JDBC Driver
run: |
wget -q https://download.oracle.com/otn-pub/otn_software/jdbc/233/ojdbc11.jar -O ./lib/ojdbc11.jar
- name: Upgrade Oracle 11g timezone file to match Instant Client
run: |
# Oracle 11g XE ships with DSTv14; Instant Client 21.15 uses v35.
# Copy newer timezone files into the 11g container and run DBMS_DST
# to upgrade the server so it matches the client.
ORACLE_CONTAINER=$(docker ps --filter "ancestor=gvenzl/oracle-xe:11" -q)
CLIENT_ZONEINFO=/opt/oracle/instantclient_21_15/oracore/zoneinfo
ls -la "$CLIENT_ZONEINFO" || ls -la /opt/oracle/instantclient_21_15/
# Copy newer timezone files from the Instant Client into the 11g container
for f in "$CLIENT_ZONEINFO"/timezlrg_*.dat "$CLIENT_ZONEINFO"/timezone_*.dat; do
[ -f "$f" ] || continue
docker cp "$f" "$ORACLE_CONTAINER":/u01/app/oracle/product/11.2.0/xe/oracore/zoneinfo/
done
docker exec "$ORACLE_CONTAINER" ls -la /u01/app/oracle/product/11.2.0/xe/oracore/zoneinfo/
# Run DBMS_DST to upgrade the database timezone version
sqlplus -S sys/${DATABASE_SYS_PASSWORD}@${DATABASE_NAME} as sysdba <<'SQL'
SET SERVEROUTPUT ON
SELECT version FROM v$timezone_file;
DECLARE
l_tz_version PLS_INTEGER;
BEGIN
l_tz_version := DBMS_DST.get_latest_timezone_version;
DBMS_OUTPUT.PUT_LINE('Latest timezone version available: ' || l_tz_version);
DBMS_DST.begin_prepare(l_tz_version);
DBMS_DST.end_prepare;
DBMS_DST.begin_upgrade(l_tz_version);
END;
/
SQL
# Restart the database to complete begin_upgrade
docker exec "$ORACLE_CONTAINER" bash -c 'echo "shutdown immediate;
startup;
exit" | sqlplus -S / as sysdba'
sqlplus -S sys/${DATABASE_SYS_PASSWORD}@${DATABASE_NAME} as sysdba <<'SQL'
SET SERVEROUTPUT ON
DECLARE
l_failures PLS_INTEGER;
BEGIN
DBMS_DST.upgrade_database(l_failures);
DBMS_DST.end_upgrade(l_failures);
DBMS_OUTPUT.PUT_LINE('Upgrade failures: ' || l_failures);
END;
/
SELECT version FROM v$timezone_file;
SQL
- name: Create database user
run: |
./ci/setup_accounts.sh
- name: Disable ActiveRecord for TruffleRuby
run: |
echo "NO_ACTIVERECORD=true" >> $GITHUB_ENV
if: "contains(matrix.ruby, 'truffleruby')"
- name: Bundle install
run: |
bundle install --jobs 4 --retry 3
- name: Run RSpec
run: |
RUBYOPT="-w --debug-frozen-string-literal" bundle exec rspec