Linux 下Oracle11g安装

linux安装Oracle11Ghttps://www.cnblogs.com/mmzs/p/9033112.html

https://www.cnblogs.com/xuzhaoyang/p/11264557.html

本文主要基于docker 快速搭建oracle11g服务......

一、docker安装
1、 CentOS 7安装docker要求系统为64位、系统内核版本为 3.10 以上:uname -r
2、查看是否已安装docker列表:yum list installed | grep docker
3、安装docker:yum -y install docker
4、启动docker:systemctl start docker
5、查看docker服务状态:systemctl status docker

6、配置镜像加速
vim /etc/docker/daemon.json
添加阿里云镜像加速器:

{

"registry-mirrors": ["https://eqcxmbvw.mirror.aliyuncs.com"]

}

sudo systemctl daemon-reload
sudo systemctl restart docker
--查看镜像加速是否生效
tail /etc/docker/daemon.json

二、安装Oracle11g

1、拉取Oracle11g镜像

 docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g

(镜像有点大:6.85g,请耐心等候。。。)

下载成功,查看镜像:docker images

 

2、创建容器

创建容器、挂载目录(/data/oracle),映射本地1521端口

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

3、测试容器

docker start oracle11g --启动容器

docker stop oracle11g --停止容器

4、进入容器

docker exec -it oracle11g /bin/bash

5、配置oracle环境变量

切换root用户:root/helowin

su root

helowin

vim /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

6、创建软链接

方便直接在系统环境先操作oralce环境

ln -s $ORACLE_HOME/bin/sqlplus /usr/bin

切换到oracle用户:su - oracle

7、登录数据库,修改用户配置

sqlplus /nolog
conn /as sysdba
alter user system identified by system;--修改system用户账号;
alter user sys identified by sys; --修改sys用户账号;
create user chenrk2020 identified by chenrk2020; -- 创建内部管理员账号;
grant connect,resource,dba to chenrk2020; --将dba权限授权给内部管理员账号;
ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED; --修改密码规则策略为密码永不过期;

 

8、查看oracle实例

lsnrctl status

9、使用pl/sql等客户端连接测试

https://www.cnblogs.com/wangsaiming/p/3555994.html

查看表空间信息

SELECT a.tablespace_name "表空间名称", 
total / (1024 * 1024) "表空间大小(M)", 
free / (1024 * 1024) "表空间剩余大小(M)", 
(total - free) / (1024 * 1024 ) "表空间使用大小(M)", 
total / (1024 * 1024 * 1024) "表空间大小(G)", 
free / (1024 * 1024 * 1024) "表空间剩余大小(G)", 
(total - free) / (1024 * 1024 * 1024) "表空间使用大小(G)", 
round((total - free) / total, 4) * 100 "使用率 %" 
FROM (SELECT tablespace_name, SUM(bytes) free 
FROM dba_free_space 
GROUP BY tablespace_name) a, 
(SELECT tablespace_name, SUM(bytes) total 
FROM dba_data_files 
GROUP BY tablespace_name) b 
WHERE a.tablespace_name = b.tablespace_name 

 

拓展:新增oracle实例

步骤如下:

a、切换到oracle用户下,找到Oracle的安装目录,并执行命令./dbca

su - oracle
cd /home/oracle/app/oracle/product/11.2.0/dbhome_2/bin
./dbca

echo $DISPLAY

export DISPLAY=本地IP:0.0

 https://www.cnblogs.com/boboc/p/7218902.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章