zoukankan      html  css  js  c++  java
  • 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/

  • 相关阅读:
    fixed解决方案
    阿里巴巴全部行业分类
    下边的flash挡住了上面的元素
    Response.Status
    分割DataTable
    window.print() 指定打印的区域
    oracle .1
    最新:电视台mms地址在线观看
    Access 时间比较错误
    Entity Framework linq
  • 原文地址:https://www.cnblogs.com/xiaotengyi/p/5199614.html
Copyright © 2011-2022 走看看