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的更多相关文章
- mysql Inoodb 内核
MySQL从5.5版本开始将InnoDB作为默认存储引擎,该存储引擎是第一个完整支持事务ACID特性的存储引擎,且支持数据行锁,多版本并发控制(MVCC),外键,以及一致性非锁定读. 作为默认存储引擎 ...
- PostgreSQL中流复制pg_basebackup做了什么
解压PostgreSQL源代码包后可以到如下路径:postgresql-9.2.4\src\backend\replication下可以看到,basebackup.c,另外还可以看到walreceiv ...
- InnoDB On-Disk Structures(三)--Tablespaces (转载)
转载.节选于 https://dev.mysql.com/doc/refman/8.0/en/innodb-tablespace.html This section covers topics rel ...
- 14.5.5 Creating a File-Per-Table Tablespace Outside the Data Directory
14.5.5 Creating a File-Per-Table Tablespace Outside the Data Directory 创建一个File-Per-Table Tablespace ...
- 1118ALTER TABLE tabname DISCARD TABLESPACE快速导入数据利用表空间
-- 快速导入数据如果你有.ibd文件的一个干净的备份,你可以按如下操作从被起源的地方恢复它到MySQL安装中:相当快速 1. 发出这个ALTER TABLE语句: 2. ALTER TABLE tb ...
- REORG TABLESPACE on z/os
这个困扰了我两天的问题终于解决了,在运行这个job时:总是提示 A REQUIRED DD CARD OR TEMPLATE IS MISSING NAME=SYSDISC A REQUIRED DD ...
- PostgreSQL: Query for location of global tablespace?
Q: I have been trying to make our database clients pro-active about not filling up the partition on ...
- svn switch relocate用法
svn info svn info 得到 Path: . Working Copy Root Path: /Users/chunhuizhao/phpworkspace/buptef_wxpay/tr ...
- Oracle Tablespace Transportation
前提:进行表空间传输需要用户有SYSDBA的系统权限,被移动的表空间是自包含的表空间,不应有依赖于表空间外部对象的对象存在.确定是否自包含可使用系统包DBMS_TTS中的TRANSPORT_SET_C ...
随机推荐
- jQuery ------------> 验证表单
简单的东西重复做,做多了之后,才能说熟能生巧. 做好一个精美的页面,固然是好,但是,一个页面除了写好之外,我们更需要的是将其功能完善.比如表单的验证,这只是众多工作之一.然后本次就以jQuery的va ...
- Spring事务管理只对出现运行期异常进行回滚
原文:http://blog.csdn.net/abc19900828/article/details/39497631 使用spring难免要用到spring的事务管理,要用事务管理又会很自然的选择 ...
- java 滤镜实现
一句话,滤镜的实现就是对像素点(RGBA)进行再运算,输出新的像素点. F(r,g,b,a)=G(r,g,b,a); 这个公式包含四个变换,即RGB颜色空间中RGB三个分量的变换以及透明度Alh ...
- Hbase的WAL在RegionServer基本调用过程
版权声明:本文由熊训德原创文章,转载请注明出处: 文章原文链接:https://www.qcloud.com/community/article/221 来源:腾云阁 https://www.qclo ...
- js时间格式转换的几种方法
公司项目需要获取时间并且转换格式,之前没有实现过但读过源码,新来的小哥给我讲了下细节.算是学到了..... function getLocalTime(){ var now=new Date(); v ...
- fis3运行项目的前准备
前几天搭建了fis3环境,但是不会运行项目.因为刚来公司前辈把项目打包给我,但是我之前没有做过这种项目. 今天前辈来了,教我几个命令行运行项目.但是没有成功..... 原因我的sass是单独安装的,没 ...
- Javascript中对象的Obeject.defineProperty()方法-------------(ES5/个人理解)
在讲到Obeject.defineProperty()方法之前先得说明一下ECMAScript中有两种属性:数据属性和访问器属性. 两种属性存在的意义:描述对象属性(key)的一些特性,因为这些属性是 ...
- 使用Dottrace跟踪代码执行时间
当自己程序遇到性能问题,比如IIs请求反应缓慢,客户端程序执行缓慢,怎么分析是哪里出了问题呢?dottrace可以帮助.net程序跟踪出代码里每个方法的执行时间,这样让我们更清晰的看出是哪里执行时间过 ...
- Codeforces Round #370 (Div. 2) E. Memory and Casinos 线段树
E. Memory and Casinos 题目连接: http://codeforces.com/contest/712/problem/E Description There are n casi ...
- tomcat 一个项目在本机和办公室以外电脑服务器上搭建出现乱码问题
插入数据库都是???乱码 页面浏览之前在本机插入的数据都是正常的 修改conf目录下的server.xml文件 转义字符集 为 GBK 或 UTF-8 utf-8 即 添加 URIEncoding= ...