HiveBrain v1.2.0
Get Started
← Back to all entries
snippetsqlMinor

pg_dump custom archive and create backup date

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
pg_dumpcreatedatecustombackupandarchive

Problem

I have archive file with custom format created by pg_dump.

Does it contain the backup creation date?

I can't create backups by myself. I receive the archived files over specific network channel. Backup files have a reception date timestamp, but not the date when it has been created on server.

Solution

You can use pg_restore -l and the output should start with something like the following:

;
; Archive created at 2019-02-13 22:59:59 UTC
;     dbname: 
;     TOC Entries: 2615
;     Compression: -1
;     Dump Version: 1.13-0
;     Format: CUSTOM
;     Integer: 4 bytes
;     Offset: 8 bytes
;     Dumped from database version: 10.6 (Ubuntu 10.6-1.pgdg16.04+1)
;     Dumped by pg_dump version: 11.1 (Ubuntu 11.1-3.pgdg16.04+1)
;


As you see, the "Archived created at" line is probably what you're looking for.

Code Snippets

;
; Archive created at 2019-02-13 22:59:59 UTC
;     dbname: <database_name>
;     TOC Entries: 2615
;     Compression: -1
;     Dump Version: 1.13-0
;     Format: CUSTOM
;     Integer: 4 bytes
;     Offset: 8 bytes
;     Dumped from database version: 10.6 (Ubuntu 10.6-1.pgdg16.04+1)
;     Dumped by pg_dump version: 11.1 (Ubuntu 11.1-3.pgdg16.04+1)
;

Context

StackExchange Database Administrators Q#229704, answer score: 6

Revisions (0)

No revisions yet.