自学内容网 自学内容网

centos8安装oracle11g

直接使用docker安装,太麻烦了!
参考地址 docker安装oracle11g

1、更新yum源为国内的镜像源、更新wget、关闭防火墙和SELinux

1、备份
cd /etc/yum.repos.d
# 全部备份到backup
mkdir backup && mv *repo backup/
2、下载阿里云的 yum 源文件并替换本地 yum 源文件:
sudo curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo

或者(centos8默认不带wget)

sudo wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo

3、更新缓存
yum clean all && yum makecache
4、安装wget
yum install wget

关闭防火墙和SELinux

systemctl stop firewalld
systemctl disable firewalld

vi /etc/selinux/config
# 修改 SELINUX=disabled,用于指示系统在启动时禁用 SELinux。
# 立即将 SELinux 切换到“宽松模式”,允许警告但不会阻止操作
setenforce 0

1、拉取oracle_11g镜像

# 2个多g
docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
#拉取 结果:
[root@localhost ~]# docker images;
REPOSITORY                                             TAG       IMAGE ID       CREATED       SIZE
registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g   latest    3fa112fd3642   8 years ago   6.85GB

2、创建Oracle_11g容器

docker run -d -p 1521:1521 --name oracle11g registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g --restart=always

若 忘记设置开机自启,可以使用以下命令:

docker update --restart=always oracle_11g

3、查看oracle11g容器是否创建成功

docker ps -a

# 结果:
[root@localhost ~]# docker ps -a
CONTAINER ID   IMAGE                                                  COMMAND                  CREATED             STATUS          PORTS                    NAMES
acbd05f8f050   registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g   "/bin/sh -c '/home/o…"   About an hour ago   Up 57 minutes   0.0.0.0:1521->1521/tcp   oracle_11g

4、启动docker start oracle11g容器

docker start oracle11g

5.进入oracle11g容器进行配置

docker exec -it oracle11g bash 

6.切换到root用户下进行配置

su root

输入密码为:helowin

7、编辑profile文件配置ORACLE环境变量

vi /etc/profile

8、最后添加以下3行配置

export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2
export ORACLE_SID=helowin
export PATH=$ORACLE_HOME/bin:$PATH

保存 ::wq
让配置生效:source /etc/profile

9、创建软连接

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

10、切换到oracle 用户

su - oracle

11、登录sqlplus并修改sys、system用户密码

sqlplus /nolog
conn /as sysdba

12、修改sys、system用户密码并刷新权限

alter user system identified by oracle;
alter user sys identified by oracle;
ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;

退出:exit;

13、查看一下oracle实例状态

lsnrctl status

14、用nacivat连接oracle数据库
服务名:helowin(一定要填写helowin)
密码:oracle(第12步设置的密码)

主机:192.168.145.130
端口:1521
服务名:helowin
用户名:system
密码:oracle

原文地址:https://blog.csdn.net/chou342175867/article/details/140541448

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!