一.docker search oracle
二.下载aspeen/oracle-11g docker pull aspeen/oracle-11g
三.从oracle 官网 下载所需要的安装包,这里我们以oracle 11g 为例子,分别下载 linux.x64_11gR2_database_1of2.zip 和 linux.x64_11gR2_database_2of2.zip两个压缩包,下载完成后解压到home目录(如下目录结构)
解压命令
unzip linux.x64_11gR2_database_1of2.zip -d /home
四.开始安装
docker run --privileged --name oracle11g -p 1521:1521 -v /home:/install jaspeen/oracle-11g
命令解释:
docker run 启动容器的命令
privileged 给这个容器特权,安装oracle可能需要操作需要root权限的文件或目录
name 给这个容器名一个名字
p 映射端口
v 挂在文件到容器指定目录 (/home 对应容器 /install/database)
jaspeen/oracle-11g 代表启动指定的容器
五.配置
docker exec -it oracle11g /bin/bash #进入容器
su - oracle
sqlplus / as sysdba
# 商业转载请联系作者获得授权,非商业转载请注明出处。
# For commercial use, please contact the author for authorization. For non-commercial use, please indicate the source.
# 协议(License):署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)
# 作者(Author):
# 链接(URL):https://www.35youth.cn/685.html
# 来源(Source):搬砖少年
SQL> alter user scott account unlock; User altered.
SQL> commit; Commit complete.
SQL> conn scott/tiger
ERROR: ORA-28001: the password has expired Changing password for scott
New password:
Retype new password: Password changed
Connected.
SQL>
数据库安装完成后,使用默认的sid为orcl,端口为1521,scott/tiger即可连接