简体   繁体   English

postgres 无法统计文件<basexxxx/xxxx>没有权限

[英]postgres could not stat file <basexxxx/xxxx> Permission denied

This is a problem using stats(), or just when calculating the database size.这是使用 stats() 或仅在计算数据库大小时出现的问题。 Using postgresql in windows 7, localhost.在 Windows 7、本地主机中使用 postgresql。

The problem after doing this is:这样做后的问题是:

"could not stat file "base/17436/119145": Permission denied"

I spent a lot of time trying to fix this problem, until i realise what is really the problem about.我花了很多时间试图解决这个问题,直到我意识到问题的真正所在。

So i'm going to answer myself.所以我要自己回答。

This could be for 2 reasons:这可能有两个原因:

-User of database (login role) without enough permissions. - 没有足够权限的数据库用户(登录角色)。

In this case, check if the user, for example "postgres", have all the controls and privileges active.在这种情况下,请检查用户(例如“postgres”)是否激活了所有控件和权限。

-If localhost, check your antivirus, Twice. - 如果是本地主机,请检查您的防病毒软件,两次。

Statistics made by postgresql might be considered as a virus movement by many antiviruses (ESET in my case), is a false positive, the only solution is to locate the directory of the database (like \\PostgreSQL\\9.3\\data) and create am exception to that directory in your antivirus software. postgresql 进行的统计可能会被许多防病毒软件(在我的情况下为 ESET)视为病毒移动,是误报,唯一的解决方案是定位数据库目录(如 \\PostgreSQL\\9.3\\data)并创建异常到您的防病毒软件中的该目录。

As you can see, this second option is not related to the database code it self.如您所见,第二个选项与其自身的数据库代码无关。

Hope this help you.希望这对你有帮助。

在我的情况下(如@JB 建议的那样)在某些情况下重新启动 PostgreSQL 服务将起作用。

in my case I got this error after broke an "reindexdb.exe database" command with Ctrl-C.在我的情况下,我在使用 Ctrl-C 破坏“reindexdb.exe 数据库”命令后收到此错误。 I was running it on Windows 7 command prompt.我在 Windows 7 命令提示符下运行它。 Stop-Start of the PostgreSQL service solved the problem. PostgreSQL 服务的停止-启动解决了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM