docker安装oracle数据库

方法一:

直接下载镜像,并启动容器。

oracle官方镜像:Oracle Container Registry

点击Database

点击enterprise,右侧需要登录oracle账号,并且接受协议。

先登录镜像仓库:

docker login --username=yourname container-registry.oracle.com

然后下载镜像:

docker pull container-registry.oracle.com/database/enterprise:19.3.0.0

启动容器:

docker run -d --name oracle container-registry.oracle.com/database/enterprise:19.3.0.0

# 查看日志
docker logs -f oracle

不过很遗憾,使用官网镜像,oracle容器启动失败。因此换了一个镜像。

# 下载镜像
docker pull registry.cn-hangzhou.aliyuncs.com/zhuyijun/oracle:19c

# 创建文件
mkdir -p /home/data/oracle/oradata

# 授权,不授权会导致后面安装失败
chmod 777 /home/data/oracle/oradata

# 启动容器
docker run -d \
-p 1521:1521 -p 5500:5500 \
-e ORACLE_SID=ORCLCDB \
-e ORACLE_PDB=ORCLPDB \
-e ORACLE_PWD=123456 \
-e ORACLE_EDITION=standard \
-e ORACLE_CHARACTERSET=AL32UTF8 \
-v /home/data/oracle/oradata:/opt/oracle/oradata \
--name oracle \
registry.cn-hangzhou.aliyuncs.com/zhuyijun/oracle:19c

完整的启动日志如下:

[root@iZbp10e871q3t6iguc8b5eZ ~]# docker logs -f oracle
Relinking oracle binary for edition: standard
make -f /opt/oracle/product/19c/dbhome_1/rdbms/lib/ins_rdbms.mk edition_standard ioracle
Deploying Oracle Database Standard Edition
mv -f /opt/oracle/product/19c/dbhome_1/lib/libedtn19.a /opt/oracle/product/19c/dbhome_1/lib/libedtn19_backup.a
cp /opt/oracle/product/19c/dbhome_1/lib/libedtn19_std.a /opt/oracle/product/19c/dbhome_1/lib/libedtn19.a
chmod 755 /opt/oracle/product/19c/dbhome_1/bin

 - Linking Oracle
rm -f /opt/oracle/product/19c/dbhome_1/rdbms/lib/oracle
/opt/oracle/product/19c/dbhome_1/bin/orald  -o /opt/oracle/product/19c/dbhome_1/rdbms/lib/oracle -m64 -z noexecstack -Wl,--disable-new-dtags -L/opt/oracle/product/19c/dbhome_1/rdbms/lib/ -L/opt/oracle/product/19c/dbhome_1/lib/ -L/opt/oracle/product/19c/dbhome_1/lib/stubs/   -Wl,-E /opt/oracle/product/19c/dbhome_1/rdbms/lib/opimai.o /opt/oracle/product/19c/dbhome_1/rdbms/lib/ssoraed.o /opt/oracle/product/19c/dbhome_1/rdbms/lib/ttcsoi.o -Wl,--whole-archive -lperfsrv19 -Wl,--no-whole-archive /opt/oracle/product/19c/dbhome_1/lib/nautab.o /opt/oracle/product/19c/dbhome_1/lib/naeet.o /opt/oracle/product/19c/dbhome_1/lib/naect.o /opt/oracle/product/19c/dbhome_1/lib/naedhs.o /opt/oracle/product/19c/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 /opt/oracle/product/19c/dbhome_1/lib/libavserver19.a ] ; then echo "-lavserver19" ; else echo "-lavstub19"; fi` `if [ -f /opt/oracle/product/19c/dbhome_1/lib/libavclient19.a ] ; then echo "-lavclient19" ; fi` -lknlopt -lslax19 -lpls19  -lrt -lplp19 -ljavavm19 -lserver19  -lwwg  `cat /opt/oracle/product/19c/dbhome_1/lib/ldflags`    -lncrypt19 -lnsgr19 -lnzjs19 -ln19 -lnl19 -lngsmshd19 -lnro19 `cat /opt/oracle/product/19c/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 /opt/oracle/product/19c/dbhome_1/lib/ldflags`    -lncrypt19 -lnsgr19 -lnzjs19 -ln19 -lnl19 -lngsmshd19 -lnro19 `cat /opt/oracle/product/19c/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 /opt/oracle/product/19c/dbhome_1/rdbms/lib/libknlopt.a | grep "kxmnsd.o" > /dev/null 2>&1 ; then echo " " ; else echo "-lordsdo19 -lserver19"; fi` -L/opt/oracle/product/19c/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 /opt/oracle/product/19c/dbhome_1/lib/sysliblist` -Wl,-rpath,/opt/oracle/product/19c/dbhome_1/lib -lm    `cat /opt/oracle/product/19c/dbhome_1/lib/sysliblist` -ldl -lm   -L/opt/oracle/product/19c/dbhome_1/lib `test -x /usr/bin/hugeedit -a -r /usr/lib64/libhugetlbfs.so && test -r /opt/oracle/product/19c/dbhome_1/rdbms/lib/shugetlbfs.o && echo -Wl,-zcommon-page-size=2097152 -Wl,-zmax-page-size=2097152 -lhugetlbfs`
rm -f /opt/oracle/product/19c/dbhome_1/bin/oracle
mv /opt/oracle/product/19c/dbhome_1/rdbms/lib/oracle /opt/oracle/product/19c/dbhome_1/bin/oracle
chmod 6751 /opt/oracle/product/19c/dbhome_1/bin/oracle
(if [ ! -f /opt/oracle/product/19c/dbhome_1/bin/crsd.bin ]; then \
    getcrshome="/opt/oracle/product/19c/dbhome_1/srvm/admin/getcrshome" ; \
    if [ -f "$getcrshome" ]; then \
        crshome="`$getcrshome`"; \
        if [ -n "$crshome" ]; then \
            if [ $crshome != /opt/oracle/product/19c/dbhome_1 ]; then \
                oracle="/opt/oracle/product/19c/dbhome_1/bin/oracle"; \
                $crshome/bin/setasmgidwrap oracle_binary_path=$oracle; \
            fi \
        fi \
    fi \
fi\
);
ORACLE EDITION: STANDARD
ORACLE PASSWORD FOR SYS, SYSTEM AND PDBADMIN: 123456

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 17-AUG-2024 07:24:31

