Sometimes there is just a simple question at the beginning. Like Daniel and I discussed this morning. Does AutoUpgrade check if the time zone file in source is higher than in target? While we discussed this, I downloaded the patches already to try it out. And in addition, I could double-check whether the time zone patches for 19c are now RU-independent finally. But the question remains for Upgrade: What if your time zone in source is newer than in target?

Photo by Srikanta H. U on Unsplash
My intention wasn’t initially to write a longer blog post. But read below …
Patching my 11.2.0.4 database with DST V.34
It all starts with the right time zone patch – and this strange sequence of steps I have to do at first.
Time Zone Spaghetti
- Find the most recent time zone patch available:
MOS Note: 412160.1 – Updated DST Transitions and New Time Zones in Oracle RDBMS and OJVM Time Zone File Patches
Gosh, this note really needs a cleanup … At least after scrolling back and forth for 3 minutes I find what I’m looking for:
.
. - Download the patch – in my case for the 11.2.0.4 environment:
Patch Download for DST V.34 from MyOracle Support
.
- The patch has a readme associated with it. But there is also a note linked from MOS Note: 412160.1 on how to apply the patch:
MOS Note: 2602555.1 – Applying the DSTv34 update for the Oracle Database
.
. - To update the time zone settings in my 11.2.0.4 database I then I need to download these scripts from MOS 1585343.1 – Scripts to update the RDBMS DST (timezone) version in an 11gR2 or 12c database. Just on the side, from Oracle 18c on these scripts are included in the
?/rdbms/admin
– but not in 11.2.0.4.
.
If I’d ever asked myself why customers don’t apply time zone patches so often, you’ll find the answer above. Or how did a customer from Poland call it a while ago: “Time Zone Spaghetti“. He told me that he started reading about DST on MOS, and after two hours he ended up with the note he started reading initially – and still didn’t know what to do.
And at this point you know why my entry sentence was meant honestly: Such a simple question …
Patch, patch, patch …
Yes, well … now I hope I have everything. But I need to apply the patch. As I do this quite often, I know what to do:
- Unpack the patch into a directory
cd
to this directory- opatch conflict check:
opatch prereq CheckConflictAgainstOHWithDetail -ph ./
opatch apply
And then connect to my database and run the two scripts:
-
start upg_tzv_check.sql
-
start upg_tzv_apply.sql
The latter script will restart the database twice. So despite the fact that you can apply the time zone patch binary while the database is up, you will encounter downtime when you adjust the time zone. And the downtime depends on the amount of data requiring change as MOS 1585343.1 explains in detail:
For the second part of upg_tzv_apply.sql after the “INFO: Upgrading all non-SYS TSTZ data.” message -> the DBMS_DST.UPGRADE_DATABASE used by upg_tzv_apply.sql will take exclusive locks on the non-SYS tables when they are actually upgraded, so this might provoke issues (deadlocks have been observed) and we strongly suggest to NOT start any applications who use the tables processed until the complete DST update is done. Other applications may already be restarted if needed.
Maybe this is another reason why time zone patches don’t get applied frequently.
Final check whether my database’s time zone got upgraded:
column property_name format a32
column value format a14
SELECT PROPERTY_NAME, SUBSTR(property_value, 1, 30) value
FROM DATABASE_PROPERTIES
WHERE PROPERTY_NAME LIKE 'DST_%'
ORDER BY PROPERTY_NAME;
PROPERTY_NAME VALUE
-------------------------------- --------------
DST_PRIMARY_TT_VERSION 34
DST_SECONDARY_TT_VERSION 0
DST_UPGRADE_STATE NONE
Wow! I’m done with the preparation for my test.
Test Setup with higher DST in source
After all these easy steps, I’m fully warmed up now. I can concentrate on the initial question.
My 11.2.0.4 database has now DST V.34 – and let me check my 19.6.0 database environment I’d like to upgrade to. I connect to an already existing 19c database:
PROPERTY_NAME VALUE -------------------------------- -------------- DST_PRIMARY_TT_VERSION 32 DST_SECONDARY_TT_VERSION 0 DST_UPGRADE_STATE NONE SELECT version FROM v$timezone_file; VERSION ---------- 32
This is the situation I wanted to check for. The target home has a lower time zone version installed than the source. How will the upgrade react to it?
Just in case you are asking now how to verify this when you have NO existing database? Go to /u01/app/oracle/product/19/oracore/zoneinfo
, and check for the highest number in timezone_n.dat
. In my case this is timezone_32.dat
whereas in my 11.2.0.4 home it is already timezone_34.dat
.
AutoUpgrade
I invoke an analyze run.
java -jar $OH19/rdbms/admin/autoupgrade.jar -config UP19.cfg -mode analyze AutoUpgrade tool launched with default options Processing config file ... +--------------------------------+ | Starting AutoUpgrade execution | +--------------------------------+ 1 databases will be analyzed Type 'help' to list console commands upg> Job 100 completed ------------------- Final Summary -------------------- Number of databases [ 1 ] Jobs finished successfully [1] Jobs failed [0] Jobs pending [0] ------------- JOBS FINISHED SUCCESSFULLY ------------- Job 100 for FTEX
This looks good at first. But let us check the ftex_preupgrade.html
file in ~/upg_logs/FTEX/100/prechecks
:

