PostgreSQL如何删除pg_xlog数据(二)
Latest checkpoint's NextOID: 65595
四、重置,删除pg_xlog
[postgres@localhost ~]$ pg_resetxlog -o 65595 -x1888 -f /database/pgdata/
Transaction log reset
五、再次查看,并重启
[postgres@localhost pgdata]$ du -sh pg_xlog/
193M pg_xlog/
[postgres@localhost pg_xlog]$ ll
total 196620
-rw-------. 1 postgres postgres 290 Nov 10 22:24 00000004000000010000003C.00000020.backup
-rw-------. 1 postgres postgres 67108864 Jan 10 08:02 00000004000000020000000F
-rw-------. 1 postgres postgres 113 Jun 17 2012 00000004.history
drwxrwxr-x. 2 postgres postgres 4096 Jan 10 08:02 archive_status
-rw-------. 1 postgres postgres 67108864 Nov 17 08:09 xlogtemp.1461
-rw-------. 1 postgres postgres 67108864 Jan 3 09:35 xlogtemp.1518
[postgres@localhost 12780]$ pg_start
server starting
[postgres@localhost 12780]$ psql
Password:
psql (9.1.3)
Type "help" for help.
postgres=# \q
已经被清理并正常启动了。以上测试是单机版环境,主备情况需要做好WAL日志的备份。 www.2cto.com
六、其他
[postgres@localhost ~]$ 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