基于docker和docker-compose部署oracle19c

基于docker和docker-compose部署oracle19c

  • 构建oracle镜像
    • docker-compose.yml
    • 启动oracle服务

构建oracle镜像

docker-compose.yml

version: '2'
services:
 oracle:
   image: heartu41/oracle19c
   container_name: oracle19c
   privileged: true
   environment:
     TZ: Asia/Shanghai
     ORACLE_SID: ORCL
     ORACLE_PDB: ORCLPDB1
     ORACLE_BASE: /opt/oracle
     ORACLE_HOME: /opt/oracle/product/19c/dbhome_1
     PATH: /opt/oracle/product/19c/dbhome_1/bin:/opt/oracle/product/19c/dbhome_1/OPatch/:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
   volumes:
    - ./oradata:/opt/oracle/oradata
   ports:
      - "1520:1521"
      - "18080:8080"
      - "15313:5500"

启动oracle服务

启动服务

docker-compose up -d

进入oracle容器

docker-compose exec oracle bash

连接oracle

sqlplus / as sysdba

切换到pdb

alter session set container=ORCLPDB1;

创建表空间

CREATE TABLESPACE HFZF DATAFILE '/opt/oracle/oradata/ORCL/PDBHFZF01.DBF' SIZE 4096M AUTOEXTEND ON NEXT 100M;
CREATE temporary TABLESPACE HFZF_TEMP tempfile '/opt/oracle/oradata/ORCL/PDBHFZF_TEMP.DBF' SIZE 1024M AUTOEXTEND ON NEXT 10M;

创建用户

create user HFZF identified by hfzf  default tablespace HFZF Temporary tablespace HFZF_TEMP;

授权用户

grant dba to hfzf;
grant connect to hfzf;

修改密码永久有效

ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;

你可能感兴趣的:(docker,数据库,docker,oracle,dba)