当前位置:Gxlcms > 数据库问题 > [转帖]如何获得一个RAC Oracle数据库(从Github - oracle/docker-images) - 本地版 ---暂时未做实验.

[转帖]如何获得一个RAC Oracle数据库(从Github - oracle/docker-images) - 本地版 ---暂时未做实验.

时间:2021-07-01 10:21:17 帮助过:12人阅读

分类专栏: 如何获得一个Oracle数据库   版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。 本文链接:https://xiaoyu.blog.csdn.net/article/details/102988682

环境

一台笔记本电脑,Windows操作系统,安装了VirtualBox,Vagrant,Github。

目标

操作系统Oracle Linux 7,运行容器数据库,数据库企业版,RAC,版本为19.3.0,实例名为ORCLCDB,带一个可插拔数据库orclpdb1。两个RAC节点均运行于同一主机。

创建Linux操作系统

克隆项目以获得Linux Vagrant Box:

PS D:\DB> git clone https://github.com/oracle/vagrant-boxes.git

 

安装磁盘扩展插件:

vagrant plugin install vagrant-disksize

 

在Vagrantfile中将内存由默认的2048改为8192,然后修改根盘的大小为80G。如下:

...
config.vm.box = "ol7-latest"
  config.disksize.size = "80GB"
  config.vm.box_url = "https://yum.oracle.com/boxes/oraclelinux/latest/ol7-latest.box"
  config.vm.define NAME
  
  config.vm.box_check_update = false
  
  # change memory size
  config.vm.provider "virtualbox" do |v|
    v.memory = 8192
    v.name = NAME
  end
...

然后创建虚机(Oracle Linux 7)。耗时7分42秒,我的环境一般在7分钟左右。

PS E:\DB\vagrant-boxes\OracleLinux\7> vagrant up

 

启动VM后,磁盘是64G,但根分区仍是32G:

$ df -h
Filesystem                   Size  Used Avail Use% Mounted on
devtmpfs                     3.8G     0  3.8G   0% /dev
tmpfs                        3.8G     0  3.8G   0% /dev/shm
tmpfs                        3.8G  8.5M  3.8G   1% /run
tmpfs                        3.8G     0  3.8G   0% /sys/fs/cgroup
/dev/mapper/vg_main-lv_root   32G  1.7G   31G   6% /
/dev/sda1                    497M  125M  373M  26% /boot
vagrant                      1.9T  1.1T  753G  60% /vagrant
tmpfs                        771M     0  771M   0% /run/user/1000

$ lsblk
NAME                MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sdb                   8:16   0 15.6G  0 disk
sda                   8:0    0   80G  0 disk
├─sda2                8:2    0   36G  0 part
│ ├─vg_main-lv_swap 252:1    0    4G  0 lvm  [SWAP]
│ └─vg_main-lv_root 252:0    0   32G  0 lvm  /
└─sda1                8:1    0  500M  0 part /boot

因此需要扩展分区,大致过程如下:

fdisk /dev/sda (n, p, <Enter>, <Enter>, w) -> 产生新分区/dev/sda3
partprobe
pvcreate /dev/sda
vgextend vg_main /dev/sda3
lvextend /dev/vg_main/lv_root /dev/sda3
xfs_growfs /

扩容后的空间:

# df -h
Filesystem                   Size  Used Avail Use% Mounted on
devtmpfs                     3.8G     0  3.8G   0% /dev
tmpfs                        3.8G     0  3.8G   0% /dev/shm
tmpfs                        3.8G  8.5M  3.8G   1% /run
tmpfs                        3.8G     0  3.8G   0% /sys/fs/cgroup
/dev/mapper/vg_main-lv_root   76G  1.7G   74G   3% /
/dev/sda1                    497M  125M  373M  26% /boot
vagrant                      1.9T  1.1T  753G  60% /vagrant
tmpfs                        771M     0  771M   0% /run/user/1000

以下操作均登入Linux中运行。

安装Docker

安装Docker,耗时0m49.161s:

sudo yum install -y yum-utils
sudo yum-config-manager --enable ol7_addons
sudo yum install -y docker-engine
sudo systemctl start docker
sudo systemctl enable docker
sudo usermod -aG docker vagrant

确认docker安装成功:

$ docker version
Client: Docker Engine - Community
 Version:           18.09.8-ol
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        76804b7
 Built:             Fri Sep 27 21:00:18 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.8-ol
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.8
  Git commit:       76804b7
  Built:            Fri Sep 27 20:54:00 2019
  OS/Arch:          linux/amd64
  Experimental:     false
  Default Registry: docker.io

