EDB Postgres を無料枠でインストールとDB作成、OracleDBからの移行を検証してみた。
投稿者:ビッグデータ編集者
								みなさんはIBM Data Management Platform for EDB Postgresをご存知でしょうか?
IBM Data Management Platform for EDB Postgresは信頼性と堅牢性に豊富な機能を備えたPostgreSQLにエンタープライズ向け各種ツール、DB機能拡張、Oracle DB互換機能を包含した製品です。
オンプレミスからクラウドまであらゆる場所に配置可能であり、低コストサブスクリプションライセンスによる高いコストパフォーマンスを誇ります。
今回は、仮想環境にIBM Data Management Platform for EDB Postgres Enterpriseを導入し、基本となるデータベース、および各種ツールの動作、さらにOracleからのデータ移行を検証してみました。
■環境
仮想化SW : VMware Workstation 15.5.5 Player
OS    : CentOS Linux release 7.8.2003
EDB    : IBM Data Management Platform for EDB Postgres V2.0.0
■特徴
・PostgreSQLをベースとしたRDBです。
(PostgreSQLのバージョンとEDB Postgresのバージョンは同じです)
・オンプレ、クラウド、OS等環境に拘らず導入・動作可能です。
・Oracleとの互換性が高いです。
■エディションの種類
【Standard】
◆モジュール
・CJ73VML_IBM Data Management Platform for EDB Postgres Standard V2.0.0 Multilingual Multiplatform eAssembly
・CJ73WML_IBM Data Management Platform for EDB Postgres Standard Non Production V2.0.0 Multilingual Multipltform eAssembly
【Enterprise】
◆モジュール
・CJ73RML_IBM Data Management Platform for EDB Postgres Enterprise v2.0.0 Multilingual Multiplatform eAssembly
・CJ73SML_IBM Data Management Platform for EDB Postgres Enterprise Non Production v2.0.0 Multilingual Multiplatform eAssembly <-- 検証で使用したモジュールはこちら。
■機能一覧
◆EDB Postgres Advanced Server 12(EPAS)
  RDBの標準的な機能
  テーブルパーティション機能
  複合トリガー機能
  集計関数
  データ・ディクショナリー・ビュー
  Oracle互換
  ROWID実装変更
◆EDB Backup and Recovery Tool 2.5.4(BART)
  パラレルでのフルバックアップ
  ブロックレベルの増分バックアップ
  ファイルの圧縮と検証
  保存ポリシーに基づく、バックアップファイルの管理
  バックアップ管理とレポート作成
  リストア
◆EDB Postgres Enterprise Manager 7.15(PEM)
  モニタリング、アラート
  開発、チューニング
  データベースの構築、設定
◆EDB Postgres Failover Manager 3.10(EFM)
  DBのヘルスチェック、カスタム・モニタリング
  ストリーミング・レプリケーションのモニタリング
  エージェント間のヘルスチェック
  フェールオーバーとクラスタ再構成
  スイッチ・オーバー&スイッチ・バック
  クラスター構成変更時のメール通知
◆EDB Postgres Replication Server 6.x
  シングルマスターレプリケーション
  マルチマスターレプリケーション
