本文的内容来自于oracle官方在github提供的基于docker安装oracle的指导文档,记录我在该文档的指导下安装过程。官方指导文档可以查看后面的参考资料。
下载oracle
下面提供两个版本的oracle的下载链接,我用的是12.1.0.2版本。
12.2.0.1
image.png12.1.0.2
image.png构建oracle镜像
git clone git@github.com:oracle/docker-images.git
cd docker-images/OracleDatabase/SingleInstance/
把下载的二级制文件放到如下目录下:
docker-images/OracleDatabase/SingleInstance/dockerfiles/12.1.0.2/linuxamd64_12102_database_1of2.zip
docker-images/OracleDatabase/SingleInstance/dockerfiles/12.1.0.2/linuxamd64_12102_database_2of2.zip
执行如下命令开始构建docker镜像:
./buildDockerImage.sh -v 12.1.0.2 -e
执行完后,oracle基本安装完成。
……
creating: database/stage/Components/oracle.javavm.containers/
creating: database/stage/Components/oracle.javavm.containers/12.1.0.2.0/
creating: database/stage/Components/oracle.javavm.containers/12.1.0.2.0/1/
creating: database/stage/Components/oracle.javavm.containers/12.1.0.2.0/1/DataFiles/
inflating: database/stage/Components/oracle.javavm.containers/12.1.0.2.0/1/DataFiles/filegroup2.jar
inflating: database/stage/Components/oracle.javavm.containers/12.1.0.2.0/1/DataFiles/filegroup1.jar
inflating: database/install/.oui
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 500 MB. Actual 37924 MB Passed
Checking swap space: must be greater than 150 MB. Actual 965 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2019-02-14_06-12-58AM. Please wait ...[WARNING] [INS-32055] The Central Inventory is located in the Oracle base.
ACTION: Oracle recommends placing this Central Inventory in a location outside the Oracle base directory.
You can find the log of this install session at:
/opt/oracle/oraInventory/logs/installActions2019-02-14_06-12-58AM.log
The installation of Oracle Database 12c was successful.
Please check '/opt/oracle/oraInventory/logs/silentInstall2019-02-14_06-12-58AM.log' for more details.
As a root user, execute the following script(s):
1. /opt/oracle/oraInventory/orainstRoot.sh
2. /opt/oracle/product/12.1.0.2/dbhome_1/root.sh
Successfully Setup Software.
This is perl 5, version 14, subversion 1 (v5.14.1) built for x86_64-linux-thread-multi
Copyright 1987-2011, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
Removing intermediate container 3efef0c78489
---> 4d98ac13db8d
Step 14/24 : FROM base
---> cdd70dd65090
Step 15/24 : USER oracle
---> Running in 3ce0ade41c74
Removing intermediate container 3ce0ade41c74
---> b8c770b07cd1
Step 16/24 : COPY --chown=oracle:dba --from=builder $ORACLE_BASE $ORACLE_BASE
---> cc1d8e8ca6d9
Step 17/24 : USER root
---> Running in b6235b46bcef
Removing intermediate container b6235b46bcef
---> 0870393eddb6
Step 18/24 : RUN $ORACLE_BASE/oraInventory/orainstRoot.sh && $ORACLE_HOME/root.sh
---> Running in fdd6f3ad07a6
Changing permissions of /opt/oracle/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /opt/oracle/oraInventory to dba.
The execution of the script is complete.
Check /opt/oracle/product/12.1.0.2/dbhome_1/install/root_fdd6f3ad07a6_2019-02-14_06-17-37.log for the output of root script
Removing intermediate container fdd6f3ad07a6
---> eff869c79c0d
Step 19/24 : USER oracle
---> Running in 62c2918ca056
Removing intermediate container 62c2918ca056
---> a5f580477b9b
Step 20/24 : WORKDIR /home/oracle
---> Running in cfd6dab67452
Removing intermediate container cfd6dab67452
---> a06b3079c6f5
Step 21/24 : VOLUME ["$ORACLE_BASE/oradata"]
---> Running in ba7ad4000307
Removing intermediate container ba7ad4000307
---> f26a71fbe835
Step 22/24 : EXPOSE 1521 5500
---> Running in 46a0979915a8
Removing intermediate container 46a0979915a8
---> 3c5d8a869cc4
Step 23/24 : HEALTHCHECK --interval=1m --start-period=5m CMD "$ORACLE_BASE/$CHECK_DB_FILE" >/dev/null || exit 1
---> Running in 12f4b428924c
Removing intermediate container 12f4b428924c
---> afc296e6312e
Step 24/24 : CMD exec $ORACLE_BASE/$RUN_FILE
---> Running in 7ff4f7a069ac
Removing intermediate container 7ff4f7a069ac
---> de6253073cde
Successfully built de6253073cde
Successfully tagged oracle/database:12.1.0.2-ee
Oracle Database Docker Image for 'ee' version 12.1.0.2 is ready to be extended:
--> oracle/database:12.1.0.2-ee
Build completed in 873 seconds.
查看构建的镜像:
$docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
oracle/database 12.1.0.2-ee de6253073cde About an hour ago 5.13GB
运行oracle镜像
docker run --name oracle_12.1.0.2-ee \
-p 1521:1521 -p 5500:5500 \
-e ORACLE_SID=ORCLCDB \
-e ORACLE_PDB=ORCLPDB1 \
-e ORACLE_PWD=<your database passwords> \
-e ORACLE_CHARACTERSET=AL32UTF8 \
-v /data/oracle_in_docker_12.1.0.2_ee/oracle/oradata:/opt/oracle/oradata \
oracle/database:12.1.0.2-ee
安装过程如下:
ORACLE PASSWORD FOR SYS, SYSTEM AND PDBADMIN: gB+UZlv4WqU=1
LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 14-FEB-2019 08:48:45
Copyright (c) 1991, 2014, Oracle. All rights reserved.
Starting /opt/oracle/product/12.1.0.2/dbhome_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 12.1.0.2.0 - Production
System parameter file is /opt/oracle/product/12.1.0.2/dbhome_1/network/admin/listener.ora
Log messages written to /opt/oracle/diag/tnslsnr/db094fd2a48b/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 14-FEB-2019 08:48:46
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/product/12.1.0.2/dbhome_1/network/admin/listener.ora
Listener Log File /opt/oracle/diag/tnslsnr/db094fd2a48b/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
The listener supports no services
The command completed successfully
Copying database files
1% complete
2% complete
27% complete
Creating and starting Oracle instance
29% complete
32% complete
33% complete
34% complete
38% complete
42% complete
43% complete
45% complete
Completing Database Creation
48% complete
51% complete
53% complete
62% complete
64% complete
72% complete
Creating Pluggable Databases
78% complete
100% complete
Look at the log file "/opt/oracle/cfgtoollogs/dbca/ORCLCDB/ORCLCDB.log" for further details.
SQL*Plus: Release 12.1.0.2.0 Production on Thu Feb 14 08:56:50 2019
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL>
System altered.
SQL>
Pluggable database altered.
SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
The Oracle base remains unchanged with value /opt/oracle
#########################
DATABASE IS READY TO USE!
#########################
The following output is now a tail of the alert.log:
Completed: alter pluggable database ORCLPDB1 open
Thu Feb 14 08:56:49 2019
CREATE SMALLFILE TABLESPACE "USERS" LOGGING DATAFILE '/opt/oracle/oradata/ORCLCDB/ORCLPDB1/ORCLPDB1_users01.dbf' SIZE 5M REUSE AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO
Completed: CREATE SMALLFILE TABLESPACE "USERS" LOGGING DATAFILE '/opt/oracle/oradata/ORCLCDB/ORCLPDB1/ORCLPDB1_users01.dbf' SIZE 5M REUSE AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO
ALTER DATABASE DEFAULT TABLESPACE "USERS"
Completed: ALTER DATABASE DEFAULT TABLESPACE "USERS"
Thu Feb 14 08:56:50 2019
ALTER SYSTEM SET control_files='/opt/oracle/oradata/ORCLCDB/control01.ctl' SCOPE=SPFILE;
ALTER PLUGGABLE DATABASE ORCLPDB1 SAVE STATE
Completed: ALTER PLUGGABLE DATABASE ORCLPDB1 SAVE STATE
Thu Feb 14 08:57:27 2019
TABLE SYS.WRP$_REPORTS: ADDED INTERVAL PARTITION SYS_P206 (3332) VALUES LESS THAN (TO_DATE(' 2019-02-15 01:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
TABLE SYS.WRP$_REPORTS_DETAILS: ADDED INTERVAL PARTITION SYS_P207 (3332) VALUES LESS THAN (TO_DATE(' 2019-02-15 01:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
TABLE SYS.WRP$_REPORTS_TIME_BANDS: ADDED INTERVAL PARTITION SYS_P210 (3331) VALUES LESS THAN (TO_DATE(' 2019-02-14 01:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
Thu Feb 14 09:11:28 2019
Default pga_aggregate_limit value is too high for the
amount of physical memory in the system
pga_aggregate_limit is 2048 MB
limit based on physical memory and SGA usage is 1198 MB
LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 14-FEB-2019 09:52:02
Copyright (c) 1991, 2014, Oracle. All rights reserved.
Starting /opt/oracle/product/12.1.0.2/dbhome_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 12.1.0.2.0 - Production
System parameter file is /opt/oracle/product/12.1.0.2/dbhome_1/network/admin/listener.ora
Log messages written to /opt/oracle/diag/tnslsnr/6cfb36cf79ef/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 14-FEB-2019 09:52:02
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/product/12.1.0.2/dbhome_1/network/admin/listener.ora
Listener Log File /opt/oracle/diag/tnslsnr/6cfb36cf79ef/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
The listener supports no services
The command completed successfully
参考资料
https://github.com/oracle/docker-images/tree/master/OracleDatabase/SingleInstance/
网友评论