Oracle问题: ORA-01882: 未找到时区

(一)现象

在一台Ubuntu20主机上执行Java程序,访问Oracle11g数据库并执行操作。⚠️
出现:ORA-00604: 递归 SQL 级别 1 出现错误 ORA-01882: 未找到时区

(二)分析

因为其它主机同一个程序是正常的,所以认为原因不是数据库,而在主机。
因为其它主机也出现过同样问题,所以即便不懂原理……

让我们选择时区吧:
执行:tzselect

Please identify a location so that time zone rules can be set correctly.
Please select a continent, ocean, "coord", or "TZ".
1) Africa                                                            7) Europe
2) Americas                                                          8) Indian Ocean
3) Antarctica                                                        9) Pacific Ocean
4) Asia                                                             10) coord - I want to use geographical coordinates.
5) Atlantic Ocean                                                   11) TZ - I want to specify the timezone using the Posix TZ format.
6) Australia
#? 4
Please select a country whose clocks agree with yours.
1) Afghanistan             9) Cambodia              17) Iran                  25) Kuwait                33) Nepal                 41) Singapore             49) Uzbekistan
2) Antarctica             10) China                 18) Iraq                  26) Kyrgyzstan            34) Oman                  42) Sri Lanka             50) Vietnam
3) Armenia                11) Cyprus                19) Israel                27) Laos                  35) Pakistan              43) Syria                 51) Yemen
4) Azerbaijan             12) East Timor            20) Japan                 28) Lebanon               36) Palestine             44) Taiwan
5) Bahrain                13) Georgia               21) Jordan                29) Macau                 37) Philippines           45) Tajikistan
6) Bangladesh             14) Hong Kong             22) Kazakhstan            30) Malaysia              38) Qatar                 46) Thailand
7) Bhutan                 15) India                 23) Korea (North)         31) Mongolia              39) Russia                47) Turkmenistan
8) Brunei                 16) Indonesia             24) Korea (South)         32) Myanmar (Burma)       40) Saudi Arabia          48) United Arab Emirates
#? 10
Please select one of the following timezones.
1) Beijing Time
2) Xinjiang Time
#? 1

The following information has been given:

        China
        Beijing Time

Therefore TZ='Asia/Shanghai' will be used.
Selected time is now:   Fri Jul 29 09:43:24 CST 2022.
Universal Time is now:  Fri Jul 29 01:43:24 UTC 2022.
Is the above information OK?
1) Yes
2) No
#? 1

You can make this change permanent for yourself by appending the line
        TZ='Asia/Shanghai'; export TZ
to the file '.profile' in your home directory; then log out and log in again.

Here is that TZ value again, this time on standard output so that you
can use the /usr/bin/tzselect command in shell scripts:
Asia/Shanghai

(三)解决

根据上面提示的内容。
如果需要对用户永久生效(时区为亚洲/上海),

则在用户.profile文件最后加入一行:

export TZ='Asia/Shanghai' 

但始终不明白:为什么过去是正常的?中途发生了什么导致了无时区问题?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值