반응형

/********************************************************************************************
-- Title : [PGS9.2] WAL 아카이브 로그스위치(log switch) 확인
-- Reference : http://www.postgresql.org/docs/9.2/static/functions-admin....
-- Key word : WAL 아카이브 archive log switch continuouse archiving 로그 스위치 로그스위치
********************************************************************************************/

-- 1. 아카이브 모드 확인 및 전환
    ㅇ 참조 : http://dbrang.tistory.com/756

-- 2. 노아카이브 모드에서의 로그

-- 3. 아카이브 모드 전환 테이블 생성 및 데이터 입력 후 로그 확인
    ㅇ commit과 checkpoint에도 아카이브 파일 미생성(아직 때가 안됐나??)

-- 4. pg_switch_xlog() / pg_xlogfile_name / pg_xlogfile_name_offset
    ㅇ pg_switch_xlog() : 현재 사용중인 로그 파일을 아카이빙하고 새로운 파일로 스위칭 함.

        psql=# select pg_switch_xlog();
         pg_switch_xlog
        ----------------
         0/8012108
    ㅇ pg_xlogfile_name/pg_xlogfile_name_offset : 아카이빙 된 파일명 출력

        psql=# select pg_xlogfile_name('0/8012108'), pg_xlogfile_name_offset('0/8012108');
          pg_xlogfile_name             |     pg_xlogfile_name_offset
        --------------------------+----------------------------------
         000000010000000000000008  | (000000010000000000000008,73992)

-- 5. 로그 확인

-- 6. 현재 사용중인 로그 확인
    ㅇ pg_current_xlog_locatioin() : 현재 사용중인 로그 출력

    psql=# select pg_current_xlog_location();
     pg_current_xlog_location
    --------------------------
     0/9000074

    psql=# select pg_xlogfile_name('0/9000074'), pg_xlogfile_name_offset('0/9000074');
         pg_xlogfile_name          |    pg_xlogfile_name_offset
    --------------------------+--------------------------------
     000000010000000000000009  | (000000010000000000000009,116)

반응형

+ Recent posts