linux通过docker部署Oracle 11g

一、安装docker

yum install -y yum-utils
#配置阿里源
yum-config-manager \
>     --add-repo \
>     https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
#更新源
[root@localhost ~]# yum makecache fast -q
#安装docker
[root@localhost ~]# yum install docker-ce docker-ce-cli containerd.io -y -q
#启动docker并开机自启
[root@localhost ~]# systemctl start docker
[root@localhost ~]# systemctl enable docker

二、获取docker的Oracle镜像

docker pull jaspeen/oracle-11g

三、上传Oracle11g安装包

/install目录是默认安装目录,不然安装时会报错(Installation files not found. Unzip installation files into mounted(/install) folder)

#创建Oracle安装目录,
mkdir /install
#将两个Oracle安装目录上传到/install目录下
-rw-r--r--. 1 root root 1239269270 429 15:52 linux.x64_11gR2_database_1of2.zip
-rw-r--r--. 1 root root 1111416131 429 15:54 linux.x64_11gR2_database_2of2.zip
#解压
[root@localhost install]unzip linux.x64_11gR2_database_1of2.zip
[root@localhost install]unzip linux.x64_11gR2_database_2of2.zip

[root@localhost install]# ll
总用量 2295592
drwxr-xr-x. 8 root root        128 821 2009 database
-rw-r--r--. 1 root root 1239269270 429 15:52 linux.x64_11gR2_database_1of2.zip
-rw-r--r--. 1 root root 1111416131 429 15:54 linux.x64_11gR2_database_2of2.zip

四、安装Oracle11g

[root@localhost install]# docker run -d --privileged --name oracle11g -p 1521:1521 -v /install/:/install jaspeen/oracle-11g
Database is not installed. Installing...
Installing Oracle Database 11g
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 120 MB.   Actual 29054 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 2045 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2022-04-29_08-36-50AM. Please wait ...You can find the log of this install session at:
 /opt/oracle/oraInventory/logs/installActions2022-04-29_08-36-50AM.log
The following configuration scripts need to be executed as the "root" user.
 #!/bin/sh
 #Root scripts to run

/opt/oracle/oraInventory/orainstRoot.sh
/opt/oracle/app/product/11.2.0/dbhome_1/root.sh
To execute the configuration scripts:
         1. Open a terminal window
         2. Log in as "root"
         3. Run the scripts
         4. Return to this window and hit "Enter" key to continue

Successfully Setup Software.
Changing permissions of /opt/oracle/oraInventory.
····································
······················
等它慢慢安装

五,初始化数据库

5.1,连接到容器,

docker exec -it oracle11g /bin/bash

3.2,切换到oracle用户,然后连接到sql控制台

su - oracle
sqlplus / as sysdba
#默认scott用户是被锁定的,需要解锁
SQL>
3.3,解锁账户
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>
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

XL's妃妃

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值