Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
bugs_oracle [2018/05/29 11:20] – external edit 127.0.0.1bugs_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 "Feature" which I was shown in oracle is the function "extract hour from timestamp", it appears that Oracle will provide an hour which is wrong: 
  
-<sxh bash> 
  
- 
-select (extract (hour from current_timestamp)),current_timestamp from dual; 
- 
-(EXTRACT(HOURFROMCURRENT_TIMESTAMP)) CURRENT_TIMESTAMP 
------------------------------------- ------------------- 
-9                                    2017-11-14 10:44:00  
- 
-</sxh> 
- 
- 
-**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>  
- 
-</sxh> 
- 
- 
- 
-  * **Use the sum of the UPC hour and the time zone**: 
- 
-<sxh bash> 
-SQL> Select (extract (HOUR from current_timestamp)), current_timestamp from dual; -------- We will extract the UTC value for hour  
- 
-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 ,current_timestamp from dual; 
-  UTC_HOUR SESSION_TZ SESSION_HOUR CURRENT_TIMESTAMP 
----------- ---------- ------------ --------------------------------------------------------------------------- 
-        16          1           17 16-NOV-17 17.26.55.236687 +01:00 
- 
- 
-</sxh>  
  • bugs_oracle.1527592802.txt.gz
  • Last modified: 2019/10/18 20:04
  • (external edit)