Skip to content

Commit 7c50495

Browse files
yahondaclaude
andcommitted
Upgrade 11g server timezone to match Instant Client 21.15
Oracle 11g XE ships with DSTv14, while Instant Client 21.15 uses v35. This mismatch causes ORA-01805 when fetching DATE/TIMESTAMP values via ruby-oci8. Copy the newer timezone files from Instant Client into the 11g container and run DBMS_DST.begin_upgrade + upgrade_database + end_upgrade to bring the server's timezone version up to match the client. See https://oracle-base.com/articles/misc/update-database-time-zone-file Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b7f055e commit 7c50495

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

.github/workflows/test_11g.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,51 @@ 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
77+
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.
81+
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
76121
- name: Create database user
77122
run: |
78123
./ci/setup_accounts.sh

0 commit comments

Comments
 (0)