In this post, I am sharing basic steps to move or change the default Windows Data Directory of the PostgreSQL.
When we install PostgreSQL on Windows operating system, by default It store in “C:\Program Files\PostgreSQL\.\Data\”
Always best practice is to store database data in separate drive instead of the system drive.
Here, It is step-by-step:
Go to Windows Service, and Stop running PostgreSQL service.
To Close all your running transactions and applications which are currently connected to PostgreSQL.
If you are ready with your new location path, copy old data directory and paste in the new location path.
Right click on the newly created folder and make sure that It has all type permissions for local postgres system user.
Open Windows Registry Editor and go to this path “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\postgresql”.
Double click on “ImagePath” and change the default path of the Data Directory after “-D”
1 "C:\Program Files\PostgreSQL\9.5\bin\pg_ctl.exe" runservice -N "postgresql-x64-9.5" -D "D:\dbrnd\PostgreSQL\9.5\data" -w
Close all the open window and start the PostgreSQL Service.
Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.
If you like this post, then please share it with others.
Please follow dbrnd.com, I will share my experience towards the success of Database Research and Development Activity.
I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.