■検証内容
◆導入検証
1) EDB Postgres Advanced Server 12(EPAS)
EPAS は、PostgreSQLをベースとしたEDBのデータベースです。
(1).モジュールの解凍
使用OSに対するEDBの導入モジュールを解凍します。
[root@edb02 myrepository]# tar -xvf epee_centos-7.6-x86_64-20200114.tar.gz epee_rhel-7.6-x86_64-20200114/ epee_rhel-7.6-x86_64-20200114/CGAL-4.7-1.rhel7.x86_64.rpm epee_rhel-7.6-x86_64-20200114/edb-as12-12.1-1.rhel7.x86_64.rpm epee_rhel-7.6-x86_64-20200114/edb-as12-edbplus-38.0.0-1.rhel7.x86_64.rpm ・・・ epee_rhel-7.6-x86_64-20200114/SFCGAL-1.2.2-1.rhel7.x86_64.rpm epee_rhel-7.6-x86_64-20200114/SFCGAL-libs-1.2.2-1.rhel7.x86_64.rpm epee_rhel-7.6-x86_64-20200114/snmp++-3.3.8-1.rhel7.x86_64.rpm [root@edb02 myrepository]#
(2).リポジトリ・ファイルの作成
最初にリポジトリ・ファイルを作成します。
[root@edb02 ~]# cd /etc/yum.repos.d [root@edb02 yum.repos.d]# cat /etc/yum.repos.d/edbcustom.repo cat: /etc/yum.repos.d/edbcustom.repo: そのようなファイルやディレクトリはありません [root@edb02 yum.repos.d]# vi /etc/yum.repos.d/edbcustom.repo 【記述例】 ===== [edbrepo] name = EPEEのカスタムリポジトリ baseurl = file:///myrepository/epee_rhel-7.6-x86_64-20200114/ enabled = 1 gpgcheck = 1 gpgkey = file:///etc/pki/rpm-gpg/ENTERPRISEDB-GPG-KEY ===== [root@edb02 yum.repos.d]# ls -l /etc/yum.repos.d/edbcustom.repo -rw-r--r--. 1 root root 194 11月 11 17:19 /etc/yum.repos.d/edbcustom.repo [root@edb02 yum.repos.d]# cat /etc/yum.repos.d/edbcustom.repo [edbrepo] name = EPEEのカスタムリポジトリ baseurl = file:///myrepository/epee_rhel-7.6-x86_64-20200114/ enabled = 1 gpgcheck = 1 gpgkey = file:///etc/pki/rpm-gpg/ENTERPRISEDB-GPG-KEY [root@edb02 yum.repos.d]#
(3).リポジトリ・キーのダウンロード
作業ディレクトリに移り、curl コマンドでリポジトリー・キーをダウンロードします。
[root@edb02 yum.repos.d]#  cd /myrepository
[root@edb02 myrepository]# ls -l /etc/pki/rpm-gpg/ENTERPRISEDB-GPG-KEY
ls: /etc/pki/rpm-gpg/ENTERPRISEDB-GPG-KEY にアクセスできません: そのようなファイルやディレクトリはありません
[root@edb02 myrepository]# curl -o /etc/pki/rpm-gpg/ENTERPRISEDB-GPG-KEY https://yum.enterprisedb.com/ENTERPRISEDB-GPG-KEY
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1780  100  1780    0     0   1676      0  0:00:01  0:00:01 --:--:--  1680
[root@edb02 myrepository]# ls -l /etc/pki/rpm-gpg/ENTERPRISEDB-GPG-KEY
-rw-r--r--. 1 root root 1780 11月 11 17:43 /etc/pki/rpm-gpg/ENTERPRISEDB-GPG-KEY
[root@edb02 myrepository]#
(4).リポジトリ・キーのインストール
ダウンロードしたリポジトリ・キーをインストールします。
[root@edb02 myrepository]# rpm --import /etc/pki/rpm-gpg/ENTERPRISEDB-GPG-KEY [root@edb02 myrepository]#
(5).必須ソフトウェアのインストール
EPASを導入する前に、必須のソフトウェアをインストールします。
[root@edb02 myrepository]# yum -y install epel-release 読み込んだプラグイン:fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: ty1.mirror.newmediaexpress.com * extras: ty1.mirror.newmediaexpress.com * updates: ty1.mirror.newmediaexpress.com 依存性の解決をしています --> トランザクションの確認を実行しています。 ・・・ インストール: epel-release.noarch 0:7-11 完了しました! [root@edb02 myrepository]# [root@edb02 myrepository]# yum makecache 読み込んだプラグイン:fastestmirror, langpacks Loading mirror speeds from cached hostfile epel/x86_64/metalink | 7.3 kB 00:00:00 * base: ftp.riken.jp * epel: nrt.edge.kernel.org * extras: ftp.riken.jp * updates: ftp.riken.jp base | 3.6 kB 00:00:00 edbrepo | 2.9 kB 00:00:00 ・・・ (12/13): epel/x86_64/other_db | 3.3 MB 00:00:01 (13/13): updates/7/x86_64/filelists_db | 2.4 MB 00:00:01 メタデータのキャッシュを作成しました [root@edb02 myrepository]#
(6).EPASのインストール
EPASをインストールします。
[root@edb02 myrepository]# yum -y install edb-as12-server 読み込んだプラグイン:fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: ftp.iij.ad.jp * epel: nrt.edge.kernel.org * extras: ftp.iij.ad.jp * updates: ftp.iij.ad.jp 依存性の解決をしています --> トランザクションの確認を実行しています。 ---> パッケージ edb-as12-server.x86_64 0:12.1.2-1.rhel7 を インストール ・・・ 依存性関連をインストールしました: boost-atomic.x86_64 0:1.53.0-28.el7 boost-chrono.x86_64 0:1.53.0-28.el7 boost-filesystem.x86_64 0:1.53.0-28.el7 boost-regex.x86_64 0:1.53.0-28.el7 edb-as12-libicu.x86_64 0:53.1-1.rhel7 edb-as12-pgagent.x86_64 0:4.0.0-1.rhel7 edb-as12-server-client.x86_64 0:12.1.2-1.rhel7 edb-as12-server-cloneschema.x86_64 0:1.10-1.rhel7 edb-as12-server-contrib.x86_64 0:12.1.2-1.rhel7 edb-as12-server-core.x86_64 0:12.1.2-1.rhel7 edb-as12-server-devel.x86_64 0:12.1.2-1.rhel7 edb-as12-server-docs.x86_64 0:12.1.2-1.rhel7 edb-as12-server-indexadvisor.x86_64 0:12.1.2-1.rhel7 edb-as12-server-libs.x86_64 0:12.1.2-1.rhel7 edb-as12-server-llvmjit.x86_64 0:12.1.2-1.rhel7 edb-as12-server-parallel-clone.x86_64 0:1.5-1.rhel7 edb-as12-server-pldebugger.x86_64 0:1.1-1.rhel7 edb-as12-server-plperl.x86_64 0:12.1.2-1.rhel7 edb-as12-server-plpython.x86_64 0:12.1.2-1.rhel7 edb-as12-server-pltcl.x86_64 0:12.1.2-1.rhel7 edb-as12-server-sqlprofiler.x86_64 0:4.0-1.rhel7 edb-as12-server-sqlprotect.x86_64 0:12.1.2-1.rhel7 edb-as12-server-sslutils.x86_64 0:1.2-1.rhel7 llvm5.0.x86_64 0:5.0.1-7.el7 llvm5.0-libs.x86_64 0:5.0.1-7.el7 tcl.x86_64 1:8.5.13-8.el7 uuid.x86_64 0:1.6.2-26.el7 完了しました! [root@edb02 myrepository]#
(7).初期化
EPASのインストール完了後、初期化を実施します。
[root@edb02 myrepository]# /usr/edb/as12/bin/edb-as-12-setup initdb Initializing database ... OK [root@edb02 myrepository]#
2) EDB Backup and Recovery Tool 2.5.4(BART)
BARTは、バックアップとリストアを行うツールです。今回は、手順確認のためDBサーバーに導入していますが、一般的には別サーバーに導入します。
※操作するためには、導入後に「pg_hba.conf」、「postgresql.conf」等の設定を行う必要があります。(設定については今後掲載予定です。)
(1).BARTのインストール
[root@edb02 epee_rhel-7.6-x86_64-20200114]# yum -y install edb-bart 読み込んだプラグイン:fastestmirror, langpacks Loading mirror speeds from cached hostfile ・・・ インストール: edb-bart.x86_64 0:2.5.2-1.rhel7 依存性関連をインストールしました: boost-serialization.x86_64 0:1.53.0-28.el7 boost-timer.x86_64 0:1.53.0-28.el7 完了しました! [root@edb02 epee_rhel-7.6-x86_64-20200114]#
3) EDB Postgres Enterprise Manager 7.15(PEM)
PEMは、Webブラウザにてデーターベース・オブジェクトの定義、管理、起動、停止、パフォーマンスチューニング、レポートやアラート通知などが行えるGUIツールです。
(1).PEMのインストール準備
PEMをインストールする前に、以下を事前にインストールしておく必要があります。
・centos-release-scl
[root@edb02 epee_rhel-7.6-x86_64-20200114]# yum install centos-release-scl 読み込んだプラグイン:fastestmirror, langpacks Loading mirror speeds from cached hostfile ・・・ 総ダウンロード容量: 24 k インストール容量: 39 k Is this ok [y/d/N]: y Downloading packages: (1/2): centos-release-scl-2-3.el7.centos.noarch.rpm | 12 kB 00:00:00 (2/2): centos-release-scl-rh-2-3.el7.centos.noarch.rpm | 12 kB 00:00:00 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 合計 52 kB/s | 24 kB 00:00:00 Running transaction check ・・・ インストール: centos-release-scl.noarch 0:2-3.el7.centos 依存性関連をインストールしました: centos-release-scl-rh.noarch 0:2-3.el7.centos 完了しました! [root@edb02 epee_rhel-7.6-x86_64-20200114]#
・rh-python36
[root@edb02 epee_rhel-7.6-x86_64-20200114]# yum -y install rh-python36 読み込んだプラグイン:fastestmirror, langpacks Loading mirror speeds from cached hostfile ・・・ インストール: rh-python36.x86_64 0:2.0-1.el7 依存性関連をインストールしました: dwz.x86_64 0:0.11-3.el7 perl-srpm-macros.noarch 0:1-8.el7 python-srpm-macros.noarch 0:3-32.el7 redhat-rpm-config.noarch 0:9.1.0-88.el7.centos rh-python36-python.x86_64 0:3.6.9-2.el7 rh-python36-python-devel.x86_64 0:3.6.9-2.el7 rh-python36-python-libs.x86_64 0:3.6.9-2.el7 rh-python36-python-pip.noarch 0:9.0.1-2.el7 rh-python36-python-setuptools.noarch 0:36.5.0-1.el7 rh-python36-python-virtualenv.noarch 0:15.1.0-2.el7 rh-python36-runtime.x86_64 0:2.0-1.el7 scl-utils-build.x86_64 0:20130529-19.el7 完了しました! [root@edb02 epee_rhel-7.6-x86_64-20200114]#
(2).PEMのインストール
[root@edb02 epee_rhel-7.6-x86_64-20200114]# yum -y install edb-pem 読み込んだプラグイン:fastestmirror, langpacks Loading mirror speeds from cached hostfile ・・・ インストール: edb-pem.x86_64 0:7.12.0-2.rhel7 依存性関連をインストールしました: apr.x86_64 0:1.4.8-5.el7 apr-util.x86_64 0:1.5.2-6.el7 boost-program-options.x86_64 0:1.53.0-28.el7 edb-pem-agent.x86_64 0:7.12.0-2.rhel7 edb-pem-docs.x86_64 0:7.12.0-2.rhel7 edb-pem-server.x86_64 0:7.12.0-2.rhel7 httpd.x86_64 0:2.4.6-93.el7.centos httpd-tools.x86_64 0:2.4.6-93.el7.centos libcurl-pem.x86_64 0:7.61.1-2.rhel7 mailcap.noarch 0:2.1.41-2.el7 mod_ssl.x86_64 1:2.4.6-93.el7.centos mod_wsgi.x86_64 0:3.4-18.el7 snmp++.x86_64 0:3.3.8-1.rhel7 tix.x86_64 1:8.4.3-12.el7 tk.x86_64 1:8.5.13-6.el7 完了しました! [root@edb02 epee_rhel-7.6-x86_64-20200114]#
4) EDB Postgres Failover Manager 3.10(EFM)
EFMは、冗長化構成を構築し、障害時のサーバー切替、切り戻しを行うツールです。
(1).EFMのインストール
[root@edb02 epee_rhel-7.6-x86_64-20200114]# yum -y install edb-efm38 読み込んだプラグイン:fastestmirror, langpacks Loading mirror speeds from cached hostfile ・・・ インストール: edb-efm38.x86_64 0:3.8-1.rhel7 完了しました! [root@edb02 epee_rhel-7.6-x86_64-20200114]#
以下、参考として各種ツールのインストール手順を掲載します。
5) EDB モジュール
(1).EDB モジュールのインストール
[root@edb02 epee_rhel-7.6-x86_64-20200114]# yum -y install edb-as12-server-edb-modules 読み込んだプラグイン:fastestmirror, langpacks Loading mirror speeds from cached hostfile ・・・ インストール: edb-as12-server-edb-modules.x86_64 0:1.0-1.rhel7 完了しました! [root@edb02 epee_rhel-7.6-x86_64-20200114]#
6) EDB Postgresコネクタ-JDBC
(1).EDB Postgresコネクタ-JDBCのインストール
[root@edb02 epee_rhel-7.6-x86_64-20200114]# yum -y install edb-jdbc 読み込んだプラグイン:fastestmirror, langpacks Loading mirror speeds from cached hostfile ・・・ インストール: edb-jdbc.x86_64 0:42.2.8.1-1.rhel7 完了しました! [root@edb02 epee_rhel-7.6-x86_64-20200114]#
7) EDB Postgresコネクタ-OCI
(1).EDB Postgresコネクタ-OCIのインストール
[root@edb02 epee_rhel-7.6-x86_64-20200114]# yum -y install edb-oci 読み込んだプラグイン:fastestmirror, langpacks Loading mirror speeds from cached hostfile ・・・ インストール: edb-oci.x86_64 0:12.1.2.1-1.rhel7 依存性関連をインストールしました: libiconv-edb.x86_64 0:1.14-1.rhel7 完了しました! [root@edb02 epee_rhel-7.6-x86_64-20200114]
8) EDB Postgresコネクタ-ODBC
(1).EDB Postgresコネクタ-ODBCのインストール
[root@edb02 epee_rhel-7.6-x86_64-20200114]# yum -y install edb-odbc 読み込んだプラグイン:fastestmirror, langpacks Loading mirror speeds from cached hostfile ・・・ インストール: edb-odbc.x86_64 0:12.00.0000.01-1.rhel7 依存性関連をインストールしました: unixODBC.x86_64 0:2.3.1-14.el7 完了しました! [root@edb02 epee_rhel-7.6-x86_64-20200114]#
9) EDB Postgres Replication Server 6.x
(1).EDB Postgres Replication Server 6.xのインストール
[root@edb02 epee_rhel-7.6-x86_64-20200114]# yum -y install ppas-xdb 読み込んだプラグイン:fastestmirror, langpacks Loading mirror speeds from cached hostfile ・・・ インストール: ppas-xdb.x86_64 0:6.2.8-1.rhel7 依存性関連をインストールしました: ppas-xdb-console.x86_64 0:6.2.8-1.rhel7 ppas-xdb-libs.x86_64 0:6.2.8-1.rhel7 ppas-xdb-publisher.x86_64 0:6.2.8-1.rhel7 ppas-xdb-subscriber.x86_64 0:6.2.8-1.rhel7 完了しました! [root@edb02 epee_rhel-7.6-x86_64-20200114]#
10) EDB * Plus
(1).EDB * Plusのインストール
[root@edb02 epee_rhel-7.6-x86_64-20200114]# yum -y install edb-as12-edbplus 読み込んだプラグイン:fastestmirror, langpacks Loading mirror speeds from cached hostfile ・・・ インストール: edb-as12-edbplus.x86_64 0:38.0.0-1.rhel7 完了しました! [root@edb02 epee_rhel-7.6-x86_64-20200114]#
11) PostGIS
(1).PostGISのインストール
[root@edb02 epee_rhel-7.6-x86_64-20200114]# yum -y install edb-as12-postgis 読み込んだプラグイン:fastestmirror, langpacks Loading mirror speeds from cached hostfile ・・・ インストール: edb-as12-postgis.x86_64 0:2.5.3-1.rhel7 依存性関連をインストールしました: CGAL.x86_64 0:4.7-1.rhel7 CharLS.x86_64 0:1.0-5.el7 SFCGAL.x86_64 0:1.2.2-1.rhel7 SFCGAL-libs.x86_64 0:1.2.2-1.rhel7 SuperLU.x86_64 0:5.2.0-5.el7 armadillo.x86_64 0:8.600.1-2.el7 arpack.x86_64 0:3.1.3-2.el7 atlas.x86_64 0:3.10.1-12.el7 blas.x86_64 0:3.4.2-8.el7 cfitsio.x86_64 0:3.370-10.el7 edb-as12-postgis-core.x86_64 0:2.5.3-1.rhel7 edb-as12-postgis-docs.x86_64 0:2.5.3-1.rhel7 edb-as12-postgis-jdbc.x86_64 0:2.2.1-6 edb-as12-postgis-utils.x86_64 0:2.5.3-1.rhel7 freexl.x86_64 0:1.0.6-1.el7 gdal.x86_64 0:1.11.4-3.el7 gdal-libs.x86_64 0:1.11.4-3.el7 geos36-edb.x86_64 0:3.6.2-6.rhel7 gpsbabel.x86_64 0:1.5.0-2.el7 hdf5.x86_64 0:1.8.12-11.el7 lapack.x86_64 0:3.4.2-8.el7 libaec.x86_64 0:1.0.4-1.el7 libdap.x86_64 0:3.13.1-2.el7 libgeotiff.x86_64 0:1.2.5-14.el7 libgfortran.x86_64 0:4.8.5-39.el7 libgta.x86_64 0:1.0.4-1.el7 libquadmath.x86_64 0:4.8.5-39.el7 libusb.x86_64 1:0.1.4-3.el7 mesa-libGLU.x86_64 0:9.0.0-4.el7 netcdf.x86_64 0:4.3.3.1-5.el7 ogdi.x86_64 0:3.2.0-0.19.beta2.el7 openblas-openmp.x86_64 0:0.3.3-2.el7 perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 perl-DBD-Pg.x86_64 0:2.19.3-4.el7 perl-DBI.x86_64 0:1.627-4.el7 perl-Data-Dumper.x86_64 0:2.145-3.el7 perl-IO-Compress.noarch 0:2.061-2.el7 perl-Net-Daemon.noarch 0:0.48-5.el7 perl-PlRPC.noarch 0:0.2020-14.el7 perl-version.x86_64 3:0.99.07-6.el7 proj.x86_64 0:4.8.0-4.el7 proj49-edb.x86_64 0:4.9.3-5.rhel7 qt.x86_64 1:4.8.7-8.el7 qt-settings.noarch 0:19-23.10.el7.centos shapelib.x86_64 0:1.3.0-2.el7 xerces-c.x86_64 0:3.1.1-10.el7_7 完了しました! [root@edb02 epee_rhel-7.6-x86_64-20200114]#
12) Slonyレプリケーション
(1).Slonyレプリケーションのインストール
[root@edb02 epee_rhel-7.6-x86_64-20200114]# yum -y install edb-as12-pgagent 読み込んだプラグイン:fastestmirror, langpacks Loading mirror speeds from cached hostfile ・・・ インストール: edb-as12-slony-replication.x86_64 0:2.2.8-1.rhel7 依存性関連をインストールしました: edb-as12-slony-replication-core.x86_64 0:2.2.8-1.rhel7 edb-as12-slony-replication-docs.x86_64 0:2.2.8-1.rhel7 edb-as12-slony-replication-tools.x86_64 0:2.2.8-1.rhel7 perl-Switch.noarch 0:2.16-7.el7 完了しました! [root@edb02 epee_rhel-7.6-x86_64-20200114]#
13) EDB Postgres pgAdmin
(1).EDB Postgres pgAdminのインストール
[root@edb02 epee_rhel-7.6-x86_64-20200114]# yum -y install edb-pgadmin4 読み込んだプラグイン:fastestmirror, langpacks Loading mirror speeds from cached hostfile ・・・ インストール: edb-pgadmin4.x86_64 0:4.17-1.rhel7 依存性関連をインストールしました: edb-pgadmin4-docs.x86_64 0:4.17-1.rhel7 edb-pgadmin4-web.x86_64 0:4.17-1.rhel7 libmng.x86_64 0:1.0.10-14.el7 qt-x11.x86_64 1:4.8.7-8.el7 完了しました! [root@edb02 epee_rhel-7.6-x86_64-20200114]#
14) pgBouncer
(1).pgBouncerのインストール
[root@edb02 epee_rhel-7.6-x86_64-20200114]# yum -y install edb-pgbouncer112 読み込んだプラグイン:fastestmirror, langpacks Loading mirror speeds from cached hostfile ・・・ インストール: edb-pgbouncer112.x86_64 0:1.12.0.1-1.rhel7 完了しました! [root@edb02 epee_rhel-7.6-x86_64-20200114]#
15) pgPool
(1).pgPoolのインストール
[root@edb02 epee_rhel-7.6-x86_64-20200114]# yum -y install edb-pgpool40 読み込んだプラグイン:fastestmirror, langpacks Loading mirror speeds from cached hostfile ・・・ インストール: edb-pgpool40.x86_64 0:4.0.6-1.rhel7 完了しました! [root@edb02 epee_rhel-7.6-x86_64-20200114]#
◆機能検証
1) EDB Postgres Advanced Server 12(EPAS)
1)-1. 起動
サーバーにログインし、データベースの起動状況を確認します。
(1).「systemctl start edb-as-12」コマンドでデータベースを起動します。
[root@edb01 ~]# systemctl status edb-as-12
● edb-as-12.service - EDB Postgres Advanced Server 12
   Loaded: loaded (/usr/lib/systemd/system/edb-as-12.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
[root@edb01 ~]# systemctl start edb-as-12
[root@edb01 ~]# 
[root@edb01 ~]# systemctl status edb-as-12
● edb-as-12.service - EDB Postgres Advanced Server 12
   Loaded: loaded (/usr/lib/systemd/system/edb-as-12.service; disabled; vendor preset: disabled)
   Active: active (running) since 木 2020-11-12 18:21:22 JST; 2min 29s ago
  Process: 16688 ExecStartPre=/usr/edb/as12/bin/edb-as-12-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
 Main PID: 16694 (edb-postmaster)
    Tasks: 10
   CGroup: /system.slice/edb-as-12.service
           ├─16694 /usr/edb/as12/bin/edb-postmaster -D /var/lib/edb/as12/data
           ├─16696 postgres: logger   
           ├─16698 postgres: checkpointer   
           ├─16699 postgres: background writer   
           ├─16700 postgres: walwriter   
           ├─16701 postgres: autovacuum launcher   
           ├─16702 postgres: archiver   
           ├─16703 postgres: stats collector   
           ├─16704 postgres: dbms_aq launcher   
           └─16705 postgres: logical replication launcher   
11月 12 18:21:22 edb01 systemd[1]: Starting EDB Postgres Advanced Server 12...
11月 12 18:21:22 edb01 edb-postmaster[16694]: 2020-11-12 18:21:22 JST LOG:  PostgreSQL 12.1 (EnterpriseDB Advanced Server 12.1.2) on x86_64-pc-linux-gnu, com...動しています
11月 12 18:21:22 edb01 edb-postmaster[16694]: 2020-11-12 18:21:22 JST LOG:  IPv4アドレス"0.0.0.0"、ポート5444で待ち受けています
11月 12 18:21:22 edb01 edb-postmaster[16694]: 2020-11-12 18:21:22 JST LOG:  IPv6アドレス"::"、ポート5444で待ち受けています
11月 12 18:21:22 edb01 edb-postmaster[16694]: 2020-11-12 18:21:22 JST LOG:  Unixソケット"/tmp/.s.PGSQL.5444"で待ち受けています
11月 12 18:21:22 edb01 edb-postmaster[16694]: 2020-11-12 18:21:22 JST LOG:  ログ出力をログ収集プロセスにリダイレクトしています
11月 12 18:21:22 edb01 edb-postmaster[16694]: 2020-11-12 18:21:22 JST ヒント:  ここからのログ出力はディレクトリ"log"に現れます。
11月 12 18:21:22 edb01 systemd[1]: Started EDB Postgres Advanced Server 12.
Hint: Some lines were ellipsized, use -l to show in full.
[root@edb01 ~]# 
1)-2. DB操作
データベースに対する基本的な操作を確認します。
(1).「enterprisedb」ユーザーにスイッチして、デフォルトで作成されている「edb」データベースに接続します。
[root@edb02 myrepository]# su - enterprisedb [enterprisedb@edb02 ~]$ edb-psql edb edb-psql (12.1.2) helpでヘルプを表示します。 edb=#
(2).「enterprisedb」ロール(EDBのユーザー)に パスワードを設定します。
edb=# alter user enterprisedb password 'PPPPPPPP'; ALTER ROLE edb=#
(3).データベースの一覧を表示します。
edb=# \l
                                                  データベース一覧
   名前    |    所有者    | エンコーディング |  照合順序   | Ctype(変換演算子) | ICU |         アクセス権限          
-----------+--------------+------------------+-------------+-------------------+-----+-------------------------------
 edb       | enterprisedb | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       |     | 
 postgres  | enterprisedb | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       |     | 
 template0 | enterprisedb | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       |     | =c/enterprisedb              +
           |              |                  |             |                   |     | enterprisedb=CTc/enterprisedb
 template1 | enterprisedb | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       |     | =c/enterprisedb              +
           |              |                  |             |                   |     | enterprisedb=CTc/enterprisedb
(4 行)
edb=#
(4).「mydb」という名前のデータベースを作成します。
edb=# create database mydb;
CREATE DATABASE
edb=# \l
                                                  データベース一覧
   名前    |    所有者    | エンコーディング |  照合順序   | Ctype(変換演算子) | ICU |         アクセス権限          
-----------+--------------+------------------+-------------+-------------------+-----+-------------------------------
 edb       | enterprisedb | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       |     | 
 mydb      | enterprisedb | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       |     | 
 postgres  | enterprisedb | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       |     | 
 template0 | enterprisedb | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       |     | =c/enterprisedb              +
           |              |                  |             |                   |     | enterprisedb=CTc/enterprisedb
 template1 | enterprisedb | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       |     | =c/enterprisedb              +
           |              |                  |             |                   |     | enterprisedb=CTc/enterprisedb