AutoUpgrade Prechecks HTML File gives you a good overview on checks and results
Hm? I’m skeptical because of the FixUp Available: Yes
. But my config file says upg1.timezone_upg=no
. Let me change this to “yes
” and repeat the analyze
run. But this doesn’t change anything.
The message is clear. I would need to patch my target home at first.
But what happens if I ignore this?
$ java -jar $OH19/rdbms/admin/autoupgrade.jar -config UP19.cfg -mode deploy AutoUpgrade tool launched with default options Processing config file ... +--------------------------------+ | Starting AutoUpgrade execution | +--------------------------------+ 1 databases will be processed Type 'help' to list console commands upg> ------------------------------------------------- Errors in database [FTEX] Stage [DBUPGRADE] Operation [STOPPED] Status [ERROR] Info [ Error: UPG-1400 UPGRADE FAILED [FTEX] Cause: This indicates that the database upgrade failed with errors. For further details, see the log file located at /home/oracle/upg_logs/FTEX/102/autoupgrade_20200409_user.log] ------------------------------------------------- Logs: [/home/oracle/upg_logs/FTEX/102/autoupgrade_20200409_user.log] -------------------------------------------------
Very simple – the upgrade fails shortly after invocation. It has to. The log tells me what has happened:
2020-04-09 11:20:07.245 ERROR DATABASE NAME: FTEX CAUSE: ERROR at Line 892 in [/home/oracle/upg_logs/FTEX/102/dbupgrade/catupgrd20200409111829ftex0.log] REASON: ORA-01722: invalid number ACTION: [MANUAL] DETAILS: 01722, 00000, "invalid number" // *Cause: The specified number was invalid. // *Action: Specify a valid number.
Magic ORA-1722 – invalid number. This means one of the initial upgrade checks failed when the upgrade got kicked off. And it prevents your database from being damaged. Nothing to restore from your side here. You just need to shut the database down in the 19c environment, and start it up again in the source environment.
preupgrade.jar and dbupgrade
If you’d gone the classic approach of using preupgrade.jar
and dbupgrade
, you would have gotten the same result
$ java -jar $OH19/rdbms/admin/preupgrade.jar TEXT TERMINAL Report generated by Oracle Database Pre-Upgrade Information Tool Version 19.0.0.0.0 Build: 1 on 2020-04-09T11:33:33 Upgrade-To version: 19.0.0.0.0 ======================================= Status of the database prior to upgrade ======================================= Database Name: FTEX Container Name: Not Applicable in Pre-12.1 database Container ID: Not Applicable in Pre-12.1 database Version: 11.2.0.4.0 DB Patch Level: PSU 11.2.0.4.200114 Compatible: 11.2.0.4.0 Blocksize: 8192 Platform: Linux x86 64-bit Timezone File: 34 Database log mode: NOARCHIVELOG Readonly: FALSE Edition: EE Oracle Component Upgrade Action Current Status ---------------- -------------- -------------- Oracle Server [to be upgraded] VALID ============== BEFORE UPGRADE ============== REQUIRED ACTIONS ================ None RECOMMENDED ACTIONS =================== ... 2. Patch the new 19 $ORACLE_HOME/oracore/zoneinfo/ with the version 34 time zone data file from the 11.2.0.4.0 $ORACLE_HOME/oracore/zoneinfo/. The database is using a time zone file version that is newer than the version shipped with the 19 release. The time zone file version used in your database must exist in the new Oracle home before upgrading the database. ... Preupgrade complete: 2020-04-09T11:33:33
Well, or not exactly. We will discuss in the team whether this should be marked as a REQUIRED ACTION instead.
The dbupgrade
run will error out as well with some longer debug output. Of course, in this case as well, I need to SHUTDOWN
my database, and STARTUP
it in the source environment. No restore needed.
DBUA
Well, I typically don’t use the DBUA for 1001 reasons. But I gave it a chance, too. And of course it had to fail as well. This is expected as the underlying checks are general checks.
It gave me a warning before upgrade:

