docker部署oracle11g以及创建表空间和用户操作
1.拉取镜像
docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
2.运行oralce镜像
docker run -it -d -p 1521:1521 -v /data/oracle:/data/oracle --name oracle11 registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
3.进入镜像内修改文件
docker exec -it oracle11 bash
4.切换为root用户
su root
//密码为helowin
5. 修改配置文件
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
6.加载文件变量
source /etc/profile
7.建立软连接
ln -s $ORACLE_HOME/bin/sqlplus /usr/bin
8.切换到oracle用户
su - oracle
// 密码为oracle
9.进行用户信息修改(修改原始密码以及新增用户)
sqlplus /nolog
conn /as sysdba
alter user system identified by system;--修改system用户账号密码;
alter user sys identified by sys;--修改sys用户账号密码;
create user root identified by 1234; -- 创建内部管理员账号密码;
grant connect,resource,dba to root; --将dba权限授权给内部管理员账号和密码;
ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED; --修改密码规则策略为密码永不过期;
alter system set processes=1000 scope=spfile; --修改数据库最大连接数据;
10.重启数据库并且退出
shutdown immediate; --关闭数据库
startup; --启动数据库
exit; 退出软链接
11.创建用户以及增加表空间
-- 创建临时空间
create temporary tablespace yth_tmp tempfile '/data/oracle/yth_tmp.dbf'
size 1024m
autoextend on
next 100m maxsize 10240m
extent management local;
-- 创建数据表空间
create tablespace yth logging datafile '/data/oracle/yth.dbf'
size 1024m
autoextend on
next 100m maxsize 10240m
extent management local;
-- 创建用户并指定表空间
create user yth identified by yth default tablespace yth temporary tablespace yth_tmp;
-- 授权
grant connect,resource,dba to yth;