(5 行)
(5).作成したデータベースに接続します。
edb=# \c mydb データベース"mydb"にユーザ"enterprisedb"として接続しました。 mydb=#
(6).オブジェクトを作成します。
以下は、sqlファイルを実行してテーブルやトリガーなどのオブジェクトを作成しています。
mydb=# \i /usr/edb/as12/share/pg-sample.sql SET BEGIN CREATE TABLE CREATE TABLE CREATE TABLE CREATE VIEW ・・・ CREATE TRIGGER CREATE FUNCTION CREATE TRIGGER COMMIT mydb=# mydb=# SELECT * FROM USER_TABLES; schema_name | table_name | tablespace_name | status | temporary -------------+-------------------------------------+-----------------+--------+----------- PUBLIC | EMP | | VALID | N PUBLIC | DEPT | | VALID | N PUBLIC | JOBHIST | | VALID | N SYS | PRODUCT_COMPONENT_VERSION | | VALID | N SYS | DUAL | | VALID | N SYS | EDB_DBMS_REDACT_FULL_DEFAULT_VALUES | | VALID | N SYS | CALLBACK_QUEUE_TABLE | | VALID | N SYS | PLSQL_PROFILER_RAWDATA | | VALID | N SYS | PLSQL_PROFILER_RUNS | | VALID | N SYS | PLSQL_PROFILER_UNITS | | VALID | N SYS | EDB$SNAP | | VALID | N SYS | EDB$SYSTEM_WAITS | | VALID | N SYS | EDB$SESSION_WAITS | | VALID | N SYS | EDB$SESSION_WAIT_HISTORY | | VALID | N SYS | EDB$STAT_ALL_INDEXES | | VALID | N SYS | EDB$STAT_ALL_TABLES | | VALID | N SYS | EDB$STAT_DATABASE | | VALID | N SYS | EDB$STATIO_ALL_INDEXES | | VALID | N SYS | EDB$STATIO_ALL_TABLES | | VALID | N (19 行) mydb=# mydb=# \q [enterprisedb@edb01 ~]$
1)-3. バックアップ(pg_dump)
(1).pg_dump コマンドを使用してバックアップを取得します。
[enterprisedb@edb01 ~]$ pwd /home/enterprisedb [enterprisedb@edb01 ~]$ ls -l 合計 0 drwxrwxr-x. 2 enterprisedb enterprisedb 97 11月 4 18:26 load [enterprisedb@edb01 ~]$ pg_dump mydb > mydb.sql [enterprisedb@edb01 ~]$ ls -l 合計 28 drwxrwxr-x. 2 enterprisedb enterprisedb 97 11月 4 18:26 load -rw-rw-r--. 1 enterprisedb enterprisedb 27467 11月 12 18:38 mydb.sql [enterprisedb@edb01 ~]$
1)-4. リストア
(1).リストア前にデータベースを削除します。
[enterprisedb@edb01 ~]$ dropdb mydb
[enterprisedb@edb01 ~]$ 
[enterprisedb@edb01 ~]$ edb-psql edb
edb-psql (12.1.2)
helpでヘルプを表示します。
edb=# \l
                                                  データベース一覧
   名前    |    所有者    | エンコーディング |  照合順序   | Ctype(変換演算子) | ICU |         アクセス権限          
-----------+--------------+------------------+-------------+-------------------+-----+-------------------------------
 edb       | enterprisedb | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       |     | 
 postgres  | enterprisedb | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       |     | 
 template0 | enterprisedb | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       |     | =c/enterprisedb              +
           |              |                  |             |                   |     | enterprisedb=CTc/enterprisedb
 template1 | enterprisedb | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       |     | =c/enterprisedb              +
           |              |                  |             |                   |     | enterprisedb=CTc/enterprisedb
(4 行)
edb=# 
(2).psql コマンドによりリストアを実施します。
リストア後、データベースの一覧を表示し、削除した「mydb」データベースが表示されている事、「mydb」に接続して表が格納されていることを確認しています。
[enterprisedb@edb01 ~]$ pwd
/home/enterprisedb
[enterprisedb@edb01 ~]$ ls -l
合計 28
drwxrwxr-x. 2 enterprisedb enterprisedb    97 11月  4 18:26 load
-rw-rw-r--. 1 enterprisedb enterprisedb 27467 11月 12 18:38 mydb.sql
[enterprisedb@edb01 ~]$ 
[enterprisedb@edb01 ~]$ psql mydb < /home/enterprisedb/mydb.sql
SET
SET
SET
SET
SET
・・・
GRANT
GRANT
GRANT
[enterprisedb@edb01 ~]$ 
[enterprisedb@edb01 ~]$ edb-psql edb
edb-psql (12.1.2)
helpでヘルプを表示します。
edb=# \l
                                                  データベース一覧
   名前    |    所有者    | エンコーディング |  照合順序   | Ctype(変換演算子) | ICU |         アクセス権限          
-----------+--------------+------------------+-------------+-------------------+-----+-------------------------------
 edb       | enterprisedb | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       |     | 
 mydb      | enterprisedb | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       |     | 
 postgres  | enterprisedb | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       |     | 
 template0 | enterprisedb | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       |     | =c/enterprisedb              +
           |              |                  |             |                   |     | enterprisedb=CTc/enterprisedb
 template1 | enterprisedb | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       |     | =c/enterprisedb              +
           |              |                  |             |                   |     | enterprisedb=CTc/enterprisedb
(5 行)
edb=# \c mydb
データベース"mydb"にユーザ"enterprisedb"として接続しました。
mydb=# SELECT * FROM USER_TABLES;
 schema_name |             table_name              | tablespace_name | status | temporary 
-------------+-------------------------------------+-----------------+--------+-----------
 PUBLIC      | EMPLOYEES_NOMAX                     |                 | VALID  | N
 PUBLIC      | DEPT                                |                 | VALID  | N
 PUBLIC      | EMP                                 |                 | VALID  | N
 PUBLIC      | JOBHIST                             |                 | VALID  | N
 SYS         | PRODUCT_COMPONENT_VERSION           |                 | VALID  | N
 SYS         | DUAL                                |                 | VALID  | N
 SYS         | EDB_DBMS_REDACT_FULL_DEFAULT_VALUES |                 | VALID  | N
 SYS         | CALLBACK_QUEUE_TABLE                |                 | VALID  | N
 SYS         | PLSQL_PROFILER_RAWDATA              |                 | VALID  | N
 SYS         | PLSQL_PROFILER_RUNS                 |                 | VALID  | N
 SYS         | PLSQL_PROFILER_UNITS                |                 | VALID  | N
 SYS         | EDB$SNAP                            |                 | VALID  | N
 SYS         | EDB$SYSTEM_WAITS                    |                 | VALID  | N
 SYS         | EDB$SESSION_WAITS                   |                 | VALID  | N
 SYS         | EDB$SESSION_WAIT_HISTORY            |                 | VALID  | N
 SYS         | EDB$STAT_ALL_INDEXES                |                 | VALID  | N
 SYS         | EDB$STAT_ALL_TABLES                 |                 | VALID  | N
 SYS         | EDB$STAT_DATABASE                   |                 | VALID  | N
 SYS         | EDB$STATIO_ALL_INDEXES              |                 | VALID  | N
 SYS         | EDB$STATIO_ALL_TABLES               |                 | VALID  | N
