尝试在本地创建Oracle Golden Gate 19环境的步骤1:安装Oracle Database CUI
只需要一个选择: ”目标”

第一步。安装Oracle数据库CUI(此文章)。
第二步:安装Oracle Golden Gate
第三步:设置Oracle Golden Gate
第四步:尝试使用Oracle Golden Gate
版本等
対象バージョンHost OSWindows10Client OS1 (name: myora1)Centos-7.8 on virtual boxClient OS2 (name: myora2)Centos-7.8 on virtual boxVirtual BoxVersion 6.1.26VagrantVersion 2.2.5Ansible (ansible_local)Version 2.9Oracle DB19cOracle Golden Gate19.1.0.0
Oracle数据库安装步骤
1.创建(将两台)Vagrantfile 文件
2.创建 Ansible playbook 文件
3.下载 Oracle DB
4.创建虚拟环境 (需时240分钟)
创建 Vagrantfile(包含两个虚拟机的一个文件)。
|-- Vagrantfile
|-- ansible
| |-- hosts
| |-- installer
| | `-- oracle-database-ee-19c-1.0-1.x86_64.rpm
| |-- myora1.yml
| `-- myora2.yml
#Vagrant::DEFAULT_SERVER_URL.replace('https://vagrantcloud.com')
# Vagrantfile
# coding: utf-8
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# (A) For /sbin/mount.vboxsf: mounting failed with the error: No such device
if Vagrant.has_plugin?("vagrant-vbguest")
config.vbguest.auto_update = false
end
config.vm.box = "bento/centos-7.8"
config.vm.box_url = "https://app.vagrantup.com/bento/boxes/centos-7.8"
# (B) myora1 vm
config.vm.define "myora1" do |server|
server.vm.hostname = 'myora1'
server.vm.network :private_network,ip: "192.168.60.50"
server.vm.provider "virtualbox" do |vbox|
vbox.gui = false
vbox.name = "CentOs7.8-myora1"
vbox.cpus = 2
vbox.memory = 2048
vbox.customize [
"modifyvm", :id,
"--vram", "256", # video memory for full screen
"--clipboard", "bidirectional", # sharing clipboard
"--draganddrop", "bidirectional", # enable drag & drop
"--cpus", "2", # 2 cpu
"--ioapic", "on" # enable I/O APIC
]
end
# (C) ansible
server.vm.synced_folder "./ansible", "/ansible"
server.vm.provision "ansible_local" do |ansible|
ansible.playbook = "/ansible/myora1.yml"
ansible.version = "latest"
ansible.verbose = false
ansible.limit = "myora1"
ansible.inventory_path = "/ansible/hosts"
end
end
# (B) myora2 vm
config.vm.define "myora2" do |server|
server.vm.hostname = 'myora2'
server.vm.network :private_network,ip: "192.168.60.60"
server.vm.provider "virtualbox" do |vbox|
vbox.gui = false
vbox.name = "CentOs7.8-myora2"
vbox.cpus = 2
vbox.memory = 2048
vbox.customize [
"modifyvm", :id,
"--vram", "256", # video memory for full screen
"--clipboard", "bidirectional", # sharing clipboard
"--draganddrop", "bidirectional", # enable drag & drop
"--cpus", "2", # 2 cpu
"--ioapic", "on" # enable I/O APIC
]
end
# (C) ansible
server.vm.synced_folder "./ansible", "/ansible"
server.vm.provision "ansible_local" do |ansible|
ansible.playbook = "/ansible/myora2.yml"
ansible.version = "2.9.24"
ansible.verbose = false
ansible.limit = "myora2"
ansible.inventory_path = "/ansible/hosts"
end
end
end
-
- (A) “vagrant-vbguest” の自動更新が有効になっていると、失敗することがあるので、無効にしている
-
- (B) “myora1” と “myora2” という2つの仮想環境を定義している
- (C) ansible の playbook を “myora1.yml” と “myora2.yml” のそれぞれの仮想環境毎に用意している
2. 制作Ansible playbook文件
通过以下方式在清单文件中指定,使得可以在本地主机上无需SSH直接执行Ansible。
myora1 ansible_connection=local
myora2 ansible_connection=local
- hosts: myora1
connection: local
become: yes
gather_facts: true
tasks:
## Install Oracle Preinstallation RPM
- name: Download Oracle preinstall rpm package
get_url:
url: https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
dest: /tmp
- name: Install Oracle Preinstallation
yum:
name: /tmp/oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
state: present
- name: Copy file for Oracle installation
copy:
src: ./installer/oracle-database-ee-19c-1.0-1.x86_64.rpm
dest: /tmp/oracle-database-ee-19c-1.0-1.x86_64.rpm
mode: 0644
- name: Install Oracle DB
become: true
yum:
name: /tmp/oracle-database-ee-19c-1.0-1.x86_64.rpm
state: present
## Require to configure Oracle DB(deny to configure for "localhost")
- name: Replace a localhost ip address
replace:
path: /etc/hosts
regexp: '^127.0.0.1'
replace: '192.168.60.50'
- name: Make ansible setup status directory
file:
path: "/ansible_setup_status"
state: directory
owner: "root"
group: "root"
mode: 0755
- name: "check 'configured_oracle_db' if exist"
stat:
path: "/ansible_setup_status/configured_oracle_db"
register: configured_oracle_db_exist
- name: Configure Oracle DB
shell:
cmd: /etc/init.d/oracledb_ORCLCDB-19c configure
environment:
ORACLE_BASE: /opt/oracle
ORACLE_HOME: /opt/oracle/product/19c/dbhome_1
ORACLE_SID: ORCLCDB
ignore_errors: yes
when: not configured_oracle_db_exist.stat.exists
- name: Put file to indicate completed configure Oracle DB
file:
path: "/ansible_setup_status/configured_oracle_db"
state: touch
- name: bash_profile of oracle user
ansible.builtin.lineinfile:
path: /home/oracle/.bash_profile
state: present
line: "{{ item }}"
with_items:
- 'export ORACLE_SID=ORCLCDB'
- 'export ORACLE_BASE=/opt/oracle'
- 'export ORACLE_HOME=$ORACLE_BASE/product/19c/dbhome_1'
- 'export PATH=$PATH:$ORACLE_HOME/bin'
-
- (A) “Oracle DB” をインストールする前準備として、Preinstallation を行う。このRPMパッケージはOracleのダウンロードページにサインインしていなくてもダウンロード可能なため、仮想環境から直接ダウンロードするようにしている
-
- (B) “Oracle DB” のインストーラはOracleにサインインしないとダウンロードができないため、予めホストPCにダウンロードしておいたパッケージをコピーするようにしている
- (C) IPアドレスに対するホスト名を逆引きした時、”localhost”だと、Oracle configure が動作しないため、ホスト名が返却されるように /etc/hosts を編集している
- hosts: myora2
connection: local
become: yes
gather_facts: true
tasks:
## Install Oracle Preinstallation RPM
- name: Download Oracle preinstall rpm package
get_url:
url: https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
dest: /tmp
- name: Install Oracle Preinstallation
yum:
name: /tmp/oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
state: present
- name: Copy file for Oracle installation
copy:
src: ./installer/oracle-database-ee-19c-1.0-1.x86_64.rpm
dest: /tmp/oracle-database-ee-19c-1.0-1.x86_64.rpm
mode: 0644
- name: Install Oracle DB
become: true
yum:
name: /tmp/oracle-database-ee-19c-1.0-1.x86_64.rpm
state: present
## Require to configure Oracle DB(deny to configure for "localhost")
- name: Replace a localhost ip address
replace:
path: /etc/hosts
regexp: '^127.0.0.1'
replace: '192.168.60.60'
- name: Make ansible setup status directory
file:
path: "/ansible_setup_status"
state: directory
owner: "root"
group: "root"
mode: 0755
- name: "check 'configured_oracle_db' if exist"
stat:
path: "/ansible_setup_status/configured_oracle_db"
register: configured_oracle_db_exist
- name: Configure Oracle DB
shell:
cmd: /etc/init.d/oracledb_ORCLCDB-19c configure
environment:
ORACLE_BASE: /opt/oracle
ORACLE_HOME: /opt/oracle/product/19c/dbhome_1
ORACLE_SID: ORCLCDB
ignore_errors: yes
when: not configured_oracle_db_exist.stat.exists
- name: Put file to indicate completed configure Oracle DB
file:
path: "/ansible_setup_status/configured_oracle_db"
state: touch
- name: bash_profile of oracle user
ansible.builtin.lineinfile:
path: /home/oracle/.bash_profile
state: present
line: "{{ item }}"
with_items:
- 'export ORACLE_SID=ORCLCDB'
- 'export ORACLE_BASE=/opt/oracle'
- 'export ORACLE_HOME=$ORACLE_BASE/product/19c/dbhome_1'
- 'export PATH=$PATH:$ORACLE_HOME/bin'
我的ora1.yml与之不同之处在于,仅仅是主机名和IP地址不同。
3. 下载 Oracle 数据库
Oracle数据库可从下载页面下载到。


