<<卸甲笔记>>-Oracle线下迁移包PPAS

简介: Oracle线下迁移包PPAS

一 环境准备

Oracle环境

a) IP:192.168.1.113,管理员用户 :sys,system,SID:prod
b) 普通用户scott,密码 scott
c) Oralce 源数据库分析
ali2

PPAS环境(Linux )

a) 安装PPAS(IP:192.168.1.116)

[root@test06 PPAS9.3GA]#tar zxvf ppasmeta-9.3.1.3-linux-x64.tar.gz
[root@test06 PPAS9.3GA]# cd ppasmeta-9.3.1.3-linux-x64
[root@test06 ppasmeta-9.3.1.3-linux-x64]# setenforce Permissive
[root@test06 ppasmeta-9.3.1.3-linux-x64]# ./ppasmeta-9.3.1.3-linux-x64.run --mode text
Language Selection
Please select the installation language
[1] English - English
[2] Japanese - 日本語
[3] Simplified Chinese - 简体中文
[4] Traditional Chinese - 繁体中文
[5] Korean - 한국어
Please choose an option [1] : 
----------------------------------------------------------------------------
Welcome to the Postgres Plus Advanced Server Setup Wizard.
----------------------------------------------------------------------------
----------------------------------------------------------------------------
Please specify the directory where Postgres Plus Advanced Server will be installed.
Installation Directory [/opt/PostgresPlus/9.3AS]: 
----------------------------------------------------------------------------
Select the components you want to install.
Database Server [Y/n] :Y
Connectors [Y/n] :Y
Infinite Cache [Y/n] :Y
Migration Toolkit [Y/n] :Y
Postgres Enterprise Manager Client [Y/n] :Y
pgpool-II [Y/n] :Y
EDB*Plus [Y/n] :Y
Slony Replication [Y/n] :Y
PgBouncer [Y/n] :Y
Is the selection above correct? [Y/n]: Y
----------------------------------------------------------------------------
Additional Directories
Please select a directory under which to store your data.
Data Directory [/opt/PostgresPlus/9.3AS/data]: 
Please select a directory under which to store your Write-Ahead Logs.
Write-Ahead Log (WAL) Directory [/opt/PostgresPlus/9.3AS/data/pg_xlog]: 
----------------------------------------------------------------------------
Configuration Mode
Postgres Plus Advanced Server always installs with Oracle(R) compatibility features and maintains full PostgreSQL compliance. Select your style preference for installation defaults and samples.
The Oracle configuration will cause the use of certain objects  (e.g. DATE data types, string operations, etc.) to produce Oracle compatible results, create the same Oracle sample tables, and have the database match Oracle examples used in the documentation.
Configuration Mode
[1] Oracle Compatible
[2] PostgreSQL Compatible
Please choose an option [1] : 
----------------------------------------------------------------------------
……
----------------------------------------------------------------------------
Pre Installation Summary
Following settings will be used for installation:
Installation Directory: /opt/PostgresPlus/9.3AS
Data Directory: /opt/PostgresPlus/9.3AS/data
WAL Directory: /opt/PostgresPlus/9.3AS/data/pg_xlog
Database Port: 5444
Database Superuser: enterprisedb
Operating System Account: enterprisedb
Database Service: ppas-9.3
PgBouncer Listening Port: 6432
Press [Enter] to continue :
----------------------------------------------------------------------------
Setup is now ready to begin installing Postgres Plus Advanced Server on your computer.
Do you want to continue? [Y/n]: Y
----------------------------------------------------------------------------
Please wait while Setup installs Postgres Plus Advanced Server on your computer.
 Installing Postgres Plus Advanced Server
 0% ______________ 50% ______________ 100%
 #########################################
 Installing Database Server ...
 Installing pgAgent ...
 Installing Connectors ...
 Installing Migration Toolkit ...
 Installing EDB*Plus ...
 Installing Infinite Cache ...
 Installing Postgres Enterprise Manager Client ...
 Installing Slony Replication ...
 Installing pgpool-II ...
 Installing PgBouncer ...
 Installing StackBuilder Plus ...
 ----------------------------------------------------------------------------
Setup has finished installing Postgres Plus Advanced Server on your computer.
[root@test06 ppasmeta-9.3.1.3-linux-x64]# ps hf -u enterprisedb -o cmd
/opt/PostgresPlus/9.3AS/bin/pgbouncer -d /opt/PostgresPlus/9.3AS/share/pgbouncer.ini
/opt/PostgresPlus/9.3AS/bin/pgagent -l 1 -s /var/log/ppas-agent-9.3.log hostaddr=localhost port=5444 dbname=edb user=enterprisedb
/opt/PostgresPlus/9.3AS/bin/edb-postgres -D /opt/PostgresPlus/9.3AS/data
 \_ postgres: logger process                                                
 \_ postgres: checkpointer process                                          
 \_ postgres: writer process                                                
 \_ postgres: wal writer process                                            
 \_ postgres: autovacuum launcher process                                   
 \_ postgres: stats collector process                                       
 \_ postgres: enterprisedb edb ::1[36172] idle 

b) PPAS pg_hba.conf文件基础配置

-bash-4.1$ vim /opt/PostgresPlus/9.3AS/data/pg_hba.conf
host    all             all             0.0.0.0/0               md5

c) 重新启动PPAS服务

[root@test06 data]# /etc/init.d/ppas-9.3 restart
Restarting Postgres Plus Advanced Server 9.3: 
waiting for server to shut down.... done
server stopped
waiting for server to start.... done
server started
Postgres Plus Advanced Server 9.3 restarted successfully

d) Oracle Client安装

[root@test06 ppasmeta-9.3.1.3-linux-x64]# rpm -ql oracle-instantclient11.2-basic-11.2.0.1.0-1.x86_64
package oracle-instantclient11.2-basic-11.2.0.1.0-1.x86_64 is not installed
[root@test06 oralceclient]# ls
oracle-instantclient11.2-basic-11.2.0.1.0-1.x86_64.rpm
[root@test06 oralceclient]# rpm -ivh oracle-instantclient11.2-basic-11.2.0.1.0-1.x86_64.rpm 
Preparing...                ########################################### [100%]
   1:oracle-instantclient11.########################################### [100%]
[root@test06 oralceclient]# rpm -ql oracle-instantclient11.2-basic-11.2.0.1.0-1.x86_64
/usr/lib/oracle/11.2/client64/bin/adrci
/usr/lib/oracle/11.2/client64/bin/genezi
/usr/lib/oracle/11.2/client64/lib/libclntsh.so.11.1
/usr/lib/oracle/11.2/client64/lib/libnnz11.so
/usr/lib/oracle/11.2/client64/lib/libocci.so.11.1
/usr/lib/oracle/11.2/client64/lib/libociei.so
/usr/lib/oracle/11.2/client64/lib/libocijdbc11.so
/usr/lib/oracle/11.2/client64/lib/ojdbc5.jar
/usr/lib/oracle/11.2/client64/lib/ojdbc6.jar
/usr/lib/oracle/11.2/client64/lib/xstreams.jar

e) JDK确认(1.6以上)

[root@test06 ppasmeta-9.3.1.3-linux-x64]# rpm -qa|grep java
java-1.7.0-openjdk-devel-1.7.0.45-2.4.3.3.el6.x86_64
java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.x86_64
tzdata-java-2013g-1.el6.noarch
gcc-java-4.4.7-4.el6.x86_64
java_cup-0.10k-5.el6.x86_64
java-1.5.0-gcj-1.5.0.0-29.1.el6.x86_64
java-1.6.0-openjdk-1.6.0.0-1.66.1.13.0.el6.x86_64
libvirt-java-0.4.9-1.el6.noarch
java-1.6.0-openjdk-devel-1.6.0.0-1.66.1.13.0.el6.x86_64
libvirt-java-devel-0.4.9-1.el6.noarch
[root@test06 ppasmeta-9.3.1.3-linux-x64]# which java
/usr/bin/java
[root@test06 ppasmeta-9.3.1.3-linux-x64]# ll /usr/bin/java
lrwxrwxrwx. 1 root root 22 Jun 13  2016 /usr/bin/java -> /etc/alternatives/java

f) JDBC配置

 [root@test06 ext]# cp /usr/lib/oracle/11.2/client64/lib/ojdbc6.jar /usr/lib/jvm/jre-1.7.0/lib/ext/
[root@test06 ext]# ls
dnsns.jar              localedata.jar  ojdbc6.jar      sunjce_provider.jar  zipfs.jar
gnome-java-bridge.jar  meta-index      pulse-java.jar  sunpkcs11.jar

二、迁移测试

在PPAS中建立测试用户及数据库

[root@test06 ppasmeta-9.3.1.3-linux-x64]# su - enterprisedb
-bash-4.1$ -bash-4.1$ psql
psql.bin (9.3.1.3)
Type "help" for help.
edb=# create user migration password 'migration' createrole createdb login;
CREATE ROLE
edb=# create database migration_test owner migration;
CREATE DATABASE

MTK配置文件toolkit.properties

/opt/PostgresPlus/9.3AS/etc/toolkit.properties
[root@test06 etc]# vim toolkit.properties
SRC_DB_URL=jdbc:oracle:thin:@192.168.1.113:1521:prod
SRC_DB_USER=scott
SRC_DB_PASSWORD=scott

TARGET_DB_URL=jdbc:edb://localhost:5444/mgt_testdb
TARGET_DB_USER=mgt_test
TARGET_DB_PASSWORD=mgt_test
/opt/PostgresPlus/9.3AS/bin/runMTK.sh

创建测试用户及测试数据库

-bash-4.1$ psql
psql.bin (9.3.1.3)
Type "help" for help.
edb=# create user mgt_test password 'mgt_test' createrole createuser createdb login;
CREATE ROLE
edb=# create database mgt_testdb owner mgt_test;
CREATE DATABASE

运行/runMTK.sh进行数据迁移

[root@test06 etc]# cd /opt/PostgresPlus/9.3AS/bin/
[root@test06 bin]# ./runMTK.sh scott
Source database connectivity info...
conn =jdbc:oracle:thin:@192.168.1.113:1521:prod
user =scott
password=******
Target database connectivity info...
conn =jdbc:edb://localhost:5444/mgt_testdb
user =mgt_test
password=******
Connecting with source Oracle database server...
Connecting with target EnterpriseDB database server...
Importing redwood schema scott...
Creating Schema...scott 
Creating Tables...
Creating Table: BONUS
Creating Table: DEPT
Creating Table: EMP
Creating Table: SALGRADE
Created 4 tables.
Loading Table Data in 8 MB batches...
Loading Table: BONUS ...
[BONUS] Table Data Load Summary: Total Time(s): 0.039 Total Rows: 0
Loading Table: DEPT ...
[DEPT] Migrated 4 rows.
[DEPT] Table Data Load Summary: Total Time(s): 0.01 Total Rows: 4
Loading Table: EMP ...
[EMP] Migrated 14 rows.
[EMP] Table Data Load Summary: Total Time(s): 0.049 Total Rows: 14
Loading Table: SALGRADE ...
[SALGRADE] Migrated 5 rows.
[SALGRADE] Table Data Load Summary: Total Time(s): 0.008 Total Rows: 5
Data Load Summary: Total Time (sec): 0.433 Total Rows: 23 Total Size(MB): 0.0
Creating Constraint: PK_DEPT
Creating Constraint: PK_EMP
Creating Constraint: FK_DEPTNO

Schema scott imported successfully.

Creating User: SCOTT

Migration process completed successfully.

Migration logs have been saved to /root/.enterprisedb/migration-toolkit/logs

******************** Migration Summary ********************
Tables: 4 out of 4
Constraints: 3 out of 3
Users: 1 out of 1

Total objects: 8
Successful count: 8
Failure count: 0

*************************************************************

查看迁移日志

[root@test06 ~]# ll /root/.enterprisedb/migration-toolkit/logs/*
-rw-r--r--. 1 root root 8059 Jun 14 09:41 /root/.enterprisedb/migration-toolkit/logs/mtk_20160614094135.log
-rw-r--r--. 1 root root 2652 Jun 14 10:00 /root/.enterprisedb/migration-toolkit/logs/mtk_20160614095957.log

PPAS数据验证

-bash-4.1$ psql -h localhost -U mgt_test -d mgt_testdb
Password for user mgt_test: 
psql.bin (9.3.1.3)
Type "help" for help.

mgt_testdb=# \d scott.*
            Table "scott.bonus"
 Column |         Type          | Modifiers 
--------+-----------------------+-----------
 ename  | character varying(10) | 
 job    | character varying(9)  | 
 sal    | numeric               | 
 comm   | numeric               | 

             Table "scott.dept"
 Column |         Type          | Modifiers 
--------+-----------------------+-----------
 deptno | numeric(2,0)          | not null
 dname  | character varying(14) | 
 loc    | character varying(13) | 
Indexes:
    "pk_dept" PRIMARY KEY, btree (deptno)
Referenced by:
    TABLE "scott.emp" CONSTRAINT "fk_deptno" FOREIGN KEY (deptno) REFERENCES scott.dept(deptno) MATCH FULL

                 Table "scott.emp"
  Column  |            Type             | Modifiers 
----------+-----------------------------+-----------
 empno    | numeric(4,0)                | not null
 ename    | character varying(10)       | 
 job      | character varying(9)        | 
 mgr      | numeric(4,0)                | 
 hiredate | timestamp without time zone | 
 sal      | numeric(7,2)                | 
 comm     | numeric(7,2)                | 
 deptno   | numeric(2,0)                | 
Indexes:
    "pk_emp" PRIMARY KEY, btree (empno)
Foreign-key constraints:
    "fk_deptno" FOREIGN KEY (deptno) REFERENCES scott.dept(deptno) MATCH FULL

       Index "scott.pk_dept"
 Column |     Type     | Definition 
--------+--------------+------------
 deptno | numeric(2,0) | deptno
primary key, btree, for table "scott.dept"

        Index "scott.pk_emp"
 Column |     Type     | Definition 
--------+--------------+------------
 empno  | numeric(4,0) | empno
primary key, btree, for table "scott.emp"

    Table "scott.salgrade"
 Column |  Type   | Modifiers 
--------+---------+-----------
 grade  | numeric | 
 losal  | numeric | 
 hisal  | numeric |
mgt_testdb=# select * from scott.emp;
 empno | ename  |    job    | mgr  |      hiredate      |   sal   |  comm   | deptno 
-------+--------+-----------+------+--------------------+---------+---------+--------
  7369 | SMITH  | CLERK     | 7902 | 17-DEC-80 00:00:00 |  800.00 |         |     20
  7499 | ALLEN  | SALESMAN  | 7698 | 20-FEB-81 00:00:00 | 1600.00 |  300.00 |     30
  7521 | WARD   | SALESMAN  | 7698 | 22-FEB-81 00:00:00 | 1250.00 |  500.00 |     30
  7566 | JONES  | MANAGER   | 7839 | 02-APR-81 00:00:00 | 2975.00 |         |     20
  7654 | MARTIN | SALESMAN  | 7698 | 28-SEP-81 00:00:00 | 1250.00 | 1400.00 |     30
  7698 | BLAKE  | MANAGER   | 7839 | 01-MAY-81 00:00:00 | 2850.00 |         |     30
  7782 | CLARK  | MANAGER   | 7839 | 09-JUN-81 00:00:00 | 2450.00 |         |     10
  7788 | SCOTT  | ANALYST   | 7566 | 19-APR-87 00:00:00 | 3000.00 |         |     20
  7839 | KING   | PRESIDENT |      | 17-NOV-81 00:00:00 | 5000.00 |         |     10
  7844 | TURNER | SALESMAN  | 7698 | 08-SEP-81 00:00:00 | 1500.00 |    0.00 |     30
  7876 | ADAMS  | CLERK     | 7788 | 23-MAY-87 00:00:00 | 1100.00 |         |     20
  7900 | JAMES  | CLERK     | 7698 | 03-DEC-81 00:00:00 |  950.00 |         |     30
  7902 | FORD   | ANALYST   | 7566 | 03-DEC-81 00:00:00 | 3000.00 |         |     20
  7934 | MILLER | CLERK     | 7782 | 23-JAN-82 00:00:00 | 1300.00 |         |     10
(14 rows)

Oracle端数据

SQL> select segment_name from dba_segments where owner='SCOTT';

SEGMENT_NAME
--------------------------------------------------------------------------------
PK_EMP
PK_DEPT
SALGRADE
EMP
DEPT

SQL> conn scott/scott
Connected.
SQL> desc emp;
 Name                       Null?    Type
 ----------------------------------------- -------- ----------------------------
 EMPNO                       NOT NULL NUMBER(4)
 ENAME                            VARCHAR2(10)
 JOB                            VARCHAR2(9)
 MGR                            NUMBER(4)
 HIREDATE                        DATE
 SAL                            NUMBER(7,2)
 COMM                            NUMBER(7,2)
 DEPTNO                         NUMBER(2)

SQL> select * from emp;

     EMPNO ENAME      JOB           MGR HIREDATE         SAL       COMM
---------- ---------- --------- ---------- ---------- ---------- ----------
    DEPTNO
----------
      7369 SMITH      CLERK          7902 17-12?-80         800
    20

      7499 ALLEN      SALESMAN          7698 20-2? -81        1600    300
    30

      7521 WARD       SALESMAN          7698 22-2? -81        1250    500
    30


     EMPNO ENAME      JOB           MGR HIREDATE         SAL       COMM
---------- ---------- --------- ---------- ---------- ---------- ----------
    DEPTNO
----------
      7566 JONES      MANAGER          7839 02-4? -81        2975
    20

      7654 MARTIN     SALESMAN          7698 28-9? -81        1250       1400
    30

      7698 BLAKE      MANAGER          7839 01-5? -81        2850
    30


     EMPNO ENAME      JOB           MGR HIREDATE         SAL       COMM
---------- ---------- --------- ---------- ---------- ---------- ----------
    DEPTNO
----------
      7782 CLARK      MANAGER          7839 09-6? -81        2450
    10

      7788 SCOTT      ANALYST          7566 19-4? -87        3000
    20

      7839 KING       PRESIDENT        17-11?-81        5000
    10


     EMPNO ENAME      JOB           MGR HIREDATE         SAL       COMM
---------- ---------- --------- ---------- ---------- ---------- ----------
    DEPTNO
----------
      7844 TURNER     SALESMAN          7698 08-9? -81        1500      0
    30

      7876 ADAMS      CLERK          7788 23-5? -87        1100
    20

      7900 JAMES      CLERK          7698 03-12?-81         950
    30


     EMPNO ENAME      JOB           MGR HIREDATE         SAL       COMM
---------- ---------- --------- ---------- ---------- ---------- ----------
    DEPTNO
----------
      7902 FORD       ANALYST          7566 03-12?-81        3000
    20

      7934 MILLER     CLERK          7782 23-1? -82        1300
    10


14 rows selected.
目录
相关文章
|
11天前
|
Oracle 关系型数据库 网络安全
崖山异构数据库迁移利器YMP初体验-Oracle迁移YashanDB
文章是作者小草对崖山异构数据库迁移利器 YMP 的初体验分享,包括背景、YMP 简介、体验环境说明、YMP 部署(含安装前准备、安装、卸载、启动与停止)、数据迁移及遇到的问题与解决过程。重点介绍了 YMP 功能、部署的诸多细节和数据迁移流程,还提到了安装和迁移中遇到的问题及解决办法。
|
8天前
|
SQL Oracle 关系型数据库
【YashanDB知识库】YMP迁移oracle不兼容给用户授权高级包
【YashanDB知识库】YMP迁移oracle不兼容给用户授权高级包
|
11天前
|
SQL Oracle 关系型数据库
Oracle向YashanDB迁移的丝滑体验
这篇文章主要介绍了从 Oracle 向 YashanDB 迁移的过程,包括 YashanDB 迁移平台 YMP 的介绍、下载安装准备、安装步骤、运行状态及访问方式,迁移中的添加数据源、创建任务、迁移配置、离线迁移、一致性校验等环节,还分享了迁移后的体验,认为 YMP 不错但希望增加在线迁移等功能。
|
12天前
|
SQL Oracle 关系型数据库
基于YMP工具实现Oracle迁移YashanDB
这篇文章主要介绍了基于 YMP 工具实现 Oracle 迁移 YashanDB 的相关内容,包括 YMP 工具的简介、架构、规格,迁移前的环境准备和工具部署,迁移过程中的创建任务、评估、配置、离线迁移、校验等步骤,以及迁移体验,指出其部署简单、数据类型兼容但存在部分功能不支持等情况。
|
12天前
|
Oracle 关系型数据库 MySQL
使用崖山YMP 迁移 Oracle/MySQL 至YashanDB 23.2 验证测试
这篇文章是作者尚雷关于使用崖山YMP迁移Oracle/MySQL至YashanDB 23.2的验证测试分享。介绍了YMP的产品信息,包括架构、版本支持等,还详细阐述了外置库部署、YMP部署、访问YMP、数据源管理、任务管理(创建任务、迁移配置、离线迁移、校验初始化、一致性校验)及MySQL迁移的全过程。
|
7月前
|
SQL 运维 Oracle
【迁移秘籍揭晓】ADB如何助你一臂之力,轻松玩转Oracle至ADB的数据大转移?
【8月更文挑战第27天】ADB(Autonomous Database)是由甲骨文公司推出的自动化的数据库服务,它极大简化了数据库的运维工作。在从传统Oracle数据库升级至ADB的过程中,数据迁移至关重要。
117 0
|
10月前
|
运维 Oracle 容灾
Oracle dataguard 容灾技术实战(笔记),教你一种更清晰的Linux运维架构
Oracle dataguard 容灾技术实战(笔记),教你一种更清晰的Linux运维架构
|
10月前
|
Oracle Java 关系型数据库
实时计算 Flink版产品使用合集之在同步Oracle数据时,需要下载并添加到项目中的jar包主要包括哪些
实时计算Flink版作为一种强大的流处理和批处理统一的计算框架,广泛应用于各种需要实时数据处理和分析的场景。实时计算Flink版通常结合SQL接口、DataStream API、以及与上下游数据源和存储系统的丰富连接器,提供了一套全面的解决方案,以应对各种实时计算需求。其低延迟、高吞吐、容错性强的特点,使其成为众多企业和组织实时数据处理首选的技术平台。以下是实时计算Flink版的一些典型使用合集。
110 13
|
9月前
|
Oracle 关系型数据库 数据库
oracle基本操作笔记分享
oracle基本操作笔记分享
60 0
|
10月前
|
存储 Oracle 关系型数据库
oracle 数据库 迁移 mysql数据库
将 Oracle 数据库迁移到 MySQL 是一项复杂的任务,因为这两种数据库管理系统具有不同的架构、语法和功能。
140 0

热门文章

最新文章

推荐镜像

更多