Oracle安装--简单篇
发表于:2026-10-31 作者:千家信息网编辑
千家信息网最后更新 2026年10月31日,Oracle安装之简单篇安装准备包linuxredhat5.8操作系统oracle11g(以下是包名)linux.x64_11gR2_database_1of2.ziplinux.x64_11gR2_
千家信息网最后更新 2026年10月31日Oracle安装--简单篇
Oracle安装之简单篇
安装准备包
linuxredhat5.8操作系统
oracle11g(以下是包名)
linux.x64_11gR2_database_1of2.zip
linux.x64_11gR2_database_2of2.zip
安装准备
配置IP,hosts,主机名。
备注hosts文件一定要与主机名对应。(如下)
127.0.0.1 localhost.localdomain localhost::1 localhost6.localdomain6 localhost6192.168.66.249 dbserver.cjl.com
配置oracle环境脚本
#!/bin/bash#查看内存大小echo "Mem Check:swap >2G,MEM >2G"grep -i memtotal /proc/meminfogrep -i swaptotal /proc/meminfo#配置yum本地源cat </etc/yum.repos.d/rhel.repo[local][local]calbaseurl=file:///mnt/Server/enabled=1gpgcheck=0END#挂载光盘并安装插件mount /dev/cdrom /mntyum -y groupinstall "Development Tools"yum -y install binutils compat-libstdc++-33 elfutils-* gcc gcc-c++* glibc* kernel-headers ksh libaio* libgcc#配置路由cat < > /etc/sysctl.conffs.aio-max-nr = 1048576fs.file-max = 6815744kernel.shmall = 2097152kernel.shmmax = 536870912kernel.shmmni = 4096kernel.sem = 250 32000 100 128net.ipv4.ip_local_port_range = 9000 65500net.core.rmem_default = 262144net.core.rmem_max = 4194304net.core.wmem_default = 262144net.core.wmem_max = 1048576ENDsysctl -p#创建用户组和用户并授权groupadd -g 500 oinstallgroupadd -g 501 dbauseradd -g oinstall -G dba oracleecho "123123" |passwd --stdin oraclemkdir /opt/oraclechown -R oracle:oinstall /opt/oraclechmod -R 775 /opt/oraclesudo mkdir /opt/tmpsudo chmod a+rw /opt/tmp#添加用户环境变量cat < >/home/oracle/.bash_profileumask 022export ORACLE_BASE=/opt/oracleexport ORACLE_HOME=\$ORACLE_BASE/product/11.2/db_1export ORACLE_SID=orclexport LANG=zh_CN.UTF-8export NLS_LANG="AMERICAN_AMERICA".ZHS16GBKexport PATH=\$PATH:\$ORACLE_HOME/binexport DISPLAY=:0.0END#添加认证模块cat < >/etc/pam.d/loginsession required /lib64/security/pam_limits.sosession required pam_limits.soEND#设置oracle限制cat < >/etc/security/limits.conforacle soft nproc 2047oracle hard nproc 16384oracle soft nofile 1024oracle hard nofile 65536oracle soft stack 10240END#oracle软堆栈限制cat < >/etc/profileif [ $USER = "oracle" ];then if [ \$SHELL = "/bin/ksh" ];then ulimit -p 16384 ulimit -p 65536 else ulimit -u 16384 -n 65536 fifiEND
解压Oracle11g的包到oracle用户的home目录
unzip -d /home/oracle linux.x64_11gR2_database_1of2.zip && unzip -d /home/oraclelinux.x64_11gR2_database_2of2.zip
允许用户oracle从本机访问
[root@dbserver ~]# xhost +access control disabled, clients can connect from any host
切换用户并进入解压目录运行安装
[root@dbserver ~]# su - oracle[oracle@dbserver ~]$ lsdatabase[oracle@dbserver ~]$ cd database/[oracle@dbserver database]$ ./runInstaller


