Add SQL functions pg_is_in_backup() and pg_backup_start_time() (Gilles Darold)
These functions report the status of base backups.
这两个函数可用于查看当前数据库是否在备份, 以及开始备份的时间.
[测试]
postgres=# select pg_start_backup(now()::text),now();
pg_start_backup | now
-----------------+-------------------------------
2/54000028 | 2013-05-08 15:55:00.267025+08
(1 row)
postgres=# select pg_is_in_backup();
pg_is_in_backup
-----------------
t
(1 row)
postgres=# select pg_backup_start_time();
pg_backup_start_time
------------------------
2013-05-09 05:55:00+08
(1 row)
postgres=# select pg_stop_backup();
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
pg_stop_backup
----------------
2/540000F0
(1 row)
postgres=# select pg_backup_start_time();
pg_backup_start_time
----------------------
(1 row)
postgres=# select pg_is_in_backup();
pg_is_in_backup
-----------------
f
(1 row)
[参考]
2. http://www.postgresql.org/docs/devel/static/functions-admin.html#FUNCTIONS-ADMIN-BACKUP
时间: 2024-10-07 02:33:20