(20 行)
mydb=# \q
[enterprisedb@edb01 ~]$ 
1)-5. LOAD
EDBLOADERによるロードができる事を確認します。
(1).制御ファイルを作成します。
EDBLOADERによるロードを行うには、以下の様に制御ファイル「例:emp.1.ctl」を作成して、LOADの内容を定義します。
[root@edb01 ~]# su - enterprisedb 最終ログイン: 2020/11/02 (月) 16:21:40 JST日時 pts/1 [enterprisedb@edb01 ~]$ [enterprisedb@edb01 ~]$ mkdir load [enterprisedb@edb01 ~]$ cd load [enterprisedb@edb01 load]$ pwd /home/enterprisedb/load [enterprisedb@edb01 load]$ [enterprisedb@edb01 load]$ vi emp.1.ctl [enterprisedb@edb01 load]$ cat emp.1.ctl LOAD DATA INFILE 'emp.1.dat' BADFILE 'emp.1.bad' APPEND INTO TABLE emp FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS ( empno, ename, job, mgr, hiredate, sal, deptno, comm ) [enterprisedb@edb01 load]$
(2).ロードするデータを準備します。
[enterprisedb@edb01 load]$ vi emp.1.dat [enterprisedb@edb01 load]$ cat emp.1.dat 9105,ROGERS,CLERK,7902,17-DEC-10,1980.00,20 9106,PETERSON,SALESMAN,7698,20-DEC-10,2600.00,30,2300.00 9107,WARREN,SALESMAN,7698,22-DEC-10,5250.00,30,2500.00 9108,"JONES, JR.",MANAGER,7839,02-APR-09,7975.00,20 [enterprisedb@edb01 load]$
(3).作成した制御ファイル、データファイルを指定して、edbldr コマンドによるロードを実施します。
[enterprisedb@edb01 load]$ /usr/edb/as12/bin/edbldr -d mydb USERID=enterprisedb/PPPPPPPP CONTROL=emp.1.ctl EDB*Loader: Copyright (c) 2007-2019, EnterpriseDB Corporation. INFO: Inserting employee 9105 INFO: ..New salary: 1980.00 INFO: Inserting employee 9106 INFO: ..New salary: 2600.00 INFO: Inserting employee 9107 INFO: ..New salary: 5250.00 INFO: Inserting employee 9108 INFO: ..New salary: 7975.00 INFO: User enterprisedb added employee(s) on 13-NOV-20 Successfully processed (4) records [enterprisedb@edb01 load]$
2) EDB Backup and Recovery Tool 2.5.4(BART)
2)-1. バックアップ(bart backup)
bart backup コマンドを使用してバックアップが取得できることを確認します。
(1).bart backup コマンドを使用してバックアップを取得します。
以下は、バックアップ後にバックアップファイルを確認しています。
[enterprisedb@edb01 ~]$ bart BACKUP -s epas12 -z INFO: DebugTarget - getVar(checkDiskSpace.bytesAvailable) INFO: new backup identifier generated 1605235183406 INFO: creating 5 harvester threads NOTICE: 必要なすべての WAL セグメントがアーカイブされました INFO: backup completed successfully INFO: BART VERSION: 2.5.2 BACKUP DETAILS: BACKUP STATUS: active BACKUP IDENTIFIER: 1605235183406 BACKUP NAME: none BACKUP PARENT: none BACKUP LOCATION: /opt/backup/epas12/1605235183406 BACKUP SIZE: 10.11 MB BACKUP FORMAT: tar.gz BACKUP TIMEZONE: Asia/Tokyo XLOG METHOD: fetch BACKUP CHECKSUM(s): 0 TABLESPACE(s): 0 START WAL LOCATION: 000000020000000000000009 BACKUP METHOD: streamed BACKUP FROM: master START TIME: 2020-11-13 11:39:43 JST STOP TIME: 2020-11-13 11:39:54 JST TOTAL DURATION: 11 sec(s) [enterprisedb@edb01 ~]$ [enterprisedb@edb01 ~]$ ls -l /opt/backup/epas12 合計 4 drwxrwxr-x. 3 enterprisedb enterprisedb 180 11月 2 14:32 1604295143129 drwxrwxr-x. 3 enterprisedb enterprisedb 180 11月 13 11:39 1605235183406 drwxrwxr-x. 2 enterprisedb enterprisedb 4096 11月 13 11:39 archived_wals [enterprisedb@edb01 ~]$ ls -l /opt/backup/epas12/1605235183406 合計 10416 -rw-rw-r--. 1 enterprisedb enterprisedb 204 11月 13 11:39 backup_label -rw-rw-r--. 1 enterprisedb enterprisedb 553 11月 13 11:39 backupinfo drwxrwxr-x. 4 enterprisedb enterprisedb 37 11月 13 11:39 base -rw-rw-r--. 1 enterprisedb enterprisedb 3867536 11月 13 11:39 base-1.tar.gz -rw-rw-r--. 1 enterprisedb enterprisedb 1014691 11月 13 11:39 base-2.tar.gz -rw-rw-r--. 1 enterprisedb enterprisedb 3130429 11月 13 11:39 base-3.tar.gz -rw-rw-r--. 1 enterprisedb enterprisedb 979580 11月 13 11:39 base-4.tar.gz -rw-rw-r--. 1 enterprisedb enterprisedb 1613899 11月 13 11:39 base-5.tar.gz -rw-rw-r--. 1 enterprisedb enterprisedb 33362 11月 13 11:39 base.tar.gz [enterprisedb@edb01 ~]$
2)-2. リストア(bart restore)
bart restore コマンドを使用してリストアできる事を確認します。
(1).EDBを停止します。
[root@edb01 ~]# systemctl stop edb-as-12 [root@edb01 ~]# systemctl status edb-as-12 ● edb-as-12.service - EDB Postgres Advanced Server 12 Loaded: loaded (/usr/lib/systemd/system/edb-as-12.service; disabled; vendor preset: disabled) Active: inactive (dead) 11月 12 18:28:03 edb01 systemd[1]: Starting EDB Postgres Advanced Server 12... 11月 12 18:28:03 edb01 edb-postmaster[16894]: 2020-11-12 18:28:03 JST LOG: PostgreSQL 12.1 (EnterpriseDB Advanced Server 12.1.2) on x86_64-pc-linux-gnu, com...動しています 11月 12 18:28:03 edb01 edb-postmaster[16894]: 2020-11-12 18:28:03 JST LOG: IPv4アドレス"0.0.0.0"、ポート5444で待ち受けています 11月 12 18:28:03 edb01 edb-postmaster[16894]: 2020-11-12 18:28:03 JST LOG: IPv6アドレス"::"、ポート5444で待ち受けています 11月 12 18:28:03 edb01 edb-postmaster[16894]: 2020-11-12 18:28:03 JST LOG: Unixソケット"/tmp/.s.PGSQL.5444"で待ち受けています 11月 12 18:28:04 edb01 edb-postmaster[16894]: 2020-11-12 18:28:04 JST LOG: ログ出力をログ収集プロセスにリダイレクトしています 11月 12 18:28:04 edb01 edb-postmaster[16894]: 2020-11-12 18:28:04 JST ヒント: ここからのログ出力はディレクトリ"log"に現れます。 11月 12 18:28:04 edb01 systemd[1]: Started EDB Postgres Advanced Server 12. 11月 13 11:50:38 edb01 systemd[1]: Stopping EDB Postgres Advanced Server 12... 11月 13 11:50:38 edb01 systemd[1]: Stopped EDB Postgres Advanced Server 12. Hint: Some lines were ellipsized, use -l to show in full. [root@edb01 ~]#
(2).リストア先の「/var/lib/edb/as12/data」配下を削除して空にします。
[root@edb01 ~]# ls -l /var/lib/edb/as12/data 合計 112 -rw-------. 1 enterprisedb enterprisedb 3 11月 2 14:32 PG_VERSION -rw-------. 1 enterprisedb enterprisedb 204 11月 2 14:32 backup_label.old ・・・ -rw-------. 1 enterprisedb enterprisedb 30577 11月 2 14:32 postgresql.conf.20201029 -rw-------. 1 enterprisedb enterprisedb 61 11月 12 18:28 postmaster.opts [root@edb01 ~]# [root@edb01 ~]# rm -fR /var/lib/edb/as12/data/* [root@edb01 ~]# rm -f /var/lib/edb/as12/data/* [root@edb01 ~]# ls -l /var/lib/edb/as12/data 合計 0 [root@edb01 ~]#
(3).「bart show-backups」コマンドにより、取得済のバックアップを確認します。
[root@edb01 ~]# su - enterprisedb
最終ログイン: 2020/11/13 (金) 13:35:24 JST日時 pts/0
[enterprisedb@edb01 ~]$ bart SHOW-BACKUPS -s epas12
 SERVER NAME   BACKUP ID       BACKUP NAME   BACKUP PARENT   BACKUP TIME               BACKUP SIZE   WAL(s) SIZE   WAL FILES   STATUS  
                                                                                                                                       
 epas12        1605235183406   none          none            2020-11-13 11:39:54 JST   10.15 MB      48.00 MB      3           active  
 epas12        1604295143129   none          none            2020-11-02 14:32:32 JST   10.15 MB      208.00 MB     13          active  
                                                                                                                                       
[enterprisedb@edb01 ~]$ bart SHOW-BACKUPS -s epas12 -i 1605235183406 -t
SERVER NAME    : epas12
BACKUP ID      : 1605235183406
BACKUP NAME    : none
BACKUP PARENT  : none
BACKUP STATUS  : active
BACKUP TIME    : 2020-11-13 11:39:54 JST
BACKUP SIZE    : 10.15 MB
WAL(S) SIZE    : 48.00 MB
NO. OF WALS    : 3
FIRST WAL FILE : 000000020000000000000009
CREATION TIME  : 2020-11-13 11:39:44 JST
LAST WAL FILE  : 00000002000000000000000B
CREATION TIME  : 2020-11-13 11:50:38 JST
[enterprisedb@edb01 ~]$ grep backup_path /usr/edb/bart/etc/bart.cfg
#backup_path = PATH             # Required. The path where all of the backups will be stored.
#pg_basebackup_path = PATH      # Required. The path to pg_basebackup binary.
backup_path = /opt/backup
pg_basebackup_path = /usr/edb/as12/bin/pg_basebackup
[enterprisedb@edb01 ~]$ find /opt/backup -name 1605235183406
/opt/backup/epas12/1605235183406
[enterprisedb@edb01 ~]$ ls -l /opt/backup/epas12/1605235183406
合計 10416
-rw-rw-r--. 1 enterprisedb enterprisedb     204 11月 13 11:39 backup_label
-rw-rw-r--. 1 enterprisedb enterprisedb     553 11月 13 11:39 backupinfo
drwxrwxr-x. 4 enterprisedb enterprisedb      37 11月 13 11:39 base
-rw-rw-r--. 1 enterprisedb enterprisedb 3867536 11月 13 11:39 base-1.tar.gz
-rw-rw-r--. 1 enterprisedb enterprisedb 1014691 11月 13 11:39 base-2.tar.gz
-rw-rw-r--. 1 enterprisedb enterprisedb 3130429 11月 13 11:39 base-3.tar.gz
-rw-rw-r--. 1 enterprisedb enterprisedb  979580 11月 13 11:39 base-4.tar.gz
-rw-rw-r--. 1 enterprisedb enterprisedb 1613899 11月 13 11:39 base-5.tar.gz
-rw-rw-r--. 1 enterprisedb enterprisedb   33362 11月 13 11:39 base.tar.gz
[enterprisedb@edb01 ~]$ 
(4).bart restore コマンドによりリストアを実施します。
[enterprisedb@edb01 ~]$ bart RESTORE -s epas12 -i 1605235183406 -p /var/lib/edb/as12/data INFO: restoring backup '1605235183406' of server 'epas12' INFO: base backup restored INFO: writing recovery settings to postgresql.auto.conf INFO: WAL file(s) will be streamed from the BART host INFO: archiving is disabled INFO: permissions set on $PGDATA INFO: restore completed successfully [enterprisedb@edb01 ~]$
(5).EDBを起動します。
[root@edb01 ~]# systemctl start edb-as-12
[root@edb01 ~]# systemctl status edb-as-12
● edb-as-12.service - EDB Postgres Advanced Server 12
   Loaded: loaded (/usr/lib/systemd/system/edb-as-12.service; disabled; vendor preset: disabled)
   Active: active (running) since 金 2020-11-13 13:54:19 JST; 5s ago
  Process: 23608 ExecStartPre=/usr/edb/as12/bin/edb-as-12-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
 Main PID: 23614 (edb-postmaster)
    Tasks: 10
   CGroup: /system.slice/edb-as-12.service
           ├─23614 /usr/edb/as12/bin/edb-postmaster -D /var/lib/edb/as12/data
           ├─23616 postgres: logger   
           ├─23622 postgres: checkpointer   
           ├─23623 postgres: background writer   
           ├─23625 postgres: stats collector   
           ├─23627 postgres: walwriter   
           ├─23628 postgres: autovacuum launcher   
           ├─23629 postgres: archiver   last was 00000002000000000000000A.partial
           ├─23630 postgres: dbms_aq launcher   
           └─23631 postgres: logical replication launcher   
