踩坑centos7安装oracle11gR2
参考1:Centos7下安装Oracle11g r2 - 慕河河 - 博客园 (cnblogs.com) 主要参考一些前期配置信息,其实都大同小异,只是写的比较详细。有一些小问题处理的方案
参考2:https://www.cnblogs.com/activiti/p/7575266.html 主要参考安装oracle的配置信息,配置监听实例。解决了 sawp 不足问题。
参考3:linux下安装oracle数据库详细教程 - lurunxiu - 博客园 (cnblogs.com) 主要是参考了配置实例的一些信息。
踩坑1:
主要是swap 内存需要为 2.7 g 实际2g :
[root@localhost oracle]# free -m #查看当前虚拟内存 total used free shared buff/cache available Mem: 1824 1369 93 10 361 250 Swap: 2048 20 2028 [root@localhost oracle]# dd if=/dev/zero of=/home/swap bs=1024 count=1024000 #将当前swap空间由2048M 增加到 3048M 新增一个2014的swap文件 1024000+0 records in 1024000+0 records out 1048576000 bytes (1.0 GB) copied, 29.4051 s, 35.7 MB/s [root@localhost oracle]# mkswap /home/swap Setting up swapspace version 1, size = 1023996 KiB no label, UUID=5e3d39d7-285e-4c74-b321-1e2b3ffabf83 [root@localhost oracle]# free -m total used free shared buff/cache available Mem: 1824 1275 95 10 454 342 Swap: 2048 141 1907 [root@localhost oracle]# swapon /home/swap #增加并启用虚拟内容 swapon: /home/swap: insecure permissions 0644, 0600 suggested. [root@localhost oracle]# free -m #再次查看 total used free shared buff/cache available Mem: 1824 1275 94 10 454 342 Swap: 3048 141 2907
2.缺少的依赖包有可能已经存在,只是版本过高,可以忽略。
yum -y install compat-*
我安装了compat 下面所有的包。。。
踩坑2:监听问题
[oracle@ora ~]$ ps -ef | grep -i tns
root 14 2 0 05:07 ? 00:00:00 [netns]
oracle 36613 1 0 14:06 ? 00:00:00 /data/oracle/product/11.2.0/db_1/bin/tnslsnr LISTENER -inherit
oracle 41384 27052 0 15:15 pts/3 00:00:00 grep --color=auto -i tns
--监听存在
oracle@ora ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 04-MAR-2022 15:11:19
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.137.129)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 04-MAR-2022 14:07:02
Uptime 0 days 1 hr. 4 min. 52 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /data/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /data/oracle/diag/tnslsnr/ora/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.137.129)(PORT=1521)))
The listener supports no services
The command completed successfully
--The listener supports no services
解决方法1:
[oracle@dg1 admin]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Fri Nov 18 11:19:06 2016
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
Total System Global Area 830930944 bytes
Fixed Size 2217912 bytes
Variable Size 545261640 bytes
Database Buffers 281018368 bytes
Redo Buffers 2433024 bytes
Database mounted.
Database opened.
SQL> show parameter service_names
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names string tong
SQL> alter system register; --强行注册监听
System altered.
SQL>
[oracle@dg1 admin]$ lsnrctl start --启动监听
解决方法2:
[oracle@dg2 ~]$ vim /u01/product/11.2.0.1/db_1/network/admin/listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = dg2)(PORT = 1521))
)
)
SID_LIST_LISTENER = --添加以下行
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(SID_NAME = orcl)
)
)
ADR_BASE_LISTENER = /u01
[oracle@dg2 ~]$ lsnrctl start
踩坑3:监听启动缓慢 ,hostname 的问题
参考 解决办法:
racle]# cat /etc/sysconfig/network # Created by anaconda [root@localhost oracle]# vi /etc/sysconfig/network #增加HOSTNAME [root@localhost oracle]# cat /etc/sysconfig/network # Created by anaconda HOSTNAME=odb-sonny [root@localhost oracle]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 [root@localhost oracle]# vi /etc/hosts #增加HOSTNAME [root@localhost oracle]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 odb-sonny ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 [root@localhost oracle]# hostname odb-sonny #执行 [root@localhost oracle]#
1, /etc/hosts 文件中的 ip和主机名不一致
2, listener.ora 中监听主机非当前主机.
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 百万级群聊的设计实践
· 永远不要相信用户的输入:从 SQL 注入攻防看输入验证的重要性
· 全网最简单!3分钟用满血DeepSeek R1开发一款AI智能客服,零代码轻松接入微信、公众号、小程
· .NET 10 首个预览版发布,跨平台开发与性能全面提升
· 《HelloGitHub》第 107 期