Thread: pg_restore error
What does this error mean? pg_restore: [tar archiver] could not find header for file 1765.dat in tar archive All of a sudden, I'm encountering this error as I debug a problem with the db interface I'm using. My backups are created using a script that hasn't changed recently, though I have just upgraded OS from MacOSX v10.4.2. to 10.4.3. My backup script executes: pg_dump -Ft -b -v source_name > output_name Verbose output yields no error messages. MacOSX v10.4.3 PostgreSQL v8.1.0 Psycopg2 v2.0b5 Any suggestions? Thanks in advance! Scott
Scott Frankel <leknarf@pacbell.net> writes: > What does this error mean? > pg_restore: [tar archiver] could not find header for file 1765.dat > in tar archive It means either the tar file is corrupt or pg_restore has a bug. Can tar read the file correctly? If so, does it find a file named 1765.dat therein? (Historically, the tar code in pg_dump/pg_restore has not been as well debugged as the custom format, so you might want to just use -Fc instead. If you're really intent on using -Ft, be prepared to help us debug it.) regards, tom lane
Yes, the tar file contains a file called 1765.dat. A `cat` of that file shows nothing more than an empty line (i.e.: a carriage return). -rw------- 1 frankel prod 1 Nov 29 11:20 1765.dat Extracting the archive, tar reported a "lone zero block." I don't know what this refers to. tar: A lone zero block at 9242 I'm happy to either help debug Ft or switch to Fc in my scripts. I was under the impression, though, that Ft was required to backup db's with blobs. I am storing some thumbnail jpg images in my db. I'd also be interested to know if the pg_restore error is due to my upgrade to postgres 8.1 or macosx 10.4.3. Thanks Scott On Dec 1, 2005, at 4:47 PM, Tom Lane wrote: > Scott Frankel <leknarf@pacbell.net> writes: >> What does this error mean? >> pg_restore: [tar archiver] could not find header for file 1765.dat >> in tar archive > > It means either the tar file is corrupt or pg_restore has a bug. > > Can tar read the file correctly? If so, does it find a file named > 1765.dat therein? > > (Historically, the tar code in pg_dump/pg_restore has not been as > well debugged as the custom format, so you might want to just use > -Fc instead. If you're really intent on using -Ft, be prepared to > help us debug it.) > > regards, tom lane > > ---------------------------(end of > broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings
Scott Frankel <leknarf@pacbell.net> writes: > Yes, the tar file contains a file called 1765.dat. A `cat` of that > file shows nothing more than an empty line (i.e.: a carriage return). > -rw------- 1 frankel prod 1 Nov 29 11:20 1765.dat > Extracting the archive, tar reported a "lone zero block." I don't > know what this refers to. Hmm, how big is the tarfile, and would you be willing to send it to me? > I'm happy to either help debug Ft or switch to Fc in my scripts. I > was under the impression, though, that Ft was required to backup db's > with blobs. I am storing some thumbnail jpg images in my db. Either -Fc or -Ft can handle blobs ... and actually, in 8.1 the issue is gone entirely because plain text pg_dump can too. > I'd also be interested to know if the pg_restore error is due to my > upgrade to postgres 8.1 or macosx 10.4.3. Your guess is as good as mine at the moment. One thought that comes to mind --- did you move the tarfile across machines at any point, and if so could it have been munged by a Unix/DOS newline conversion? regards, tom lane
Using custom output format instead of tar output (-Fc instead if -Ft) appears to work without error. My initial tests with the backup db seem to match the original db. The compressed output files are also a lot smaller ;) Note that the problematic tar files were never transfered between platforms. They are written to a local disk and are accessed directly from that location. Thanks for the info! Scott On Dec 1, 2005, at 8:02 PM, Tom Lane wrote: > Scott Frankel <leknarf@pacbell.net> writes: >> Yes, the tar file contains a file called 1765.dat. A `cat` of that >> file shows nothing more than an empty line (i.e.: a carriage return). > >> -rw------- 1 frankel prod 1 Nov 29 11:20 1765.dat > >> Extracting the archive, tar reported a "lone zero block." I don't >> know what this refers to. > > Hmm, how big is the tarfile, and would you be willing to send it to > me? > >> I'm happy to either help debug Ft or switch to Fc in my scripts. I >> was under the impression, though, that Ft was required to backup db's >> with blobs. I am storing some thumbnail jpg images in my db. > > Either -Fc or -Ft can handle blobs ... and actually, in 8.1 the issue > is gone entirely because plain text pg_dump can too. > >> I'd also be interested to know if the pg_restore error is due to my >> upgrade to postgres 8.1 or macosx 10.4.3. > > Your guess is as good as mine at the moment. One thought that > comes to > mind --- did you move the tarfile across machines at any point, and if > so could it have been munged by a Unix/DOS newline conversion? > > regards, tom lane > > ---------------------------(end of > broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org