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=# 


你可能感兴趣的:(PostgreSQL)