0
推荐
1625
阅读

备份 PostgreSQL 数据

和何包含珍贵数据的东西一样,PostgreSQL 数据库也应该经常备份。尽管这个过程相当简单, 但是我们还是应该理解做这件事所用的一些技巧和假设。 备份 PostgreSQL 数据有三种完全不同的方法:     SQL 转储    文件系统级别备份    在线备份    每种备...

发表了文章 • 2016-09-02 10:48 • 0 条评论

0
推荐
3524
阅读

#PostgreSQL# PostgreSQL PITR示例 (物理备份+WAL日志) 时间点恢复(Point In Time Recovery)

我将步骤整理如下:PITR:时间点恢复(Point In Time Recovery)一、备份1. 创建表,插入100W测试数据:  create table foo(id integer);insert into foo values(generate_series(1,1000000));2. 可以查看现在数据库的大小:select oid from pg_dtabase where datname='postgres'; 返回 16384 ;在base目录下找到该文...

发表了文章 • 2016-08-24 15:55 • 0 条评论

1
推荐
2095
阅读

#PostgreSQL# 数据库的备份与恢复

pg_dump <http://www.runoob.com/manual/PostgreSQL/app-pgdump.html>SQL 转储的方法采用的主意是创建一个文本文件,这个文本里面都是 SQL 命令:pg_dump dbname > outfile使用pg_dump自定义转储格式. 如果PostgreSQL是在一个安装了zlib 压缩库的系统上制作的, 那么自定义转储格式将在写入输出文件...

发表了文章 • 2016-08-23 16:30 • 0 条评论

0
推荐
1049
阅读

#psql# 把查询的结果以JSON输出出来

某行的全部列都要输出:row_to_json(tablename)可以在子查询中过滤一些列:array_to_json(array_agg(row_to_json(tablename))) 

发表了文章 • 2016-08-18 08:38 • 0 条评论

1
推荐
1487
阅读

安装最新版本的Postgresql数据库

结合了http://tecadmin.net/install-postgresql-server-on-ubuntu/ 和http://askubuntu.com/questions/291035/how-to-add-a-gpg-key-to-the-apt-sources-keyring还有自己的一点机灵1. 主体Step 1: Add PostgreSQL Apt RepositoryPostgreSQL packages are also available in default Ubuntu repository, But when I try t...

发表了文章 • 2016-08-11 16:55 • 0 条评论

1
推荐
1160
阅读

JSON Generation with PostgreSQL ---- [转]

How ToThe simplest way to return JSON is with row_to_json() function. It accepts a row value and returns a JSON value.select row_to_json(words) from words; This will return a single column per row in the words table.{"id":6013,"text":"advancement","pronunciation":"advancement",...} Howe...

发表了文章 • 2016-08-10 14:21 • 0 条评论

0
推荐
1268
阅读

Postgresql杀正在进行的进程

Table 9-60. Server Signaling FunctionsNameReturn TypeDescriptionpg_cancel_backend(pid int)booleanCancel a backend's current query. You can execute this against another backend that has exactly the same role as the user calling the function. In all other cases, you must be a superuser.pg_relo...

发表了文章 • 2016-08-10 09:23 • 0 条评论

0
推荐
1040
阅读

csv数据导入到psql中

scp /home/richard_ma/Downloads/DBA-AWS\ SFDC\ Host\ -\ SFDC\ PC.csv root@172.×××.×××.170:/data/richard手动去掉headercreate table temp_server_awscopy temp_server_aws from '/data/richard/DBA-AWS SFDC Host - SFDC PC.csv' with delimiter ',';COPY  (select * from temp_server_aws) to '/data/richard...

发表了文章 • 2016-07-27 11:05 • 0 条评论

0
推荐
1260
阅读

ACID properties

AtomicityThe atomicity property identifies that the transaction is atomic. An atomic transaction is either fully completed, or is not begun at all. Any updates that a transaction might affect on a system are completed in their entirety. If for any reason an error occurs and the transact...

发表了文章 • 2016-06-20 09:35 • 0 条评论

1
推荐
2001
阅读

dateadd () 在Postgresql & MS SQL

MSSQL select dateadd(year,1, '2004-2-29') PostgreSQL select '2004-2-29'::date + cast('1 years' as interval) MSSQL: select dateadd(month,1,'2004-2-29') PostgreSQL: select '2004-2-29'::date + cast('1 months' as interval) MSSQL: select dateadd(month,1, '1976-11-05 6:29 AM') PostgreSQL: select '2006-...

发表了文章 • 2016-06-17 09:05 • 0 条评论

0
推荐
3393
阅读

[转]----PostgreSQL 客户端下查看表,视图,function,切换数据库等

\?: 查看所有帮助 \l: 查看所有数据库 \c dataname: 切换数据库 \dt: 查看所有自己创建的表 \dt+: 查看所有自己创建的表,显示表的相关内容占的磁盘大小 \dt(+) tablename: 参看指定表 \dv: 查看所有自己创建的视图 \dv+: 查看所有自己创建的视图,显示大小 \df: 查看所有自己...

发表了文章 • 2016-06-13 15:34 • 0 条评论

0
推荐
1401
阅读

应用.sql.gz文件恢复备份的数据库

ftp上传: richard_ma@richardma:~$ ftp ×××.×××.×××.247 ftp> put /home/richard_ma/Downloads/controldb20160504.sql.gz /tmp登录247, tmp改名 cdb.sql.gz: 在CentOS端,/home/richard_ma/ 有了tmp文件, mv tmp cdb.sql.gz 创建表空间: [root@cdcns47 /]# cd /data [root@cdcns47 data]# mkdir pg_data [roo...

发表了文章 • 2016-05-27 16:46 • 0 条评论

0
推荐
2514
阅读

postgresql 查看数据库,表,索引,表空间以及大小

1,查看数据库查看复制打印?playboy=> \l                       //\加上字母l,相当于mysql的,mysql> show databases;        &nb...

发表了文章 • 2016-05-27 14:36 • 0 条评论