DBUA 19c: Time Zone Warning
And failed with ORA-1722 when I started the upgrade process:

DBUA 19c: Error with ORA-1722
When you click “OK”, what can you do then?
I hit the RETRY button (greyed out in the screenshot above but visible and clickable when you confirm the error box with “OK”). Now the ORA-1722 wasn’t visible anymore – but instead a SEVERE error got displayed:

DBUA 19c: Retry is not a good idea – and makes no sense
There is the Progress Log button – let me see what it says:

DBUA 19c: Where is the correct log?
Well, it looks as if should check the directory: /u01/app/oracle/cfgtoollogs/dbua/upgrade2020-04-09_12-38-56PMFTEX
. And being honest, I gave up after a few minutes. Not even does the DBUA tell me which log file contains the error. But at least it displayed the correct error during the first run.
What really annoys me, and this is one of the 1001 reasons I mentioned above, is what happens when I abort the upgrade with DBUA:

DBUA 19c: Misleading famous last words … DON’T RESTORE!
This is at first incorrect, at second misleading and at third can cause you a lot of extra work. If I hadn’t called or mailed by customers several times already I would ignore that. But those got told by Support to restore their database at such point were not happy to learn later that this wasn’t needed.
The database is in good shape, the DBUA didn’t “destroy” it. You simply have to go back to your source environment and start the database up. That’s it.
Finally …
This is the error condition in the standard catupgrd0.log
, the main worker’s log file:
12:41:29 DOC>####################################################################### 12:41:29 DOC>####################################################################### 12:41:29 DOC> The following error is generated if (1) the old release uses a time 12:41:29 DOC> zone file version newer than the one shipped with the new oracle 12:41:29 DOC> release and (2) the new oracle home has not been patched yet: 12:41:29 DOC> 12:41:29 DOC> SELECT TO_NUMBER('MUST_PATCH_TIMEZONE_FILE_VERSION_ON_NEW_ORACLE_HOME') 12:41:29 DOC> * 12:41:29 DOC> ERROR at line 1: 12:41:29 DOC> ORA-01722: invalid number 12:41:29 DOC> 12:41:29 DOC> o Action: 12:41:29 DOC> Shutdown database ("alter system checkpoint" and then "shutdown abort"). 12:41:29 DOC> Patch new ORACLE_HOME to the same time zone file version as used 12:41:29 DOC> in the old ORACLE_HOME. 12:41:29 DOC> 12:41:29 DOC>####################################################################### 12:41:29 DOC>####################################################################### 12:41:29 DOC># 12:41:29 SQL> 12:41:29 SQL> Rem SELECT TO_NUMBER('MUST_PATCH_TIMEZONE_FILE_VERSION_ON_NEW_ORACLE_HOME') 12:41:29 SQL> 12:41:29 SQL> Rem Check if time zone file version used by the database exists in new home 12:41:29 SQL> SELECT TO_NUMBER('MUST_PATCH_TIMEZONE_FILE_VERSION_ON_NEW_ORACLE_HOME') 12:41:29 2 FROM sys.props$ 12:41:29 3 WHERE 12:41:29 4 ( 12:41:29 5 (name = 'DST_PRIMARY_TT_VERSION' AND TO_NUMBER(value$) > &C_LTZ_CONTENT_VER) 12:41:29 6 AND 12:41:29 7 (0 = (select count(*) from v$timezone_file)) 12:41:29 8 ); old 5: (name = 'DST_PRIMARY_TT_VERSION' AND TO_NUMBER(value$) > &C_LTZ_CONTENT_VER) new 5: (name = 'DST_PRIMARY_TT_VERSION' AND TO_NUMBER(value$) > 32) SELECT TO_NUMBER('MUST_PATCH_TIMEZONE_FILE_VERSION_ON_NEW_ORACLE_HOME') * ERROR at line 1: ORA-01722: invalid number Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Summary
Well, such a simple question … but it took me a while to verify all potential scenarios. And of course to patch my source with the DST V.34 patch. No idea why the time zone patch selection isn’t handled by an assistant note. It almost begs for such a note asking you for your database version you’d like to patch, then give you a choice to say either “Newest” or choose from an optional list, then give you the link to the patch to download and the scripts to apply it if necessary. Could be very simple …
Of course, especially AutoUpgrade may need a few additional tweaks to improve the process. We will discuss this internally and see what we can do.
Solution
If you wonder why the solution is coming after the summary: This is pure coincidence. When I wanted to shutdown my environment, I thought to myself: It isn’t finished yet. I will need to apply the DST V.34 patch now to my target environment and see if all works fine. And it will be a good chance to check whether time zone patches in 19c now have been created patch-level-independently, or as initially falsely depending on a specific patch level (i.e., various patches for 19.4.0, 19.5.0, 19.6.0 and so on).
I downloaded the patch marked as 19.0.0.0.0 from the same patch number from MOS as the one for 11.2.0.4 above.
Then I applied it without downtime to my target 19.6.0. home. And this worked. So good news here. The time zone patches are again patch-level independent.
Finally, I kick off AutoUpgrade again. But before this can succeed, I need to clear the recovery data (please see my troubleshooting blog post from the other day) as otherwise AutoUpgrade would error out again.
$ java -jar $OH19/rdbms/admin/autoupgrade.jar -config UP19.cfg -mode deploy -clear_recovery_data The recovery data was removed, the AutoUpgrade will start from the beginning AutoUpgrade tool launched with default options Processing config file ... +--------------------------------+ | Starting AutoUpgrade execution | +--------------------------------+ 1 databases will be processed Type 'help' to list console commands upg> lsj +----+-------+---------+---------+-------+--------------+--------+--------+-----------+ |Job#|DB_NAME| STAGE|OPERATION| STATUS| START_TIME|END_TIME| UPDATED| MESSAGE| +----+-------+---------+---------+-------+--------------+--------+--------+-----------+ | 103| FTEX|DBUPGRADE|EXECUTING|RUNNING|20/04/09 13:47| N/A|13:50:55|0%Upgraded | +----+-------+---------+---------+-------+--------------+--------+--------+-----------+ Total jobs 1
And soon after …
upg> Job 103 completed ------------------- Final Summary -------------------- Number of databases [ 1 ] Jobs finished successfully [1] Jobs failed [0] Jobs pending [0] ------------- JOBS FINISHED SUCCESSFULLY ------------- Job 103 for FTEX
Yes! Strike!
More Information and Links
- MOS Note: 412160.1 – Updated DST Transitions and New Time Zones in Oracle RDBMS and OJVM Time Zone File Patches
- MOS Note: 2602555.1 – Applying the DSTv34 update for the Oracle Database
- MOS 1585343.1 – Scripts to update the RDBMS DST (timezone) version in an 11gR2 or 12c database
- Create a database with NON-DEFAULT Time Zone
- Does PDB$SEED get time zone patched?
- How to patch all my PDBs with a new time zone file?
- The DST patch-dependency problem
- Data Pump: The Time Zone Pitfalls
- Database Migration from non-CDB to PDB: The Time Zone Pitfall
- Troubleshooting, restoring and restarting AutoUpgrade
–Mike
it seems that ” /home/oracle/scripts” is missing on the image on link version 7 jan 2020.
Can you please assist ..
Oracle Database 19c (19.3.0) Upgrade and Migration hands-on Lab
Updated! 07-JAN-2020
https://mikedietrichde.com/database-upgrade-hands-on-lab-oracle-18c-and-19c/hol-19c-main-index-page-oracle-database-19c-hands-on-lab/
Let me check this with my mates – I haven’t done the uploads but given the number of downloads we’ve had, I’m a but curious now as others would have failed completing the lab as everything is kept in /home/oracle/scripts
Can you go back to the Snapshot and try again?
Cheers,
Mike
Hi Mike,
We have a cluster database on exadata. We are upgrading 12.1.0.2 to 19.6.0.0 with autoupgrade utility.
We have been facing the issue during post upgrade phase of SPFILE. SPFILE is getting deleted from ASM.
We also copied the SPFILE in $ORACLE_HOME/dbs and tried to re-run the upgrade but we got below error.
Our SR 3-23710525231 has been in unattended mode since 8+ days. No one is responding. Can you please help us.
SR 3-23710525231
=================
DATABASE NAME: TESTDMO4
CAUSE: ERROR at Line 4 in [Buffer]
REASON: ORA-17502: ksfdcre:4 Failed to create file +DATA_DG/TESTDMO/PARAMETERFILE/spfile.40703.1047530711
ACTION: [MANUAL]
DETAILS: 17502, 00000, “ksfdcre:%s Failed to create file %s”
// *Cause: file creation failed due to either insufficient OS permission or
// the file already exists
// *Action: check additional error messages
2020-08-10 08:44:43.560 ERROR
DATABASE NAME: TESTDMO4
CAUSE: ERROR at Line 5 in [Buffer]
REASON: ORA-15046: ASM file name ‘+DATA_DG/TESTDMO/PARAMETERFILE/spfile.40703.1047530711’ is not in single-file creation form
ACTION: [MANUAL]
DETAILS: 15046, 00000, “ASM file name ‘%s’ is not in single-file creation form”
// *Cause: The ASM file name was not in a form that can be used to create
// an single file because a file/incarnation number was present.
// *Action: Correct the specified ASM file name.
//
2020-08-10 08:44:43.565 ERROR Creating spfile failed
2020-08-10 08:44:43.566 ERROR UPGRADE FAILED [TESTDMO]
2020-08-10 08:44:43.566 ERROR Exception Error in Database Upgrade [TESTDMO]
2020-08-10 08:44:43.597 ERROR testdmo Return status is ERROR
2020-08-10 08:44:43.600 ERROR Dispatcher failed: AutoUpgException [UPG-1400#UPGRADE FAILED [TESTDMO]]
2020-08-10 08:44:43.600 INFO Starting error management routine
2020-08-10 08:44:43.601 INFO Ended error management routine
2020-08-10 08:44:43.602 ERROR Error running dispatcher for job 101
Cause: Database upgrade failed with errors
2020-08-10 08:44:43.602 ERROR Dispatcher failed:
Error: UPG-1400
UPGRADE FAILED [TESTDMO]
Hi Omprakash,
I see that you spoke to a support consultant now. I apologize the inconvenience – and I can tell you that I informed a support exec.
The SR will be reviewed by the exec team.
Please use this guidance to upload autoupgrade logs.
https://mikedietrichde.com/2020/04/08/troubleshooting-restoring-and-restarting-autoupgrade/
From the SR it looks to me as you just uploaded partial files.
Thanks
Mike
The issue is fixed in a newer version with AutoUpgrade already.
If you’d like to try the newer version, please tell the engineer via the SR – and you’d be able to download it then.
Cheers,
Mike
Thank you Mike for you response. I have uploaded all the logs in SR as requested.
Hi Omprakash,
the SR reached our team – now you’ll see progress.
Cheers, and again sorry for the inconvenience!
Mike
Thank you very much Mike.
Yes I would like to try with new Auto Upgrade utility and the same also been updated in the SR.
We are migrating our 4 database from 12.1.0.2 to 19C. At present we are in development environment. So before moving to production I wanted to test this utility thoroughly. I tested 1 database upgrade with DBUA and 2 database in parallel with AutoUpgrade. DBUA worked fine without any issue. For AutoUpgrade only SPFILE issue I am facing. If this would be fixed in new AutoUpgrade version then it would be great help for me during prod migration.
Regards,
Omprakash
Hi Omprakash,
the support engineer will share it with you later today.
Thanks,
Mike
Thank you very much Mike.
Welcome!
Cheers,
Mike
AutoUpgrade is reporting below:
Database time zone version is 18. It is older than current release time
zone version 36. Time zone upgrade is needed using the DBMS_DST package.
BUT running SELECT DBMS_DST.get_latest_timezone_version FROM dual shows timezone is 36 after the upgrade. Is there any post-AutoUpgrade check that is needed to be run?
Hi Edwin,
AU does upgrade the time zone automatically unless you disabled it with:
upg1.timezone_upg=false
Cheers,
Mike
Hi Mike. I know this is an old thread but I’d like to know if I can flashingback database after upgrade successfully db/timezone file version. ? Without of course upgrade timezone on source.
Hi William,
yes, it will flashback everything including the TZ changes.
Cheers
Mike