AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-141992

Rogerlr's questions

Martin Hope
Rogerlr
Asked: 2021-04-03 18:21:50 +0800 CST

Oracle RAC srvctl 中的 start 和 enable 有什么区别?

  • 1

在 Oracle 12c 文档中,对于与数据库关联的服务, srvctl start和srvctl enable命令之间的区别并不清楚。在dba_service视图中,一个已经启动了服务的数据库,列ENABLED带有NO,我注意到当 RAC 服务已经启动并且您尝试启用它时,它会通知您它已经启用。

srvctl enable service -d mydb -s myservice
PRCC-1010: myservice was already enabled
PRCR-1002: Resource ora.mydb.myservice.svc is already enabled 
oracle oracle-12c
  • 1 个回答
  • 166 Views
Martin Hope
Rogerlr
Asked: 2019-10-11 16:33:57 +0800 CST

带有子查询的 PostgreSQL 查询没有按预期工作

  • 0

我正在尝试进行一个应该基于子查询返回记录的查询。这是一个例子:

select ... where tablename like ('%subquery_result%');

子查询按预期生成字符串:

appldb=# select '''%_p' || 
replace(substring(CAST(current_date - INTERVAL '1 MONTH' AS text), 1, 7),'-', '_') || '%''';
   ?column?
---------------
 '%_p2019_09%'
(1 row)

使用上面的字符串,返回记录:

select tablename from pg_tables 
where tablename like '%_p2019_09%' limit 2;
      tablename
---------------------
 part_p2019_09_26
 part_p2019_09_29
(2 rows)

但是当我使用完整的查询时,我没有返回:

appldb=# select tablename 
from pg_tables 
where tablename like ( select '''%_p' || 
replace(substring(CAST(current_date - INTERVAL '1 MONTH' AS text), 1, 7),'-', '_') || '%''' );
 tablename
-----------
(0 rows)

我已经尝试删除子查询周围的括号。但是查询出错了。

我是否错过了确保where子句解释子查询的任何步骤?

postgresql
  • 1 个回答
  • 220 Views
Martin Hope
Rogerlr
Asked: 2019-08-31 09:21:40 +0800 CST

如何将外部过程从 Oracle Listener 迁移到 Postgres

  • 0

考虑到我正在使用从我的 Oracle 12.2 侦听器(EXTPROC 侦听器参数)调用的 C 或 java 外部过程。该 Oracle 数据库将迁移到 Postgres。

我的问题是如何迁移 C 或 java 外部程序?

我应该为 Postgres 安装 C 或 java 扩展,然后在我的 Postgres 数据库中编译这些程序吗?

postgresql oracle-12c
  • 1 个回答
  • 55 Views
Martin Hope
Rogerlr
Asked: 2018-06-12 06:39:52 +0800 CST

尝试将 2 个或更多 Postgres 实例复制到一台备用主机

  • 3

我的设置有 2 个 Postgres 主机:

  • 主机SRV1作为主主机,有 2 个实例和 IP 192.168.1.241

    • A监听端口 5432 的实例
    • B监听端口 5433 的实例
  • 主机SRV2作为备用实例C,IP 192.168.1.243 使用默认端口。

我已经使用repmgrA配置了从一个实例到另一个实例的成功复制。C

我正在使用 PostgreSQL 10 和 rempgr 4。

如何使用 repmgr配置从新实例(例如B)到主机(备用)上的新实例的复制?SRV2

postgresql replication
  • 1 个回答
  • 584 Views
Martin Hope
Rogerlr
Asked: 2018-05-24 11:06:49 +0800 CST

如何使用 PG_RESTORE 恢复功能

  • 3

我做了我的数据库的备份:

-bash-4.2$ pg_dump -d mydb --format=custom -f /tmp/dump 
-bash-4.2$ 

下面检查,我在那里看到了我的功能:

-bash-4.2$ pg_restore -l /tmp/dump | grep -i addconf
233; 1255 39949 FUNCTION public addconfiguration(text) mydb
247; 1255 39950 FUNCTION public addconfiguration2(text) mydb
273; 1255 39951 FUNCTION public addconfiguration3(text) mydb

然后我尝试使用 Postgres pg_restore指令恢复一个函数:

