Migrate Db To Postgres

Migrate Db To Postgres Rating: 7,6/10 4950 votes

Migrating the data cluster from C: to E:I’m new to working with large data in Windows, and ran into some unexpected difficulty when the PostgreSQL database ran out of space on my server’s C drive. It might also be a good idea to isolate your postgres database from a location other than the C:Program Files folder for permissions/security/data integrity reasons (I had a reference for this but I lost it). Here’s how to move your PostgreSQL data directoryBasing myself on and this 1. Stop the PostgreSQL serviceGo to Start Services. Scroll down to postgresql-x64-9.5 and right-click Stop 2.

MigratePostgresMigrate Db To Postgres

Copy dataI copied the data with File Explorer from C:Program FilesPostgreSQL9.5data to E:pgdbdata 3. Modify postgresql.conf ( probably not necessary if you move everything to the new location)I edited the following lines. Sc config postgresql-x64-9.5 binPath= 'C:Program FilesPostgreSQL9.5binpgctl.exe' runservice -N 'postgresql-x64-9.5' -D 'E:pgdbdata' -w'5. Change permissions for the new data directoryFor the new data-dictionary folder: Right-click on it and click Properties. Under the Security Tab click “ Edit.” and then “ Add.”. Type “ Network Service” and then click “ Check Names”, make sure it has Modify and Full Control permissions and then click OK.Equally important PostgreSQL needs to be able to “see” the data-directory (see my ), i.e.

Migrate Db To Postgres File

It needs to have read access to the parent directories above it. So Right-click on the pgdb folder and under the Security Permissions add Network Services again, but this time it only needs Read & Execute as well as List folder contents permissions. Restart the ServiceGo back to the Services window (if it was still open, refresh it) and Start the PostgreSQL service. You should be able to connect to it again in PGAdmin.