Re: Execute commands in single-user mode
От
Melvin Davidson
Тема
Re: Execute commands in single-user mode
Дата
Msg-id
CANu8FizL+2Miw60tq94m6e0PfC2UAxX71TpByHXP6-qymhTjRA@mail.gmail.com
Ответ на
Execute commands in single-user mode (Andreas Joseph Krogh)
Список
Дерево обсуждения
Execute commands in single-user mode Andreas Joseph Krogh <andreas@visena.com>
Re: Execute commands in single-user mode Tom Lane <tgl@sss.pgh.pa.us>
Re: Execute commands in single-user mode Andreas Joseph Krogh <andreas@visena.com>
Re: Execute commands in single-user mode Tom Lane <tgl@sss.pgh.pa.us>
Re: Execute commands in single-user mode Andreas Joseph Krogh <andreas@visena.com>
Re: Execute commands in single-user mode Jim Nasby <Jim.Nasby@BlueTreble.com>
Re: Execute commands in single-user mode Andreas Joseph Krogh <andreas@visena.com>
Re: Execute commands in single-user mode Jim Nasby <Jim.Nasby@BlueTreble.com>
Re: Execute commands in single-user mode Melvin Davidson <melvin6925@gmail.com>
Re: Execute commands in single-user mode Andreas Joseph Krogh <andreas@visena.com>
Re: Execute commands in single-user mode Melvin Davidson <melvin6925@gmail.com>
Well, you can't combine psql with the postgres startup, but you can issue subsequent commands from bash with the -c option:
EG:postgres --single -O -D $PGDATA $DB_NAME
# give postgres a few seconds to complete startup
sleep 30
psql -U postgres -d your_database -c "alter table pg_largeobject set tablespace some_tablespace;"
pg_ctl stop -d $PGDATA -m fastpsql -U postgres -d your_database -c "alter table pg_largeobject set tablespace some_tablespace;"
On Sun, Jan 10, 2016 at 8:53 AM, Andreas Joseph Krogh <andreas@visena.com> wrote:
Hi all.I'm planning to move all my pg_largeobject tables to separate tablespaces and to be able to do that I need to shuddown PG and start in single-user mode, like this:postgres --single -O -D $PGDATA $DB_NAMEThen I have to execute the command:alter table pg_largeobject set tablespace some_tablespace;Is it possible to issue the above ALTER-statement from the command-line so I can start PG in single-user mode AND execute the ALTER-statement from the command-line i a bash-loop?Thanks.
--
Melvin Davidson
I reserve the right to fantasize. Whether or not you
wish to share my fantasy is entirely up to you.
I reserve the right to fantasize. Whether or not you
wish to share my fantasy is entirely up to you.
В списке pgsql-general по дате отправления