如何获得一个单实例Oracle数据库(从Oracle Container Reg

环境
一台笔记本电脑,操作系统,安装了,。一个账号 。
目标
操作系统 Linux 7,运行容器数据库,数据库为单实例,版本12.2.0.1(也可以12.1.0.2),实例名为,带一个可插拔数据库 。
从可以得到比 Hub更多的image,包括单实例,RAC,包括企业版,标准版和。
创建Linux操作系统
在中将内存改为4096,然后创建虚机( Linux 7) 。耗时6分59秒 。
【如何获得一个单实例Oracle数据库(从Oracle Container Reg】PS E:\DB\vagrant-boxes\OracleLinux\7> Measure-Command { vagrant up | Out-Default}
安装
安装,耗时1m9.076s:
sudo yum install -y yum-utilssudo yum-config-manager --enable ol7_addonssudo yum install -y docker-enginesudo systemctl start dockersudo systemctl enable dockersudo usermod -aG docker vagrant
$ sudo docker versionClient: Docker Engine - CommunityVersion:18.09.8-olAPI version:1.39Go version:go1.10.8Git commit:76804b7Built:Fri Sep 27 21:00:18 2019OS/Arch:linux/amd64Experimental:falseServer: Docker Engine - CommunityEngine:Version:18.09.8-olAPI version:1.39 (minimum version 1.12)Go version:go1.10.8Git commit:76804b7Built:Fri Sep 27 20:54:00 2019OS/Arch:linux/amd64Experimental:falseDefault Registry: docker.io
用户自动加入到组:
$ id vagrantuid=1000(vagrant) gid=1000(vagrant) groups=1000(vagrant),10(wheel),993(docker)

如何获得一个单实例Oracle数据库(从Oracle Container Reg

文章插图
PullImage
访问网页,进入 目录:
对于企业版,有3个image 。分别为12.2.0.1(3 GB),12.2.0.1-slim(2 GB),12.1.0.2( 5 GB) 。
slim版没有以下功能:
,R,Label ,Text,and
$ docker login container-registry.oracle.com$ docker pull container-registry.oracle.com/database/enterprise:12.2.0.1
感觉网速有点慢,此步骤耗时45m26.719s 。
实际上,这样的场景还是建议在云环境中进行,利用免费账号做一台主机就好 。
在OCI云环境中,区域耗时3m21.626s 。
查看image:
$ docker imagesREPOSITORYTAGIMAGE IDCREATEDSIZEcontainer-registry.oracle.com/database/enterprise12.2.0.112a359cd05282 years ago3.44GB
创建容器数据库
docker run -d -it --name odbee12201 container-registry.oracle.com/database/enterprise:12.2.0.1
容器很快就启动了,但实际上需要做一些配置工作后才可使用,这些配置工作包括参数设置,创建PDB登 。但数据库实例是已经包含在 image里了的 。这些配置脚本位于容器中的~/setup目录 。
查看状态,等待其从(: )变为(:), 数据库就可以使用了 。
$ docker psCONTAINER IDIMAGECOMMANDCREATEDSTATUSPORTSNAMES00f72df39972container-registry.oracle.com/database/enterprise:12.2.0.1"/bin/sh -c '/bin/ba…"5 seconds agoUp 4 seconds (health: starting)1521/tcp, 5500/tcpodbee12201
也可以监控的运行日志:
$ docker logs -f 00f72df39972Setup Oracle DatabaseOracle Database 12.2.0.1 SetupSun Nov 10 00:02:06 UTC 2019Check parameters ......log file is : /home/oracle/setup/log/paramChk.logparamChk.sh is done at 0 secuntar DB bits ......log file is : /home/oracle/setup/log/untarDB.loguntarDB.sh is done at 114 secconfig DB ......log file is : /home/oracle/setup/log/configDB.logSun Nov 10 00:04:00 UTC 2019Start Docker DB configurationCall configDBora.sh to configure databaseSun Nov 10 00:04:01 UTC 2019Configure DB as oracle userSetup Database directories ...SQL*Plus: Release 12.2.0.1.0 Production on Sun Nov 10 00:04:01 2019Copyright (c) 1982, 2016, Oracle.All rights reserved.Connected to an idle instance.SQL>File created.SQL> ORACLE instance started.Total System Global Area 1342177280 bytesFixed Size8792536 bytesVariable Size352323112 bytesDatabase Buffers973078528 bytesRedo Buffers7983104 bytesDatabase mounted.Database opened.SQL>Database altered.SQL>NAMETYPEVALUE------------------------------------ ----------- ------------------------------spfilestring/u01/app/oracle/product/12.2.0/dbhome_1/dbs/spfileORCLCDB.oraSQL>NAMETYPEVALUE------------------------------------ ----------- ------------------------------encrypt_new_tablespacesstringCLOUD_ONLYSQL>User altered.SQL>User altered.SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Productionupdate passwordEnter password for SYS:create pdb : ORCLPDB1SQL*Plus: Release 12.2.0.1.0 Production on Sun Nov 10 00:04:55 2019Copyright (c) 1982, 2016, Oracle.All rights reserved.Connected to:Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit ProductionSQL>2345Pluggable database created.SQL>Pluggable database altered.SQL>Pluggable database altered.SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit ProductionReset Database parametersSQL*Plus: Release 12.2.0.1.0 Production on Sun Nov 10 00:05:44 2019Copyright (c) 1982, 2016, Oracle.All rights reserved.Connected to:Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit ProductionSQL>System altered.SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit ProductionLSNRCTL for Linux: Version 12.2.0.1.0 - Production on 10-NOV-2019 00:05:44Copyright (c) 1991, 2016, Oracle.All rights reserved.Starting /u01/app/oracle/product/12.2.0/dbhome_1/bin/tnslsnr: please wait...TNSLSNR for Linux: Version 12.2.0.1.0 - ProductionSystem parameter file is /u01/app/oracle/product/12.2.0/dbhome_1/admin/ORCLCDB/listener.oraLog messages written to /u01/app/oracle/diag/tnslsnr/00f72df39972/listener/alert/log.xmlListening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=0.0.0.0)(PORT=1521)))STATUS of the LISTENER------------------------AliasLISTENERVersionTNSLSNR for Linux: Version 12.2.0.1.0 - ProductionStart Date10-NOV-2019 00:05:45Uptime0 days 0 hr. 0 min. 0 secTrace LeveloffSecurityON: Local OS AuthenticationSNMPOFFListener Parameter File/u01/app/oracle/product/12.2.0/dbhome_1/admin/ORCLCDB/listener.oraListener Log File/u01/app/oracle/diag/tnslsnr/00f72df39972/listener/alert/log.xmlListening Endpoints Summary...(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))The listener supports no servicesThe command completed successfullyDONE!Remove password infoDocker DB configuration is complete !configDB.sh is done at 219 secDone ! The database is ready for use .