我成功地将Postgresql 11中的转储还原为9.3.9。
postgres=# drop database ambari
DROP DATABASE
[dumps]$ pg_restore -U postgres -h db ambari.dump
-- Dumped from database version 11.7
-- Dumped by pg_dump version 11.7
-- Name: ambari; Type: SCHEMA; Schema: -; Owner: ambari
CREATE SCHEMA ambari;
ALTER SCHEMA ambari OWNER TO ambari;
SET default_tablespace = '';
-- Name: adminpermission; Type: TABLE; Schema: ambari; Owner: ambari
CREATE TABLE ambari.adminpermission (
permission_id bigint NOT NULL,
permission_name character varying(255) NOT NULL,
resource_type_id integer NOT NULL,
permission_label character varying(255),
principal_id bigint NOT NULL,
sort_order smallint DEFAULT 1 NOT NULL
);
ALTER TABLE ambari.adminpermission OWNER TO ambari;等
-- PostgreSQL database dump complete当我列出数据库时,即使在原始数据库中也没有ambari。
[dumps]$ psql -U postgres -h db
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
jiradb7 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +我在模式之间也找不到它:
postgres=# \dn
List of schemas
Name | Owner
public | postgres
postgres-# select nspname from pg_catalog.pg_namespace;
nspname
pg_toast
pg_temp_1
pg_toast_temp_1
pg_catalog
public
information_schema我的问题是安巴里模式在哪里?
更新:
[dumps]$ psql -U postgres -h db
psql (11.7, server 9.3.9)
postgres=# create database ambari;
CREATE DATABASE
[dumps]$ pg_restore -U postgres -h db -d ambari ambari.dump
pg_restore: [archiver (db)] Error while INITIALIZING:
pg_restore: [archiver (db)] could not execute query: ERROR: unrecognized configuration parameter "idle_in_transaction_session_timeout"
Command was: SET idle_in_transaction_session_timeout = 0;
pg_restore: [archiver (db)] could not execute query: ERROR: unrecognized configuration parameter "row_security"
Command was: SET row_security = off;
WARNING: errors ignored on restore: 2
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
ambari | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
(7 rows)
postgres=# \c ambari
psql (9.2.24, server 9.3.9)
You are now connected to database "ambari" as user "postgres".
ambari=# \d
No relations found.
ambari=# \dtvs ambari.*
List of relations
Schema | Name | Type | Owner
ambari | adminpermission | table | ambari
ambari | adminprincipal | table | ambari
ambari | adminprincipaltype | table | ambari发布于 2020-06-16 15:08:14
你没有恢复垃圾场。您的pg_restore调用将转储的内容输出到标准输出。要将转储还原到数据库中,必须添加-d选项:
pg_restore -U postgres -h db -d databasename ambari.dump第二次尝试似乎已经成功。您可能看不到这些表,因为它们不在您的search_path上。试试\dt *.*。
https://dba.stackexchange.com/questions/269272
复制相似问题