oracle迁移到greenplum的方案

oracle数据库是一种关系型数据库管理系统,在数据库领域一直处于领先的地位,适合于大型项目的开发;银行、电信、电商、金融等各领域都大量使用Oracle数据库。git

greenplum是一款开源的分布式数据库存储解决方案,主要关注数据仓库和BI报表及多维查询等方面。采用了shared-nothing的大规模并行处理MPP架构。github

目前我手头的工做是须要将oracle数据库迁移到greenplum库中,大概收集了一下资料。sql

由于greenplum数据库是基于postgresql的,因此能够使用oracle迁移到postgresql的方式来作。数据库

先看一下官网:安全

https://wiki.postgresql.org/wiki/Converting_from_other_Databases_to_PostgreSQL架构

 

 

官网上列举了全部oracle迁移到pg的可用工具。带锁的是收费的,不带锁的是开源的oracle

本次采用的是ora2pg的工具来作。app

安装这边就不提了,能够参照git官网的说明来安装 https://github.com/darold/ora2pg分布式

咱们的目的是要将oracle的表的表结构转换成pg的建表语句。数据的抽取咱们须要另外想办法。工具

这个ora2pg工具主要是用配置文件来控制须要转换的东西。能够单独转换表结构,能够导出数据。也能够导出视图、索引、包结构等。

主要的配置文件内容以下:

#---------------------------------#  
  
#---------------------------------#  
  
# Set the Oracle home directory  
ORACLE_HOME /usr/lib/oracle/18.3/client64  
  
# Set Oracle database connection (data source, user, password)  
ORACLE_DSN dbi:Oracle:host=192.168.***.***;sid=xe;port=****  
ORACLE_USER ***
ORACLE_PWD ****
# Oracle schema/owner to use  
#SCHEMA SCHEMA_NAME  
SCHEMA  TIANYA   SYSTEM
#--------------------------  
# EXPORT SECTION (Export type and filters)  
#--------------------------  
  
# Type of export. Values can be the following keyword:  
# TABLE Export tables, constraints, indexes, …  
# PACKAGE Export packages  
# INSERT Export data from table as INSERT statement  
# COPY Export data from table as COPY statement  
# VIEW Export views  
# GRANT Export grants  
# SEQUENCE Export sequences  
# TRIGGER Export triggers  
# FUNCTION Export functions  
# PROCEDURE Export procedures  
# TABLESPACE Export tablespace (PostgreSQL >= 8 only)  
# TYPE Export user-defined Oracle types  
# PARTITION Export range or list partition (PostgreSQL >= v8.4)  
# FDW Export table as foreign data wrapper tables  
# MVIEW Export materialized view as snapshot refresh view  
# QUERY Convert Oracle SQL queries from a file.  
# KETTLE Generate XML ktr template files to be used by Kettle.  
  
TYPE TABLE VIEW  COPY
# By default all output is dump to STDOUT if not send directly to PostgreSQL  
# database (see above). Give a filename to save export to it. If you want  
# a Gzip’d compressed file just add the extension .gz to the filename (you  
# need perl module Compress::Zlib from CPAN). Add extension .bz2 to use Bzip2  
# compression.  
OUTPUT output2.sql  
# Base directory where all dumped files must be written  
#OUTPUT_DIR /var/tmp  
OUTPUT_DIR /application/ora2pg/output

  主要就是配置了链接oracle的信息,选择要导出的类型,导出的文件存储在哪一个目录下等等

目前的问题是,这写方案都不是一键完成的,里面须要手工操做。而且没有测试过这些工具的可靠性,安全性。未必可以用于生产环境

相关文章
相关标签/搜索