I have been having issues pushing my database onto Heroku. I have been getting this error:
pg_restore: creating DEFAULT "public.user_snacklist id"
pg_restore: processing data for table "public.favorites"
pg_restore: error: unrecognized data block type (0) while searching archive
! pg_restore errored with 1
When I run this command
heroku pg:push my_database DATABASE_URL
where I have my project database replacing "my_database". I have tried deleting my postgres addon and retrying. I have tried editing my database to remove any null data columns. I then retried this method with no luck.
I have a feeling there is something wrong with my favorites table inside my database but my friends and I could not find anything useful.
Any help would be appreciated!
Related
When using pg_upgrade to upgrade PostgreSQL from 11 to 13 I receive the below error in step "Restoring database schemas in the new cluster":
pg_restore: while PROCESSING TOC:
pg_restore: from TOC entry 3801; 0 0 ACL FUNCTION "pg_stat_statements_reset"() postgres
pg_restore: error: could not execute query: ERROR: role "29648" does not exist
I can see pg_restore has already successfully restored other databases and all custom tables and constraints.
After researching online I can see that other suggest using the pg_restore option "-x, --no-privileges" however I do not see a way of applying this to the pg_upgrade command.
I've tried to locate this role in origin to no avail using SELECT * FROM pg_roles; but I see no role with rolname or oid as "29648".
You somehow managed to corrupt your database: there are permissions on the function pg_stat_statements_reset() for a user that doesn't exist. You'll have to search your conscience or statement history for the cause.
The solution for this problem is simple, since the function belongs to an extension:
DROP EXTENSION pg_stat_statements;
CREATE EXTENSION pg_stat_statements;
Now the function will have the default permissions, and the upgrade should work without problems.
I'm trying postgres database backup and restore. The access to postgres is through pgpool.
To achieve the back up I am following the official postgres pg_dumpall documentation.
Commands taken from postgres website: https://www.postgresql.org/docs/14/app-pg-dumpall.html
$ pg_dumpall > db.out
To reload database(s) from this file, you can use:
$ psql -f db.out postgres
The backup works fine.
However, when attempting to restore, I'm getting the following error because of replication feature enabled by pgpool.
psql:tmp/backup/postgresDump/pg_data.out:15: ERROR: database "xyz" is being accessed by other users
DETAIL: There is 1 other session using the database.
Here are the following ideas I tried by browsing other SO questions.
I tried to update active='f' in pg_catalog.pg_replication_slots view. It failed with the error below
DETAIL: Views that do not select from a single table or view are not automatically updatable.
HINT: To enable updating the view, provide an INSTEAD OF UPDATE trigger or an unconditional ON UPDATE DO INSTEAD rule.
List the process ids for the replication slot and used pg_terminate_backend along with the pid, followed by restore.
Command to terminate the replication slot
psql -U postgres -h pgpool.default.cluster.local -c "SELECT pg_terminate_backend(3402)"
pg_terminate_backend
----------------------
f
(1 row)
As per the second answer in this link, Postgresql - unable to drop database because of some auto connections to DB
I executed the terminate_backend command multiple times until it returned 0 results. Although this step was successful, restore failed with error saying
psql:tmp/postgresDump/pg_data.out:14: ERROR: database "xyz" is being accessed by other users
DETAIL: There is 1 other session using the database.
Looks like as soon as I drop a replication slot, the pgpool recreates the replication slot and establishes a connection for it.
Tried by dropping the replication_slot following the official documentation.
https://www.postgresql.org/docs/9.5/functions-admin.html
psql -U postgres -h pgpool.default.local -c "select pg_drop_replication_slot('repmgr_slot_1001');"
ERROR: replication slot "repmgr_slot_1001" is active for PID 3402
Any information on how to execute restore functionality through psql is highly appreciated.
I am getting the following error. I can't backup and cant't restore any database. This will be a huge issue if the database crashes:
Database restore error: Postgres subprocess ('/usr/bin/pg_restore', u'--dbname=back', '--no-owner', '/tmp/tmpKY434e') error 1
Database backup error: Postgres subprocess ('/usr/bin/pg_dump', '--no-owner', '--file=/tmp/tmp40EUve/dump.sql', u'Live_GasandOil') error 1
Please help this is very critical
The issue was that there was an extra table in the database which was not supposed to be there. on drooping that table i got that fixed.
I have a DB in postgres. The DB is big with total size over 4TB and over 500,000 tables and many indexes. The DB is over 4 yr old.
Recently, the Pgsql DB server was not starting up, so I did the following to get it started again:
/usr/pgsql-9.3/bin/pg_resetxlog -f /var/lib/pgsql/9.3/data
/usr/pgsql-9.3/bin/pg_ctl -D /var/lib/pgsql/9.3/data stop
/usr/pgsql-9.3/bin/pg_ctl -D /var/lib/pgsql/9.3/data start
/usr/pgsql-9.3/bin/pg_ctl -D /var/lib/pgsql/9.3/data stop
systemctl restart postgresql-9.3
Since then I am getting the following error whenever I try to create a new table in the DB:
mps_schools=> create table test_test(hello int);
ERROR: right sibling's left-link doesn't match: block 19 links to 346956 instead of expected 346955 in index "pg_depend_reference_index"
I have tried re-indexing the DB, but it doesnt work. What more can I do?
pg_resetxlog destroyed your database, which is something that can easily happen, which is why you don't call it just because you don't get the database started. It's something of a last ditch effort to get a corrupted database up.
What can you do?
Best solution: restore from a backup from before you ran pg_resetxlog.
Perform an offline backup of your database.
Then start the database in single user mode:
postgres --single -P -D /your/database/directory yourdbname
Then try to reindex pg_depend:
REINDEX TABLE pg_catalog.pg_depend;
Exit the single user session, restart the database, run pg_dumpall to dump the database (and hope that it works), create a new database cluster with initdb and import the dump.
Don't continue using the cluster where you ran pg_resetxlog.
When I use the following command to create a database in OrientDB 2.0.10,
CREATE DATABASE plocal:../databases/pincode admin admin plocal
I get the following error.
Creating database [plocal:../databases/pincode] using the storage type [plocal]...
Error: com.orientechnologies.orient.core.exception.ODatabaseException: Cannot create database 'pincode'
Error: com.orientechnologies.orient.core.command.OCommandExecutorNotFoundException:Cannot find a command executor for the command request: sql.select count(*) from ORole where name.type() not in ["STRING"] and name is not null
I get the same error if i try to create the database this way,
CREATE DATABASE remote:localhost/pincode root password plocal
I have connected to the remote server in both cases.
Similar error of command executor not found, pops up even when I try to connect to the database.
Can someone help tell me where I'm going wrong?