11月 13 13:54:18 edb01 systemd[1]: Starting EDB Postgres Advanced Server 12...
11月 13 13:54:19 edb01 edb-postmaster[23614]: 2020-11-13 13:54:19 JST LOG:  PostgreSQL 12.1 (EnterpriseDB Advanced Server 12.1.2) on x86_64-pc-linux-gnu, com...動しています
11月 13 13:54:19 edb01 edb-postmaster[23614]: 2020-11-13 13:54:19 JST LOG:  IPv4アドレス"0.0.0.0"、ポート5444で待ち受けています
11月 13 13:54:19 edb01 edb-postmaster[23614]: 2020-11-13 13:54:19 JST LOG:  IPv6アドレス"::"、ポート5444で待ち受けています
11月 13 13:54:19 edb01 edb-postmaster[23614]: 2020-11-13 13:54:19 JST LOG:  Unixソケット"/tmp/.s.PGSQL.5444"で待ち受けています
11月 13 13:54:19 edb01 edb-postmaster[23614]: 2020-11-13 13:54:19 JST LOG:  ログ出力をログ収集プロセスにリダイレクトしています
11月 13 13:54:19 edb01 edb-postmaster[23614]: 2020-11-13 13:54:19 JST ヒント:  ここからのログ出力はディレクトリ"log"に現れます。
11月 13 13:54:19 edb01 systemd[1]: Started EDB Postgres Advanced Server 12.
Hint: Some lines were ellipsized, use -l to show in full.
[root@edb01 ~]# 
(6).リストアしたデータベースに接続しオブジェクトを確認します。
[root@edb01 ~]# su - enterprisedb
最終ログイン: 2020/11/13 (金) 13:46:31 JST日時 pts/0
[enterprisedb@edb01 ~]$ edb-psql edb
edb-psql (12.1.2)
helpでヘルプを表示します。
edb=# \l
                                                  データベース一覧
   名前    |    所有者    | エンコーディング |  照合順序   | Ctype(変換演算子) | ICU |         アクセス権限          
-----------+--------------+------------------+-------------+-------------------+-----+-------------------------------
 edb       | enterprisedb | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       |     | 
 mydb      | enterprisedb | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       |     | 
 postgres  | enterprisedb | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       |     | 
 template0 | enterprisedb | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       |     | =c/enterprisedb              +
           |              |                  |             |                   |     | enterprisedb=CTc/enterprisedb
 template1 | enterprisedb | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       |     | =c/enterprisedb              +
           |              |                  |             |                   |     | enterprisedb=CTc/enterprisedb
(5 行)
edb=# \c mydb
データベース"mydb"にユーザ"enterprisedb"として接続しました。
mydb=# \db+
                               テーブル空間一覧
    名前    |    所有者    | 場所 | アクセス権限 | オプション | サイズ | 説明 
------------+--------------+------+--------------+------------+--------+------
 pg_default | enterprisedb |      |              |            | 64 MB  | 
 pg_global  | enterprisedb |      |              |            | 768 kB | 
(2 行)
mydb=# SELECT * FROM USER_TABLES;
 schema_name |             table_name              | tablespace_name | status | temporary 
-------------+-------------------------------------+-----------------+--------+-----------
 PUBLIC      | EMPLOYEES_NOMAX                     |                 | VALID  | N
 PUBLIC      | DEPT                                |                 | VALID  | N
 PUBLIC      | EMP                                 |                 | VALID  | N
 PUBLIC      | JOBHIST                             |                 | VALID  | N
 SYS         | PRODUCT_COMPONENT_VERSION           |                 | VALID  | N
 SYS         | DUAL                                |                 | VALID  | N
 SYS         | EDB_DBMS_REDACT_FULL_DEFAULT_VALUES |                 | VALID  | N
 SYS         | CALLBACK_QUEUE_TABLE                |                 | VALID  | N
 SYS         | PLSQL_PROFILER_RAWDATA              |                 | VALID  | N
 SYS         | PLSQL_PROFILER_RUNS                 |                 | VALID  | N
 SYS         | PLSQL_PROFILER_UNITS                |                 | VALID  | N
 SYS         | EDB$SNAP                            |                 | VALID  | N
 SYS         | EDB$SYSTEM_WAITS                    |                 | VALID  | N
 SYS         | EDB$SESSION_WAITS                   |                 | VALID  | N
 SYS         | EDB$SESSION_WAIT_HISTORY            |                 | VALID  | N
 SYS         | EDB$STAT_ALL_INDEXES                |                 | VALID  | N
 SYS         | EDB$STAT_ALL_TABLES                 |                 | VALID  | N
 SYS         | EDB$STAT_DATABASE                   |                 | VALID  | N
 SYS         | EDB$STATIO_ALL_INDEXES              |                 | VALID  | N
 SYS         | EDB$STATIO_ALL_TABLES               |                 | VALID  | N
(20 行)
mydb=# select count(*) from emp;
 count 
-------
14
(1 行)
mydb=# 
mydb=# \q
[enterprisedb@edb01 ~]$ 
3) EDB Postgres Enterprise Manager 7.15(PEM)
PEMは、Webブラウザにてデーターベース・オブジェクトの定義、管理、起動、停止、パフォーマンスチューニング、レポートやアラート通知などが行えるGUIツールです。
このツールで一般的な操作が行える事を確認します。

3)-1. DB作成
データベースが作成できる事を確認します。
(1).画面左側のツリー構造でDatabasesを右クリックし、Create->Databaseを選択します。

(2).Generalタブでデータベース名、コメントを入力し(その他の項目はデフォルト)、Saveをクリックします。

(3).画面左側のツリー構造のDatabases配下に新しくデータベースが作成されました。

3)-2. テーブル作成
テーブルが作成できる事を確認します。
作成したデータベースにテーブルを作成します。
(1).画面左側のツリー構造でテーブルを作成したいデータベース -> Schemas -> スキーマを展開します。
Tablesを右クリックし、Create -> Tableを選択します。

(2).Generalタブでテーブル名、コメントを入力します。(その他の項目はデフォルト)

(3).Columnsタブでカラムを追加します。
Columns欄の右側の「+」をクリックすると画面に入力フィールドが追加されるので、カラム名や属性を入力します。

(4).今回はカラムの追加時にプライマリーキーを指定したので、Constraintsタブで制約名を入力します。

(5).SQLタブにテーブル作成用のDDLが表示されるので確認し、Saveをクリックします。

(6).画面左側のツリー構造のTables配下に新しくテーブルが作成されました。

3)-3. IMPORT
データがImportできる事を確認します。
作成したテーブルに以下のCSVファイルをImportします。

(1).画面左側のツリー構造でデータをImportしたいテーブルを右クリックし、Import/Exportを選択します。

(2).OptionsタブのImport/ExportでImportを選択し、Filenameの右側にある3点アイコン(
)をクリックします。

(3).画面右上にあるUpload Fileアイコン(
)をクリックし、開いた画面にImport対象のファイルをドロップします。

(4).ファイルのアップロードが完了したら、画面右上の×印アイコンをクリックして画面を閉じます。

(5).Import対象のファイルをクリックし、画面右下のSelectをクリックします。

(6).画面右下のOKをクリックします。

(7).Importが完了すると以下のようなポップアップが表示されます。
More detailsをクリックすると実行されたコマンドを確認することができます。


(8).テーブルの内容を確認します。
画面左側のツリー構造で対象のテーブルを右クリックし、View/Edit Data -> All Rowsを選択します。

(9).画面右側の上段にSelectステートメント、下段にテーブルの内容が表示されます。
CSVのデータがImportされました。

3)-4. バックアップ
バックアップが取得できる事を確認します。
※PEMにBARTが組み込まれていることが前提になります。
(1).画面左側のツリー構造でBART Serversを展開してBARTサーバーを右クリックし、Backupを選択します。

(2).Generalタブでデータベースサーバー名、バックアップ名、Gzipへの圧縮、スレッド数、チェックサムの確認を入力し(その他の項目はデフォルト)、Backupをクリックします。


(3).バックアップが完了すると画面右側のDashboardタブに情報が表示されます。
  Backup and Restore Activities欄:成功/失敗した回数
  Number of backup taken欄:データベースサーバーの情報
  Initiated Server Backups欄:バックアップの履歴

4) Oracleからのデータ移行
4)-1. Migration Toolkitを使用したOracleからのデータ移行
Migration Toolkitという移行ツールを使用してOracleからデータが移行できる事を確認します。
移行対象のデータ量が比較的少ない場合はこの移行ツールを使用した移行がおススメです。
(1).OracleのJDBCドライバ(ojdbc8.jar)を保存します。
-bash-4.2$ ls -l /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.222.b03-1.el7.x86_64/jre/lib/ext/ 合計 11764 -rw-r--r--. 1 root root 4003855 5月 23 2019 cldrdata.jar -rw-r--r--. 1 root root 9445 5月 23 2019 dnsns.jar -rw-r--r--. 1 root root 48733 5月 23 2019 jaccess.jar -rw-r--r--. 1 root root 1204599 5月 23 2019 localedata.jar -rw-r--r--. 1 root root 617 5月 23 2019 meta-index -rw-r--r--. 1 root root 2033515 5月 23 2019 nashorn.jar -rw-r--r-- 1 root root 4036257 4月 3 2018 ojdbc8.jar -rw-r--r--. 1 root root 30639 5月 23 2019 sunec.jar -rw-r--r--. 1 root root 299710 5月 23 2019 sunjce_provider.jar -rw-r--r--. 1 root root 273121 5月 23 2019 sunpkcs11.jar -rw-r--r--. 1 root root 78007 5月 23 2019 zipfs.jar -bash-4.2$
(2).移行ツールのプロパティに移行元(Oracle)と移行先(EDB)の接続情報を設定します。
-bash-4.2$ cd /usr/edb/migrationtoolkit/etc/ -bash-4.2$ -bash-4.2$ -bash-4.2$ vi toolkit.properties -bash-4.2$ cat toolkit.properties SRC_DB_URL=jdbc:oracle:thin:@//192.168.XXX.XX:1521/EDB SRC_DB_USER=edb_adm SRC_DB_PASSWORD=PPPPPPPP TARGET_DB_URL=jdbc:edb://localhost:5444/edb_oracle TARGET_DB_USER=enterprisedb TARGET_DB_PASSWORD=PPPPPPPP -bash-4.2$
(3).移行先(EDB)のデータベースを作成します。
-bash-4.2$ edb-psql edb
ユーザ enterprisedb のパスワード:
edb-psql (12.1.2)
"help"でヘルプを表示します。
edb=#
edb=#
edb=# create database edb_oracle;
CREATE DATABASE
edb=#
edb=#
edb=# \l
                                                   データベース一覧
    名前    |    所有者    | エンコーディング |  照合順序   | Ctype(変換演算子)
