文章目录
利用docker安装oracle11g
镜像 registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
拉取镜像
docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
创建容器
docker run -d -p 1521:1521 --name oracle11g registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
启动容器
docker start oracle11g
进入oracle11g容器
docker exec -it oracle11g /bin/bash
配置oracle环境变量
切换到root 用户下
su root
密码:helowin
vi /etc/profile
export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2
export ORACLE_SID=helowin
export PATH= O R A C L E H O M E / b i n : ORACLE_HOME/bin: ORACLEHOME/bin:PATH
切回到oracle用户
su oracle
数据库操作
登录sqlplus
sqlplus /nolog
conn /as sysdba
修改sys、system用户密码
alter user system identified by system;
alter user sys identified by sys;
创建表空间
CREATE TABLESPACE DATASPACE_01 DATAFILE ‘/home/oracle/app/oracle/oradata/DATASPACE_01.dbf’ SIZE 1G;
CREATE TABLESPACE DATASPACE_02 DATAFILE ‘/home/oracle/app/oracle/oradata/DATASPACE_02.dbf’ SIZE 1G;
CREATE TABLESPACE DATASPACE_03 DATAFILE ‘/home/oracle/app/oracle/oradata/DATASPACE_03.dbf’ SIZE 1G;
CREATE TABLESPACE DATASPACE_04 DATAFILE ‘/home/oracle/app/oracle/oradata/DATASPACE_04.dbf’ SIZE 1G;
CREATE TABLESPACE DATASPACE_05 DATAFILE ‘/home/oracle/app/oracle/oradata/DATASPACE_05.dbf’ SIZE 1G;
CREATE TABLESPACE DATASPACE_06 DATAFILE ‘/home/oracle/app/oracle/oradata/DATASPACE_06.dbf’ SIZE 1G;
CREATE TABLESPACE DATASPACE_07 DATAFILE ‘/home/oracle/app/oracle/oradata/DATASPACE_07.dbf’ SIZE 1G;
CREATE TABLESPACE DATASPACE_08 DATAFILE ‘/home/oracle/app/oracle/oradata/DATASPACE_08.dbf’ SIZE 1G;
CREATE TABLESPACE DATASPACE_09 DATAFILE ‘/home/oracle/app/oracle/oradata/DATASPACE_09.dbf’ SIZE 1G;
CREATE TABLESPACE DATASPACE_10 DATAFILE ‘/home/oracle/app/oracle/oradata/DATASPACE_10.dbf’ SIZE 1G;
CREATE TABLESPACE DATASPACE_11 DATAFILE ‘/home/oracle/app/oracle/oradata/DATASPACE_11.dbf’ SIZE 1G;
CREATE TABLESPACE DATASPACE_12 DATAFILE ‘/home/oracle/app/oracle/oradata/DATASPACE_12.dbf’ SIZE 1G;
CREATE TABLESPACE GCS_DATA DATAFILE ‘/home/oracle/app/oracle/oradata/GCS_DATA.dbf’ SIZE 8G;
创建用户:
create user gcs identified by gcs default tablespace GCS_DATA;
create user cif identified by cif default tablespace GCS_DATA;
grant connect,resource,dba to gcs;
查看表空间的名称及大小
SELECT t.tablespace_name, round(SUM(bytes / (1024 * 1024)), 0) ts_size
FROM dba_tablespaces t, dba_data_files d
WHERE t.tablespace_name = d.tablespace_name
GROUP BY t.tablespace_name;
镜像docker-oracle-xe-11g
实例:XE
deepdiver/docker-oracle-xe-11g
XE版本对数据库有相当大的限制,比如说在10g中用户数据最大为4G, 11G中最大为11G,如果超出大小就会报ora-12952/ora-12953的错误