Today, Gisela, a former team mate from CSS/ACS Support contacted me regarding an issue seen at a customer. She reported an ORA-39405 with impdp when you have mixed time zone versions. But how can this happen? And what are the potential workarounds? Since some of our hosted environments got into the same situation already, this may be worth a blog post and some explanation.

Photo by Benjamin Voros on Unsplash
Why does this happen?
You never cared about DST (Daylight Savings Time) files and versions of your database? This isn’t unusual, and in many environments actually not a problem I guess. Hence, you may have never seen the ORA-39405 with an Data Pump expdp/impdp run yet. But this may happen one day if you don’t pay attention.
The root cause is something we had to do in order to allow smooth transition and migration between environments. Since Oracle Database 19c Release Update (RU) 19.18.0 we ship all available time zone files and deploy them to $ORACLE_HOME/oracore/zoneinfo.
Read more about this change here.
This change was not only important to ease your admin tasks and prevent the situation we had seen too often, moving databases and PDBs from host 1 to host 2, and apparently the ORACLE_HOME on host 1 had newer time zone patches than on host 2, and the move failed. The same problem was even more disturbing when you as a care-taking DBA had applied DST patches to your source, and then tried to migrate it into OCI, and the recent time zone patches were missing.
But … there can be a downside
Unfortunately, as often with a change, not everybody is happy no matter how important and needed the change is, and how good our intentions are.
During a patching operation we add the files but we don’t update your database. You can trigger this when you use AutoUpgrade for patching with the upg1.timezone_upg=yes explicitly set. But if you use any other approach to lift your database from the old to the new home, the database’s DST version remains unchanged.
In contradiction, the creation of a new database pulls the newest available DST file from $ORACLE_HOME/oracore/zoneinfo. You can workaround this when you use the environment variable ORA_TZFILE and point it to your desired DST file in the earlier mentioned directory. Find this workaround described here.
Correction (Feb 1, 2024):
In an earlier version of the blog post I wrote that DBCA (Database Configuration Assistant) ignores the environment variable ORA_TZFILE and does not offer a drop-down list or item to choose the DST version you want your database to be created with. This got tracked under:
- Bug 35243563 – DBCA NEEDS AN OPTION TO CHOOSE THE DST VERSION A DATABASE GETS CREATED WITH
- ER 35232202 – ER FOR PROVIDING AN INPUT TO DBCA FOR CHOSING A SPECIFIC VERSION OF TIMEZONE FILE
- ER 26980562 – DBCA SHOULD PROVIDE AN OPTION FOR CUSTOMER TO CHOOSE THE DST TO BE ENABLED (rejected)
But this is not correct anymore, at least not in Oracle Database 19c with newer RUs.
Thanks to Andreas Groetz who pointed me to the changed behavior I learned and verified that you can set now the ORA_TZFILE variable, and then call DBCA in GUI mode to have your database freshly created – and it honors the variable’s setting. I can’t tell you from which RU this works but Andreas tried with 19.18, and there it works already.
Generally speaking, the technical reason for all these potential pitfalls is that you can’t downgrade time zone. It is a one-way street. So, when you take an export taken from a database with an older DST version and import it into a database on a higher DST version, all is fine. But when you try the reverse, the database does not know how to do the conversion. And since there is no downgrade for DST data types available, the import needs to be rejected.
But here our DST experts chimed in, and there are options evaluated whether this could be made possible as well.
Important Annotation – May 1, 2025
Before you continue reading, take note of this blog post:
since the below topic has been solved from 19.27.0 on with the Data Pump Bundle Patch.
What could go wrong?
At first, you create a database with an 19.17.0 home, and it will have DST V.32. You can always check the DST version your database is operating on with this query:
SELECT * FROM v$timezone_file; FILENAME VERSION CON_ID ---------------------------------------- timezlrg_32.dat 32 0
Now, months later, you deploy 19.20.0 and patch your existing database. It will of course still stay on DST V.32 – no change (unless you used AutoUpgrade and advised it explicitly to adjust the DST version as part of the patching process.
But you create now a new database out of your 19.20.0 home. And when you check, you will find out that it has a newer DST version:
SELECT * FROM v$timezone_file; FILENAME VERSION CON_ID -------------------- ---------- ---------- timezlrg_42.dat 42 0
This is no issue as long as you don’t export from the NEW database, and want to import into the OLD one. And of course, the same issue will trouble you when you want to unplug a PDB from the NEW database, and plug it into the OLD CDB. Since the DST file is missing, you will receive a plugin error, and the PDB will open only restricted until you apply the missing DST patch to your 19.17.0 home.
This actually is one of the core reasons why we ship the DST files. The unplug/plug scenario is coming, and of course also when you clone. The DST files are needed in both homes to prevent such issues.
For Data Pump you will receive the error mentioned in this post’s headline: ORA-39405 with impdp when you have mixed time zone versions. This gets explained nicely in MOS Note: 2793311.1 – ORA-39405: Oracle Data Pump Does Not Support Importing From A Source Database With TSTZ Version, too.
Potential workarounds
Now the crucial question is: How can you avoid such situations, and what are the potential workarounds for you?
Since I updated the blog post to explain that DBCA indeed does not ignore ORA_TZFILE anymore, I adjusted this section as well.
Workaround 0 – Use an underscore (added June 2, 2024)
This workaround is currently available in Oracle 21c and 23ai only. But we are checking whether it can be added to 19c as well. Stay tuned. The fix is included into Data Pump Bundle Patch 19.27.0 and newer. The fix even triggers a conversion where needed. This new parameter:
_datapump_bypass_tstz_check=TRUE
would override the check. Default of the parameter is FALSE. It is available from Oracle 21c onward natively but gets added from 19.27.0 RU with the Data Pump Bundle Patch on top as well.
Please make sure to read also:
Workaround 1 – Create databases via a DBCA or via script
Set the ORA_TZFILE variable, and either use DBCA or a script to create the databases with the DST setting you desire.
Workaround 2 – Update your DST version in all databases
I guess this is the most unlikely workaround even though it would be a good best practice. Whenever you patch, make sure you use either AutoUpgrade with upg1.timezone_upg=yes or trigger the DST upgrade manually afterwards. This of course would require that you patch all your databases more or less at the same time, and not any of them just months later. It would work but I am unsure whether this is really a workaround matching reality.
Workaround 3 – Delete the unwanted files
This is potentially the most efficient workaround but not ideal as you can see from the comments below.
If you are strictly on-prem but also one you won’t most likely receive official blessing from Oracle Support. Still, I have customers using this one, and I don’t see any technical danger involved with it. But keep in mind: I am not Oracle Support, and I can’t give official blessings for any attempt to delete files we deploy into your Oracle Home with a patch.
The idea is simple: You just create a job which runs on a regular basis (or at least after every patch apply) and deletes all newer unwanted DST files from all $ORACLE_HOME/oracore/zoneinfo directories and its subdirectories. This way, you prevent new databases being created on newer time zone files. Unfortunately, the big downside here: You will miss the newer time zone files.
But – and thanks for this feedback – Hansjörg commented to better NOT use Workaround 3 on an Exadata or Engineered System or in Cloud VMs since the tooling (for instance, odacli or dbcli) will get in trouble.
Workaround 4 – The unofficial way
Well, I had no idea how many people would have been tempted to challenge this, or find better or smarter ways. Let me just point to Kamil Stawiarski’s blog post. Kamil is stopping the process, injecting a new value into the Master Table. Simple, isn’t it?
Cool approach – and it works nicely if you have OS access.
Workaround 5 – The insane way
But of course, we have crazy people in our team, too. Rodrigo was forced with the same challenge recently but in Autonomous Database where you don’t have OS access. So his advanced solution is a bit different. He uses a trigger which creates a job when the Master Table gets created, and this job tries to update the value in the Master table. Once it succeeded, it will stop and exit. The difference here is that Rodrigo has everything (including the import) done with DBMS_DATAPUMP, and nothing happens on the command line but everything within the database.
- Schema trigger AFTER DDL which fires once a CREATE TABLE for the Master table gets issued
- Do a metadata_only import to check whether the DST version is lower
- Background job started in an infinite loop. This job does an update on the Master table until the update succeeds – so you can see many failing update statements.
And of course, you want to do this only when you are 100% certain that you have no time zone data in your database.
Further Links and Information
- Remember ORA-39405? There is a fix for it
- RU contains now all available time zone / DST patches
- MOS Note: 2793311.1 – ORA-39405: Oracle Data Pump Does Not Support Importing From A Source Database With TSTZ Version
- Use the ORATZ_FILE environment variable to create a database with a lower DST version
- Kamil Stawiarski’s Blog Post how to infiltrate the Master Table and workaround this error
–Mike
For deploying new databases in our on-prem cloud, we use a deployment-procedure in our OMS/OEM.
Which indeed under the hood uses dbca to create the database.
To make sure the database uses a predefined DST version, we use the ORA_TZFILE variable set in the ‘.bashrc’ file of the user of our emagent.
This way the deployment procedure is using the ORA_TZFILE defined in the .bashrc.
I just tested it this week, because I needed a database with an older DST version, and it worked like a charm.
Jannes,
you are right – and almost at the same time a customer told me about it either.
Hence, I updated the blog post.
I can’t tell when this “fix” came in silently. It is undocumented, none of the bugs has been updated – and all enhancements got rejected beforehand by the owner of the tool.
Good that it works now – but I can’t tell you since when exactly.
Cheers,
Mike
Hi,
just to clarify using Workaround 3: Don’t use Workaround 3 on engineered Systems or on cloud database vms. This may cause issues with tools like odacli or dbcli.
Thanks Hansjoerg – I added your comment to the blog post!
Cheers,
Mike
Hi Mike,
I think workaround 2 could be a starting point for snow ball effect. I just send you an email on that.
Is it my understanding correct, that import (if it would be possilble) will have problems mostly with “TIMESTAMP WITH LOCAL TIMEZONE” (as they are relative to DBTIMEZONE setting) ?
It would be nice to have some key in “impdp” like “yeah, ignore timezone difference, my data are OK anyway”
Alex,
impdp to a higher DST version is never a problem. The issue is when you want to go backwards.
We are evaluation possible solutions.
Cheers,
Mike
Hi friends,
not really regarding this topic i’m currently experiencing an unsual behaviour when exporting an oracle instance schemas, 4 of 7 schemas are not exported, not when FULL=YES and also not when specifield schemas=….
These 4 schemas have been created after 2021/11/02, i assume the database version has been 19.12 at that time. Nothing unusal found yet from system-table views, also neither expdp shows errors and alert log also nothing… somebody ever experienced something like this? I’m clueless and trying to get some feedback from the community prior to contacting oracle-support. Any hints appreciated
br, Till
ps.: Current version 19.22 datapump patches applied as well
Hi Till,
haven’t seen this – please file an SR and collect the necessary information beforehand:
Cheers,
Mike
So it was your “good intentions” that makes it impossible to copy tables from a fully patched version of 19c to another at a different patch level using data pump?
Basically, you make it impossible for us to do our jobs. Thanks so much. I guess the only reliable procedure is to create our own copy routines, as once again, Oracle has screwed the pooch.
Hi Alan,
we have a workaround – and I am checking currently whether we’ll be able to get it in 19c as well.
It is available in 21c and onwards.
_datapump_bypass_tstz_check=true
would override it at your own risk.
Cheers,
Mike
+1 for getting this option into 19c. Especially when RUs and now quarterly patches are including the time zone file updates.
Working on it …
Cheers,
Mike
The normal process to upgrade timezones works
@?/rdbms/admin/utltz_countstats.sql
@?/rdbms/admin/utltz_upg_check.sql
@?/rdbms/admin/utltz_upg_apply.sql
Note last step recycles your database twice. It does warn you.
Thanks Vic, we know – but this isn’t often an option since the problem happens on the database you want to import into.
IN many cases, you can’t upgrade the TZ version just to a higher setting.
Cheers,
Mike
Hi Mike,
thank you for posting the concepts of “workaraound 5”.
On a sandbox database, I succeded even without creating a ddl trigger. My version of “workaraound 5” relies on the assumption that the timezone version is stored in the records with process_order=-1 and process_order=-2. This pl/sql block must be executed before starting the Datapump job:
impdp userid=imp_dba job_name=MY_MASTER_TABLE…
declare n number := 1;begin
loop
begin -- fake timezone version of IMPORT or EXPORT record, but not for both...
-- execute immediate 'update imp_dba.MY_MASTER_TABLE set property=40 where property=32 and process_order=-2 and operation=''IMPORT''';
execute immediate 'update imp_dba.MY_MASTER_TABLE set property=32 where property=40 and process_order=-1 and operation=''EXPORT''';
if sql%rowcount > 0 then
dbms_output.put_line ('update done at loop counter: ' || n );
commit;
exit;
end if;
exception
when others then
null;
end;
n := n + 1;
rollback; -- before sleeping: release the table share lock (0 rows updated when record is not yet available)
sys.dbms_session.sleep(1/50);
end loop;
end;
/
regards,
Norbert
Hi Norbert,
thanks a lot – and I will share your w/a with Rodrigo as well.
Cheers, and thanks again for sharing!
Mike
Hi Mike,
just wanted to share an update on the TZ issue that might help others as well.
I’m working on a migration from ADB-S to ADB-D and came across the timezone issue. My source db is an ADB-S 19.27 with TZ 44 and my target an ADB-D 19.26 with TZ 43. As expected the import fails with:
ORA-39405: Oracle Data Pump does not support importing from a source database with TSTZ version 44 into a target database with TSTZ version 43.
In ADB-D you can update the TZ of the database during a maintenance window:
Open your Container Database details page, then click on “Actions” and schedule a maintenance. The maintenance page gives you the option to update the TZ.
https://docs.oracle.com/en/cloud/paas/autonomous-database/dedicated/sqkuc/index.html
For those looking for upgrading the ADB-S TZ information…
You can use:
BEGIN
DBMS_CLOUD_ADMIN.ENABLE_FEATURE(
feature_name => ‘AUTO_DST_UPGRADE’);
END;
/
and here the link:
https://docs.oracle.com/en/cloud/paas/autonomous-database/serverless/adbsb/manage-time-zone-file-version.html#GUID-C6B4A8AA-89B2-43D1-9510-64C75D27F0D9
THANK YOU, Klaus!!
Cheers,
Mike
Hi Mike,
Any news about this feature : _datapump_bypass_tstz_check=true ?
I’am on a 19.29 DB + 19.29 Datapump patch, and still no luck…
Thanks Yvan.
“`
KILKENYD:orp19000@lx9893:~ > opatch lsinventory | grep -B 2 -A 2 -i unique
Patch 38535360 : applied on Wed Oct 29 16:25:40 CET 2025
Unique Patch ID: 28165873
Patch description: “DATAPUMP BUNDLE PATCH 19.29.0.0.0”
Created on 16 Oct 2025, 00:49:07 hrs PST8PDT
—
Patch 38322923 : applied on Wed Oct 29 16:24:09 CET 2025
Unique Patch ID: 28061972
Patch description: “OCW RELEASE UPDATE 19.29.0.0.0 (38322923)”
Created on 29 Sep 2025, 23:46:39 hrs PST8PDT
—
Patch 38291812 : applied on Wed Oct 29 16:21:38 CET 2025
Unique Patch ID: 28130960
Patch description: “Database Release Update : 19.29.0.0.251021 (38291812)”
Created on 6 Oct 2025, 17:36:33 hrs UTC
KILKENYD:orp19000@lx9893:~ > sdb
SQL*Plus: Release 19.0.0.0.0 – Production on Thu Oct 30 10:06:33 2025
Version 19.29.0.0.0
Copyright (c) 1982, 2025, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 – Production
Version 19.29.0.0.0
SQL> ALTER SESSION SET “_datapump_bypass_tstz_check”=TRUE;
ALTER SESSION SET “_datapump_bypass_tstz_check”=TRUE
*
ERROR at line 1:
ORA-02248: invalid option for ALTER SESSION
SQL>
“`
Did you read this from the blog post?
Important Annotation – May 1, 2025
Before you continue reading, take note of this blog post:
Remember ORA-39405? There is a fix for it
https://mikedietrichde.com/2025/02/05/remember-ora-39405-with-impdp-there-is-a-fix-for-it/
since the below topic has been solved from 19.27.0 on with the Data Pump Bundle Patch.
Thanks 🙂
Mike
Thank you so much for the easy solution (DPBP patch 38535360 on 19.29).
This really saved my day.
Welcome, Paul!