这个问题很老了,但我想分享一个我发现的有效方法。
如果您没有使用“pg_dump”进行备份并且您的旧数据是文件夹,请尝试以下步骤。在 Postgres 数据库中,将记录添加到“pg_database”表。使用经理程序或“插入”。进行必要的检查并更改以下插入查询并运行它。
查询将在运行后返回一个 OID。使用此号码的名称创建一个文件夹。将旧数据复制到此文件夹后,即可使用。
/*
------------------------------------------
*** Recover From Folder ***
------------------------------------------
Check this table on your own system.
Change the differences below.
*/
INSERT INTO
pg_catalog.pg_database(
datname, datdba, encoding, datcollate, datctype, datistemplate, datallowconn,
datconnlimit, datlastsysoid, datfrozenxid, datminmxid, dattablespace, datacl)
VALUES(
-- Write Your collation
'NewDBname', 10, 6, 'Turkish_Turkey.1254', 'Turkish_Turkey.1254',
False, True, -1, 12400, '536', '1', 1663, Null);
/*
Create a folder in the Data directory under the name below New OID.
All old backup files in the directory "data\base\Old OID" are the directory with the new OID number
Copy. The database is now ready for use.
*/
select oid from pg_database a where a.datname = 'NewDBname';