Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
bugs_oracle [2018/05/29 11:20] – external edit 127.0.0.1 | bugs_oracle [2021/04/27 11:32] (current) – andonovj | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | - **Wrong function extract** | + | ======Overview====== |
+ | Oracle is full of bugs, I am sorry to say it, but like any software, even Oracle has A LOT of bugs. Here are few of them: | ||
+ | - [[oracle_bugs_wrong_hour_extract| Incorrect hour extract]] | ||
+ | - [[oracle_bugs_statistic_advisor| Statistic Advisor]] | ||
+ | - [[oracle_linux7.2_crash|Crash due to Linux 7.2 IPC Setting]] | ||
+ | - [[oracle_12c_expdp_hang_enqueue_blocker|Expdp hangs/slow on Enqueue blocked on low memory]] | ||
- | Very interesting " | ||
- | <sxh bash> | ||
- | |||
- | select (extract (hour from current_timestamp)), | ||
- | |||
- | (EXTRACT(HOURFROMCURRENT_TIMESTAMP)) CURRENT_TIMESTAMP | ||
- | ------------------------------------ ------------------- | ||
- | 9 2017-11-14 10: | ||
- | |||
- | </ | ||
- | |||
- | |||
- | **Solution** | ||
- | This behavior is somehow normal however, since the function: extract (hour from current_timestamp) is supposed to return you the hour in UTC format, excluding the timezone, therefore if the hour is 18:00 and the timezone is +02:00 it will return you 16:00, instead of 18:00. There are 2 ways how to negate this: | ||
- | |||
- | * **Use the current_scn**: | ||
- | <sxh bash> | ||
- | SQL> select (extract (hour from (scn_to_timestamp(current_scn)))) from v$database; | ||
- | |||
- | (EXTRACT(HOURFROM(SCN_TO_TIMESTAMP(CURRENT_SCN)))) | ||
- | -------------------------------------------------- | ||
- | 17 | ||
- | |||
- | SQL> | ||
- | |||
- | </ | ||
- | |||
- | |||
- | |||
- | * **Use the sum of the UPC hour and the time zone**: | ||
- | |||
- | <sxh bash> | ||
- | SQL> Select (extract (HOUR from current_timestamp)), | ||
- | |||
- | SQL> Select (extract (HOUR from current_timestamp)) UTC_HOUR, (extract (TIMEZONE_HOUR from current_timestamp)) SESSION_TZ, (extract (HOUR from current_timestamp))+(extract (TIMEZONE_HOUR from current_timestamp)) SESSION_HOUR , | ||
- | UTC_HOUR SESSION_TZ SESSION_HOUR CURRENT_TIMESTAMP | ||
- | ---------- ---------- ------------ --------------------------------------------------------------------------- | ||
- | 16 1 17 16-NOV-17 17.26.55.236687 +01:00 | ||
- | |||
- | |||
- | </ |