随笔分类 -  PostgreSQL

摘要:迁移PostgreSQL的Sequence(序列)问题 https://masuit.net/2042?t=0HN6FQRQT1K6P 如何快速获取同步序列的SQL 有些项目中数据量比较少,在迁移过程;表数据迁移过去;但是序列需要重置下;接下来讲到,引用自:https://www.cnblogs.c 阅读全文
posted @ 2024-09-22 19:44 DBAGPT 编辑
摘要:在 PostgreSQL 中可以使用以下查询来获取指定 schema 下所有用户或角色对 sequence 的权限详细信息: 查询指定 schema 下所有用户对 sequence 的权限: SELECT pg_catalog.pg_get_userbyid(g.grantee) AS grante 阅读全文
posted @ 2024-06-04 22:28 DBAGPT 编辑
摘要:https://aws.amazon.com/cn/blogs/database/validating-database-objects-after-migration-using-aws-sct-and-aws-dms/ Step 1 - Validate packages Run the fol 阅读全文
posted @ 2024-05-15 21:41 DBAGPT 编辑
摘要:在Oracle中,您可以使用以下查询来获取所需的信息: 查询主键索引信息: SELECT c.table_name, c.constraint_name AS index_name, LISTAGG(c.column_name, ', ') WITHIN GROUP (ORDER BY c.posi 阅读全文
posted @ 2024-05-15 07:33 DBAGPT 编辑
摘要:#!/bin/bash # 读取result.txt文件内容 while IFS= read -r line do if [[ $line == *"ORACLEDB"* ]]; then ORACLEDB_line="$line" # 保存ORACLEDB行 else # 提取POSTGRES行的 阅读全文
posted @ 2024-05-02 17:10 DBAGPT 编辑
摘要:--1.SQL用 postgres账户查询 PostgreSQL 中指定DB以及schema下唯一索引的信息,按照表名:索引名:索引键值 并按表名排序输出 SELECT t.tablename AS table_name, i.indexname AS index_name, string_agg( 阅读全文
posted @ 2024-05-01 20:39 DBAGPT 编辑
摘要:#!/bin/bash # 过滤掉所有OK列以及以 开头的列到result1.txt文件中 grep -v -E "TABLE1: OK|--" data_validation.txt > result1.txt # 提取ORACLEDB以及POSTGRES开头的列,按照原格式存储到temp1.tx 阅读全文
posted @ 2024-04-24 22:57 DBAGPT 编辑
摘要:#!/bin/bash # 从data_validation.txt文件中提取需要处理的行,并将结果保存到temp.txt文件中 grep -E "ORACLEDB|POSTGRES" data_validation.txt > temp.txt # 逐行读取temp.txt文件 while IFS 阅读全文
posted @ 2024-04-24 22:32 DBAGPT 编辑
摘要:Oracle SELECT LOWER(c.table_name) || ':' || LOWER(i.index_name) || ':' || LOWER(wm_concat(c.column_name)) AS output FROM all_indexes i JOIN all_ind_co 阅读全文
posted @ 2024-04-24 22:02 DBAGPT 编辑
摘要:Both Oracle and PostgreSQL support the TIMESTAMP WITH TIME ZONE data type, but there are some differences in how they handle and store time zone infor 阅读全文
posted @ 2024-04-23 09:55 DBAGPT 编辑
摘要:设置root密码,并创建db以及密码和用户 Vagrant.configure("2") do |config| config.vm.box = "oraclelinux/8" config.vm.network "private_network", ip: "192.168.56.101" con 阅读全文
posted @ 2024-03-30 13:28 DBAGPT 编辑
摘要:CREATE OR REPLACE FUNCTION disable_triggers(a boolean, nsp character varying) RETURNS void AS $BODY$ declare act character varying; r record; begin if 阅读全文
posted @ 2024-03-27 22:46 DBAGPT 编辑
摘要:create or replace function disable_triggers(a boolean, nsp character varying) returns void as $$ declare act character varying; r record; begin if(a i 阅读全文
posted @ 2024-03-27 22:44 DBAGPT 编辑
摘要:导入时,加入参数TRUNCATE_TABLE,可以清空原有数据。 阅读全文
posted @ 2024-03-27 22:37 DBAGPT 编辑
摘要:如果你在使用 Hibernate 和 PostgreSQL 时遇到了 "character varying = bytea" 错误,那么可能是因为你在实体类中的属性映射或查询条件中将一个类型为 "character varying" 的属性与一个类型为 "bytea" 的列进行了混淆。 要解决这个错 阅读全文
posted @ 2024-03-27 22:01 DBAGPT 编辑
摘要:在 PostgreSQL 中,NULL 值是用于表示缺失或未知值的特殊值。无论数据类型是什么,NULL 值都被视为一个独立的概念,与其他值不相等,包括 bytea 和 character varying。 因此,在 PostgreSQL 中,bytea 类型的 NULL 值与 character v 阅读全文
posted @ 2024-03-27 21:59 DBAGPT 编辑
摘要:在将数据库对象从Oracle迁移到PostgreSQL时,以下是一个常见的迁移顺序建议: 表:首先迁移表的结构和数据,因为其他对象(如索引、触发器和函数)可能依赖于表的存在。 索引:迁移表之后,迁移索引。在PostgreSQL中创建与Oracle索引相对应的索引。 触发器:迁移触发器。在Postgr 阅读全文
posted @ 2024-03-14 22:22 DBAGPT 编辑
摘要:#!/bin/bash # 检查ora2pg命令是否可用 command -v ora2pg >/dev/null 2>&1 || { echo >&2 "ora2pg 工具未安装或未在PATH中。请先安装并配置好ora2pg工具。"; exit 1; } # 配置文件路径 ora2pg_conf= 阅读全文
posted @ 2024-03-14 22:06 DBAGPT 编辑
摘要:#!/bin/bash # Check if running as the postgres user if [[ "$USER" != "postgres" ]]; then echo "Error: This script must be run as the postgres user." e 阅读全文
posted @ 2024-03-14 21:56 DBAGPT 编辑
摘要:#!/bin/bash # Source database credentials SRC_DB_HOST="localhost" SRC_DB_PORT="5442" SRC_DB_NAME="postgres" SRC_DB_USER="myuser" SRC_DB_PASS='mypwd' # 阅读全文
posted @ 2024-03-14 21:23 DBAGPT 编辑

点击右上角即可分享
微信分享提示