PostgreSQL View current log

前端之家收集整理的这篇文章主要介绍了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=# 
原文链接:https://www.f2er.com/postgresql/196102.html

猜你在找的Postgre SQL相关文章