安装Oracle EE

前期

进入自己需要设置的目录,创建文件夹,文件夹授权

mkdir xxx
chmod o+w /oracle/oradata
chmod 777 /oracle/oradata

安装ORACLE EE

1:查找镜像

docker search oracle19c

2:选择适合的镜像

docker pull heartu41/oracle19c

3:运行

docker run -p 1521:1521 -p 5500:5500 \
--name oracletest \
--privileged=true \
--restart=always \
-e ORACLE_SID=ORCL \
-e ORACLE_PDB=ORCLTEST \
-e ORACLE_PWD=123456 \
-e ORACLE_CHARACTERSET=AL32UTF8 \
-e ORACLE_BASE=/opt/oracle \
-e ORACLE_EDITION=standard \
-e ORACLE_HOME=/opt/oracle/product/19c/dbhome_1 \
-e ORACLE_ALLOW_REMOTE=true \
-e TZ=Asia/Chongqing \
-e 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:/sbin:/bin \
-e NLS_LANG=AMERICAN_AMERICA.AL32UTF8 \
NLS_DATE_LANGUAGE
-it \
-v /data/oracle/oradata:/opt/oracle/oradata \
-d f59790109034 

查看:

 docker logs -ft oracletest

4:查看设置时区是否生效

docker exec -it oracletest date +"%Z %z"

5:进入容器

docker exec -it oracletest /bin/bash

6:修改密码

./setPassword.sh 123456

7:设置PDB

grep $ORACLE_HOME /etc/oratab | cut -d: -f1
export ORACLE_SID=ORCL

8:连接数据库

sqlplus / as sysdba

10:取消受限模式

 alter system disable restricted session;

9:执行

alter session set "_ORACLE_SCRIPT"=true; 

9:查看

show pdbs;

image-20220518004536828

10:创建模式后授权表空间

 ALTER USER   用户名 QUOTA UNLIMITED ON 表空间

11 如果需要修改字符集或者环境变量

查询:

SELECT USERENV('language') FROM dual; 

则安装vim

docker exec -it --user root oracletest /bin/bash
yum install vim

编辑文件

vim ~/.bash_profile

添加

export NLS_LANG="SIMPLIFIED CHINESE_CHINA".ZHS16GBK
or
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
or
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

加载文件

source ~/.bash_profile

修改oracle参数形式

select * from v$nls_parameters;

image-20220527023344358

创建用户表空间

-- 移除表空间
DROP TABLESPACE HTHSETEMP INCLUDING CONTENTS AND DATAFILES

-- 移除用户
drop user HSE_TEMP CASCADE

-- 创建表空间
CREATE TABLESPACE NTHSETESTPSPACE
DATAFILE '/opt/oracle/oradata/ORCL/ORCLTEST/NTHSETESTPSPACE.dbf' 
SIZE 20G AUTOEXTEND ON next 4G

-- 创建用户
CREATE USER HSE_TEMP IDENTIFIED  BY 000000

--- 修改密码
alter user 用户名 identified by 新密码; 

-- 修改用户表空间
ALTER USER HSE_TEMP quota unlimited ON HTHSETEMP

-- 实际应用
create user <username> identified by <password> 
default tablespace <tablespace_name> -- 默认表空间
temporary tablespace temp -- 临时表空间
quota unlimited on <tablespace_name> -- 表空间额度

-- 权限设设置
grant create session to HSE_TEMP
grant create table to HSE_TEMP
grant create tablespace to HSE_TEMP;
grant create any view to HSE_TEMP;
grant connect,resource to HSE_TEMP;
grant create any sequence to HSE_TEMP;
grant create any table to HSE_TEMP;
grant delete any table to HSE_TEMP;
grant insert any table to HSE_TEMP;
grant select any table to HSE_TEMP;
grant unlimited tablespace to HSE_TEMP;
grant execute any procedure to HSE_TEMP;
grant update any table to HSE_TEMP;

-- 查看当前用户的权限
select * from role_sys_privs;


常用命令

startup mount  #启动
shutdown immediate; 关闭
sqlplus / as sysdba  进入
 lsnrctl status 查看监听状态
 lsnrctl start  开启监听
 lsnrctl reload  重启
 lsnrctl stop  停止

其余问题

问题

cannot mount database in EXCLUSIVE mode

解决:

cd $ORACLE_HOME/dbs
ls lk*
rm lk*

问题

ORA-00205: error in identifying control file, check alert log for more info   : (

解决

ipcs -s
ipcrm -s semid-NO.

问题

ORA-00214: control file '/opt/oracle/oradata/ORCL/control01.ctl' version 2647
inconsistent with file '/opt/oracle/oradata/ORCL/control02.ctl' version 2613

解决

cd /opt/oracle/oradata/ORCL/
ls
cp control01.ctl control02.ctl


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

sirwsl

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值