Copyright (c) 1991, 2019, Oracle.  All rights reserved.

Starting /opt/oracle/product/19c/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 19.0.0.0.0 - Production
System parameter file is /opt/oracle/product/19c/dbhome_1/network/admin/listener.ora
Log messages written to /opt/oracle/diag/tnslsnr/2a98d967d8a2/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 19.0.0.0.0 - Production
Start Date                17-AUG-2024 07:24:31
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/19c/dbhome_1/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/2a98d967d8a2/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
[WARNING] [DBT-06208] The 'SYS' password entered does not conform to the Oracle recommended standards.
   CAUSE:
a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].
b.The password entered is a keyword that Oracle does not recommend to be used as password
   ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
[WARNING] [DBT-06208] The 'SYSTEM' password entered does not conform to the Oracle recommended standards.
   CAUSE:
a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].
b.The password entered is a keyword that Oracle does not recommend to be used as password
   ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
[WARNING] [DBT-06208] The 'PDBADMIN' password entered does not conform to the Oracle recommended standards.
   CAUSE:
a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].
b.The password entered is a keyword that Oracle does not recommend to be used as password
   ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
Prepare for db operation
8% complete
Copying database files
31% complete
Creating and starting Oracle instance
32% complete
36% complete
40% complete
43% complete
46% complete
Completing Database Creation
51% complete
54% complete
Creating Pluggable Databases
58% complete
77% complete
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
 /opt/oracle/cfgtoollogs/dbca/ORCLCDB.
Database Information:
Global Database Name:ORCLCDB
System Identifier(SID):ORCLCDB
Look at the log file "/opt/oracle/cfgtoollogs/dbca/ORCLCDB/ORCLCDB.log" for further details.

SQL*Plus: Release 19.0.0.0.0 - Production on Sat Aug 17 07:39:39 2024
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Standard Edition 2 Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL>
System altered.

SQL>
System altered.

SQL>
Pluggable database altered.

SQL>
PL/SQL procedure successfully completed.

SQL> Disconnected from Oracle Database 19c Standard Edition 2 Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
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:
ORCLPDB(3):ALTER DATABASE DEFAULT TABLESPACE "USERS"
ORCLPDB(3):Completed: ALTER DATABASE DEFAULT TABLESPACE "USERS"
2024-08-17T07:39:40.008101+00:00
ALTER SYSTEM SET control_files='/opt/oracle/oradata/ORCLCDB/control01.ctl' SCOPE=SPFILE;
2024-08-17T07:39:40.020258+00:00
ALTER SYSTEM SET local_listener='' SCOPE=BOTH;
   ALTER PLUGGABLE DATABASE ORCLPDB SAVE STATE
Completed:    ALTER PLUGGABLE DATABASE ORCLPDB SAVE STATE

XDB initialized.
2024-08-17T07:49:10.368074+00:00
ORCLPDB(3):Resize operation completed for file# 10, old size 327680K, new size 337920K

如果输出:DATABASE IS READY TO USE!,则表示oracle启动成功。可以通过客户端登录。

方法二:

手动安装。参考:docker配置oracle19c镜像 - 简书

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值