微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

PostgreSQL View current log

[postgres@zwc pg_xlog]$ psql -h 192.168.1.13 -p 1521 -U zwc -d testdb
Password for user zwc: 
psql (9.2.4)
Type "help" for help.

testdb=> select pg_current_xlog_location();
 pg_current_xlog_location 
--------------------------
 0/8000000
(1 row)

testdb=> select pg_xlogfile_name(pg_current_xlog_location());
     pg_xlogfile_name     
--------------------------
 000000010000000000000001
(1 row)

testdb=> 
testdb=> 
testdb=> \dt
         List of relations
 Schema |   Name    | Type  | Owner 
--------+-----------+-------+-------
 public | orderinfo | table | zwc
(1 row)

testdb=> create table t01(id integer,name varchar(30));
CREATE TABLE
testdb=> \dt
         List of relations
 Schema |   Name    | Type  | Owner 
--------+-----------+-------+-------
 public | orderinfo | table | zwc
 public | t01       | table | zwc
(2 rows)

testdb=> insert into t01 values(1,'aaa');
INSERT 0 1


[postgres@zwc pg_xlog]$ psql
psql (9.2.4)
Type "help" for help.

postgres=# select pg_switch_xlog();
 pg_switch_xlog 
----------------
 0/80151D0
(1 row)

postgres=# select pg_xlogfile_name(pg_current_xlog_location());
     pg_xlogfile_name     
--------------------------
 000000010000000000000002
(1 row)

postgres=# \! ls -l
total 131312
-rw------- 1 postgres postgres 67108864 Sep  2 14:28 000000010000000000000001
-rw------- 1 postgres postgres 67108864 Sep  2 14:30 000000010000000000000002
drwx------ 2 postgres postgres     4096 Aug 28 12:56 archive_status
-rw-rw-r-- 1 postgres postgres    96147 Sep  2 14:30 gmon.out
postgres=# 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