pg_restore: [tar archiver] could not find header for file "toc.dat" in tar archive - postgresql-13

I'm try to restore a database .we get error. Like pg_restore: [tar archiver] could not find header for file "toc.dat" in tar archive
PostgreSQL 13 cluster
pls any one help me

Related

Error copying Postgres database in Heroku

I've been using the same command to copy my Heroku Postgres database from my production environment to my development without a hitch, until today:
heroku pg:copy <production-app>::DATABASE DATABASE --app <development-app>
Starting copy of DATABASE to DATABASE... done
Copying... !
▸ An error occurred and the backup did not finish.
▸
▸
▸ pg_restore: warning: errors ignored on restore: 36
▸ pg_restore finished with errors
▸ waiting for pg_dump to complete
▸ pg_dump finished successfully
▸
▸ Run heroku pg:backups:info <redacted> for more details.
Then if I run the command for more details, I get:
▸ Not found.
Probably not a solution because it didn't fully work for me, but possibly a place to start.
Rather than use pg:copy, I tried to break it into a few steps.
First, I did a dump from the source database:
pg_dump -O -f dumpfile.sql $(heroku config:get DATABASE_URL -a <my-app>
Next, I manually edited the file. I changed:
CREATE EXTENSION IF NOT EXISTS citext WITH SCHEMA public; to
CREATE EXTENSION IF NOT EXISTS citext WITH SCHEMA heroku_ext;
and I replaced any references to public.citext with heroku_ext.citext.
Last, I loaded the edited dump file:
psql $(heroku config:get HEROKU_POSTGRESQL_COLOR_URL -a <my-app>) < dumpfile.sql
It didn't fail in the same way as pg:copy but there were other errors that prevented my app from running properly. I haven't yet had the chance to dig deeper.
Update: Heroku support suggested this workaround to me that is somewhat similar but I've not had a chance to try it yet:
The best path forward is going to be moving those extensions into the heroku_ext schema.
To fix the pg:copy upgrade method, you will need to correct the source system to be in the heroku_ext. To do this you will want to capture a backup, modify the backup file and restore using the modified backup file.
Because of the uniqueness around each customers' database, we are not able to automate these steps behind the scenes.
Steps for doing so
Download Your Backup https://devcenter.heroku.com/articles/heroku-postgres-backups#downloading-your-backups
Convert dump file to .sql file pg_restore -f <output-file-name> <input-file-name>
Modify the CREATE EXTENSION commands to use WITH SCHEMA heroku_ext. You may need to modify the dependencies suggested above.
Restore the backup using pg_restore
Take a new backup pg:backup:capture on the corrected database so the next restore comes from a corrected

Load Mariadb files .frm .ibd .opt

I recovered Mariadb files from a crashed server with .frm, .ibd and .opt extensions.
How can I "mount" them into a new database ? I saw a way to do it with .sql files with something like mysql -u username -p new_database < data-dump.sql, but I don't know how to handle multiple files with this command.

Where can I find Postgresql dump file?

I use this command to create dump file from Postgresql database
pg_dump rulings > rulings.sql
But I can not find any SQL dump file from
C:\Program Files\PostgreSQL\12\bin
Command-line does not say anything about it, therefore I can not see if there is any error.
How can I find it??
In this case the dump file is created in the current directory, ie. the directory where pg_dump has been started. if this is run a script, check the directory used in the script.

Impossible to restore PostgreSQL database from dump

My computer runs Ubuntu 14.04 with postgreSQL 9.3
I would like to restore a large PSQL database called bigdb on my computer from a dump file (dump file size = 2.3GB).
The dump file comes from a different computer, I currently don't have any prior version of the database on my computer.
I created an empty database called testdb in which I'd like to "write" bigdb
I tried the command:
$pg_restore -C -d testdb dump.dmp
It gave me around 300 errors of this type:
pg_restore: [archiver (db)] Error from TOC entry 15475; 0 25342 TABLE DATA tb_italmaj jturf
pg_restore: [archiver (db)] could not execute query: ERROR: relation "tb_italmaj" does not exist
Command was: COPY tb_italmaj (id_mvtmaj, file_name, file_dh, pgdone, pgdonedh, pgfonctrue, pgerrcode, pgerrmess, pgrowdata) FROM stdin;
At the end, testdb is still empty.
It seems like testdb needs to have the same "structure" (tables,...) as bigdb, but I thought the parameter "-C" would create the database.
I also tried to extract the dump in a plain txt file dump.sql and I tried restoring it with the command:
$psql -v ON_ERROR_STOP=1 testdb < dump.sql
This error popped out immediately:
ERROR: relation "id_tab_eed__texte_seq" does not exist
Likewise it seems that the relations from bigdb need to be created before restoring it and I can't do this.
The only command that executed properly was:
$pg_restore -C dump.dmp
But in this case, no database was created on my computer.
I have been struggling with this issue for several hours. Can someone help me ?
Thanks in advance.
PS: This is my first post and I am not a native english speaker, I hope I was clear. If not, feel free to ask for complementary information.

Unable to restore SEC filings preloaded database from arelle.org, postgres pg_dump gzip file

I was trying to restore an SEC form preloaded database from Arelle.org using postgres. Below is the link:
http://arelle.org/documentation/xbrl-database/
It's the one towards the bottom of the page where it says "Preloaded Database".
I was able to download the file, but unable to gunzipped it at first. So, I copied the file and renamed it with .gz extension instead of .gzip. Then, I was able to gunzip it, but noot sure if that affects the file.
After that I tried the following command on postgress to restore the database in the database that I created:
psql -U username -d mydb -f secfile.pg (no luck)
I also tried:
pg_restore -C -d mydb secfile.pg (also no luck)
I am not sure if it's because I copied and renamed the file. But, I'd really appreciate it if anyone could help.

Resources