克隆Github项目

耗时0m31.599s:

sudo yum install -y git
git clone https://github.com/oracle/docker-images.git

设置内核参数

docker会从Host OS继承参数,因此需在文件/etc/sysctl.conf中设置以下参数:

fs.file-max = 6815744
net.core.rmem_max = 4194304
net.core.rmem_default = 262144
net.core.wmem_max = 1048576
net.core.wmem_default = 262144
net.core.rmem_default = 262144

使其生效:

sudo sysctl -a
sudo sysctl -p

 

创建虚拟网络

docker network create --driver=bridge --subnet=172.16.1.0/24 rac_pub1_nw
docker network create --driver=bridge --subnet=192.168.17.0/24 rac_priv1_nw

 

查看状态:

$ docker network ls
NETWORK ID          NAME                DRIVER              SCOPE
aac5636fe8fc        bridge              bridge              local
051a1439f036        host                host                local
1a9007862a18        none                null                local
fe35e54e1aa0        rac_priv1_nw        bridge              local
0c6bdebeab78        rac_pub1_nw         bridge              local

配置实时模式

RAC的某些进程需要运行在实时模式,因此需要在文件/etc/sysconfig/docker中添加以下:

OPTIONS=‘--selinux-enabled --cpu-rt-runtime=950000‘

 

使其生效:

sudo systemctl daemon-reload
sudo systemctl stop docker
sudo systemctl start docker

 

SELINUX 配置为 permissive模式(/etc/selinux/config),过程略。
然后重启实例使得SELINUX生效。

此时的空间状态:

$ df -h
Filesystem                   Size  Used Avail Use% Mounted on
devtmpfs                     3.8G     0  3.8G   0% /dev
tmpfs                        3.8G     0  3.8G   0% /dev/shm
tmpfs                        3.8G  8.5M  3.8G   1% /run
tmpfs                        3.8G     0  3.8G   0% /sys/fs/cgroup
/dev/mapper/vg_main-lv_root   76G  2.1G   74G   3% /
/dev/sda1                    497M  125M  373M  26% /boot
vagrant                      1.9T  1.1T  753G  60% /vagrant
tmpfs                        771M     0  771M   0% /run/user/1000

将安装文件拷贝到目录

耗时真的看运气,有时7分钟,最近一次1分半:

cd docker-images/OracleDatabase/RAC/OracleRealApplicationClusters/dockerfiles/19.3.0
cp /vagrant/LINUX.X64_193000_db_home.zip .
cp /vagrant/LINUX.X64_193000_grid_home.zip .

 

此时的空间状态:

$ df -h
Filesystem                   Size  Used Avail Use% Mounted on
devtmpfs                     3.8G     0  3.8G   0% /dev
tmpfs                        3.8G     0  3.8G   0% /dev/shm
tmpfs                        3.8G  8.5M  3.8G   1% /run
tmpfs                        3.8G     0  3.8G   0% /sys/fs/cgroup
/dev/mapper/vg_main-lv_root   76G  7.6G   68G  11% /
/dev/sda1                    497M  125M  373M  26% /boot
vagrant                      1.9T  1.1T  745G  61% /vagrant
tmpfs                        771M     0  771M   0% /run/user/1000

构建Docker Install Image

这一步最重要的任务就是拷贝介质和配置脚本,还有从网络下载OS更新。然后安装GI和数据库。
执行以下命令开始构建:

$ cd docker-images/OracleDatabase/RAC/OracleRealApplicationClusters/dockerfiles
$ ls
12.2.0.1  18.3.0  19.3.0  buildDockerImage.sh
$ time ./buildDockerImage.sh -v 19.3.0

如果空间不够,会报错:

...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
checkSpace.sh: ERROR - There is not enough space available in the docker container.
checkSpace.sh: The container needs at least 35 GB , but only 14 available.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
...
There was an error building the image.

以下是成功时的完整日志,整个过程耗时58分钟:

$ time ./buildDockerImage.sh -v 19.3.0
Checking if required packages are present and valid...
LINUX.X64_193000_grid_home.zip: OK
LINUX.X64_193000_db_home.zip: OK
==========================
DOCKER info:
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
Server Version: 18.09.8-ol
Storage Driver: overlay2
 Backing Filesystem: xfs
 Supports d_type: true
 Native Overlay Diff: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: c4446665cb9c30056f4998ed953e6d4ff22c7c39
runc version: 4bb1fe4ace1a32d3676bb98f5d3b6a4e32bf6c58
init version: fec3683
Security Options:
 seccomp
  Profile: default
 selinux
