Background Image

FORUM

조회 수 790 추천 수 0 댓글 6
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄


* 질문 등록 시 다음의 내용을 꼭 기입하여 주세요.

OS
Linux 64bit
CUBRID Ver.

[cubrid_rel] 수행 결과

CUBRID 11.3 (11.3.1.1142-bee7aa8) (64bit release build for Linux) (May 18 2024 04:32:25)

CUBRID TOOL Ver.

[도움말]-[버전정보] 확인

SQLGate for CUBRID Developer

9.9.8.0

응용 환경(API)
해당없음


* CUBRID 응용 오류, SQL 오류 또는 SQL 튜닝 관련된 문의는 반드시 다음의 내용을 추가해 주세요. 비밀글이나 비밀 댓글도 가능합니다.
* 저희가 상황을 이해하고, 재현이 가능해야 알 수 있는 문제들이 많습니다. 가능한 정보/정황들을 부탁합니다.

 

에러 내용 및 재현 방법 재현 가능한 Source와 SQL
관련 테이블(인덱스, 키정보 포함) 정보 CUBRID 홈 디렉토리 아래 log 디렉토리 압축


-------------- 아래에 질문 사항을 기입해 주세요. ------------------------------------------------------------------------

1. cubrid.conf 에 설정을 다음과 같이 했습니다.

 

[common]

# Read the manual for detailed description of system parameters
# Manual > Performance Tuning > Database Server Configuration > Default Parameters

# Size of data buffer are using K, M, G, T unit
data_buffer_size=512M

# Size of log buffer are using K, M, G, T unit
log_buffer_size=256M

# Size of sort buffer are using K, M, G, T unit
# The sort buffer should be allocated per thread.
# So, the max size of the sort buffer is sort_buffer_size * max_clients.
sort_buffer_size=2M

# The maximum number of concurrent client connections the server will accept.
# This value also means the total # of concurrent transactions.
max_clients=100

# TCP port id for the CUBRID programs (used by all clients).
cubrid_port_id=1523

# The createdb and addvoldb create a volume file of 'db_volume_size' size
# if don't have any options about size.
db_volume_size=512M

# The createdb creates a log volume file of 'log_volume_size' size
# if don't have any options about size.
log_volume_size=512M

# The log_max_archives parameter configures the maximum number of archive log files kept.
# To completely recover the database from the media failures with a backup,
# the archive log volumes that was archived from the backup must be kept.
# Tune this parameter with the enough number of archive logs to cope with a media failure.
#
# log_max_archives=2147483647
log_max_archives=0 

server_timezone=Etc/UTC

 

2. SQLGate 에서

 

1) 다음과 같이 datetime 관련 값을 저장하고 select 해봤을 때 결과는 UTC로 저장된 것으로 나옵니다.

 

CREATE TABLE tbl (a DATETIME, b DATETIMETZ,  c DATETIMELTZ);
INSERT INTO tbl VALUES (datetime'2015-02-24 12:30', datetimetz'2015-02-24 12:30', datetimeltz'2015-02-24 12:30');

SELECT * FROM tbl

 

2015-02-24 오후 12:30:00    2015-02-24 12:30:00.000 Etc/UTC UTC    2015-02-24 12:30:00.000 Etc/UTC UTC

 

2) 하지만 현재 시간을 select 해보면 KST로 나옵니다.

 

SELECT NOW();

 

2024-07-07 오후 11:23:13

 

3. 질문입니다.

 

1) 시간이 KST로 나오는 이유는 무엇인가요?