运行root用户执行提示脚本
[root@dbserver ~]# /opt/oracle/oraInventory/orainstRoot.sh 更改权限/opt/oracle/oraInventory.添加组的读取和写入权限。删除全局的读取, 写入和执行权限。更改组名/opt/oracle/oraInventory 到 oinstall.脚本的执行已完成。[root@dbserver ~]# /opt/oracle/product/11.2/db_1/root.sh Running Oracle 11g root.sh script...The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /opt/oracle/product/11.2/db_1Enter the full pathname of the local bin directory: [/usr/local/bin]: Copying dbhome to /usr/local/bin ... Copying oraenv to /usr/local/bin ... Copying coraenv to /usr/local/bin ...Creating /etc/oratab file...Entries will be added to the /etc/oratab file as needed byDatabase Configuration Assistant when a database is createdFinished running generic part of root.sh script.Now product-specific root actions will be performed.Finished product-specific root actions.[root@dbserver ~]#
访问以上地址测试https://dbserver.cjl.com:1158/em/
oracle用户访问测试
[oracle@dbserver database]$ sqlplus sys as sysdbaSQL*Plus: Release 11.2.0.1.0 Production on Fri Sep 18 05:28:47 2015Copyright (c) 1982, 2009, Oracle. All rights reserved.Enter password: Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL> show user;USER is "SYS"SQL>
图形界面添加数据库
如果重新启动还需web访问可用以下命令重新获取网址
[oracle@dbserver ~]$ emctl start dbconsoleOracle Enterprise Manager 11g Database Control Release 11.2.0.1.0 Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved.https://dbserver.cjl.com:1158/em/console/aboutApplicationStarting Oracle Enterprise Manager 11g Database Control ........ started. ------------------------------------------------------------------Logs are generated in directory /opt/oracle/product/11.2/db_1/dbserver.cjl.com_orcl/sysman/log
如果发现不能使用dbca命令时试试它
[oracle@dbserver ~]$ /opt/oracle/product/11.2/db_1/bin/dbca Xlib: connection to ":0.0" refused by serverXlib: No protocol specified[root@dbserver ~]# xhost +access control disabled, clients can connect from any host
启动数据库先启动监听
[oracle@dbserver ~]$ lsnrctlLSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-SEP-2015 05:07:44Copyright (c) 1991, 2009, Oracle. All rights reserved.Welcome to LSNRCTL, type "help" for information.LSNRCTL> startStarting /opt/oracle/product/11.2/db_1/bin/tnslsnr: please wait...TNSLSNR for Linux: Version 11.2.0.1.0 - ProductionSystem parameter file is /opt/oracle/product/11.2/db_1/network/admin/listener.oraLog messages written to /opt/oracle/diag/tnslsnr/dbserver/listener/alert/log.xmlListening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbserver.cjl.com)(PORT=1521)))Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))STATUS of the LISTENER------------------------Alias LISTENERVersion TNSLSNR for Linux: Version 11.2.0.1.0 - ProductionStart Date 18-SEP-2015 05:07:50Uptime 0 days 0 hr. 0 min. 0 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File /opt/oracle/product/11.2/db_1/network/admin/listener.oraListener Log File /opt/oracle/diag/tnslsnr/dbserver/listener/alert/log.xmlListening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbserver.cjl.com)(PORT=1521)))The listener supports no servicesThe command completed successfullyLSNRCTL> quit[oracle@dbserver ~]$ sqlplus sys as sysdbaSQL*Plus: Release 11.2.0.1.0 Production on Fri Sep 18 05:08:12 2015Copyright (c) 1982, 2009, Oracle. All rights reserved.Enter password: Connected to an idle instance.SQL> startupORACLE instance started.Total System Global Area 839282688 bytesFixed Size 2217992 bytesVariable Size 541067256 bytesDatabase Buffers 289406976 bytesRedo Buffers 6590464 bytesDatabase mounted.Database opened.SQL> show user;USER is "SYS"SQL> alter database open;alter database open*ERROR at line 1:ORA-01531: a database already open by the instanceSQL> quitDisconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options
关闭数据库
shutdown immediate
shutdown abort (上一条关闭不能执行,则执行这条强制关机)
关闭监听
lsnrctl stop
本文如出现错误请留言!
用户
配置
数据
数据库
权限
脚本
主机
命令
环境
目录
准备
测试
监听
运行
限制
操作系统
光盘
全局
内存
变量
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
耶加雪菲
互联网科技公司经营范围
江苏根荣互联网科技
科技与互联网
合肥互联网科技公司
智网互联网科技
丰台科技园 互联网
上海致骋互联网科技
科技大学互联网专业好不好
济南和联互联网科技有限公司
欧洲十大科技互联网公司
广州恒生互联网科技有限
互联网科技与管理
互联网为啥属于高科技
阿大互联网科技有限公司
阿里互联网科技企业
科技大学互联网
2021互联网科技公司排名
广州燕处互联网科技有限公司
互联网科技的前景
互联网科技巨头监管
壹账通互联网科技
科技创新互联网企业
互联网金融科技平台
苏州大垚互联网科技
昊天互联网科技有限公司
消费医药和互联网科技
中国互联网公司排名锤子科技
长沙互联网科技
昆明中奇联合互联网科技