'timezone'에 해당되는 글 1건

  1. 2014.05.09 11gR2 RAC에서 리스너를 통한 sysdate 조회 이상 해결

환경: RAC 11.2.0.4 e/e 64bit on AIX, Oracle Grid Infrastructure without HACMP

 

변경내용: OS 엔지니어가 OS Timezone KORST9KORDT 에서 KORST9 로 변경 후 하루가 지난 뒤 개발자가 OS 시간이 현실의 시간보다 1시간 느려짐을 확인하여 OS엔지니어가 date 설정으로 1시간 빠르게 진행함

         당시 DB CRS는 전부 중지 후 OS 작업을 진행했었음

 

문제: sqlplus / as sysdba로 접속하면 sysdate OS의 시간과 같지만 sqlplus system/xxx@tns 형식과 같이 리스너를 통해 접속하여 sysdate를 조회하면 1시간 빠르게 나타남. 당연히 toad orange 등을 통해서도 같은 현상 발생

$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.4.0 Production on Thu May 8 20:51:50 2014

 

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

 

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning and Real Application Clusters options

 

SQL> alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';

 

Session altered.

 

SQL> select sysdate from dual;

 

SYSDATE

-------------------

2014-05-08 20:51:57

 

SQL> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning and Real Application Clusters options

$ sqlplus system/xxxx@real1/realdb

 

SQL*Plus: Release 11.2.0.4.0 Production on Thu May 8 20:52:15 2014

 

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

 

 

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning and Real Application Clusters options

 

SQL> alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';

 

Session altered.

 

SQL> select sysdate from dual;

 

SYSDATE

-------------------

2014-05-08 21:52:20

 

원인: CRS를 통해 Listener TZ 값을 CRS의 설정을 가져와 시작되는데 OS Timezone 값은 변경되었으나 CRS Timezone은 변경되지 않아 발생

해결:

1.    모든 노드의 root로 접속하여 $GRID_HOME/crs/install/s_crsconfig_<nodename>_env.txt 파일의 TZ 값을 OS TZ 값과 같이 변경

※각 OS TZ 값 확인은 검색하면 바로 나오기에 생략

#TZ=KORST9KORDT

TZ=KORST9

 

2.    모든 노드의 DB 중지(srvctl stop instance ...)

3.    모든 노드의 CRS 중지(crsctl stop crs)

4.    모든 노드의 CRS 시작(crsctl start crs)

5.    모든 노드의 DB 시작(srvctl start instance ...)

 

결과확인:

$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.4.0 Production on Thu May 8 21:08:47 2014

 

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

 

 

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning and Real Application Clusters options

 

SQL> alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';

 

Session altered.

 

SQL> select sysdate from dual;

 

SYSDATE

-------------------

2014-05-08 21:08:47

 

SQL> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning and Real Application Clusters options

$ sqlplus system/xxxx@real1/realdb

 

SQL*Plus: Release 11.2.0.4.0 Production on Thu May 8 21:08:55 2014

 

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

 

 

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning and Real Application Clusters options

 

SQL> alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';

 

Session altered.

 

SQL> select sysdate from dual;

 

SYSDATE

-------------------

2014-05-08 21:08:55

 

기타: 위 방법으로 보통 해결되나 안될 경우는 아래 방법이 필요할 수도 있다. 또한 11gR2미만에서는 위처럼 crs 설정 파일이 없을 수 있기에 아래 방법이 필요할 수도 있다.

 

srvctl setenv database -d <dbname> -t TZ=<the TZ you want>
srvctl setenv nodeapps -n <nodename> -t TZ=<the TZ you want>
--
만약 11gR2 이상이라면 nodeapps 대신 listener를 사용한다.
srvctl setenv listener -l <listenername> -t TZ=<the TZ you want>

 

참고문서: Oracle Support Document 1390015.1 (Incorrect SYSDATE shown when connected via Listener in RAC)

Dates & Calendars - Frequently Asked Questions (문서 ID 227334.1)

 

 

Posted by neo-orcl
,