| ICU |         アクセス権限
------------+--------------+------------------+-------------+-------------------
+-----+-------------------------------
 edb        | enterprisedb | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8
|     |
 edb_oracle | enterprisedb | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8
|     |
 pem        | enterprisedb | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8
|     | enterprisedb=CTc/enterprisedb+
            |              |                  |             |
|     | pem_user=Tc/enterprisedb     +
            |              |                  |             |
|     | pem_agent=Tc/enterprisedb
 postgres   | enterprisedb | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8
|     |
 template0  | enterprisedb | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8
|     | =c/enterprisedb              +
            |              |                  |             |
|     | enterprisedb=CTc/enterprisedb
 template1  | enterprisedb | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8
|     | =c/enterprisedb              +
            |              |                  |             |
|     | enterprisedb=CTc/enterprisedb
(6 行)
edb=#
edb=#
edb=# \q
-bash-4.2$
(4).移行元(Oracle)のテーブルのレコード数を確認します。(実際にはデータ内容も確認しています)
[oracle@oraclelinux ~]$ sqlplus edb_adm/PPPPPPPP@edb
SQL*Plus: Release 12.2.0.1.0 Production on 月 12月 21 17:01:54 2020
Copyright (c) 1982, 2016, Oracle.  All rights reserved.
最終正常ログイン時間: 月 12月 21 2020 13:52:33 +09:00
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
に接続されました。
SQL>
SQL>
SQL> select count(*) from edbuser.testtable;
  COUNT(*)
----------
      9542
SQL>
SQL>
SQL> exit
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Productionとの接続が切断されました。
[oracle@oraclelinux ~]$
(5).移行ツールを実行します。
-bash-4.2$ cd /usr/edb/migrationtoolkit/bin -bash-4.2$ -bash-4.2$ -bash-4.2$ ./runMTK.sh EDBUSER Running EnterpriseDB Migration Toolkit (Build 53.0.0) ... ソースデータベース接続情報... 接続 =jdbc:oracle:thin:@//192.168.XXX.XX:1521/EDB ユーザ =edb_adm パスワード=****** ターゲットデータベース接続情報... 接続 =jdbc:edb://localhost:5444/edb_oracle ユーザ =enterprisedb パスワード=****** ソースOracleデータベースサーバに接続しています... Connected to Oracle, version 'Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production' ターゲットEDB Postgresデータベースサーバに接続しています... Connected to EnterpriseDB, version '12.1.2' redwoodスキーマのインポート... スキーマ作成...edbuser テーブル作成... テーブル作成: TESTTABLE 1個のテーブルを作成しました。 8 MB のバッチのテーブルデータロード... ラージオブジェクトをテーブルにロード:TESTTABLE ... [TESTTABLE] 1個の行を移行しました。 [TESTTABLE] 2個の行を移行しました。 [TESTTABLE] 3個の行を移行しました。 ・・・ [TESTTABLE] 9,540個の行を移行しました。 [TESTTABLE] 9,541個の行を移行しました。 [TESTTABLE] 9,542個の行を移行しました。 [TESTTABLE] テーブルデータロード概要: 全時間(s):7.387 全行数:9542 全サイズ(MB): 0.26953125 データロード概要: 全時間(秒):7.49 全行数:9542 全サイズ(MB):0.276 制約作成: TESTTABLE_PK スキーマEDBUSERがインポートされました。 ユーザを作成しています: EDBUSER 移行処理が無事に完了しました。 移行ログが/var/lib/edb/.enterprisedb/migration-toolkit/logsに保存されました ******************** 移行概要情報 ******************** Tables: 1 移行元 1 Constraints: 1 移行元 1 Users: 1 移行元 1 オブジェクトの合計数: 3 成功件数: 3 失敗件数: 0 Invalid count: 0 ************************************************************* -bash-4.2$
(6).移行ログの内容を確認します。
-bash-4.2$ cat /var/lib/edb/.enterprisedb/migration-toolkit/logs/mtk_EDBUSER_20201221050909.log 2020-12-21 17:09:09 Running EnterpriseDB Migration Toolkit (Build 53.0.0) ... 2020-12-21 17:09:09 ソースデータベース接続情報... 2020-12-21 17:09:09 接続 =jdbc:oracle:thin:@//192.168.XXX.XX:1521/EDB 2020-12-21 17:09:09 ユーザ =edb_adm 2020-12-21 17:09:09 パスワード=****** 2020-12-21 17:09:09 ターゲットデータベース接続情報... 2020-12-21 17:09:09 接続 =jdbc:edb://localhost:5444/edb_oracle 2020-12-21 17:09:09 ユーザ =enterprisedb 2020-12-21 17:09:09 パスワード=****** 2020-12-21 17:09:09 ソースOracleデータベースサーバに接続しています... 2020-12-21 17:09:10 Connected to Oracle, version 'Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production' 2020-12-21 17:09:10 ターゲットEDB Postgresデータベースサーバに接続しています... 2020-12-21 17:09:10 Connected to EnterpriseDB, version '12.1.2' 2020-12-21 17:09:10 redwoodスキーマのインポート... 2020-12-21 17:09:10 スキーマ作成...edbuser 2020-12-21 17:09:10 Getting Object Type Definitions... 2020-12-21 17:09:14 Getting Sequence Definitions 2020-12-21 17:09:14 Getting Advanced Queues... 2020-12-21 17:09:14 Getting Table Definitions 2020-12-21 17:09:17 テーブル作成... 2020-12-21 17:09:17 テーブル作成: TESTTABLE 2020-12-21 17:09:17 1個のテーブルを作成しました。 2020-12-21 17:09:18 8 MB のバッチのテーブルデータロード... 2020-12-21 17:09:18 ラージオブジェクトをテーブルにロード:TESTTABLE ... 2020-12-21 17:09:18 [TESTTABLE] 1個の行を移行しました。 2020-12-21 17:09:18 [TESTTABLE] 2個の行を移行しました。 2020-12-21 17:09:18 [TESTTABLE] 3個の行を移行しました。 ・・・ 2020-12-21 17:09:25 [TESTTABLE] 9,540個の行を移行しました。 2020-12-21 17:09:25 [TESTTABLE] 9,541個の行を移行しました。 2020-12-21 17:09:25 [TESTTABLE] 9,542個の行を移行しました。 2020-12-21 17:09:25 [TESTTABLE] テーブルデータロード概要: 全時間(s):7.387 全 行数:9542 全サイズ(MB): 0.26953125 2020-12-21 17:09:25 データロード概要: 全時間(秒):7.49 全行数:9542 全サイズ(MB):0.276 2020-12-21 17:09:25 Getting Constraint Definitions 2020-12-21 17:09:27 制約作成: TESTTABLE_PK 2020-12-21 17:09:27 Getting Index Definitions 2020-12-21 17:09:36 Getting Trigger Definitions 2020-12-21 17:09:39 Getting View Definitions... 2020-12-21 17:09:39 Getting Materialized View Definitions... 2020-12-21 17:09:39 Getting Procedure Definitions 2020-12-21 17:09:40 Getting Function Definitions 2020-12-21 17:09:40 Getting Package Definitions 2020-12-21 17:09:40 Getting Public Synonym Definitions 2020-12-21 17:09:41 Getting all Invalid Objects 2020-12-21 17:09:42 2020-12-21 17:09:42 スキーマEDBUSERがインポートされました。 2020-12-21 17:09:42 2020-12-21 17:09:42 Getting Profile Resource Definitions... 2020-12-21 17:09:42 Getting Roles Definitions... 2020-12-21 17:09:42 Getting Users Definitions... 2020-12-21 17:09:42 ユーザを作成しています: EDBUSER 2020-12-21 17:09:42 Getting Grants Definitions... 2020-12-21 17:09:44 2020-12-21 17:09:44 移行処理が無事に完了しました。 2020-12-21 17:09:44 移行ログが/var/lib/edb/.enterprisedb/migration-toolkit/logsに保存されました 2020-12-21 17:09:44 ******************** 移行概要情報 ******************** Tables: 1 移行元 1 Constraints: 1 移行元 1 Users: 1 移行元 1 オブジェクトの合計数: 3 成功件数: 3 失敗件数: 0 Invalid count: 0 ************************************************************* -bash-4.2$
(7).移行先(EDB)のテーブルのレコード数を確認します。(実際にはデータの内容も確認しています)
Oracleから正常にデータが移行されました。
-bash-4.2$ edb-psql edb_oracle ユーザ enterprisedb のパスワード: edb-psql (12.1.2) "help"でヘルプを表示します。 edb_oracle=# edb_oracle=# edb_oracle=# select count(*) from edbuser.testtable; count ------- 9542 (1 行) edb_oracle=#
4)-2. dblink_oraを使用したOracleからのデータ移行
dblink_oraを使用してOracleからデータが移行できる事を確認します。
※dblink_oraはOCIベースのデータベースリンクを提供します。
移行対象のデータ量が多く、Migration Toolkitによる移行が重い場合はこちらの方法がおススメです。
今回の検証では移行元のテーブルはMigration Toolkitによる移行検証で使用したテーブルと同一です。
(1).OracleInstantClientをインストールします。
[root@edbas12 EDB_work]# yum install oracle-instantclient-basic-21.1.0.0.0-1.x86_64.rpm
読み込んだプラグイン:langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
oracle-instantclient-basic-21.1.0.0.0-1.x86_64.rpm を調べています: oracle-instantclient-basic-21.1.0.0.0-1.x86_64
oracle-instantclient-basic-21.1.0.0.0-1.x86_64.rpm をインストール済みとして設定 しています
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ oracle-instantclient-basic.x86_64 0:21.1.0.0.0-1 を インストール
--> 依存性解決を終了しました。
centos-sclo-rh/x86_64                                    | 3.0 kB     00:00
centos-sclo-rh/x86_64/primary_db                         | 2.9 MB     00:00
centos-sclo-sclo/x86_64                                  | 3.0 kB     00:00
edbrepo                                                  | 2.9 kB     00:00
epel/x86_64/metalink                                     | 9.1 kB     00:00
epel/x86_64                                              | 4.7 kB     00:00
epel/x86_64/updateinfo                                   | 1.0 MB     00:00
epel/x86_64/primary_db                                   | 6.9 MB     00:01
rhel                                                     | 2.8 kB     00:00
依存性を解決しました
================================================================================
 Package
      アーキテクチャー
             バージョン   リポジトリー                                     容量
