当前位置: 首页 > news >正文

pgloader SQLSERVER -> PostgreSQL 配置文件样例

pgloader 是什么?安装和基本用户法可以去其他同道的blog上去看,这里不占用网络空间了。刚开始用官方的文档读起还是很费劲的,所以把常用的配置例子放在这里。

官方文档:https://pgloader.readthedocs.io/en/latest/index.html

迁移 SQLServer 与迁移 MySQL 基本相同, 默认的 WITH 选项包含: no truncate, create tables, include drop, create indexes, reset sequences, foreign keys, downcase identifiers, uniquify index names, create schemas(仅SQLServer)

注意最后的分号不能省

完整用法

load databasefrom mssql://sa:123456@127.0.0.1/hsoatestinto postgresql://oa:password@192.168.0.70:11018/testdbWITH include drop, create tables, create indexes, reset sequences,workers = 8, concurrency = 1,multiple readers per thread, rows per range = 50000SET maintenance_work_mem to '128MB',work_mem to '12MB',search_path to 'sakila, public, "$user"'CAST type bigint when (= precision 20) to bigserial drop typemod,type date drop not null drop default using zero-dates-to-null,-- type tinyint to boolean using tinyint-to-boolean,type year to integerMATERIALIZE VIEWS film_list, staff_list-- INCLUDING ONLY TABLE NAMES MATCHING ~/film/, 'actor'-- EXCLUDING TABLE NAMES MATCHING ~<ory>-- DECODING TABLE NAMES MATCHING ~/messed/, ~/encoding/ AS utf8-- ALTER TABLE NAMES MATCHING 'film' RENAME TO 'films'-- ALTER TABLE NAMES MATCHING ~/_list$/ SET SCHEMA 'mv'ALTER TABLE NAMES MATCHING ~/_list$/, 'sales_by_store', ~/sales_by/SET SCHEMA 'mv'ALTER TABLE NAMES MATCHING 'film' RENAME TO 'films'ALTER TABLE NAMES MATCHING ~/./ SET (fillfactor='40')ALTER SCHEMA 'sakila' RENAME TO 'pagila'BEFORE LOAD DO$$ create schema if not exists pagila; $$,$$ create schema if not exists mv;     $$,$$ alter database sakila set search_path to pagila, mv, public; $$;

只导入结构

load databasefrom mssql://sa:123456@127.0.0.1/hsoatestinto postgresql://oa:password@192.168.0.70:11018/testdb
WITH schema only
;

只导入数据

load databasefrom mssql://sa:123456@127.0.0.1/hsoatestinto postgresql://oa:password@192.168.0.70:11018/testdb
WITH data only
;

单表导入

load databasefrom mssql://sa:123456@127.0.0.1/hsoatestinto postgresql://oa:password@192.168.0.70:11018/testdbincluding only table names like 'FlowBasicData' in schema 'dbo'
;

排除表

load databasefrom mssql://sa:123456@127.0.0.1/hsoatest_sgwDatainto postgresql://oa:password@192.168.0.70:11018/testdb
excluding table names like 'GlobalAccount' in schema 'dbo'
;

http://www.lryc.cn/news/501887.html

相关文章:

  • APP、小程序对接聚合广告平台,有哪些广告变现策略?
  • HarmonyOs DevEco Studio小技巧39-模拟器的使用
  • 【C语言】浮点数的原理、整型如何转换成浮点数
  • TesseractOCR-GUI:基于WPF/C#构建TesseractOCR简单易用的用户界面
  • Elasticsearch高性能实践
  • 软件测试--录制与回放脚本
  • nodejs 06.npm的使用以及package.json详解
  • 如何使用WinCC DataMonitor基于Web发布浏览Excel报表文档
  • 颜色的基本处理
  • 跟李笑来学美式俚语(Most Common American Idioms): Part 66
  • 爬虫技术简介
  • 如何打开Windows10的设备管理器
  • scala列表
  • c++检查某一文件是否存在
  • Scala的隐式类,隐式参数和值,隐式对象
  • LabVIEW实现HTTP通信
  • 【EXCEL】 获取多列中 不为空的那一个数据
  • VBA API 概述 | 宏编程
  • pythonOpenCV篇:0基础带你python入门之常用函数
  • 第十七届山东省职业院校技能大赛 中职组“网络安全”赛项资源任务书样题③
  • 【每日一题 基础题】验证回文串
  • 【Hadoop】-- hadoop3.x default port
  • SQL Server:只有MDF文件,如何附加数据库
  • 深入理解代理模式(Proxy):静态代理、动态代理与AOP
  • 项目中如何选择JVM垃圾回收器?
  • 如何借助5G网关实现油罐车安全在线监测
  • Edge SCDN的独特优势有哪些?
  • 在Goland中对goroutine协程断点调试
  • 解密分布式锁:保障系统一致性的关键
  • Redis 击穿、穿透与雪崩:深度解析与应对策略