Kernel Version: 4.14.35-1902.6.6.el7uek.x86_64
Operating System: Oracle Linux Server 7.7
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 7.528GiB
Name: ol7-vagrant-rac
ID: MS7Y:32TG:TGTF:C3QP:DR4Q:IDG4:RHHS:SQVW:5QWY:U45Z:ZCXK:BDCP
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine

Registries: docker.io (secure)
==========================
Building image ‘oracle/database-rac:19.3.0‘ ...
Sending build context to Docker daemon  5.949GB
Step 1/11 : FROM oraclelinux:7-slim
Trying to pull repository docker.io/library/oraclelinux ...
7-slim: Pulling from docker.io/library/oraclelinux
a316717fc6ee: Pull complete
Digest: sha256:c5f3baff726ffd97c7e9574e803ad0e8a1e5c7de236325eed9e87f853a746e90
Status: Downloaded newer image for oraclelinux:7-slim
 ---> 874477adb545
Step 2/11 : MAINTAINER Paramdeep Saini <paramdeep.saini@oracle.com>
 ---> Running in a1b3685f3111
Removing intermediate container a1b3685f3111
 ---> 8187c15c17ab
Step 3/11 : ENV SETUP_LINUX_FILE="setupLinuxEnv.sh"     INSTALL_DIR=/opt/scripts     GRID_BASE=/u01/app/grid     GRID_HOME=/u01/app/19.3.0/grid     INSTALL_FILE_1="LINUX.X64_193000_grid_home.zip"     GRID_INSTALL_RSP="gridsetup_19c.rsp"     GRID_SW_INSTALL_RSP="grid_sw_install_19c.rsp"     GRID_SETUP_FILE="setupGrid.sh"     FIXUP_PREQ_FILE="fixupPreq.sh"     INSTALL_GRID_BINARIES_FILE="installGridBinaries.sh"     INSTALL_GRID_PATCH="applyGridPatch.sh"     INVENTORY=/u01/app/oraInventory     CONFIGGRID="configGrid.sh"      ADDNODE="AddNode.sh"       DELNODE="DelNode.sh"     ADDNODE_RSP="grid_addnode.rsp"      SETUPSSH="setupSSH.expect"      DOCKERORACLEINIT="dockeroracleinit"     GRID_USER_HOME="/home/grid"     SETUPGRIDENV="setupGridEnv.sh"     ASM_DISCOVERY_DIR="/dev"     RESET_OS_PASSWORD="resetOSPassword.sh"     MULTI_NODE_INSTALL="MultiNodeInstall.py"     DB_BASE=/u01/app/oracle     DB_HOME=/u01/app/oracle/product/19.3.0/dbhome_1     INSTALL_FILE_2="LINUX.X64_193000_db_home.zip"     DB_INSTALL_RSP="db_sw_install_19c.rsp"     DBCA_RSP="dbca_19c.rsp"     DB_SETUP_FILE="setupDB.sh"     PWD_FILE="setPassword.sh"     RUN_FILE="runOracle.sh"     STOP_FILE="stopOracle.sh"     ENABLE_RAC_FILE="enableRAC.sh"     CHECK_DB_FILE="checkDBStatus.sh"     USER_SCRIPTS_FILE="runUserScripts.sh"     REMOTE_LISTENER_FILE="remoteListener.sh"     INSTALL_DB_BINARIES_FILE="installDBBinaries.sh"     GRID_HOME_CLEANUP="GridHomeCleanup.sh"     ORACLE_HOME_CLEANUP="OracleHomeCleanup.sh"     DB_USER="oracle"     GRID_USER="grid"    FUNCTIONS="functions.sh"    COMMON_SCRIPTS="/common_scripts"    CHECK_SPACE_FILE="checkSpace.sh"    RESET_FAILED_UNITS="resetFailedUnits.sh"    SET_CRONTAB="setCrontab.sh"    CRONTAB_ENTRY="crontabEntry"    EXPECT="/usr/bin/expect"    BIN="/usr/sbin"    container="true"
 ---> Running in 01dfaa3cc133
Removing intermediate container 01dfaa3cc133
 ---> be15b2094e53
Step 4/11 : ENV  INSTALL_SCRIPTS=$INSTALL_DIR/install      PATH=/bin:/usr/bin:/sbin:/usr/sbin:$PATH      SCRIPT_DIR=$INSTALL_DIR/startup      GRID_PATH=$GRID_HOME/bin:$GRID_HOME/OPatch/:/usr/sbin:$PATH       DB_PATH=$DB_HOME/bin:$DB_HOME/OPatch/:/usr/sbin:$PATH      GRID_LD_LIBRARY_PATH=$GRID_HOME/lib:/usr/lib:/lib      DB_LD_LIBRARY_PATH=$DB_HOME/lib:/usr/lib:/lib
 ---> Running in 7c6a76bc6baf
