![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
postgres
文章平均质量分 54
qxy0503
这个作者很懒,什么都没留下…
展开
-
[2022-03-29] No connections allowed during/after terminal recovery
背景,主备库failover切换测试,备库日志提示No connections allowed during/after terminal recovery报错,具体过程如下。1、主库flush 最后redo到备库15:15:12 SYS@db1(11g)> startup mount;ORACLE instance started.Total System Global Area 1252663296 bytesFixed Size 2252824原创 2022-03-29 15:46:33 · 720 阅读 · 0 评论 -
[2022-03-16]posgresql连接提示psql: error: FATAL: no pg_hba.conf
新安装的数据库连接时提示如下错误:[postgres@postgres data]$ psql -h 192.168.40.160 -p5432 -d postgrespsql: error: FATAL: no pg_hba.conf entry for host "192.168.40.160", user "postgres", database "postgres", SSL off[postgres@postgres data]$ 出现该错误的原因是没有在pg_hba.conf 里原创 2022-03-16 15:14:38 · 2479 阅读 · 0 评论 -
[2021-01-22]PostgreSQL简单extension实现
通过C语言实现简单插件功能,其实这个功能也可以通过C语言函数来实现类似的功能,C语言实现功能并应用到PostgreSQL中可以参考:https://blog.csdn.net/m15217321304/article/details/112987414--//最终的文件如下[postgres@postgres add_one]$ pwd/opt/soft_bak/postgresql-11.1/contrib/add_one[postgres@postgres add_one]$ ls -lt原创 2021-01-22 16:43:31 · 321 阅读 · 0 评论 -
[2021-01-22]c语言实现postgresql函数
有时候可以自己用C语言来实现一些特定功能的函数,C语言实现的函数如何被PostgreSQL引用呢,下面就介绍下PostgreSQL引用C语言函数的方法创建funcs.c文件,里面实现两个数相加的功能#include "postgres.h"#include <string.h>#include "fmgr.h"#include "utils/geo_decls.h"PG_MODULE_MAGIC;/* by value */PG_FUNCTION_INFO_V1(ad原创 2021-01-22 16:11:10 · 461 阅读 · 0 评论 -
[2021-01-06] Reply received is ‘GSOutput file <trail_file> is not in any allowed output directories
--//19.1投递进程报错GGSCI (dm01) 54> view report exppint*********************************************************************** Oracle GoldenGate Capture for Oracle Version 19.1.0.0.4 OGGCORE_19.1.0.0.0_PLATFORMS_191017.1054_FBO原创 2021-01-06 16:33:10 · 2061 阅读 · 1 评论 -
postgres clog事物可见性测试
可见性的信息记录在infomask字段/* * information stored in t_infomask: */#define HEAP_HASNULL 0x0001 /* has null attribute(s) */#define HEAP_HASVARWIDTH 0x0002 /* has variable-width attribute(s) */#define HEAP_HASEXTERNAL原创 2020-12-08 12:46:40 · 586 阅读 · 0 评论 -
使用pg_upgrade升级postgres大版本
pg_upgrade有普通模式和Link模式两种升级模式。 在普通模式下, 会把旧版本的数据拷贝到新版本中, 所以如果使用普通模式升级, 要确保有足够的磁盘空间存储新旧两份数据;link模式下, 只是在新版本的数据目录中建立了旧版本数据文件的硬链接, 可以有效减少磁盘占用的空间在升级之前应该运行pg_upgrade并用-c参数检查新旧版本的兼容性, 把每一项不兼容的问题都解决了才可以顺利升级。使用pg_upgrade时加上-c参数只会检查新旧版本的兼容性, 不会运行真正的升级程序, 不会修改数据文件, 并且原创 2020-11-30 11:17:10 · 1142 阅读 · 0 评论 -
docker 安装postgresql笔记
1、查找镜像[root@k8s ~]# docker search postgresNAME DESCRIPTION STARS OFFICIAL AUTOMATEDpostgres The PostgreSQL object-relational原创 2020-10-21 17:12:23 · 1535 阅读 · 0 评论 -
postgres统计信息规则和触发条件分析
在oracle中如果表或索引的统计信息不准,可能导致oracle走错执行计划。同样在postgres中也同样存在统计信息,如果统计信息不准也会导致走错执行计划。本文中主要测试什么时候会触发postgres做自动统计信息收集,因为postgres数据库是开源的,所以在源码中能看到触发统计信息的公式,可以通过临界值来测试自动统计信息收集。 postgres中统计信息是...原创 2018-07-22 16:22:51 · 3616 阅读 · 0 评论 -
使用eclipse分析postgres事务的调用开始过程
postgres数据库是开源数据库,数据库底层是通过C语言来实现的。这里介绍使用eclipse的debug方式来动态跟踪postgres中一个事务调用的开始过程(StartTransactionCommand)。/* ----------------------------------------------------------------* PostgresMain* ...原创 2020-04-13 15:20:38 · 324 阅读 · 0 评论 -
postgres-内存上下文分配源码
AtStart_Memory();--//xact.c/** AtStart_Memory*/static voidAtStart_Memory(void){ TransactionState s = CurrentTransactionState; /* * If this is the first time thr...原创 2020-04-13 15:03:38 · 377 阅读 · 0 评论 -
Postgres登陆认证源码
--//客户端认证函数入口ClientAuthentication(Port *port)voidClientAuthentication(Port *port){ int status = STATUS_ERROR; char *logdetail = NULL; /* ...原创 2020-04-08 16:46:42 · 1118 阅读 · 0 评论 -
postgres 切换用户和数据库
postgres=> \l+ List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges | Size | Ta...原创 2020-04-03 14:31:49 · 9332 阅读 · 0 评论 -
postgres远程连接方式配置
连接远端postgres时需要指定IP地址,默认安装的postgres数据库配置只监控本地地址(localhost),其他主机是无法访问的,这里通过一个简单的例介绍远程主机连接方式。环境如下:主机 IP地址QXY 192.168.40.170QXY1 192.168.40.1711、(QXY)主机创建一个新用户scott[postgres@qx...原创 2018-06-06 17:55:21 · 9635 阅读 · 1 评论 -
postgres-恢复到指定还原点
--//查看测试表数据[postgres@postgres ~]$ ppsql (11.1)Type "help" for help.postgres=# select * from tbl;id | ival | description | created_time ----+------+-------------+------------...原创 2020-04-03 11:55:02 · 670 阅读 · 0 评论 -
postgres-基于恢复到指定时间测试
--//当前数据[postgres@postgres ~]$ ppsql (11.1)Type "help" for help.postgres=# select *from tbl; id | ival | description | created_time ----+------+-------------+----------------...原创 2020-04-03 11:32:06 · 1175 阅读 · 0 评论 -
postgres 基于时间线恢复测试
--//当前时间线为5--//插入一些数据[postgres@postgres pg_wal]$ ppsql (11.1)Type "help" for help.postgres=# select * from tbl;id | ival | description | created_time ----+------+------------...原创 2020-04-03 11:11:20 · 861 阅读 · 0 评论 -
postgreSQL 时间线
“时间线”(Timeline)是PG一个很有特色的概念,在备份恢复方面的文档里面时有出现。但针对这个概念的详细解释却很少,也让人不太好理解,我们在此仔细解析一下。时间线的引入为了理解引入时间线的背景,我们来分析一下,如果没有时间线,会有什么问题?先举个将数据库恢复到以前时间点的例子。假设在一个数据库的运行过程 中,DBA在周三12:00AM删掉了一个关键的表,但是直到周五中午才发现这个问题...转载 2020-04-03 10:23:21 · 886 阅读 · 0 评论 -
postgres 表空间创建和查询
--//创建表空间所需目录[postgres@postgres ~]$ mkdir tbs[postgres@postgres ~]$ pwd/home/postgres[postgres@postgres ~]$ cd pg11[postgres@postgres pg11]$ ppsql (11.1)--//创建表空间语法postgres=# \help create tab...原创 2020-04-01 14:51:52 · 1037 阅读 · 0 评论 -
postgres主备库切换测试
主备库切换常用的有两种方式,第一种是使用触发文件,9.0之前的版本只能使用此种方式切换,第二个是使用命令promote的方式。切换之前需要查看主备库的角色,查看角色的方式可以参考:https://blog.csdn.net/m15217321304/article/details/86628843文件触发方式的主要步骤如下:1) 配置备库的recovery.conf文件trigge...原创 2019-01-25 14:08:15 · 1727 阅读 · 0 评论 -
postgres参数生效的几种方式
很多情况下需要修改$PGDATA下的postgresql.conf文件中的参数,有的改过之后需要重启postgres,有的只需要reload。postgres参数一共有7种类型,可以通过pg_settings视图查看,这7中类型的如下:postgres=# \d pg_settings View "pg_catalog.pg_settings" Column...原创 2018-09-28 16:31:13 · 2128 阅读 · 0 评论 -
postgres查询当前时间的方法
1、使用now()postgres=# select now(); now -------------------------------2019-03-26 22:30:10.204689-04(1 row)postgres=#2、current_timestamppostgres=# select current_...原创 2019-03-27 14:28:37 · 4567 阅读 · 0 评论 -
pg_stat_wal_receiver说明
postgres=# select * from pg_stat_wal_receiver;-[ RECORD 1 ]---------+----------------------------------------------------------------------------------------------------------------------------------...原创 2019-03-27 14:48:42 · 1156 阅读 · 0 评论 -
posgresql 监控主备延迟
本文主要摘自PostgresSQL实战一书,便于以后查询 同步流复制和异步流复制主备库之间的延迟是客观存在的,事实上当流复制主库、备库机器负载较低的情况下主备延迟通常能在毫秒级,数据库越繁忙或数据库主机负载越高主备延迟越大,有两个维度衡量主备库之间的延迟:通过WAL延迟时间衡量,通过WAL日志应用延迟量衡量,下面详细介绍。方式一:通过WAL延迟时间衡量 WAL的延...原创 2019-03-27 15:02:12 · 2595 阅读 · 0 评论 -
postgres判断主备角色的五种方法
方式一:操作系统上查看WAL发送进程或WAL接收进程流复制主库上有WAL发送进程,流复制备库上有WAL接收进程主库[postgres@postgres pg11]$ ps -ef | grep "wal" | grep -v "grep"postgres 6199 6195 0 10:55 ? 00:00:01 postgres: walwriter ...原创 2019-03-27 15:14:40 · 4078 阅读 · 0 评论 -
postgres主备切换之文件触发方式
本文测试参考PostgresSQL实战一书。本文档测试环境:主库IP:192.168.40.130 主机名:postgres 端口:5442备库IP: 192.168.40.131 主机名:postgreshot 端口:5442PostgreSQL9.0版本流复制主备切换只能通过创建触发文件方式进行,这一小节将介绍这种主备切换方式,测试环境为一主一备异步流复制...原创 2019-03-27 17:22:53 · 4971 阅读 · 0 评论 -
postgres常用的查询语句
1、查询配置文件的位置show config_file;2、查询当前参数值和该参数可以配置哪些值eg:select name, setting, enumvals, context from pg_settings where name = 'archive_mode';postgres=# select name, setting, enumvals, context f...原创 2019-01-25 12:16:34 · 2118 阅读 · 0 评论