================================================================================
インストール中:
 oracle-instantclient-basic
      x86_64 21.1.0.0.0-1 /oracle-instantclient-basic-21.1.0.0.0-1.x86_64 237 M
トランザクションの要約
================================================================================
インストール  1 パッケージ
合計容量: 237 M
インストール容量: 237 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  インストール中          : oracle-instantclient-basic-21.1.0.0.0-1.x86_6   1/1
  検証中                  : oracle-instantclient-basic-21.1.0.0.0-1.x86_6   1/1
インストール:
  oracle-instantclient-basic.x86_64 0:21.1.0.0.0-1
完了しました!
[root@edbas12 EDB_work]#
(2).libclntsh.soが含まれていることを確認します。
[root@edbas12 EDB_work]# ls -l /usr/lib/oracle/21/client64/lib/ 合計 242944 lrwxrwxrwx 1 root root 17 12月 25 11:02 libclntsh.so -> libclntsh.so.21.1 lrwxrwxrwx 1 root root 17 12月 25 11:02 libclntsh.so.10.1 -> libclntsh.so.21.1 lrwxrwxrwx 1 root root 17 12月 25 11:02 libclntsh.so.11.1 -> libclntsh.so.21.1 lrwxrwxrwx 1 root root 17 12月 25 11:02 libclntsh.so.12.1 -> libclntsh.so.21.1 lrwxrwxrwx 1 root root 17 12月 25 11:02 libclntsh.so.18.1 -> libclntsh.so.21.1 lrwxrwxrwx 1 root root 17 12月 25 11:02 libclntsh.so.19.1 -> libclntsh.so.21.1 lrwxrwxrwx 1 root root 17 12月 25 11:02 libclntsh.so.20.1 -> libclntsh.so.21.1 -rwxr-xr-x 1 root root 83357368 10月 31 18:34 libclntsh.so.21.1 lrwxrwxrwx 1 root root 21 12月 25 11:02 libclntshcore.so -> libclntshcore.so.21.1 -rwxr-xr-x 1 root root 8094056 10月 31 18:34 libclntshcore.so.21.1 -rwxr-xr-x 1 root root 7097376 10月 31 18:34 libnnz21.so lrwxrwxrwx 1 root root 15 12月 25 11:02 libocci.so -> libocci.so.21.1 lrwxrwxrwx 1 root root 15 12月 25 11:02 libocci.so.10.1 -> libocci.so.21.1 lrwxrwxrwx 1 root root 15 12月 25 11:02 libocci.so.11.1 -> libocci.so.21.1 lrwxrwxrwx 1 root root 15 12月 25 11:02 libocci.so.12.1 -> libocci.so.21.1 lrwxrwxrwx 1 root root 15 12月 25 11:02 libocci.so.18.1 -> libocci.so.21.1 lrwxrwxrwx 1 root root 15 12月 25 11:02 libocci.so.19.1 -> libocci.so.21.1 lrwxrwxrwx 1 root root 15 12月 25 11:02 libocci.so.20.1 -> libocci.so.21.1 -rwxr-xr-x 1 root root 2374192 10月 31 18:34 libocci.so.21.1 -rwxr-xr-x 1 root root 142553648 10月 31 18:34 libociei.so -rwxr-xr-x 1 root root 153480 10月 31 18:34 libocijdbc21.so -rwxr-xr-x 1 root root 116104 10月 31 18:34 liboramysql.so drwxr-xr-x 3 root root 19 12月 25 11:02 network -rw-r--r-- 1 root root 4972232 10月 31 18:35 ojdbc8.jar -rw-r--r-- 1 root root 37676 10月 31 18:34 xstreams.jar [root@edbas12 EDB_work]#
(3).「.bash_profile」でパスに/usr/lib/oracle/21/client64/binを追加します。
[root@edbas12 EDB_work]# su - enterprisedb 最終ログイン: 2020/12/25 (金) 11:00:03 JST -bash-4.2$ -bash-4.2$ -bash-4.2$ vi .bash_profile -bash-4.2$ cat .bash_profile [ -f /etc/profile ] && source /etc/profile PGDATA=/var/lib/edb/as12/data export PGDATA # If you want to customize your settings, # Use the file below. This is not overridden # by the RPMS. [ -f /var/lib/edb/.enterprisedb_profile ] && source /var/lib/edb/.enterprisedb_profile export PATH=/usr/lib/oracle/21/client64/bin:$PATH -bash-4.2$ -bash-4.2$ -bash-4.2$ exit ログアウト [root@edbas12 EDB_work]# [root@edbas12 EDB_work]# [root@edbas12 EDB_work]# su - enterprisedb 最終ログイン: 2020/12/25 (金) 11:45:22 JST日時 pts/0 -bash-4.2$ -bash-4.2$ -bash-4.2$ echo $PATH /usr/lib/oracle/21/client64/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin -bash-4.2$
(4).EDBからOracleに接続できることを確認します。
-bash-4.2$ edb-psql edb_oracle
ユーザ enterprisedb のパスワード:
edb-psql (12.1.2)
"help"でヘルプを表示します。
edb_oracle=#
edb_oracle=#
edb_oracle=# select dblink_ora_connect('ora1','192.168.XXX.XX','EDB','edb_adm','PPPPPPPP',1521);
 dblink_ora_connect
--------------------
 OK
(1 行)
edb_oracle=#
edb_oracle=#
edb_oracle=# select dblink_ora_status('ora1');
 dblink_ora_status
-------------------
 OK
(1 行)
edb_oracle=#
edb_oracle=#
edb_oracle=# select dblink_ora_disconnect('ora1');
 dblink_ora_disconnect
-----------------------
 OK
(1 行)
edb_oracle=#
edb_oracle=# \q
-bash-4.2$
(5).移行先(EDB)で予め空のテーブルを作成しておきます。
今回は上記の移行ツールによる移行検証で作成されたテーブルのレコードを削除して流用します。
-bash-4.2$ edb-psql edb_oracle
ユーザ enterprisedb のパスワード:
edb-psql (12.1.2)
"help"でヘルプを表示します。
edb_oracle=#
edb_oracle=#
edb_oracle=# select count(*) from edbuser.testtable;
 count
-------
  9542
(1 行)
edb_oracle=#
edb_oracle=#
edb_oracle=# delete from edbuser.testtable;
DELETE 9542
edb_oracle=#
edb_oracle=#
edb_oracle=# select count(*) from edbuser.testtable;
 count
-------
     0
(1 行)
edb_oracle=#
(6).Oracleに接続します。
edb_oracle=# select dblink_ora_connect('ora1','192.168.XXX.XX','EDB','edb_adm','PPPPPPPP',1521);
 dblink_ora_connect
--------------------
 OK
(1 行)
edb_oracle=#
(7).データを移行します。
edb_oracle=# select dblink_ora_copy('ora1','select * from edbuser.testtable','edbuser','testtable',true,1000);
INFO:  Row: 0
INFO:  Row: 1000
INFO:  Row: 2000
INFO:  Row: 3000
INFO:  Row: 4000
INFO:  Row: 5000
INFO:  Row: 6000
INFO:  Row: 7000
INFO:  Row: 8000
INFO:  Row: 9000
 dblink_ora_copy
-----------------
            9542
(1 行)
edb_oracle=#
(8).Oracleから切断します。
edb_oracle=# select dblink_ora_disconnect('ora1');
 dblink_ora_disconnect
-----------------------
 OK
(1 行)
edb_oracle=#
(9).移行先(EDB)のテーブルのレコード数を確認します。(実際にはデータの内容も確認しています)
Oracleから正常にデータが移行されました。
edb_oracle=# select count(*) from edbuser.testtable; count ------- 9542 (1 行) edb_oracle=# edb_oracle=# edb_oracle=# \q -bash-4.2$
■所管
◆良い点
設定手順、コマンド、操作方法に慣れてしまえば、低コストでシステムが構築できます。
移行ツールが充実しており、Oracleとの親和性が高いためOracleからの移行が容易です。
◆改善点
マニュアルに関して以下の点で苦労したためもう少し整備されると良いと思います。
・ツール毎にマニュアルが存在しますが、必要な手順を各マニュアルから探し自分で一連化する必要がありました。
・ツールの設定時にマニュアルに必須項目が明記されていないため試行錯誤しました。
・メッセージに対する対応方法が記載されたマニュアルが見つからずエラー発生時の対応に苦労しました。
◆総評
コストが安くOracleからのデータ移行が比較的簡単なため、Oracleのアップデートや他DBへのマイグレーションを検討しているお客様にはEDBへのマイグレーションを候補としておススメします。
検証できていない機能がまだまだ多数あるため引き続き検証を実施していきます。
また、今後はEDBと他のDBとの比較も検証していきたいと思います。



