Skip to content

Commit 91e7ca2

Browse files
yahondaclaude
andcommitted
Use 11g server's v14 timezone file via ORA_TZFILE
Approach: - Oracle 11g XE uses timezone v14; Instant Client 21.15 uses v35 - 11g's DBMS_DST doesn't support upgrading to v35 (GET_LATEST_TIMEZONE_VERSION was added in 12c), so we cannot upgrade the server - Instead, extract v14 files from the 11g container and point the client at them via ORA_TZFILE — client stays at 21.15, just uses v14 tz data Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 7c50495 commit 91e7ca2

1 file changed

Lines changed: 11 additions & 43 deletions

File tree

.github/workflows/test_11g.yml

Lines changed: 11 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -73,51 +73,19 @@ jobs:
7373
- name: Install JDBC Driver
7474
run: |
7575
wget -q https://download.oracle.com/otn-pub/otn_software/jdbc/233/ojdbc11.jar -O ./lib/ojdbc11.jar
76-
- name: Upgrade Oracle 11g timezone file to match Instant Client
76+
- name: Configure ORA_TZFILE to match Oracle 11g server
7777
run: |
78-
# Oracle 11g XE ships with DSTv14; Instant Client 21.15 uses v35.
79-
# Copy newer timezone files into the 11g container and run DBMS_DST
80-
# to upgrade the server so it matches the client.
78+
# Oracle 11g XE uses timezone file v14; Instant Client 21.15 embeds v35.
79+
# This mismatch causes ORA-01805 when ruby-oci8 fetches DATE/TIMESTAMP
80+
# values. Copy the v14 files from the 11g container and point the
81+
# Instant Client at them via ORA_TZFILE.
8182
ORACLE_CONTAINER=$(docker ps --filter "ancestor=gvenzl/oracle-xe:11" -q)
82-
CLIENT_ZONEINFO=/opt/oracle/instantclient_21_15/oracore/zoneinfo
83-
ls -la "$CLIENT_ZONEINFO" || ls -la /opt/oracle/instantclient_21_15/
84-
# Copy newer timezone files from the Instant Client into the 11g container
85-
for f in "$CLIENT_ZONEINFO"/timezlrg_*.dat "$CLIENT_ZONEINFO"/timezone_*.dat; do
86-
[ -f "$f" ] || continue
87-
docker cp "$f" "$ORACLE_CONTAINER":/u01/app/oracle/product/11.2.0/xe/oracore/zoneinfo/
88-
done
89-
docker exec "$ORACLE_CONTAINER" ls -la /u01/app/oracle/product/11.2.0/xe/oracore/zoneinfo/
90-
# Run DBMS_DST to upgrade the database timezone version
91-
sqlplus -S sys/${DATABASE_SYS_PASSWORD}@${DATABASE_NAME} as sysdba <<'SQL'
92-
SET SERVEROUTPUT ON
93-
SELECT version FROM v$timezone_file;
94-
DECLARE
95-
l_tz_version PLS_INTEGER;
96-
BEGIN
97-
l_tz_version := DBMS_DST.get_latest_timezone_version;
98-
DBMS_OUTPUT.PUT_LINE('Latest timezone version available: ' || l_tz_version);
99-
DBMS_DST.begin_prepare(l_tz_version);
100-
DBMS_DST.end_prepare;
101-
DBMS_DST.begin_upgrade(l_tz_version);
102-
END;
103-
/
104-
SQL
105-
# Restart the database to complete begin_upgrade
106-
docker exec "$ORACLE_CONTAINER" bash -c 'echo "shutdown immediate;
107-
startup;
108-
exit" | sqlplus -S / as sysdba'
109-
sqlplus -S sys/${DATABASE_SYS_PASSWORD}@${DATABASE_NAME} as sysdba <<'SQL'
110-
SET SERVEROUTPUT ON
111-
DECLARE
112-
l_failures PLS_INTEGER;
113-
BEGIN
114-
DBMS_DST.upgrade_database(l_failures);
115-
DBMS_DST.end_upgrade(l_failures);
116-
DBMS_OUTPUT.PUT_LINE('Upgrade failures: ' || l_failures);
117-
END;
118-
/
119-
SELECT version FROM v$timezone_file;
120-
SQL
83+
sudo mkdir -p /opt/oracle/instantclient_21_15/oracore/zoneinfo
84+
docker cp "$ORACLE_CONTAINER":/u01/app/oracle/product/11.2.0/xe/oracore/zoneinfo/timezlrg_14.dat /tmp/timezlrg_14.dat
85+
docker cp "$ORACLE_CONTAINER":/u01/app/oracle/product/11.2.0/xe/oracore/zoneinfo/timezone_14.dat /tmp/timezone_14.dat
86+
sudo mv /tmp/timezlrg_14.dat /opt/oracle/instantclient_21_15/oracore/zoneinfo/
87+
sudo mv /tmp/timezone_14.dat /opt/oracle/instantclient_21_15/oracore/zoneinfo/
88+
echo "ORA_TZFILE=/opt/oracle/instantclient_21_15/oracore/zoneinfo/timezlrg_14.dat" >> $GITHUB_ENV
12189
- name: Create database user
12290
run: |
12391
./ci/setup_accounts.sh

0 commit comments

Comments
 (0)