Hi and thank you.
[QUOTE=ab;54488]On 09/19/2018 01:04 PM, mlino wrote:[color=blue]
I have installed Postgresql94 using zypper and I would like to change
the data directory. I alraedy have a database, so I would like to
migrate it to the new location and then change the location in the
postgresql configuration.[/color]
That sounds reasonable, assuming by “migrate it to the new location” you
mean something like the following:
- Stop the PostgreSQL service.
- Move the files to the new location.
- Update the configuration to point to the new location.
- Start the PostgreSQL service.
[color=red]
I followed the exact steps you listed above, but the server doesn’t start in the new location. I got an error in the postgresql-init script, related to the new location of the files.
[/color]
[color=blue]
I Have tried to make the change, but I was unable to manage to restart
postgres server again.[/color]
How, in annoying detail, did you try this, and what specific symptoms do
you have of failure? The more details you can provide the better,
including configuration files (like for PostgreSQL), log file output, etc.
[color=red]
I stopped the server the I did a copy for the new location using rsync
rsync -av -o -g /var/lib/pgsql/ /dados/pgsql
Then I changed the location of the files in /etc/sysconfig/postgresql pointing to the new location. I have left the new location commented as you can see bellow.
Path: Applications/PostgreSQL
Description: The PostgreSQL Database System
Type: string()
Default: “~postgres/data”
ServiceRestart: postgresql
In which directory should the PostgreSQL database reside?
POSTGRES_DATADIR=“~postgres/data”
#POSTGRES_DATADIR=“/dados/pgsql/data”
After that, I tried to restart the server and it doesn’t start due to an error in the postgresql-init script. Then I tried to fix the error but I didn’t figure out what was happening so I decided to rollback the changes.
This is the content of the /dados/pgsql
[FONT=Courier New][SIZE=3]
-rwxr-x— 1 postgres postgres 8851 Sep 19 17:37 .bash_history
drwxr-x— 3 postgres postgres 4096 Sep 19 15:06 .local
-rwxr-x— 1 postgres postgres 1314 Sep 19 15:06 .psql_history
-rwxr-x— 1 postgres postgres 600 Sep 19 15:06 .viminfo
-rw-r–r-- 1 postgres postgres 4947 Sep 19 16:25 .y2log
-rwxr-x— 1 postgres postgres 4 Sep 19 15:06 PG_VERSION
drwx------ 8 postgres postgres 4096 Sep 19 15:06 base
drwxr-xr-x 3 postgres postgres 4096 Sep 19 17:41 dados
drwx------ 19 postgres postgres 4096 Sep 19 17:52 data
drwx------ 2 postgres postgres 4096 Sep 19 15:06 global
-rwxr-x— 1 postgres postgres 1341 Sep 19 17:44 initlog
-rwxr-x— 1 postgres postgres 1058 Sep 19 15:06 logfile
drwx------ 2 postgres postgres 4096 Sep 19 15:06 pg_clog
drwx------ 2 postgres postgres 4096 Sep 19 15:06 pg_dynshmem
-rwxr-x— 1 postgres postgres 4517 Sep 19 15:06 pg_hba.conf
-rwxr-x— 1 postgres postgres 1636 Sep 19 15:06 pg_ident.conf
drwx------ 2 postgres postgres 4096 Sep 19 15:06 pg_log
drwx------ 4 postgres postgres 4096 Sep 19 15:06 pg_logical
drwx------ 4 postgres postgres 4096 Sep 19 15:06 pg_multixact
drwx------ 2 postgres postgres 4096 Sep 19 15:06 pg_notify
drwx------ 2 postgres postgres 4096 Sep 19 15:06 pg_replslot
drwx------ 2 postgres postgres 4096 Sep 19 15:06 pg_serial
drwx------ 2 postgres postgres 4096 Sep 19 15:06 pg_snapshots
drwx------ 2 postgres postgres 4096 Sep 19 15:06 pg_stat
drwx------ 2 postgres postgres 4096 Sep 19 15:06 pg_stat_tmp
drwx------ 2 postgres postgres 4096 Sep 19 15:06 pg_subtrans
drwx------ 2 postgres postgres 4096 Sep 19 15:06 pg_tblspc
drwx------ 2 postgres postgres 4096 Sep 19 15:06 pg_twophase
drwx------ 3 postgres postgres 4096 Sep 19 15:06 pg_xlog
-rwxr-x— 1 postgres postgres 88 Sep 19 15:06 postgresql.auto.conf
-rwxr-x— 1 postgres postgres 20860 Sep 19 15:06 postgresql.conf
-rwxr-x— 1 postgres postgres 57 Sep 19 15:06 postmaster.opts[/SIZE][/FONT]
[/color]
Thank you.
Good luck.
If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below.
If you want to send me a private message, please let me know in the
forum as I do not use the web interface often.[/QUOTE]