2) 응용에서 insert into t values (now())와 같이 했을 때 UTC로 저장이 되나요?

 

  • ?
    정만영 2024.07.09 16:21

    기본적으로 세션 타임존은 server_timezone의 설정을 따르지만, 세션 시작 후에 변경될 수 있습니다. 만약 세션 타임존이 별도로 설정되지 않았다면 서버(OS) 타임존을 따릅니다​​.

    server_timezone 서버 파라미터 입니다, 설정 후 DB재구동이 필요하며 SQLGate 에서 "SELECT SESSIONTIMEZONE()" 실행해 보시고 아래는 CSQL에서 테스트한 결과 입니다.

     

    ex)
    csql> SELECT NOW();
       CURRENT_DATETIME
    ===============================
      03:56:14.269 PM 07/09/2024

    csql> SELECT SESSIONTIMEZONE();
      sessiontimezone
    ======================
      'Asia/Seoul'

    csql> ;sc tbl
     <Class Name>
         dba.tbl
     <Attributes>
         a                    DATETIME
         b                    DATETIMETZ
         c                    DATETIMELTZ

    csql> SELECT * FROM tbl;
      a                              b                                                c
    =================================================================================================================================
      03:40:38.456 PM 07/09/2024     03:40:38.456 PM 07/09/2024 Asia/Seoul KST        03:40:38.456 PM 07/09/2024 Asia/Seoul KST
      03:40:39.699 PM 07/09/2024     03:40:39.699 PM 07/09/2024 Asia/Seoul KST        03:40:39.699 PM 07/09/2024 Asia/Seoul KST
      03:40:40.044 PM 07/09/2024     03:40:40.044 PM 07/09/2024 Asia/Seoul KST        03:40:40.044 PM 07/09/2024 Asia/Seoul KST

     

     

    =================== Etc/UTC 타임존 변경

     

     

    csql> ;se timezone=Etc/UTC
    timezone=Etc/UTC

     

    csql> SELECT NOW();
       CURRENT_DATETIME
    ===============================
      06:57:36.452 AM 07/09/2024

    csql> SELECT SESSIONTIMEZONE();
      sessiontimezone
    ======================
      'Etc/UTC'

    csql> SELECT * FROM tbl;
      a                              b                                                c
    =================================================================================================================================
      03:40:38.456 PM 07/09/2024     03:40:38.456 PM 07/09/2024 Asia/Seoul KST        06:40:38.456 AM 07/09/2024 Etc/UTC UTC
      03:40:39.699 PM 07/09/2024     03:40:39.699 PM 07/09/2024 Asia/Seoul KST        06:40:39.699 AM 07/09/2024 Etc/UTC UTC
      03:40:40.044 PM 07/09/2024     03:40:40.044 PM 07/09/2024 Asia/Seoul KST        06:40:40.044 AM 07/09/2024 Etc/UTC UTC

     

    자세한 정보는 매뉴얼 참조: https://www.cubrid.org/manual/ko/11.3/sql/datatype.html#id7

  • ?
    steve 2024.07.10 06:38
    이미 timezone을 UTC로 변경하고 cubrid를 재기동한 상태입니다.

    SELECT SESSIONTIMEZONE();

    sessiontimezone
    Etc/UTC

    SELECT NOW();
    CURRENT_DATETIME
    2024-07-10 오전 6:37:21

    Timezone은 UTC인데 시간은 KST 기준으로 나옵니다.

    UTC라면 9시간 차이가 나야 맞을 것입니다.
    그 점을 질문드린 것입니다.
  • ?
    정만영 2024.07.10 08:42

    네, 9시간 차이입니다.

    csql> SELECT NOW();

    === <Result of SELECT Command in Line 1> ===

       CURRENT_DATETIME            
    ===============================
      08:40:00.107 AM 07/10/2024   

    1 row selected. (0.003253 sec) Committed. (0.000009 sec) 

    1 command(s) successfully processed.
    csql> SELECT SESSIONTIMEZONE();

    === <Result of SELECT Command in Line 1> ===

      sessiontimezone     
    ======================
      'Asia/Seoul'        

    1 row selected. (0.003277 sec) Committed. (0.000008 sec) 

    1 command(s) successfully processed.
    csql> ;se timezone=Etc/UTC

    === Set Param Input ===

    timezone=Etc/UTC

    csql> SELECT NOW();

    === <Result of SELECT Command in Line 1> ===

       CURRENT_DATETIME            
    ===============================
      11:40:21.181 PM 07/09/2024   

    1 row selected. (0.002893 sec) Committed. (0.000008 sec) 

    1 command(s) successfully processed.
    csql> SELECT SESSIONTIMEZONE();

    === <Result of SELECT Command in Line 1> ===

      sessiontimezone     
    ======================
      'Etc/UTC'           

    1 row selected. (0.003222 sec) Committed. (0.000009 sec) 

    1 command(s) successfully processed.

  • ?
    steve 2024.07.10 15:59
    9시간 차이가 나지 않습니다.
    제가 글을 작성한 시간이 오전 6시 37분입니다.
    그런데 제가 그때 DB select now()를 실행시켜서 찍힌 시간이 오전 6시 37분입니다.
    9시간 차이가 나는 것이 아니고 KST 기준시로 나왔습니다.
    timezone은 Etc/UTC 이니까, 지금 DB 시간은 9시간 전으로 나와야 하는 것이 아닌가요?
  • ?
    정만영 2024.07.10 18:30
    steve님, 질문에 의도를 잘 이해 했습니다.^^
    저도 아래와 같이 자바와 파이썬으로 UTC 시간을 확인 했는데 DB 시간과 차이가 발생하네요.

    import java.time.ZonedDateTime;
    import java.time.format.DateTimeFormatter;
    import java.time.ZoneId;

    public class CurrentUTCTime {
    public static void main(String[] args) {
    // Get the current time in UTC
    ZonedDateTime utcNow = ZonedDateTime.now(ZoneId.of("UTC"));

    // Format the datetime to a readable string
    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS z");
    String formattedUtcNow = utcNow.format(formatter);

    // Print the current UTC time
    System.out.println("Current UTC time: " + formattedUtcNow);
    }
    }
    ----------자바 결과
    [java_user@pm-myjun1 work]$ java CurrentUTCTime
    Current UTC time: 2024-07-10 09:18:52.160 UTC
    --------파이썬 결과
    C:\Users\USER\VSCode_file>python time_zone.py
    Current UTC time: 2024-07-10 09:18:15.529705+00:00
    ---------DB 결과
    [java_user@pm-myjun1 work]$ !csql
    csql -u dba demodb

    CUBRID SQL Interpreter


    Type `;help' for help messages.

    csql> SELECT SESSIONTIMEZONE();

    === <Result of SELECT Command in Line 1> ===

    sessiontimezone
    ======================
    'Etc/UTC'

    1 row selected. (0.003063 sec) Committed. (0.000004 sec)

    1 command(s) successfully processed.
    csql> SELECT NOW();

    === <Result of SELECT Command in Line 1> ===

    CURRENT_DATETIME
    ===============================
    06:19:24.336 PM 07/10/2024

    1 row selected. (0.002771 sec) Committed. (0.000004 sec)

    1 command(s) successfully processed.


    제품 버그인지 확인 후 다시 댓글 남기도록 하겠습니다, 감사합니다.
  • ?

    CUBRID 이슈가 아닌 Client Tool timezone을 설정하는 부분에서 상이한 결과가 발생 것으로 보입니다, 저는 DBeaver Tool로 timezone을 'Etc/UTC' 설정하고 테스트한 결과 데이터 출력이 정상적으로 확인됩니다.


List of Articles
번호 제목 글쓴이 날짜 조회 수
공지 CUBRID 사용자를 위한 DBeaver 도구 출시 안내 8 admin 2024.04.23 17031
4040 큐브리드 브로커 리스트 명단 및 log 수집 2 11시38분 2024.07.09 931
4039 이중화 한 Slave 서버가 다운된 후 Master 서버에서 master 상태로 있는 것이 아닌 slave 상태로 있습니다. 3 file 로키 2024.07.09 806
4038 백업파일을 받았습니다. 3 mango 2024.07.08 829
» Timezone 설정 관련 문의 6 steve 2024.07.07 790
4036 큐브리드 로더 1 자바조 2024.07.05 832
4035 cubrid_server 메모리 사용량 문의 1 그로구 2024.07.04 858
4034 cubrid table 데이터 delete 처리 문의 1 안녕 2024.07.03 809
4033 Java import java.sql.DatabaseMetaData 1 file 레드혁 2024.07.01 879
4032 큐브리드 이미 생성된 테이블 create문 출력하는 방법 문의 1 hwson 2024.06.27 935
4031 정상작동 하다가 Locales for language 'en_US' are not available with charset 'ksc-euc' 오류로 업데이트 안됩니다. 1 나라디 2024.06.25 815
4030 cci_prepare의 handle을 쓰레드에서 사용할 때 safe 여부 1 가을이아빠 2024.06.20 877
4029 gettransactioninfo api sql text 조회 안됨 6 11시38분 2024.06.19 823
4028 api 결과 값 질문 5 11시38분 2024.06.19 711
4027 데이터베이스 로드 관련 문의 3 file hwson 2024.06.19 843
4026 batch에서 insert 작업할 때 1 mango 2024.06.19 987
4025 시퀀스 nextval 할 때 특정 값 제외 하는 방법 있습니까? 1 mango 2024.06.18 835
4024 컬럼의 DEFAULT 값 추출 문의 1 새옹지마 2024.06.17 757
4023 큐브리드 매니저 호스트연결시 무한 로딩 3 file dfdfdd 2024.06.13 857
4022 큐브리드 locale이 euckr일 때 cp949 문자도 지원하는 것인가요? 4 닉네임어려워 2024.06.10 857
4021 view 실행 쿼리를 조회 하고 싶습니다. 3 mango 2024.06.10 953
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 ... 208 Next
/ 208

Contact Cubrid

영업문의 070-4077-2112 / 기술문의 070-4077-2148 / 대표전화 070-4077-2110 / Email. contact_at_cubrid.com
Contact Sales