docker 安装oracle 数据库

docker 安装oracle 数据库

  1. 拉取镜像:
docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
  1. 查看镜像
    docker images

  2. 运行oracle镜像,生成容器

docker run -d -p 1521:1521 --name oracle11g registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g

(注:后期可将oralce数据文件挂载到本机数据盘)
4. 进入容器
docker ps

docker exec -it 容器id bash

 docker exec -it 0ed7326b56d7 bash
  1. 配置环境变量:
    进入容器,默认oracle用户
    5.1 切换root用户 默认密码 helowin
    vi /etc/profile
    添加以下内容
export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2
export ORACLE_SID=helowin
export PATH=$ORACLE_HOME/bin:$PATH

刷新文件

source /etc/profile 

5.2 创建连接

ln -s $ORACLE_HOME/bin/sqlplus /usr/bin
  1. 登录oracle
    su - oracle
    注: “-” 别忘了
splplus / as sysdba

/*第1步:创建数据表空间 */

create tablespace testdb logging  datafile '/oracledata/testdb.dbf' size 100m  autoextend on  next 100m maxsize 2000m  extent management local;   

/*第2步:创建用户并指定表空间 */

create user testdb identified by testdb_2022 account unlock default tablespace testdb temporary tablespace TEMP;  

/*第3步:给用户授予权限 */

grant connect,resource,dba to testdb;

完事!

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值