wsl 使用docker 部署oracle11g数据库

wsl 使用docker 部署oracle11g数据库

1. 下载oracle11g

sudo docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g

2. 运行oracle11g容器(docker-compose)

services:
  oracle-1.0:
    container_name: oracle11g
    image: oracle11g:1.0
    restart: always
    ports:
      - "1521:1521"
    volumes:
      - ./var/lib/oracle:/data/oracle:ro
      - /etc/localtime:/etc/localtime:ro

启动失败:解决方法:在%userprofile%文件夹下创建一个.wslconfig文件。

win+R,运行%userprofile%,输入

[wsl2]
kernelCommandLine = vsyscall=emulate
#重启wsl,重启电脑
wsl --shutdown

3. 数据库配置

# 进入容器
sudo docker exec -it oracle11g /bin/bash
# root用户设置新密码(原密码:helowin)
su root
passwd
# 修改环境变量m创建软连接,便于在oracle账户连接oracle数据库
vi /home/oracle/.bashrc
# 在该文件的末尾加三行
export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2
export ORACLE_SID=helowin
export PATH=$ORACLE_HOME/bin:$PATH
# 环境变量生效
source /home/oracle/.bashrc
# 创建数据库运行命令软连接
ln -s $ORACLE_HOME/bin/sqlplus /usr/bin
# 连接数据库(在oracle账号下)
sqlplus /nolog
conn /as sysdba
# 修改密码为oraclen
alter user system identified by oraclen;
alter user sys identified by oraclen;
alter user scott account unlock;
alter user scott identified by oraclen;

4. Navicat连接数据库

数据库默认服务名:helowin
地址:127.0.0.1
使用用户:scott
密码:oraclen

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值