Difference between revisions of "Moving the PostgreSQL Database to a New Location in MS Windows"
From Observer GigaFlow Support | VIAVI Solutions Inc.
Kevin Wilkie (Talk | contribs) |
|||
(2 intermediate revisions by one user not shown) | |||
Line 1: | Line 1: | ||
− | [[Category: | + | [[Category:Database]] |
− | + | 1 - Stop the Postgres and Gigaflow services | |
− | + | 2 - Copy C:\Program Files\PostgreSQL\data\*.* to the destination directory (ex. D:\pgdata\) #May be in a subfloder or versioned folder name | |
− | 1 - Stop the Postgres and | + | |
− | 2 - Copy C:\Program Files\PostgreSQL\data\*.* to the destination directory (ex. D:\pgdata\) | + | |
3 - Open the Registry Editor | 3 - Open the Registry Editor | ||
NB: when changing paths in registry keys, the path names are often case sensitive!! | NB: when changing paths in registry keys, the path names are often case sensitive!! | ||
Line 11: | Line 9: | ||
To: C:\Program Files\PostgreSQL\bin\pg_ctl.exe" runservice -N "pgsql-8.4" -D "d:\pgdata\" (where d:\pgdata = your new PostgreSQL directory) | To: C:\Program Files\PostgreSQL\bin\pg_ctl.exe" runservice -N "pgsql-8.4" -D "d:\pgdata\" (where d:\pgdata = your new PostgreSQL directory) | ||
5 - Go to HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations (OR HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432\PostgreSQL\Installations | 5 - Go to HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations (OR HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432\PostgreSQL\Installations | ||
− | - Look for and open the alpha-numeric subfolder | + | - Look for and open the alpha-numeric subfolder called "Directory Data" |
- Modify Data Directory: | - Modify Data Directory: | ||
From: C:\Program Files\PostgreSQL\data\ | From: C:\Program Files\PostgreSQL\data\ | ||
Line 24: | Line 22: | ||
- Right-click and select Properties | - Right-click and select Properties | ||
- Click on the Security | - Click on the Security | ||
− | - Click on Add to add the | + | - Click on Add to add the "Network Service" user |
− | - Give the | + | - Give the "Network Service"user the permission to Modify the directory |
− | 8 - Restart the PostgreSQL and | + | 8 - Restart the PostgreSQL and Gigaflow services from the Administrative Tools > Services panel on your server |
Latest revision as of 14:29, 29 August 2022
1 - Stop the Postgres and Gigaflow services 2 - Copy C:\Program Files\PostgreSQL\data\*.* to the destination directory (ex. D:\pgdata\) #May be in a subfloder or versioned folder name 3 - Open the Registry Editor NB: when changing paths in registry keys, the path names are often case sensitive!! 4 - Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\pgsql-8.4 (may be 9.0 or 9.1 depending on version installed) - Modify ImagePath: From: C:\Program Files\PostgreSQL\bin\pg_ctl.exe" runservice -N "pgsql-8.4" -D "C:\Program Files\PostgreSQL\data\" To: C:\Program Files\PostgreSQL\bin\pg_ctl.exe" runservice -N "pgsql-8.4" -D "d:\pgdata\" (where d:\pgdata = your new PostgreSQL directory) 5 - Go to HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations (OR HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432\PostgreSQL\Installations - Look for and open the alpha-numeric subfolder called "Directory Data" - Modify Data Directory: From: C:\Program Files\PostgreSQL\data\ To: D:\pgdata\ (where d:\pgdata = your new PostgreSQL directory) 6 - Go to HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Services\pgsql-9.0 (OR HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432\PostgreSQL\Services\pgsql-8.4 - Modify Data Directory: From: C:\Program Files\PostgreSQL\data\ To: D:\pgdata\ (where d:\pgdata = your new PostgreSQL directory) IMPORTANT: The data directory requires proper permissions in order to allow the service to have access. 7 - Open Windows Explorer - Go to the new PostgreSQL data directory in Windows Explorer - Right-click and select Properties - Click on the Security - Click on Add to add the "Network Service" user - Give the "Network Service"user the permission to Modify the directory 8 - Restart the PostgreSQL and Gigaflow services from the Administrative Tools > Services panel on your server