将下载的rpm软件包按以下方式放置。
|-- Vagrantfile
|-- ansible
| |-- hosts
| |-- installer
| | `-- oracle-database-ee-19c-1.0-1.x86_64.rpm ←これ
| |-- myora1.yml
| `-- myora2.yml
创建虚拟环境
那么,我们将使用命令来创建虚拟环境。
移动到具有Vagrantfile的目录。
$ ls
Vagrantfile ansible/
执行 vagrant up(在本地环境大约需要240分钟)。
$ vagrant up --provision
==> vagrant: A new version of Vagrant is available: 2.2.18 (installed version: 2.2.5)!
==> vagrant: To upgrade visit: https://www.vagrantup.com/downloads.html
Bringing machine 'myora1' up with 'virtualbox' provider...
Bringing machine 'myora2' up with 'virtualbox' provider...
==> myora1: Importing base box 'bento/centos-7.8'...
(省略)
TASK [bash_profile of oracle user] *********************************************
changed: [myora2] => (item=export ORACLE_SID=ORCLCDB)
changed: [myora2] => (item=export ORACLE_BASE=/opt/oracle)
changed: [myora2] => (item=export ORACLE_HOME=$ORACLE_BASE/product/19c/dbhome_1)
changed: [myora2] => (item=export PATH=$PATH:$ORACLE_HOME/bin)
PLAY RECAP *********************************************************************
myora2 : ok=11 changed=9 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
3. 登录虚拟环境并使用 SQL 客户端登录到 Oracle 数据库。
$ vagrant ssh myora1
[vagrant@myora1 ~]$ sudo su - oracle
Last login: Sat Aug 14 02:22:46 UTC 2021
[oracle@myora1 ~]$ sql / as sysdba
SQLcl: Release 19.1 Production on Sat Aug 14 03:22:45 2021
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL>
4. 查看集装箱
# 接続中のコンテナ確認
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
# 利用可能なPDBの一覧
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 ORCLPDB1 READ WRITE NO
SQL>
以上
请提供一篇关于这个话题的初步参考。
- Oracle 19cをCentOS7にCUIからインストール