달력

4

« 2024/4 »

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30

'xlog 적용 방지'에 해당되는 글 1

  1. 2012.08.01 pg_resetxlog 사용
2012. 8. 1. 15:47

pg_resetxlog 사용 Work/PostgreSQL2012. 8. 1. 15:47

Database의 Transaction Log가 해당 Disk 혹은 Volume 을 모두 차지해서 Postgresql service가 내려가는 경우라 던가... 여타의 이유로 Postgresql service 를 시작하고자 하는데.. Transaction Log의 replay 를 막고자 하는 경우가 있다.

이 경우 pg_resetxlog 를 사용하면 된다. 당연히 Postgresql service 는 내려가 있는 상태에서 실행해야 한다.

login as: root
root@xxx.xxx.xxx.xxx'password:
Last login: Fri Jul 27 18:08:12 2012 from 10.3.4.34
*** [ 경고 WARNING ] **************************************************
- 부당한 접속, 자료의 변경, 유출 및 삭제 시 해당 법령에 의해 처벌 됨
- Any improper access and disclosure of material changes and deletions
  that becomes punishable by law.
***********************************************************************
[root@pgdb01 ~]# su - postgres
-bash-4.1$ cd /usr/pgsql-9.1/bin/
-bash-4.1$ ls -alh
total 6.8M
.
.
-rwxr-xr-x. 1 root root  29K Jun  4 09:20 pg_resetxlog
.
.
-bash-4.1$
-bash-4.1$ ./pg_resetxlog --help
pg_resetxlog resets the PostgreSQL transaction log.
Usage:
  pg_resetxlog [OPTION]... DATADIR
Options:
  -e XIDEPOCH     set next transaction ID epoch
  -f              force update to be done
  -l TLI,FILE,SEG force minimum WAL starting location for new transaction log
  -m XID          set next multitransaction ID
  -n              no update, just show extracted control values (for testing)
  -o OID          set next OID
  -O OFFSET       set next multitransaction offset
  -x XID          set next transaction ID
  --help          show this help, then exit
  --version       output version information, then exit
Report bugs to <pgsql-bugs@postgresql.org>.
-bash-4.1$ ./pg_resetxlog -f /var/lib/pgsql/9.1/data
Transaction log reset
-bash-4.1$ exit
logout
[root@pgdb01 ~]# service postgresql-9.1 start
Starting postgresql-9.1 service:                           [  OK  ]
[root@pgdb01 ~]#


:
Posted by Elick