Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/database/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Database PostgreSQL错误:进程仍在等待数据库0的关系2676上的AccessShareLock_Database_Postgresql_Postgresql 9.6_Database Locking - Fatal编程技术网

Database PostgreSQL错误:进程仍在等待数据库0的关系2676上的AccessShareLock

Database PostgreSQL错误:进程仍在等待数据库0的关系2676上的AccessShareLock,database,postgresql,postgresql-9.6,database-locking,Database,Postgresql,Postgresql 9.6,Database Locking,我们无法连接到PostgreSQL实例,必须重新启动PostgreSQL服务才能连接到该实例,但几天内我们开始出现相同的错误 日志显示以下错误 2019-02-18 08:00:03.043 UTC [5053] postgres@utilitydbLOG: process 5053 still waiting for AccessShareLock on relation 2676 of database 0 after 1000.431 ms 2019-02-18 08:04:04.486

我们无法连接到PostgreSQL实例,必须重新启动PostgreSQL服务才能连接到该实例,但几天内我们开始出现相同的错误

日志显示以下错误

2019-02-18 08:00:03.043 UTC [5053] postgres@utilitydbLOG:  process 5053 still waiting for AccessShareLock on relation 2676 of database 0 after 1000.431 ms
2019-02-18 08:04:04.486 UTC [5170] bucardo@bucardoLOG:  process 5170 still waiting for AccessShareLock on relation 2676 of database 0 after 1001.006 ms
2019-02-18 08:15:02.802 UTC [5445] postgres@utilitydbLOG:  process 5445 still waiting for AccessShareLock on relation 2676 of database 0 after 1000.425 ms
2019-02-18 08:30:02.844 UTC [5846] postgres@utilitydbLOG:  process 5846 still waiting for AccessShareLock on relation 2676 of database 0 after 1000.501 ms
2019-02-18 08:33:23.428 UTC [5940] bucardo@bucardoLOG:  process 5940 still waiting for AccessShareLock on relation 2676 of database 0 after 1001.265 ms
2019-02-18 08:45:02.869 UTC [6269] postgres@utilitydbLOG:  process 6269 still waiting for AccessShareLock on relation 2676 of database 0 after 1000.340 ms
2019-02-18 08:51:08.230 UTC [6478] dbuser@postgresLOG:  process 6478 still waiting for AccessShareLock on relation 2676 of database 0 after 1000.438 ms
当我检查服务状态时,它会显示以下详细信息

postgres: postgres utilitydb [local] startup waiting
postgres: postgres utilitydb [local] startup waiting
postgres: postgres utilitydb [local] startup waiting
postgres: postgres utilitydb [local] startup waiting
postgres: postgres utilitydb [local] startup waiting
postgres: postgres utilitydb [local] startup waiting
postgres: postgres utilitydb [local] startup waiting
postgres: postgres utilitydb [local] startup waiting
postgres: postgres utilitydb [local] startup waiting
我知道我需要检查数据库中的锁,但日志中提供的信息并不详细。PostgreSQL系统表中没有oid=0的数据库

如何调试此问题


任何帮助都将不胜感激。

有东西在
pg\u authid\u rolname\u索引
上持有一个
ACCESS EXCLUSIVE

持有此锁时,任何人都不能使用该索引,而且由于这是用户表(
pg_authid
)上的索引,您需要搜索特定用户名,因此无法成功登录

您已成为“拒绝服务”攻击的牺牲品

如果存在持有锁的活动数据库会话,请将其杀死

如果即使重新启动数据库,锁仍然存在,则它必须是已准备好的事务。关闭数据库并清除数据目录的
pg_twophase
子目录


更好地保护您的数据库并更改所有超级用户密码。

某些东西在
pg\u authid\u rolname\u索引上持有
ACCESS EXCLUSIVE

持有此锁时,任何人都不能使用该索引,而且由于这是用户表(
pg_authid
)上的索引,您需要搜索特定用户名,因此无法成功登录

您已成为“拒绝服务”攻击的牺牲品

如果存在持有锁的活动数据库会话,请将其杀死

如果即使重新启动数据库,锁仍然存在,则它必须是已准备好的事务。关闭数据库并清除数据目录的
pg_twophase
子目录


更好地保护您的数据库并更改所有超级用户密码。

请您提及用户表的名称好吗?我已将其添加到我的答案中。我们运行一项维护作业,对数据库的所有表(包括系统表)重新编制索引并清空。这是否可能是pg_authid_rolname_索引上的访问独占锁定的原因?是的,这可以解释问题。但如果该索引上的
REINDEX
需要一秒钟以上的时间,那么就有问题了。你有多少用户?为什么要这样做?
SELECT*fromtablename,其中ctid='(4,43)'可通过
从pg_类中选择relname(oid=16537)找到表名
请您提及用户表的名称好吗?我已将其添加到我的答案中。我们运行一个维护作业,该作业将重新索引和清空数据库的所有表(包括系统表)。这是否可能是pg_authid_rolname_索引上的访问独占锁定的原因?是的,这可以解释问题。但如果该索引上的
REINDEX
需要一秒钟以上的时间,那么就有问题了。你有多少用户?为什么要这样做?
SELECT*fromtablename,其中ctid='(4,43)'可通过
从pg_类中选择relname(oid=16537)找到表名