How to relocate tablespace directory
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了How to relocate tablespace directory相关的知识,希望对你有一定的参考价值。
I’ll demonstrate how to relocate a tablespace directory without the reconstruction of databases.
I have a tablespace tblspc
located at /home/postgres/tblspc
and want to relocate to /home/postgres/new_tblspc
.
[1] Get Oid of the tablespace
testdb=# SELECT oid,spcname FROM pg_tablespace WHERE spcname = ‘tblspc‘;
oid | spcname
-------+----------
24580 | tblspc
(1 row)
[2] Stop postgres
[postgres]$ pg_ctl -D $PGDATA stop
[3] Relocate the tablespace directory
[postgres]$ cp -r /home/postgres/tblspc /home/postgres/new_tblspc
[postgres]$ rm -rf /home/postgres/tblspc
[4] Change the link of tablespace to new directory
[postgres]$ cd $PGDATA/pg_tblspc
[postgres]$ rm 24580
[postgres]$ ln -s /home/postgres/new_tblspc 24580
[5] Start postgres
[postgres]$ pg_ctl -D $PGDATA start
Then, the tablespace’s directory has changed.
testdb=# SELECT pg_tablespace_location(24580);
pg_tablespace_location
--------------------------
/home/postgres/new_tblspc
(1 row)
参考:
http://www.interdb.jp/blog/tips/relocatingtablespace/
以上是关于How to relocate tablespace directory的主要内容,如果未能解决你的问题,请参考以下文章
How to recover a skipped tablespace after an incomplete recovery? (Doc ID 1561645.1)
这个 GCC 错误“... relocation truncated to fit...”是啥意思?
ARM Cortex-M7 长分支在编译时出现错误“relocation truncated to fit: R_ARM_PREL31”
unable to extend table SYS.AUD$ by 8192 in tablespace SYSTEM
Oracle hidden costs revealed, Part2 – Using DTrace to find why writes in SYSTEM tablespace are slowe