![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
postgressql
bigclouder
专注于金融领域……
展开
-
CentOS 6.5 安装postgres数据库
安装数据库yum install postgresql-server初始化数据库service postgresql initdb 启动数据库chkconfig postgresql onservice postgresql start常见配置初始化PG系统用户passwd postgres修改数据库访问控制,允许所有的IP进行访问vi /var/lib/pgsql/data/postgresql.conf修改listen_addresses = 'localhos原创 2020-10-21 10:44:25 · 285 阅读 · 1 评论 -
postgresql 9.3.1 编译安装
postgresql 9.3.1 编译安装1 编译、安装tar -xvf postgresql-9.3.1.tar cd postgresql-9.3.1./configuremakemake install 2 创建用户及组groupadd postgresuseradd -g postgres postgrespasswd postgres3 环境设置 mkdi原创 2016-03-02 15:58:34 · 705 阅读 · 0 评论 -
postgresql 查看数据库,表,索引,表空间以及大小
转载自博客http://blog.51yip.com/pgsql/1525.html1,查看数据库playboy=> \l //\加上字母l,相当于mysql的,mysql> show databases; List of databases Name | Owner | Encoding-----转载 2016-03-28 15:47:12 · 23967 阅读 · 1 评论 -
ERROR: current transaction is aborted, commands ignored until end of transaction block
我们在PG数据库,关闭了事务的自动提交的情况下,会经常的遇到这样的问题ERROR: current transaction is aborted, commands ignored until end of transaction block为什么会造成了这样的问题,原因是Postgres数据库中,同一事务中如果某次数据库操作中出错的话,那这个事务以后的数据库都会出错。我们举个很原创 2016-03-14 01:27:58 · 41889 阅读 · 2 评论 -
Postgresql 事务的提交与回滚
用过oracle或mysql的人都知道在sqlplus或mysql中,做一个dml语句,如果发现做错了,还可以rollback;掉,但在PostgreSQL的psql中,如果执行一个dml,没有先运行begin;的话,一执行完就马上提交了,不能回滚,这样容易导致误操作的发生,有没有什么办法避免这个风险呢?当然有,在psql中默认是打开自动提交的,我们可以关闭自动提交,方法如下:设置\set A原创 2016-03-14 01:23:07 · 19861 阅读 · 2 评论 -
如何看懂Postgres的执行计划
如何看懂Postgres的执行计划test=# insert into test select id from (select generate_series(1,10000000))ids(id);INSERT 0 10000000Time: 39656.016 mstest=# select * from test where id=1; id ---- 1(1 row)原创 2016-03-14 00:58:51 · 12192 阅读 · 1 评论 -
Postgresql 分区表测试
--创建父表drop table num_master;create table num_master (id int not null primary key); --创建生成分区表的函数create or replace function create_partition_table () returns void as $$declare i int;dec原创 2016-03-13 21:56:50 · 658 阅读 · 0 评论 -
使用pg_rman软件来实现postgresql数据库的备份恢复
使用pg_rman来进行备份恢复pg_rman的安装软件pg_rman-1.2.11-1.pg93.rhel6.x86_64.rpm在安装这个rpm的时候,有一个依赖包需要我们去额外下载的[09:33:24 root()@enmorep soft]# rpm -ivh pg_rman-1.2.11-1.pg94.rhel6.x86_64.rpmerror: Failed dep原创 2016-03-12 11:40:06 · 2549 阅读 · 0 评论 -
查看Postgresql的连接状况,以及如何的去kill掉pg的连接
查看Postgresql的连接状况,以及如何的去kill掉pg的连接 我们如果要杀掉远程的连接,首先第一步我们需要去查询出我们的数据库究竟有哪些连接,我们通过下面的视图 select * from pg_stat_activity;结果集会显示出当前连接的数据库名,用户,IP地址,连接开始时间,查询的语句等。 这里的pg_stat_activity其实是一个视图,它的定义可原创 2016-03-11 12:05:03 · 8298 阅读 · 0 评论 -
Postgresql 流复制同步模式
Postgresql 流复制同步模式这里配基于同步复制的Hot-Standby 就非常容易了,简单的来讲基于第6个教程只需要修改两个地方:编辑 postgresql.conf 以支持 WAL archiving:wal_level = archivearchive_mode = onarchive_command = 'cp %p /home/postgres/ar原创 2016-03-11 11:13:17 · 6527 阅读 · 0 评论 -
使用ora2pg完成从oracle到postgresql的迁移工作
使用Ora2Pg实现从oracle平台往postgres平台的迁移ora2pg这个软件是通过perl语言来实现数据库的连接与同步的PERL语言一直是90年代开发CGI程序的首选语言。因为那个时代Python/Ruby/PHP这类相对“高级”的脚本语言尚属幼年或着根本没有出生;而用C/C++来开发CGI,灵活性则又太差。PERL以其快速的开发周期,灵活的语法定义和能充分扩展模块机制,在那个Web原创 2016-03-10 15:03:17 · 9106 阅读 · 0 评论 -
PostgreSQL pg_hba.conf 文件解析以及忘记密码的处理方法
pg_hba.conf是客户端认证配置文件,定义如何认证客户端。下面是常用的pg_hba.conf配置:# TYPE DATABASE USER ADDRESS METHOD# "local" is for Unix domain socket connections onlylocal all原创 2016-03-15 19:13:40 · 6220 阅读 · 0 评论 -
postgresql 9.3.1数据库流复制
postgresql 9.3.1数据库流复制主库创建流复制用户CREATE USER repuser replication LOGIN CONNECTION LIMIT 5 ENCRYPTED PASSWORD '123456';在主库设置过滤,允许备库的相关的访问pg_hba.confhost replication repuser 10.211.55原创 2016-03-02 17:42:44 · 1131 阅读 · 0 评论 -
postgres 备库遇到 FATAL: the database system is starting up问题
postgres 备库遇到 FATAL: the database system is starting up问题[06:46:00 postgres()@kiwi data]$ psqlpsql: FATAL: the database system is starting up解决办法:修改备库的postgresql.conf参数文件hot_standby = on原创 2016-03-02 11:09:44 · 6797 阅读 · 0 评论