Removing intermediate container 7c6a76bc6baf
 ---> 1666646716e1
Step 5/11 : COPY $GRID_SW_INSTALL_RSP  $INSTALL_GRID_PATCH $SETUP_LINUX_FILE $GRID_SETUP_FILE $INSTALL_GRID_BINARIES_FILE $FIXUP_PREQ_FILE $DB_SETUP_FILE $CHECK_SPACE_FILE $DB_INSTALL_RSP $INSTALL_DB_BINARIES_FILE $ENABLE_RAC_FILE $GRID_HOME_CLEANUP $ORACLE_HOME_CLEANUP $INSTALL_FILE_1 $INSTALL_FILE_2 $INSTALL_SCRIPTS/
 ---> aeded06d0a00
Step 6/11 : COPY $RUN_FILE $ADDNODE $ADDNODE_RSP $SETUPSSH $FUNCTIONS $CONFIGGRID $GRID_INSTALL_RSP $DBCA_RSP $PWD_FILE $CHECK_DB_FILE $USER_SCRIPTS_FILE $STOP_FILE $CHECK_DB_FILE $REMOTE_LISTENER_FILE $SETUPGRIDENV $DELNODE $RESET_OS_PASSWORD $MULTI_NODE_INSTALL  $SCRIPT_DIR/
 ---> b9b139ebda70
