本文介绍了Windows上的pg_upgrade无法写入日志文件pg_upgrade_internal.log的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我试图在Windows 2008R2上运行pg_upgrade,但出现错误:I'm trying to run pg_upgrade on Windows 2008R2, but I'm getting the error:我在 23216734 ,该文件说明问题与权限有关,但无济于事Windows,因为我没有名为 postgresI saw a similar question for Linux at 23216734 which explains that the issue is with permissions, but it doesn't help with Windows as I do not have a user named postgres pg_upgrade文档,其中提到了 postgres 用户:但是,我又没有这样的用户,并且试图以管理员身份运行此命令,所以我不明白为什么我没有权限。我什至尝试做But again, I do not have such a user, and am trying to run this command as Administrator so I don't understand why I would have no permission. I even tried to doRUNAS /USER:Administrator "CMD.EXE"并在新的命令提示符下运行pg_upgrade,但出现相同的错误。And run pg_upgrade in the new command prompt, but am getting the same error.也,我不确定哪个目录需要权限?试图将 pg_upgrade_internal.log 写入哪里?Also, I am not sure which directory needs permissions? Where is the process trying to write pg_upgrade_internal.log to?更多详细信息:我正在运行的命令是:C:\Apps\postgresql\pgsql-9.5.0\bin>pg_upgrade.exe --old-datadir=E:\PGSQL_data --new-datadir=E:\PGSQLData\pgsql-9.5 --old-bindir=C:\Apps\postgresql\pgsql-9.4.5.3\bin --new-bindir=C:\Apps\postgresql\pgsql-9.5.0\bin在出现错误的同一命令提示符下,我运行了以下命令,所有这些都起作用,在相应的目录中创建一个空文件,因此允许对传递到pg_upgrade的目录进行写权限:From the same command prompt that gives the error I ran the following commands and they all worked, creating an empty file in the respective directories, so write permissions to the directories that are passed to pg_upgrade are allowed:C:\Apps\postgresql\pgsql-9.5.0\bin>type nul > E:\PGSQL_data\_test_write_permission.txtC:\Apps\postgresql\pgsql-9.5.0\bin>type nul > E:\PGSQLData\pgsql-9.5\_test_write_permission.txtC:\Apps\postgresql\pgsql-9.5.0\bin>type nul > C:\Apps\postgresql\pgsql-9.4.5.3\bin\_test_write_permission.txtC:\Apps\postgresql\pgsql-9.5.0\bin>type nul > C:\Apps\postgresql\pgsql-9.5.0\bin\_test_write_permission.txt所以现在我比以前更加困惑……So now I'm even more puzzled than before...更多细节:我看到创建内部日志文件的命令位于 / src / bin / pg_upgrade / option.c#L101I see that the command to create the internal log file is at /src/bin/pg_upgrade/option.c#L101哪个调用 fopen_priv(INTERNAL_LOG_FILE, a)定义为 / src / bin / pg_upgrade / file.c#L243但我不确定它试图写入哪个目录。如果我知道,那么我可以检查该目录上的权限。But I'm not sure to which directory it is trying to write. If I would know that then I can check the permissions on that directory.有什么想法吗?推荐答案因此,源代码在 /src/bin/pg_upgrade/file.c#L243 / * fopen()文件* / 给了我一个主意。So the source code comment at /src/bin/pg_upgrade/file.c#L243 /* fopen() file with no group/other permissions */ gave me an idea.我创建了一个临时文件文件夹C:\temp并授予所有人的 Write 权限,然后从该目录中运行pg_upgrade,即I created a temp folder at C:\temp and gave Write permissions to Everyone, and then ran pg_upgrade from that directory, i.e. C:\temp> C:\Apps\postgresql\pgsql-9.5.0\bin\pg_upgrade.exe --old-datadir = E:\PGSQL_data- new-datadir = E:\PGSQLData\pgsql-9.5 --old-bindir = C:\Apps\postgresql\pgsql-9.4.5.3\bin --new-bindir = C:\Apps\ \postgresql\pgsql-9.5.0\bin而在我尝试从工作目录%PGSQL%\bin 没有对所有人的写权限。Whereas before I was trying to run pg_upgrade from the working directory %PGSQL%\bin which did not have a Write permissions to Everyone.现在我不明白无法写入日志文件pg_upgrade_intern al.log 错误了。 文档实际上说 pg_upgrade需要在当前目录中具有写权限。 这篇关于Windows上的pg_upgrade无法写入日志文件pg_upgrade_internal.log的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 06-15 02:20