pg_basebackup: error: could not initiate base backup: ERROR: could not stat file or directory



  • I have postgres 14 running on Windows 2019 server and I am using pg_basebackup to take regular backups.

    The same powershell script which was working last week suddenly started giving me below errors. No changes happened in the system except a host reboot.

    For testing purposes, I tried giving full access to everyone to the both data directory/backup directory and still the same error.

    PS G:\FULL_Backup> Start-Process -FilePath "C:\Program Files\PostgreSQL\14\bin\pg_basebackup.exe" -ArgumentList "-D G:\FULL_Backup\PG_Basebackup_2022-05-16_085816", "-Ft", "-z", "-R", "-U postgres", "-w" -Wait -NoNewWindow
    pg_basebackup: error: could not initiate base backup: ERROR:  could not stat file or directory "./base/18119/43980": Permission denied
    pg_basebackup: removing contents of data directory "G:\FULL_Backup\PG_Basebackup_2022-05-16_085816"
    

    Thanks, Udhayan



  • The database server cannot read one of its own files, which should never happen. You have to fix that condition.

    Probably causes for that are:

    • You are running a virus scanner on the data directory that locks the file. Don't do that.

    • You changed ownership or permissions on that file. You should never modify anything in the data directory.


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2