Step 7/11 : RUN chmod 755 $INSTALL_SCRIPTS/*.sh  &&     sync &&     $INSTALL_DIR/install/$CHECK_SPACE_FILE &&     $INSTALL_DIR/install/$SETUP_LINUX_FILE &&     $INSTALL_DIR/install/$GRID_SETUP_FILE &&     $INSTALL_DIR/install/$DB_SETUP_FILE &&     sed -e ‘/hard *memlock/s/^/#/g‘ -i /etc/security/limits.d/oracle-database-preinstall-19c.conf &&     su  $GRID_USER -c "$INSTALL_DIR/install/$INSTALL_GRID_BINARIES_FILE EE $PATCH_NUMBER" &&     $INVENTORY/orainstRoot.sh &&     $GRID_HOME/root.sh &&     su  $DB_USER  -c  "$INSTALL_DIR/install/$INSTALL_DB_BINARIES_FILE EE" &&     su  $DB_USER  -c  "$INSTALL_DIR/install/$ENABLE_RAC_FILE" &&     $INVENTORY/orainstRoot.sh &&     $DB_HOME/root.sh &&     su  $GRID_USER -c "$INSTALL_SCRIPTS/$GRID_HOME_CLEANUP" &&     su  $DB_USER -c "$INSTALL_SCRIPTS/$ORACLE_HOME_CLEANUP" &&     $INSTALL_DIR/install/$FIXUP_PREQ_FILE &&     rm -rf $INSTALL_DIR/install &&     rm -rf $INSTALL_DIR/install &&     sync &&     chmod 755 $SCRIPT_DIR/*.sh &&     chmod 755 $SCRIPT_DIR/*.expect &&     chmod 666 $SCRIPT_DIR/*.rsp &&     echo "nohup $SCRIPT_DIR/runOracle.sh &" >> /etc/rc.local &&     rm -f /etc/rc.d/init.d/oracle-database-preinstall-19c-firstboot &&     mkdir -p $GRID_HOME/dockerinit &&     cp $GRID_HOME/bin/$DOCKERORACLEINIT $GRID_HOME/dockerinit/ &&     chown $GRID_USER:oinstall $GRID_HOME/dockerinit &&     chown root:oinstall $GRID_HOME/dockerinit/$DOCKERORACLEINIT &&     chmod 4755 $GRID_HOME/dockerinit/$DOCKERORACLEINIT &&     ln -s $GRID_HOME/dockerinit/$DOCKERORACLEINIT /usr/sbin/oracleinit &&     chmod +x /etc/rc.d/rc.local  &&     rm -f /etc/sysctl.d/99-oracle-database-preinstall-19c-sysctl.conf &&     rm -f /etc/sysctl.d/99-sysctl.conf &&     sync
 ---> Running in c40a0e8ea8ed
Loaded plugins: ovl
No package openssh-client available.
Resolving Dependencies
--> Running transaction check
---> Package e2fsprogs.x86_64 0:1.42.9-16.el7 will be installed
...
Transaction Summary
================================================================================
Install  14 Packages (+109 Dependent packages)
Upgrade              (   9 Dependent packages)

Total download size: 70 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
...
Complete!
Loaded plugins: ovl
Cleaning repos: ol7_UEKR5 ol7_developer_EPEL ol7_latest
...
/opt/scripts/install/installGridBinaries.sh: line 57:  : command not found
Launching Oracle Grid Infrastructure Setup Wizard...

[WARNING] [INS-13014] Target environment does not meet some optional requirements.
   CAUSE: Some of the optional prerequisites are not met. See logs for details. gridSetupActions2019-11-11_03-39-25AM.log
   ACTION: Identify the list of failed prerequisite checks from the log: gridSetupActions2019-11-11_03-39-25AM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.
The response file for this session can be found at:
 /u01/app/19.3.0/grid/install/response/grid_2019-11-11_03-39-25AM.rsp

You can find the log of this install session at:
 /tmp/GridSetupActions2019-11-11_03-39-25AM/gridSetupActions2019-11-11_03-39-25AM.log

As a root user, execute the following script(s):
        1. /u01/app/oraInventory/orainstRoot.sh
        2. /u01/app/19.3.0/grid/root.sh

Execute /u01/app/oraInventory/orainstRoot.sh on the following nodes:
[c40a0e8ea8ed]
Execute /u01/app/19.3.0/grid/root.sh on the following nodes:
[c40a0e8ea8ed]


Successfully Setup Software with warning(s).
Moved the install session logs to:
 /u01/app/oraInventory/logs/GridSetupActions2019-11-11_03-39-25AM
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
Check /u01/app/19.3.0/grid/install/root_c40a0e8ea8ed_2019-11-11_03-41-46-398462346.log for the output of root script


Launching Oracle Database Setup Wizard...

[WARNING] [INS-13014] Target environment does not meet some optional requirements.
   CAUSE: Some of the optional prerequisites are not met. See logs for details. /u01/app/oraInventory/logs/InstallActions2019-11-11_03-46-31AM/installActions2019-11-11_03-46-31AM.log
   ACTION: Identify the list of failed prerequisite checks from the log: /u01/app/oraInventory/logs/InstallActions2019-11-11_03-46-31AM/installActions2019-11-11_03-46-31AM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.
The response file for this session can be found at:
 /u01/app/oracle/product/19.3.0/dbhome_1/install/response/db_2019-11-11_03-46-31AM.rsp

You can find the log of this install session at:
 /u01/app/oraInventory/logs/InstallActions2019-11-11_03-46-31AM/installActions2019-11-11_03-46-31AM.log

As a root user, execute the following script(s):
        1. /u01/app/oracle/product/19.3.0/dbhome_1/root.sh

Execute /u01/app/oracle/product/19.3.0/dbhome_1/root.sh on the following nodes:
[c40a0e8ea8ed]


Successfully Setup Software with warning(s).
(if /u01/app/oracle/product/19.3.0/dbhome_1/bin/skgxpinfo | grep rds;then make -f  /u01/app/oracle/product/19.3.0/dbhome_1/rdbms/lib/ins_rdbms.mk ipc_rds; else make -f  /u01/app/oracle/product/19.3.0/dbhome_1/rdbms/lib/ins_rdbms.mk ipc_g; fi)
make[1]: Entering directory `/‘
rm -f /u01/app/oracle/product/19.3.0/dbhome_1/lib/libskgxp19.so
cp /u01/app/oracle/product/19.3.0/dbhome_1/lib//libskgxpg.so /u01/app/oracle/product/19.3.0/dbhome_1/lib/libskgxp19.so
make[1]: Leaving directory `/‘
 - Use stub SKGXN library
cp /u01/app/oracle/product/19.3.0/dbhome_1/lib/libskgxns.so /u01/app/oracle/product/19.3.0/dbhome_1/lib/libskgxn2.so
/usr/bin/ar d /u01/app/oracle/product/19.3.0/dbhome_1/rdbms/lib/libknlopt.a ksnkcs.o
/usr/bin/ar cr /u01/app/oracle/product/19.3.0/dbhome_1/rdbms/lib/libknlopt.a /u01/app/oracle/product/19.3.0/dbhome_1/rdbms/lib/kcsm.o
chmod 755 /u01/app/oracle/product/19.3.0/dbhome_1/bin

 - Linking Oracle
rm -f /u01/app/oracle/product/19.3.0/dbhome_1/rdbms/lib/oracle
/u01/app/oracle/product/19.3.0/dbhome_1/bin/orald  -o /u01/app/oracle/product/19.3.0/dbhome_1/rdbms/lib/oracle -m64 -z noexecstack -Wl,--disable-new-dtags -L/u01/app/oracle/product/19.3.0/dbhome_1/rdbms/lib/ -L/u01/app/oracle/product/19.3.0/dbhome_1/lib/ -L/u01/app/oracle/product/19.3.0/dbhome_1/lib/stubs/   -Wl,-E /u01/app/oracle/product/19.3.0/dbhome_1/rdbms/lib/opimai.o /u01/app/oracle/product/19.3.0/dbhome_1/rdbms/lib/ssoraed.o /u01/app/oracle/product/19.3.0/dbhome_1/rdbms/lib/ttcsoi.o -Wl,--whole-archive -lperfsrv19 -Wl,--no-whole-archive /u01/app/oracle/product/19.3.0/dbhome_1/lib/nautab.o /u01/app/oracle/product/19.3.0/dbhome_1/lib/naeet.o /u01/app/oracle/product/19.3.0/dbhome_1/lib/naect.o /u01/app/oracle/product/19.3.0/dbhome_1/lib/naedhs.o /u01/app/oracle/product/19.3.0/dbhome_1/rdbms/lib/config.o  -ldmext -lserver19 -lodm19 -lofs -lcell19 -lnnet19 -lskgxp19 -lsnls19 -lnls19  -lcore19 -lsnls19 -lnls19 -lcore19 -lsnls19 -lnls19 -lxml19 -lcore19 -lunls19 -lsnls19 -lnls19 -lcore19 -lnls19 -lclient19  -lvsnst19 -lcommon19 -lgeneric19 -lknlopt -loraolap19 -lskjcx19 -lslax19 -lpls19  -lrt -lplp19 -ldmext -lserver19 -lclient19  -lvsnst19 -lcommon19 -lgeneric19 `if [ -f /u01/app/oracle/product/19.3.0/dbhome_1/lib/libavserver19.a ] ; then echo "-lavserver19" ; else echo "-lavstub19"; fi` `if [ -f /u01/app/oracle/product/19.3.0/dbhome_1/lib/libavclient19.a ] ; then echo "-lavclient19" ; fi` -lknlopt -lslax19 -lpls19  -lrt -lplp19 -ljavavm19 -lserver19  -lwwg  `cat /u01/app/oracle/product/19.3.0/dbhome_1/lib/ldflags`    -lncrypt19 -lnsgr19 -lnzjs19 -ln19 -lnl19 -lngsmshd19 -lnro19 `cat /u01/app/oracle/product/19.3.0/dbhome_1/lib/ldflags`    -lncrypt19 -lnsgr19 -lnzjs19 -ln19 -lnl19 -lngsmshd19 -lnnzst19 -lzt19 -lztkg19 -lmm -lsnls19 -lnls19  -lcore19 -lsnls19 -lnls19 -lcore19 -lsnls19 -lnls19 -lxml19 -lcore19 -lunls19 -lsnls19 -lnls19 -lcore19 -lnls19 -lztkg19 `cat /u01/app/oracle/product/19.3.0/dbhome_1/lib/ldflags`    -lncrypt19 -lnsgr19 -lnzjs19 -ln19 -lnl19 -lngsmshd19 -lnro19 `cat /u01/app/oracle/product/19.3.0/dbhome_1/lib/ldflags`    -lncrypt19 -lnsgr19 -lnzjs19 -ln19 -lnl19 -lngsmshd19 -lnnzst19 -lzt19 -lztkg19   -lsnls19 -lnls19  -lcore19 -lsnls19 -lnls19 -lcore19 -lsnls19 -lnls19 -lxml19 -lcore19 -lunls19 -lsnls19 -lnls19 -lcore19 -lnls19 `if /usr/bin/ar tv /u01/app/oracle/product/19.3.0/dbhome_1/rdbms/lib/libknlopt.a | grep "kxmnsd.o" > /dev/null 2>&1 ; then echo " " ; else echo "-lordsdo19 -lserver19"; fi` -L/u01/app/oracle/product/19.3.0/dbhome_1/ctx/lib/ -lctxc19 -lctx19 -lzx19 -lgx19 -lctx19 -lzx19 -lgx19 -lclscest19 -loevm -lclsra19 -ldbcfg19 -lhasgen19 -lskgxn2 -lnnzst19 -lzt19 -lxml19 -lgeneric19 -locr19 -locrb19 -locrutl19 -lhasgen19 -lskgxn2 -lnnzst19 -lzt19 -lxml19 -lgeneric19  -lgeneric19 -lorazip -loraz -llzopro5 -lorabz2 -lorazstd -loralz4 -lipp_z -lipp_bz2 -lippdc -lipps -lippcore  -lippcp -lsnls19 -lnls19  -lcore19 -lsnls19 -lnls19 -lcore19 -lsnls19 -lnls19 -lxml19 -lcore19 -lunls19 -lsnls19 -lnls19 -lcore19 -lnls19 -lsnls19 -lunls19  -lsnls19 -lnls19  -lcore19 -lsnls19 -lnls19 -lcore19 -lsnls19 -lnls19 -lxml19 -lcore19 -lunls19 -lsnls19 -lnls19 -lcore19 -lnls19 -lasmclnt19 -lcommon19 -lcore19  -ledtn19 -laio -lons  -lmql1 -lipc1 -lfthread19    `cat /u01/app/oracle/product/19.3.0/dbhome_1/lib/sysliblist` -Wl,-rpath,/u01/app/oracle/product/19.3.0/dbhome_1/lib -lm    `cat /u01/app/oracle/product/19.3.0/dbhome_1/lib/sysliblist` -ldl -lm   -L/u01/app/oracle/product/19.3.0/dbhome_1/lib `test -x /usr/bin/hugeedit -a -r /usr/lib64/libhugetlbfs.so && test -r /u01/app/oracle/product/19.3.0/dbhome_1/rdbms/lib/shugetlbfs.o && echo -Wl,-zcommon-page-size=2097152 -Wl,-zmax-page-size=2097152 -lhugetlbfs`
rm -f /u01/app/oracle/product/19.3.0/dbhome_1/bin/oracle
mv /u01/app/oracle/product/19.3.0/dbhome_1/rdbms/lib/oracle /u01/app/oracle/product/19.3.0/dbhome_1/bin/oracle
chmod 6751 /u01/app/oracle/product/19.3.0/dbhome_1/bin/oracle
(if [ ! -f /u01/app/oracle/product/19.3.0/dbhome_1/bin/crsd.bin ]; then     getcrshome="/u01/app/oracle/product/19.3.0/dbhome_1/srvm/admin/getcrshome" ;     if [ -f "$getcrshome" ]; then         crshome="`$getcrshome`";         if [ -n "$crshome" ]; then             if [ $crshome != /u01/app/oracle/product/19.3.0/dbhome_1 ]; then                 oracle="/u01/app/oracle/product/19.3.0/dbhome_1/bin/oracle";                 $crshome/bin/setasmgidwrap oracle_binary_path=$oracle;             fi         fi     fi fi);
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
Check /u01/app/oracle/product/19.3.0/dbhome_1/install/root_c40a0e8ea8ed_2019-11-11_03-51-20-097025139.log for the output of root script
Preparing...                          ########################################
Updating / installing...
cvuqdisk-1.0.10-1                     ########################################
Removing intermediate container c40a0e8ea8ed
 ---> 947c42f51105
Step 8/11 : USER grid
 ---> Running in f12659d9d383
Removing intermediate container f12659d9d383
 ---> 06b8b4dcd15e
Step 9/11 : WORKDIR /home/grid
 ---> Running in 0106cd633ef9
Removing intermediate container 0106cd633ef9
 ---> c2ad15635695
Step 10/11 : VOLUME ["/common_scripts"]
 ---> Running in d817b9de8b29
Removing intermediate container d817b9de8b29
 ---> c0465d5925d5
Step 11/11 : CMD ["/usr/sbin/oracleinit"]
 ---> Running in 499d3e1cf5d9
Removing intermediate container 499d3e1cf5d9
 ---> 049f87053beb
Successfully built 049f87053beb
Successfully tagged oracle/database-rac:19.3.0

  Oracle Database Docker Image for Real Application Clusters (RAC) version 19.3.0 is ready to be extended:

    --> oracle/database-rac:19.3.0

  Build completed in 3463 seconds.


real    57m55.524s
user    0m16.831s
sys     0m20.288s

至此,数据库的RAC docker image就绪。linux image使用的瘦身版。

$ docker images
REPOSITORY            TAG                 IMAGE ID            CREATED             SIZE
oracle/database-rac   19.3.0              049f87053beb        About an hour ago   20.6GB
oraclelinux           7-slim              874477adb545        3 months ago        118MB

 

此时的空间状态:

$ df -h
Filesystem                   Size  Used Avail Use% Mounted on
devtmpfs                     3.8G     0  3.8G   0% /dev
tmpfs                        3.8G     0  3.8G   0% /dev/shm
tmpfs                        3.8G  8.5M  3.8G   1% /run
tmpfs                        3.8G     0  3.8G   0% /sys/fs/cgroup
/dev/mapper/vg_main-lv_root   76G   27G   49G  36% /
/dev/sda1                    497M  125M  373M  26% /boot
vagrant                      1.9T  1.2T  698G  63% /vagrant
tmpfs                        771M     0  771M   0% /run/user/1000

实际上,此时可以删除数据库和GI的安装介质了。

创建共享主机解析文件

sudo mkdir /opt/containers
sudo touch /opt/containers/rac_host_file

准备共享磁盘(块设备)

停止虚机。vagrant halt
挂接50G磁盘。VBoxManage createmedium diskVBoxManage storageattach
启动虚机。vagrant up
确认可看到新盘,本例为sdc:

$ lsblk
NAME                MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sdb                   8:16   0 15.6G  0 disk
sdc                   8:32   0   50G  0 disk
sda                   8:0    0   80G  0 disk
├─sda2                8:2    0   36G  0 part
│ ├─vg_main-lv_swap 252:1    0    4G  0 lvm  [SWAP]
│ └─vg_main-lv_root 252:0    0 75.5G  0 lvm  /
├─sda3                8:3    0 43.5G  0 part
│ └─vg_main-lv_root 252:0    0 75.5G  0 lvm  /
└─sda1                8:1    0  500M  0 part /boot

初始化磁盘以确保其上无文件系统:

$ sudo dd if=/dev/zero of=/dev/sdc  bs=8k count=10000

口令管理

以下设置的口令为oracle和grid操作系统用户以及数据库共同使用。

mkdir /opt/.secrets/
openssl rand -hex 64 -out /opt/.secrets/pwd.key
-- 将口令明码写入临时文件
echo Oracle.123# >/opt/.secrets/common_os_pwdfile
-- 加密后存储
openssl enc -aes-256-cbc -salt -in /opt/.secrets/common_os_pwdfile -out /opt/.secrets/common_os_pwdfile.enc -pass file:/opt/.secrets/pwd.key
-- 删除临时文件
rm -f /opt/.secrets/common_os_pwdfile

创建第一个RAC节点:racnode1容器

先创建容器:

docker create -t -i   --hostname racnode1   --volume /boot:/boot:ro   --volume /dev/shm   --tmpfs /dev/shm:rw,exec,size=4G   --volume /opt/containers/rac_host_file:/etc/hosts    --volume /opt/.secrets:/run/secrets   --dns-search=example.com   --device=/dev/sdc:/dev/asm_disk1    --privileged=false    --cap-add=SYS_NICE   --cap-add=SYS_RESOURCE   --cap-add=NET_ADMIN   -e NODE_VIP=172.16.1.160   -e VIP_HOSTNAME=racnode1-vip    -e PRIV_IP=192.168.17.150   -e PRIV_HOSTNAME=racnode1-priv   -e PUBLIC_IP=172.16.1.150   -e PUBLIC_HOSTNAME=racnode1    -e SCAN_NAME=racnode-scan   -e SCAN_IP=172.16.1.70    -e OP_TYPE=INSTALL   -e DOMAIN=example.com   -e ASM_DEVICE_LIST=/dev/asm_disk1   -e ASM_DISCOVERY_DIR=/dev   -e COMMON_OS_PWD_FILE=common_os_pwdfile.enc   -e PWD_KEY=pwd.key   --restart=always --tmpfs=/run -v /sys/fs/cgroup:/sys/fs/cgroup:ro   --cpu-rt-runtime=95000 --ulimit rtprio=99    --name racnode1   oracle/database-rac:19.3.0

查看状态:

$ docker ps -a
CONTAINER ID        IMAGE                        COMMAND                  CREATED             STATUS              PORTS               NAMES
aa88f55d68cd        oracle/database-rac:19.3.0   "/usr/sbin/oracleinit"   5 seconds ago       Created                                 racnode1

配置racnode1的网络:

docker network disconnect bridge racnode1
docker network connect rac_pub1_nw --ip 172.16.1.150 racnode1
docker network connect rac_priv1_nw --ip 192.168.17.150  racnode1

启动第一个容器:

docker start racnode1

查看日志:

docker logs -f racnode1

在容器内部或在宿主机都可以查看到dbca 进程,这个比较神奇。
以下命令可登录到容器内部:

docker exec -it racnode1 bash

/u01/app/oracle/cfgtoollogs/dbca/ORCLCDB中可以查看到dbca的日志。

以下为成功执行时的完整日志,可知首先内存还是

人气教程排行