-bash-4.2$ pg_restore -d postgres --function=addconfiguration2(text) -v /tmp/dump 
-bash: syntax error near unexpected token `('

我也尝试不使用括号和 arg,但它没有用:

-bash-4.2$ pg_restore -d postgres --function=addconfiguration2 -v /tmp/dump 
pg_restore: connecting to database for restore
pg_restore: implied data-only restore

在尝试之后,我验证了该函数是否是使用\df内部 psql 创建的,但没有成功。

如何使用 pg_restore 恢复函数?

postgresql pg-restore
  • 1 个回答
  • 3044 Views
Martin Hope
Rogerlr
Asked: 2018-04-25 08:45:08 +0800 CST

Postgres repmgr - 未附加下游节点

  • 0

我在 node1 和 node3 上配置了 repmgr 复制(分别是主节点和备用节点),并且设置成功地在备用节点上创建了新的记录和对象。但几周后,我注意到复制不再起作用,但是一些 repmgr 命令在复制工作时返回结果。我尝试重新启动并再次注册备用节点,但它不起作用。

我怎样才能继续复制?

节点状态如下:

-bash-4.2$ psql -V
psql (PostgreSQL) 10.3

节点 1 - 主要

-bash-4.2$ repmgr node check
Node "node1":
    Server role: OK (node is primary)
    Replication lag: OK (N/A - node is primary)
    WAL archiving: OK (0 pending archive ready files)
    Downstream servers: OK (this node has no downstream nodes)
    Replication slots: OK (node has no replication slots)
-bash-4.2$

节点 3 - 待机

-bash-4.2$ repmgr -f /etc/repmgr/10/repmgr.conf node check 
Node "node3":
    Server role: OK (node is standby)
    Replication lag: OK (0 seconds)
    WAL archiving: OK (0 pending archive ready files)
    Downstream servers: CRITICAL (1 of 1 downstream nodes not attached; missing: node3 (ID: 3))
    Replication slots: OK (node has no replication slots)

-bash-4.2$ repmgr node status 
Node "node3":
    PostgreSQL version: 10.3
    Total data size: 2393 MB
    Conninfo: host=node3 user=repmgr dbname=repmgr connect_timeout=2
    Role: standby
    WAL archiving: disabled (on standbys "archive_mode" must be set to "always" to be effective)
    Archive command: /bin/true
    WALs pending archiving: 0 pending files
    Replication connections: 0 (of maximal 10)
    Replication slots: 0 (of maximal 10)
    Upstream node: node3 (ID: 3)
    Replication lag: 0 seconds
    Last received LSN: 4/AC000000
    Last replayed LSN: 4/AC000140
postgresql repmgr
  • 2 个回答
  • 4430 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目

    • 12 个回答
  • Marko Smith

    如何让sqlplus的输出出现在一行中?

    • 3 个回答
  • Marko Smith

    选择具有最大日期或最晚日期的日期

    • 3 个回答
  • Marko Smith

    如何列出 PostgreSQL 中的所有模式?

    • 4 个回答
  • Marko Smith

    列出指定表的所有列

    • 5 个回答
  • Marko Smith

    如何在不修改我自己的 tnsnames.ora 的情况下使用 sqlplus 连接到位于另一台主机上的 Oracle 数据库

    • 4 个回答
  • Marko Smith

    你如何mysqldump特定的表?

    • 4 个回答
  • Marko Smith

    使用 psql 列出数据库权限

    • 10 个回答
  • Marko Smith

    如何从 PostgreSQL 中的选择查询中将值插入表中?

    • 4 个回答
  • Marko Smith

    如何使用 psql 列出所有数据库和表?

    • 7 个回答
  • Martin Hope
    Jin 连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目 2014-12-02 02:54:58 +0800 CST
  • Martin Hope
    Stéphane 如何列出 PostgreSQL 中的所有模式? 2013-04-16 11:19:16 +0800 CST
  • Martin Hope
    Mike Walsh 为什么事务日志不断增长或空间不足? 2012-12-05 18:11:22 +0800 CST
  • Martin Hope
    Stephane Rolland 列出指定表的所有列 2012-08-14 04:44:44 +0800 CST
  • Martin Hope
    haxney MySQL 能否合理地对数十亿行执行查询? 2012-07-03 11:36:13 +0800 CST
  • Martin Hope
    qazwsx 如何监控大型 .sql 文件的导入进度? 2012-05-03 08:54:41 +0800 CST
  • Martin Hope
    markdorison 你如何mysqldump特定的表? 2011-12-17 12:39:37 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 对 SQL 查询进行计时? 2011-06-04 02:22:54 +0800 CST
  • Martin Hope
    Jonas 如何从 PostgreSQL 中的选择查询中将值插入表中? 2011-05-28 00:33:05 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 列出所有数据库和表? 2011-02-18 00:45:49 +0800 CST

热门标签

sql-server mysql postgresql sql-server-2014 sql-server-2016 oracle sql-server-2008 database-design query-performance sql-server-2017

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve