Oracle 迁移数据到 Klustron
Oracle 迁移数据到 Klustron
注意:
如无特别说明,文中的版本号可以使用任何已发布版本的版本号代替。所有已发布版本详见:Release_notes
本文目标:
主要内容是使用 ora2pg工具迁移 Oracle 表和数据到 Klustron。环境中源端 Oracle 数据库和目标端 Klustron 已经安装部署好。本文主要介绍如何在源端和目标端安装部署 ora2pg,以及如何配置 ora2pg 将 Oracle 表和数据迁移到 Klustron。
1 ora2pg 安装部署
1.1 部署规划。
**源端:**Oracle | **目标端:**Klustron |
---|---|
IP **:**192.168.56.104 | IP : **计算节点:**192.168.56.112 **存储节点:**192.168.56.113,192.168.56.114 |
ora2pg **软件:**ora2pg for Oracle **ora2pg****软件:**ora2pg for PostgreSQL | |
安装 ora2pg **操作系统用户:**root | |
ora2pg **下载链接:**https://sourceforge.net/projects/ora2pg/ |
1.2 在源端配置 root 系统用户的环境变量,设置 ORACLE_HOME 、PATH 、LD_LIBRARY_PATH 环境变量。[Oracle]
[root@db19c ~]# more ~/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=/usr/local/mysql/bin:$PATH:$HOME/bin
export PATH
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19.0.0/db_1
export ORACLE_SID=orcl
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH
export LD_LIBRARY_PATH=$ORACLE_BASE/product/19.0.0/db_1/lib
1.3 在源端创建 /root/ora2pg 目录存放需要下载 ora2pg 的所有软件。[Oracle]
[root@db19c ~]# mkdir /root/ora2pg
[root@db19c ~]# cd /root/ora2pg
1.4 在源端安装 ora2pg 需要的驱动包。[Oracle]
[root@ db19c ora2pg]# yum install -y perf cpan
1.5 在源端安装 ora2pg 需要的DBI模块。[Oracle]
[root@ db19c ora2pg]# wget http://www.cpan.org/authors/id/T/TI/TIMB/DBI-1.643.tar.gz
[root@ db19c ora2pg]# tar -zxvf DBI-1.643.tar.gz
[root@ db19c ora2pg]# cd DBI-1.643
[root@ db19c ora2pg]# perl Makefile.PL
[root@ db19c ora2pg]# make && make install
1.6 在源端安装 ora2pg 需要的 DBD::Oracle 模块。[Oracle]
[root@db19c ~]# cd /root/ora2pg
[root@ db19c ora2pg]# wget http://www.cpan.org/authors/id/M/MJ/MJEVANS/DBD-Oracle-1.80.tar.gz
[root@ db19c ora2pg]# tar -zxvf DBD-Oracle-1.80.tar.gz
[root@ db19c ora2pg]# cd DBD-Oracle-1.80
[root@ db19c ora2pg]# perl Makefile.PL
[root@ db19c ora2pg]# make -j 8 && make install
1.7 在源端安装 ora2pg 需要的 DBD::PG 模块。[Oracle]
[root@db19c ~]# cd /root/ora2pg
[root@ db19c ora2pg]# yum install postgresql-devel -y
[root@ db19c ora2pg]# wget http://www.cpan.org/authors/id/T/TU/TURNSTEP/DBD-Pg-3.14.2.tar.gz
[root@ db19c ora2pg]# tar -zxvf DBD-Pg-3.14.2.tar.gz
[root@ db19c ora2pg]# cd DBD-Pg-3.14.2
[root@ db19c ora2pg]# perl Makefile.PL
[root@ db19c ora2pg]# make -j 8 && make install
1.8 在源端安装 ora2pg 软件模块。[Oracle]
[root@db19c ~]# cd /root/ora2pg
[root@ db19c ora2pg]# wget https://sourceforge.net/projects/ora2pg/files/23.2/ora2pg-23.2.tar.bz2 --no-check-certificate
[root@ db19c ora2pg]# tar xjf ora2pg-23.2.tar.bz2
[root@ db19c ora2pg]# cd ora2pg-23.2/
[root@ db19c ora2pg]# perl Makefile.PL
[root@ db19c ora2pg]# make && make install
1.9 检查所有软件是否已安装。[Oracle]
[root@db19c ora2pg]# cat > /root/check.pl <<"EOF"
#!/usr/bin/perl
use strict;
use ExtUtils::Installed;
my $inst= ExtUtils::Installed->new();
my @modules = $inst->modules();
foreach(@modules)
{
my $ver = $inst->version($_) || "???";
printf("%-12s -- %s\n", $_, $ver);
}
exit;
EOF
[root@db19c ora2pg]# perl /root/check.pl
DBD::Oracle -- 1.80
DBD::Pg -- 3.14.2
DBI -- 1.643
Ora2Pg -- 23.2
Perl -- 5.16.
2 数据库准备
2.1 源端 Oracle 数据库创建数据库用户。[Oracle]
[oracle@db19c ~]$ sqlplus / as sysdba
SQL> create user kunlun_test identified by kunlun;
SQL> grant dba to kunlun_test;
2.2 源端数据库用 kunlun_test 用户登录数据库,并创建表。[Oracle]
[oracle@db19c ~]$ sqlplus kunlun_test/kunlun
SQL> CREATE TABLE categories (
categories_id number(11) NOT NULL,
categories_image varchar2(64),
parent_id number(11) NOT NULL,
sort_order number(3),
date_added timestamp,
last_modified timestamp,
PRIMARY KEY (categories_id)
using index
);
SQL> CREATE TABLE categories_description (
categories_id number(11) NOT NULL,
language_id number(11) NOT NULL,
categories_name varchar2(32) NOT NULL,
PRIMARY KEY (categories_id,language_id)
using index
);
SQL> CREATE TABLE products (
products_id number(11) NOT NULL,
products_quantity number(4) NOT NULL,
products_model varchar2(12),
products_image varchar2(64),
products_price number(15,4) NOT NULL,
products_date_added timestamp NOT NULL,
products_last_modified timestamp,
products_date_available timestamp,
products_weight number(5,2) NOT NULL,
products_status number(1) NOT NULL,
products_tax_class_id number(11) NOT NULL,
manufacturers_id number(11),
products_ordered number(11) NOT NULL,
PRIMARY KEY (products_id)
using index
);
2.3 源端数据库对 kunlun_test 用户新建的 3 张表插入数据。[Oracle]
a) 对表categories插入数据
INSERT INTO categories VALUES (1,'category_hardware.gif',0,1,timestamp'2023-04-04 08:31:00',NULL);
INSERT INTO categories VALUES (2,'category_software.gif',0,2,timestamp'2023-04-04 08:31:00',NULL);
INSERT INTO categories VALUES (3,'category_dvd_movies.gif',0,3,timestamp'2023-04-04 08:31:00',NULL);
INSERT INTO categories VALUES (4,'subcategory_graphic_cards.gif',1,0,timestamp'2023-04-04 08:31:00',NULL);
INSERT INTO categories VALUES (5,'subcategory_printers.gif',1,0,timestamp'2023-04-04 08:31:00',NULL);
INSERT INTO categories VALUES (6,'subcategory_monitors.gif',1,0,timestamp'2023-04-04 08:31:00',NULL);
INSERT INTO categories VALUES (7,'subcategory_speakers.gif',1,0,timestamp'2023-04-04 08:31:00',NULL);
INSERT INTO categories VALUES (8,'subcategory_keyboards.gif',1,0,timestamp'2023-04-04 08:31:00',NULL);
INSERT INTO categories VALUES (9,'subcategory_mice.gif',1,0,timestamp'2023-04-04 08:31:00',NULL);
INSERT INTO categories VALUES (10,'subcategory_action.gif',3,0,timestamp'2023-04-04 08:31:00',NULL);
INSERT INTO categories VALUES (11,'subcategory_science_fiction.gif',3,0,timestamp'2023-04-04 08:31:00',NULL);
INSERT INTO categories VALUES (12,'subcategory_comedy.gif',3,0,timestamp'2023-04-04 08:31:00',NULL);
INSERT INTO categories VALUES (13,'subcategory_cartoons.gif',3,0,timestamp'2023-04-04 08:31:00',NULL);
INSERT INTO categories VALUES (14,'subcategory_thriller.gif',3,0,timestamp'2023-04-04 08:31:00',NULL);
INSERT INTO categories VALUES (15,'subcategory_drama.gif',3,0,timestamp'2023-04-04 08:31:00',NULL);
INSERT INTO categories VALUES (16,'subcategory_memory.gif',1,0,timestamp'2023-04-04 08:31:00',NULL);
INSERT INTO categories VALUES (17,'subcategory_cdrom_drives.gif',1,0,timestamp'2023-04-04 08:31:00',NULL);
INSERT INTO categories VALUES (18,'subcategory_simulation.gif',2,0,timestamp'2023-04-04 08:31:00',NULL);
INSERT INTO categories VALUES (19,'subcategory_action_games.gif',2,0,timestamp'2023-04-04 08:31:00',NULL);
INSERT INTO categories VALUES (20,'subcategory_strategy.gif',2,0,timestamp'2023-04-04 08:31:00',NULL);
INSERT INTO categories VALUES (21,'category_gadgets.png',0,4,timestamp'2023-04-04 08:31:00',NULL);
COMMIT;
b) 对表 categories_description 插入数据
INSERT INTO categories_description VALUES (1,1,'Hardware');
INSERT INTO categories_description VALUES (2,1,'Software');
INSERT INTO categories_description VALUES (3,1,'DVD Movies');
INSERT INTO categories_description VALUES (4,1,'Graphics Cards');
INSERT INTO categories_description VALUES (5,1,'Printers');
INSERT INTO categories_description VALUES (6,1,'Monitors');
INSERT INTO categories_description VALUES (7,1,'Speakers');
INSERT INTO categories_description VALUES (8,1,'Keyboards');
INSERT INTO categories_description VALUES (9,1,'Mice');
INSERT INTO categories_description VALUES (10,1,'Action');
INSERT INTO categories_description VALUES (11,1,'Science Fiction');
INSERT INTO categories_description VALUES (12,1,'Comedy');
INSERT INTO categories_description VALUES (13,1,'Cartoons');
INSERT INTO categories_description VALUES (14,1,'Thriller');
INSERT INTO categories_description VALUES (15,1,'Drama');
INSERT INTO categories_description VALUES (16,1,'Memory');
INSERT INTO categories_description VALUES (17,1,'CDROM Drives');
INSERT INTO categories_description VALUES (18,1,'Simulation');
INSERT INTO categories_description VALUES (19,1,'Action');
INSERT INTO categories_description VALUES (20,1,'Strategy');
INSERT INTO categories_description VALUES (21,1,'Gadgets');
COMMIT;
c) 对表 products 插入数据
INSERT INTO products VALUES (1,32,'MG200MMS','matrox/mg200mms.gif','299.9900',timestamp'2023-04-04 08:31:00',NULL,NULL,'23.00',1,1,1,0);
INSERT INTO products VALUES (2,32,'MG400-32MB','matrox/mg400-32mb.gif','499.9900',timestamp'2023-04-04 08:31:00',NULL,NULL,'23.00',1,1,1,0);
INSERT INTO products VALUES (3,2,'MSIMPRO','microsoft/msimpro.gif','49.9900',timestamp'2023-04-04 08:31:00',NULL,NULL,'7.00',1,1,3,0);
INSERT INTO products VALUES (4,13,'DVD-RPMK','dvd/replacement_killers.gif','42.0000',timestamp'2023-04-04 08:31:00',NULL,NULL,'23.00',1,1,2,0);
INSERT INTO products VALUES (5,17,'DVD-BLDRNDC','dvd/blade_runner.gif','35.9900',timestamp'2023-04-04 08:31:00',NULL,NULL,'7.00',1,1,3,0);
INSERT INTO products VALUES (6,10,'DVD-MATR','dvd/the_matrix.gif','39.9900',timestamp'2023-04-04 08:31:00',NULL,NULL,'7.00',1,1,3,0);
INSERT INTO products VALUES (7,10,'DVD-YGEM','dvd/youve_got_mail.gif','34.9900',timestamp'2023-04-04 08:31:00',NULL,NULL,'7.00',1,1,3,0);
INSERT INTO products VALUES (8,10,'DVD-ABUG','dvd/a_bugs_life.gif','35.9900',timestamp'2023-04-04 08:31:00',NULL,NULL,'7.00',1,1,3,0);
INSERT INTO products VALUES (9,10,'DVD-UNSG','dvd/under_siege.gif','29.9900',timestamp'2023-04-04 08:31:00',NULL,NULL,'7.00',1,1,3,0);
INSERT INTO products VALUES (10,10,'DVD-UNSG2','dvd/under_siege2.gif','29.9900',timestamp'2023-04-04 08:31:00',NULL,NULL,'7.00',1,1,3,0);
INSERT INTO products VALUES (11,10,'DVD-FDBL','dvd/fire_down_below.gif','29.9900',timestamp'2023-04-04 08:31:00',NULL,NULL,'7.00',1,1,3,0);
INSERT INTO products VALUES (12,10,'DVD-DHWV','dvd/die_hard_3.gif','39.9900',timestamp'2023-04-04 08:31:00',NULL,NULL,'7.00',1,1,4,0);
INSERT INTO products VALUES (13,10,'DVD-LTWP','dvd/lethal_weapon.gif','34.9900',timestamp'2023-04-04 08:31:00',NULL,NULL,'7.00',1,1,3,0);
INSERT INTO products VALUES (14,10,'DVD-REDC','dvd/red_corner.gif','32.0000',timestamp'2023-04-04 08:31:00',NULL,NULL,'7.00',1,1,3,0);
INSERT INTO products VALUES (15,10,'DVD-FRAN','dvd/frantic.gif','35.0000',timestamp'2023-04-04 08:31:00',NULL,NULL,'7.00',1,1,3,0);
INSERT INTO products VALUES (16,10,'DVD-CUFI','dvd/courage_under_fire.gif','38.9900',timestamp'2023-04-04 08:31:00',NULL,NULL,'7.00',1,1,4,0);
INSERT INTO products VALUES (17,10,'DVD-SPEED','dvd/speed.gif','39.9900',timestamp'2023-04-04 08:31:00',NULL,NULL,'7.00',1,1,4,0);
INSERT INTO products VALUES (18,10,'DVD-SPEED2','dvd/speed_2.gif','42.0000',timestamp'2023-04-04 08:31:00',NULL,NULL,'7.00',1,1,4,0);
INSERT INTO products VALUES (19,10,'DVD-TSAB','dvd/theres_something_about_mary.gif','49.9900',timestamp'2023-04-04 08:31:00',NULL,NULL,'7.00',1,1,4,0);
INSERT INTO products VALUES (20,10,'DVD-BELOVED','dvd/beloved.gif','54.9900',timestamp'2023-04-04 08:31:00',NULL,NULL,'7.00',1,1,3,0);
INSERT INTO products VALUES (21,16,'PC-SWAT3','sierra/swat_3.gif','79.9900',timestamp'2023-04-04 08:31:00',NULL,NULL,'7.00',1,1,7,0);
INSERT INTO products VALUES (22,13,'PC-UNTM','gt_interactive/unreal_tournament.gif','89.9900',timestamp'2023-04-04 08:31:00',NULL,NULL,'7.00',1,1,8,0);
INSERT INTO products VALUES (23,16,'PC-TWOF','gt_interactive/wheel_of_time.gif','99.9900',timestamp'2023-04-04 08:31:00',NULL,NULL,'10.00',1,1,8,0);
INSERT INTO products VALUES (24,17,'PC-DISC','gt_interactive/disciples.gif','90.0000',timestamp'2023-04-04 08:31:00',NULL,NULL,'8.00',1,1,8,0);
INSERT INTO products VALUES (25,16,'MSINTKB','microsoft/intkeyboardps2.gif','69.9900',timestamp'2023-04-04 08:31:00',NULL,NULL,'8.00',1,1,2,0);
INSERT INTO products VALUES (26,10,'MSIMEXP','microsoft/imexplorer.gif','64.9500',timestamp'2023-04-04 08:31:00',NULL,NULL,'8.00',1,1,2,0);
INSERT INTO products VALUES (27,7,'HPLJ1100XI','hewlett_packard/lj1100xi.gif','499.9900',timestamp'2023-04-04 08:31:00',NULL,NULL,'45.00',1,1,9,1);
INSERT INTO products VALUES (28,100,'GT-P1000','samsung/galaxy_tab.gif','749.9900',timestamp'2023-04-04 08:31:00',NULL,NULL,'1.00',1,1,10,0);
COMMIT;
2.4 目标端 Klustron 数据库创建数据库和数据库用户。[Klustron]
a) 登录数据库
psql -h 192.168.56.112 -p 47001 postgres
b) 创建用户 kunlun_test
create user kunlun_test with password 'kunlun';
c) 创建数据库
create database testdb owner kunlun_test;
d) 授予用户权限
grant all privileges on database testdb to kunlun_test;
e) 退出 psql 命令行,重新以 kunlun_test 连接 testdb 数据库
psql -h 192.168.56.112 -p 47001 -U kunlun_test testdb
3 使用 ora2pg 迁移数据
3.1在源端数据库服务器上设置 ora2pg 配置文件,设置导出表结构的配置文件,及内容如下。[Oracle]
[root@db19c ora2pg]#
[root@db19c ora2pg]# pwd
/etc/ora2pg
[root@db19c ora2pg]# vi ora2pg_kunlun_test_table_ddl.conf
ORACLE_HOME /u01/app/oracle/product/19.0.0/db_1
ORACLE_DSN dbi:Oracle:host=192.168.56.104;sid=orcl;port=1521
ORACLE_USER system
ORACLE_PWD oracle
SCHEMA kunlun_test
EXPORT_SCHEMA 1
CREATE_SCHEMA 0
TYPE TABLE
PG_NUMERIC_TYPE 0
PG_INTEGER_TYPE 1
DEFAULT_NUMERIC bigint
SKIP fkeys checks
NLS_LANG AMERICAN_AMERICA.UTF8
OUTPUT_DIR /tmp
OUTPUT ora2pg_kunlun_test_table_ddl.sql
PG_VERSION 11
PG_SCHEMA kunlun_test
3.2 在源端数据库 kunlun_test 用户生成创建表的 DDL 语句脚本(生成 PostgreSQL 的建表语句脚本),生成的脚本存放在 /tmp/ora2pg_kunlun_test_table_ddl.sql。[Oracle]
[root@db19c ora2pg]# ora2pg -c /etc/ora2pg/ora2pg_kunlun_test_table_ddl.conf
[========================>] 3/3 tables (100.0%) end of scanning.
[========================>] 3/3 tables (100.0%) end of table export.
Fixing function calls in output files...
3.3 在源端查看生成的 PostgreSQL 建表 DDL 脚本内容。[Oracle]
[root@db19c ora2pg]# more /tmp/ora2pg_kunlun_test_table_ddl.sql
-- Generated by Ora2Pg, the Oracle database Schema converter, version 23.2
-- Copyright 2000-2022 Gilles DAROLD. All rights reserved.
-- DATASOURCE: dbi:Oracle:host=192.168.56.104;sid=orcl;port=1521
SET client_encoding TO 'UTF8';
\set ON_ERROR_STOP ON
SET check_function_bodies = false;
SET search_path = kunlun_test,public;
CREATE TABLE categories (
categories_id bigint NOT NULL,
categories_image varchar(64),
parent_id bigint NOT NULL,
sort_order smallint,
date_added timestamp,
last_modified timestamp
) ;
ALTER TABLE categories ADD PRIMARY KEY (categories_id);
CREATE TABLE categories_description (
categories_id bigint NOT NULL,
language_id bigint NOT NULL,
categories_name varchar(32) NOT NULL
) ;
ALTER TABLE categories_description ADD PRIMARY KEY (categories_id,language_id);
CREATE TABLE products (
products_id bigint NOT NULL,
products_quantity smallint NOT NULL,
products_model varchar(12),
products_image varchar(64),
products_price decimal(15,4) NOT NULL,
products_date_added timestamp NOT NULL,
products_last_modified timestamp,
products_date_available timestamp,
products_weight decimal(5,2) NOT NULL,
products_status smallint NOT NULL,
products_tax_class_id bigint NOT NULL,
manufacturers_id bigint,
products_ordered bigint NOT NULL
) ;
ALTER TABLE products ADD PRIMARY KEY (products_id);
3.4 在源端将 DDL 建表脚本(ora2pg_kunlun_test_table_ddl.sql)拷贝到目标端 Klustron 集群计算节点的 /tmp 目录下。
[root@db19c ora2pg]# scp /tmp/ora2pg_kunlun_test_table_ddl.sql kunlun@192.168.56.112:/tmp
kunlun@192.168.56.112's password:
ora2pg_kunlun_test_table_ddl.sql 100% 1339 1.2MB/s 00:00
3.5 在目标端 Klustron 执行 ora2pg_kunlun_test_table_ddl.sql 建表脚本。[Klustron]
[kunlun@kunlun1 ~]$ psql -h 192.168.56.112 -p 47001 -U kunlun_test testdb
psql (Kunlun-1.2.1 on x86_64-pc-linux-gnu, 64-bit)
Type "help" for help.
testdb=> \i /tmp/ora2pg_kunlun_test_table_ddl.sql
SET
SET
SET
CREATE TABLE
ALTER TABLE
CREATE TABLE
ALTER TABLE
CREATE TABLE
ALTER TABLE
testdb=> \d
List of relations
Schema | Name | Type | Owner
--------+------------------------+-------+-------------
public | categories | table | kunlun_test
public | categories_description | table | kunlun_test
public | products | table | kunlun_test
(3 rows)
3.6 在源端数据库服务器上设置 ora2pg 配置文件,设置导出表数据的配置文件,及内容如下。[Oracle]
[root@db19c ora2pg]# pwd
/etc/ora2pg
[root@db19c ora2pg]# more ora2pg_kunlun_test_data.conf
ORACLE_HOME /u01/app/oracle/product/19.0.0/db_1
ORACLE_DSN dbi:Oracle:host=192.168.56.104;sid=orcl;port=1521
ORACLE_USER system
ORACLE_PWD oracle
SCHEMA kunlun_test
EXPORT_SCHEMA 1
CREATE_SCHEMA 0
TYPE COPY
PG_NUMERIC_TYPE 0
PG_INTEGER_TYPE 1
DEFAULT_NUMERIC bigint
SKIP fkeys checks
NLS_LANG AMERICAN_AMERICA.UTF8
OUTPUT_DIR /tmp
OUTPUT ora2pg_kunlunt_test_data.sql
PG_DSN dbi:Pg:dbname=testdb;host=192.168.56.112;port=47001
PG_USER kunlun_test
PG_PWD kunlun
PG_VERSION 11
3.7 在源端数据库服务器上 [Oracle] 执行 ora2pg 命令,将数据在线迁移到 Klustron 数据库。
[root@db19c ora2pg]# ora2pg -c /etc/ora2pg/ora2pg_kunlun_test_data.conf
[========================>] 3/3 tables (100.0%) end of scanning.
SET client_encoding TO 'UTF8';
SET synchronous_commit TO off;
[========================>] 21/21 rows (100.0%) Table CATEGORIES (21 recs/sec)
[========================>] 21/21 total rows (100.0%) - (0 sec., avg: 21 recs/sec).
[========================>] 21/21 rows (100.0%) on total estimated data (1 sec., avg: 21 recs/sec)
SET client_encoding TO 'UTF8';
SET synchronous_commit TO off;
[========================>] 21/0 rows (100.0%) Table CATEGORIES_DESCRIPTION (21 recs/sec)
[========================>] 42/21 total rows (200.0%) - (0 sec., avg: 42 recs/sec).
[========================>] 21/21 rows (100.0%) on total estimated data (1 sec., avg: 21 recs/sec)
SET client_encoding TO 'UTF8';
SET synchronous_commit TO off;
[========================>] 28/0 rows (100.0%) Table PRODUCTS (28 recs/sec)
[========================>] 70/21 total rows (333.3%) - (0 sec., avg: 70 recs/sec).
[========================>] 21/21 rows (100.0%) on total estimated data (1 sec., avg: 21 recs/sec)
Fixing function calls in output files...
[root@db19c tmp]#
4 数据验证
4.1 源端数据库查看 kunlun_test 用户下迁移的所有表的记录数。[Oracle]
[oracle@db19c ~]$ sqlplus kunlun_test/kunlun
SQL> select * from tab;
TNAME TABTYPE CLUSTERID
------------------------- ------------- ----------
CATEGORIES TABLE
CATEGORIES_DESCRIPTION TABLE
PRODUCTS TABLE
SQL>
SQL> select count(*) from CATEGORIES;
COUNT(*)
----------
21
SQL> select count(*) from CATEGORIES_DESCRIPTION;
COUNT(*)
----------
21
SQL>
SQL> select count(*) from PRODUCTS;
COUNT(*)
----------
28
4.2 目标端数据库查看迁移过来的所有表记录数,查看是否和源端数据库一致。[Klustron]
[kunlun@kunlun1 ~]$ psql -h 192.168.56.112 -p 47001 -U kunlun_test testdb
psql (Kunlun-1.2.1 on x86_64-pc-linux-gnu, 64-bit)
Type "help" for help.
testdb=>
testdb=> \d
List of relations
Schema | Name | Type | Owner
--------+------------------------+-------+-------------
public | categories | table | kunlun_test
public | categories_description | table | kunlun_test
public | products | table | kunlun_test
(3 rows)
testdb=>
testdb=> select count(*) from categories;
count
-------
21
(1 row)
testdb=> select count(*) from categories_description;
count
-------
21
(1 row)
testdb=> select count(*) from products;
count
-------
28
(1 row)
testdb=>
数据已经完整迁移到 Klustron 数据库上。