我正在尝试使用以下公式备份数据库:
pg_dump -h localhost -p 5432 -U user1004 -d dtm \
--format=custom --compress=9 --no-owner > dsm_001.dmp
它失败并显示以下错误消息:
pg_dump: [archiver (db)] query failed: ERROR: permission denied for relation audit_log
pg_dump: [archiver (db)] query was: LOCK TABLE admin.audit_log IN ACCESS SHARE MODE
第一个奇怪的事情是此数据库中没有admin
模式:
$ psql -d dtm
psql (9.5.17)
Type "help" for help.
dtm=# \dt admin.*
No matching relations found.
此外,用户拥有数据库并具有SUPERUSER
特权:
dsm=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
dtm | user1004 | 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 +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(4 rows)
dsm=# \du
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------------------+-----------
user1004 | Superuser | {}
postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
任何人都可以照亮它吗?