热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

linux下如何安装oracle11g数据库?-linux运维

linux下如何安装oracle11g数据库?下面本篇文章给大家介绍一下linux下安装和配置oracle11g数据库。有一定的参考价值,有需要的朋友可以参考一下,希望对大家有所帮助。
linux下如何安装oracle 11g数据库?下面本篇文章给大家介绍一下linux下安装和配置oracle 11g数据库。有一定的参考价值,有需要的朋友可以参考一下,希望对大家有所帮助。

linux下命令行安装oracle 11g数据库

1、准备:

本次安装的基本环境:vmware中安装centos6.10(虚拟机安装这里就不做介绍了)

虚拟机要求:内存推荐2G以上

需要下载Linux版本下对应的oracle安装包:

下载地址:http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html

对应的oracle版本:

linux.x64_11gR2_database_1of2.zip

linux.x64_11gR2_database_2of2.zip

课程推荐:《linux课程》

2、机器基础配置修改

1)设置系统:Oracle只支持操作系统Red Hat Enterprise Linux 6,故需将/etc/redhat-release中的内容改成Red Hat

[root@Oracle ~]# vi /etc/redhat-release  
#CentOS release 6.10 (Final)
Red Hat Enterprise Linux 6

(2)机器信息关闭,selinux,防火墙的不必要的服务

[root@Oracle ~]# cat /etc/selinux/config                         //selinux关闭(disabled)
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@Oracle ~]# /etc/init.d/iptables stop                        //防火墙关闭
[root@Oracle ~]# vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.152.130   Oracle                          //新增行:IP 机器名(这是我的ip和主机名)

(3)修改用户的限制文件

[root@Oracle ~]# cat /etc/security/limits.conf                //在该文件内添加以下内容
oracle           soft    nproc           2047
oracle           hard    nproc           16384
oracle           soft    nofile          1024
oracle           hard    nofile          65536
oracle           soft    stack           10240

(4)修改内核参数

[root@Oracle ~]# cat /etc/sysctl.conf		//在文件中添加以下内容
net.ipv4.ip_local_port_range= 9000 65500 
fs.file-max = 6815744 
kernel.shmall = 10523004 
kernel.shmmax = 6465333657 
kernel.shmmni = 4096 
kernel.sem = 250 32000 100128 
net.core.rmem_default=262144 
net.core.wmem_default=262144 
net.core.rmem_max=4194304 
net.core.wmem_max=1048576 
fs.aio-max-nr = 1048576
[root@Oracle ~]# sysctl –p				// 执行这条语句使配置生效

(5)依赖包安装

[root@Oracle ~]# yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*.i686 elfutils-libelf-devel gcc gcc-c++ glibc*.i686 glibc glibc-devel glibc-devel*.i686 ksh libgcc*.i686 libgcc libstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.i686 libaio libaio*.i686 libaio-devel libaio-devel*.i686 make sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686 libXp

3、建立用户、组,安装目录

(1)建立用户、组

[root@Oracle ~]# groupadd oinstall
[root@Oracle ~]# groupadd dba
[root@Oracle ~]# groupadd oper
[root@Oracle ~]# useradd -g oinstall -G dba,oper oracle
[root@Oracle ~]# echo "oracle" | passwd --stdin oracle
[root@Oracle ~]# id oracle		//查看用户所属组
uid=501(oracle) gid=501(oinstall) groups=501(oinstall),502(dba),503(oper)

(2)新建安装目录

[root@Oracle ~]# mkdir -p /var/app
[root@Oracle ~]# mkdir -p /var/app/oracle
[root@Oracle ~]# mkdir -p /var/app/oracle/product
[root@Oracle ~]# mkdir -p /var/app/oracle/product/11.2.0
[root@Oracle ~]# mkdir -p /var/app/oracle/product/11.2.0/dbhome_1
[root@Oracle ~]# mkdir -p /home/oracle/backup
[root@Oracle ~]# mkdir -p /home/oracle/oraInventory
[root@Oracle ~]# chown -R oracle:oinstall /var/app
[root@Oracle ~]# chown -R oracle:oinstall /home/oracle/backup
[root@Oracle ~]# chown -R oracle:oinstall /home/oracle/oraInventory
[root@Oracle ~]# chmod -R 775 /var/app

(3)设置并刷新环境变量

[root@Oracle ~]# cat /home/oracle/.bash_profile   //给该文件添加以下内容
umask 022
export ORACLE_BASE=/var/app
export ORACLE_HOME=$ORACLE_BASE/oracle/product/11.2.0/dbhome_1
export ORACLE_SID=ora11g
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
[root@Oracle ~]# source /home/oracle/.bash_profile		//执行该句使配置生效

4、安装Oracle

(1)拷贝Oracle安装文件到指定目录

[root@Oracle ~]# cp linux.x64_11gR2_database_*.zip /var/app/oracle/

(2)切换到oracle用户,解压安装包

[root@Oracle ~]# su - oracle
[oracle@Oracle ~]$ cd /var/app/oracle/
[oracle@Oracle oracle]$ unzip linux.x64_11gR2_database_1of2.zip
[oracle@Oracle oracle]$ unzip linux.x64_11gR2_database_2of2.zip

解压后得到database目录,其中response目录里面有三个rsp文件,用来作为静默安装时应答文件的模板。分别为:

[oracle@Oracle response]$ ls -l
total 76
-rw-rw-r-- 1 oracle oinstall 44960 Aug  8 17:10 dbca.rsp      //安装应答
-rw-rw-r-- 1 oracle oinstall 22752 Aug  8 14:23 db_install.rsp      //创建数据库应答
-rwxrwxr-x 1 oracle oinstall  5740 Feb 26  2009 netca.rsp //建立监听,本地服务名等网络设置

(5)修改配置文件,安装Oracle数据库

[oracle@Oracle database]$ cp /var/app/oracle/database/response/ /home/oracle/           //备份

(6)修改后的静默安装配置文件db_install.rsp内容如下:

[root@db response]# cat db_install.rsp | grep -v '^#' | grep -v '^$'
oracle.install.respOnseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=db
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/var/app/oracle/oraInventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/var/app/oracle/product/11.2.0/dbhome_1
ORACLE_BASE=/var/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.isCustomInstall=false
oracle.install.db.customCompOnents=oracle.server:11.2.0.1.0,oracle.sysman.ccr:10.2.7.0.0,oracle.xdk:11.2.0.1.0,oracle.rdbms.oci:11.2.0.1.0,oracle.network:11.2.0.1.0,oracle.network.listener:11.2.0.1.0,oracle.rdbms:11.2.0.1.0,oracle.options:11.2.0.1.0,oracle.rdbms.partitioning:11.2.0.1.0,oracle.oraolap:11.2.0.1.0,oracle.rdbms.dm:11.2.0.1.0,oracle.rdbms.dv:11.2.0.1.0,orcle.rdbms.lbac:11.2.0.1.0,oracle.rdbms.rat:11.2.0.1.0
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oinstall
oracle.install.db.CLUSTER_NODES=
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=ora11g
oracle.install.db.config.starterdb.SID=ora11g
oracle.install.db.config.starterdb.characterSet=AL32UTF8
oracle.install.db.config.starterdb.memoryOption=true
oracle.install.db.config.starterdb.memoryLimit=1500
oracle.install.db.config.starterdb.installExampleSchemas=false
oracle.install.db.config.starterdb.enableSecuritySettings=true
oracle.install.db.config.starterdb.password.ALL=oracle
oracle.install.db.config.starterdb.password.SYS=
oracle.install.db.config.starterdb.password.SYSTEM=
oracle.install.db.config.starterdb.password.SYSMAN=
oracle.install.db.config.starterdb.password.DBSNMP=
oracle.install.db.config.starterdb.cOntrol=DB_CONTROL
oracle.install.db.config.starterdb.gridcontrol.gridCOntrolServiceURL=
oracle.install.db.config.starterdb.dbcontrol.enableEmailNotification=false
oracle.install.db.config.starterdb.dbcontrol.emailAddress=
oracle.install.db.config.starterdb.dbcontrol.SMTPServer=
oracle.install.db.config.starterdb.automatedBackup.enable=false
oracle.install.db.config.starterdb.automatedBackup.osuid=
oracle.install.db.config.starterdb.automatedBackup.ospwd=
oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=
oracle.install.db.config.asm.diskGroup=
oracle.install.db.config.asm.ASMSNMPPassword=
MYORACLESUPPORT_USERNAME=
MYORACLESUPPORT_PASSWORD=
SECURITY_UPDATES_VIA_MYORACLESUPPORT=
DECLINE_SECURITY_UPDATES=true
PROXY_HOST=
PROXY_PORT=
PROXY_USER=
PROXY_PWD=

(7)开始静默安装

[oracle@Oracle database]$ cd /var/app/oracle/database
[oracle@Oracle database]$ ./runInstaller -silent -responseFile  /var/app/oracle/database/response/db_install.rsp

(8)查看安装进度

[oracle@Oracle database]$ cd /var/app/oracle/oraInventory/logs
[oracle@Oracle logs]$ tail -f installActions*log

(9)当出现以下信息时

var/app/oracle/oraInventory/orainstRoot.sh
var/app/oracle/product/11.2.0/dbhome_1/root.sh
To execute the configuration scripts:
	1. Open a terminal window
	2. Log in  as "root"
	3. Run the scripts
	4. Return to this window and hit "Enter" key to continue
Successfully Setup Software.

打开新的客户端使用root身份执行以下脚本

[root@Oracle ~]# var/app/oracle/oraInventory/orainstRoot.sh
[root@Oracle ~]# var/app/oracle/product/11.2.0/dbhome_1/root.sh

(10)执行完上面的脚本后回到安装界面按下Enter继续。

5、配置Oracle监听

(1)运行监听文件

[oracle@Oracle ~]$ cd /var/app/oracle/database/response
[oracle@Oracle response]$ netca /silent /responsefile /var/app/oracle/database/response/netca.rsp

运行成功之后,在/var/app/oracle/product/11.2.0/dbhome_1/network/admin目录下会生成sqlnet.ora和listener.ora两个文件

[oracle@Oracle admin]$ ls
listener.ora  samples  shrept.lst  sqlnet.ora  tnsnames.ora

执行以下命令查看监听器是否已经在1521端口上开始工作了

[root@Oracle ~]# netstat -tlnp | grep 1521
tcp        0      0 :::1521                     :::*                        LISTEN      1792/tnslsnr

如果监听没有启动,则手动启动监听器

[oracle@Oracle ~]$ lsnrctl start

(2)配置Oracle数据库

[oracle@Oracle response]$ pwd
/var/app/oracle/database/response
[oracle@Oracle response]$ vi dbca.rsp
GDBNAME = "orcl11.us.oracle.com"     //78 行 全局数据库的名字=SID+主机域名
SID="ora11g"    //149行 SID
SYSPASSWORD = "oracle"    //190行
SYSTEMPASSWORD = "oracle"   //200行
CHARACTERSET="AL32UTF8" //415行 编码
NATIOnALCHARACTERSET="UTF8" //425行 编码

(3)创建数据库

[oracle@Oracle ~]$  $ORACLE_HOME/bin/dbca -silent -responseFile  /var/app/oracle/database/response/dbca.rsp

6、启动数据库

进入Oracle SQL命令行

[oracle@Oracle ~]$ sqlplus / as sysdba
SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/var/app/oracle/product/11.2.0/dbhome_1/dbs/initora11g.ora'

启动时会出现以上错误,解决方法如下:找到init.ora.78201817526文件,将其复制到/var/app/oracle/product/11.2.0/dbhome_1/dbs目录下

[oracle@Oracle admin]$ locate init.ora           //定位寻找目标文件
/var/app/admin/orcl11g/pfile/init.ora.78201817526               //目标文件
/var/app/oracle/product/11.2.0/dbhome_1/dbs/init.ora
/var/app/oracle/product/11.2.0/dbhome_1/srvm/admin/init.ora
[oracle@Oracle admin]$ cd /var/app/admin/orcl11g/pfile/
[oracle@Oracle pfile]$ ls
init.ora.78201817526
[oracle@Oracle pfile]$ cp init.ora.78201817526  /var/app/oracle/product/11.2.0/dbhome_1/dbs/
[oracle@Oracle dbs]$ mv init.ora.78201817526 initora11g.ora    //将目标文件改成所需文件名

进入到Oracle SQL命令行中,执行startup

[oracle@Oracle ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Fri Aug 10 01:59:43 2018
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> startup                                         //启动数据库实例
ORACLE instance started.
Total System Global Area  839282688 bytes
Fixed Size                  2217992 bytes
Variable Size             494929912 bytes
Database Buffers          339738624 bytes
Redo Buffers                2396160 bytes
Database mounted.
Database opened.

**** 参考文章:

https://blog.csdn.net/JIANG123456T/article/details/77745892

https://blog.csdn.net/zxx2403/article/details/46594597


推荐阅读
  • CEPH LIO iSCSI Gateway及其使用参考文档
    本文介绍了CEPH LIO iSCSI Gateway以及使用该网关的参考文档,包括Ceph Block Device、CEPH ISCSI GATEWAY、USING AN ISCSI GATEWAY等。同时提供了多个参考链接,详细介绍了CEPH LIO iSCSI Gateway的配置和使用方法。 ... [详细]
  • 成功安装Sabayon Linux在thinkpad X60上的经验分享
    本文分享了作者在国庆期间在thinkpad X60上成功安装Sabayon Linux的经验。通过修改CHOST和执行emerge命令,作者顺利完成了安装过程。Sabayon Linux是一个基于Gentoo Linux的发行版,可以将电脑快速转变为一个功能强大的系统。除了作为一个live DVD使用外,Sabayon Linux还可以被安装在硬盘上,方便用户使用。 ... [详细]
  • centos安装Mysql的方法及步骤详解
    本文介绍了centos安装Mysql的两种方式:rpm方式和绿色方式安装,详细介绍了安装所需的软件包以及安装过程中的注意事项,包括检查是否安装成功的方法。通过本文,读者可以了解到在centos系统上如何正确安装Mysql。 ... [详细]
  • 本文介绍了使用CentOS7.0 U盘刻录工具进行安装的详细步骤,包括使用USBWriter工具刻录ISO文件到USB驱动器、格式化USB磁盘、设置启动顺序等。通过本文的指导,用户可以轻松地使用U盘安装CentOS7.0操作系统。 ... [详细]
  • 在Docker中,将主机目录挂载到容器中作为volume使用时,常常会遇到文件权限问题。这是因为容器内外的UID不同所导致的。本文介绍了解决这个问题的方法,包括使用gosu和suexec工具以及在Dockerfile中配置volume的权限。通过这些方法,可以避免在使用Docker时出现无写权限的情况。 ... [详细]
  • Webmin远程命令执行漏洞复现及防护方法
    本文介绍了Webmin远程命令执行漏洞CVE-2019-15107的漏洞详情和复现方法,同时提供了防护方法。漏洞存在于Webmin的找回密码页面中,攻击者无需权限即可注入命令并执行任意系统命令。文章还提供了相关参考链接和搭建靶场的步骤。此外,还指出了参考链接中的数据包不准确的问题,并解释了漏洞触发的条件。最后,给出了防护方法以避免受到该漏洞的攻击。 ... [详细]
  • Linux磁盘的分区、格式化的观察和操作步骤
    本文介绍了如何观察Linux磁盘的分区状态,使用lsblk命令列出系统上的所有磁盘列表,并解释了列表中各个字段的含义。同时,还介绍了使用parted命令列出磁盘的分区表类型和分区信息的方法。在进行磁盘分区操作时,根据分区表类型选择使用fdisk或gdisk命令,并提供了具体的分区步骤。通过本文,读者可以了解到Linux磁盘分区和格式化的基本知识和操作步骤。 ... [详细]
  • 本文介绍了Linux系统中正则表达式的基础知识,包括正则表达式的简介、字符分类、普通字符和元字符的区别,以及在学习过程中需要注意的事项。同时提醒读者要注意正则表达式与通配符的区别,并给出了使用正则表达式时的一些建议。本文适合初学者了解Linux系统中的正则表达式,并提供了学习的参考资料。 ... [详细]
  • Ubuntu 9.04中安装谷歌Chromium浏览器及使用体验[图文]
    nsitionalENhttp:www.w3.orgTRxhtml1DTDxhtml1-transitional.dtd ... [详细]
  • 如何在服务器主机上实现文件共享的方法和工具
    本文介绍了在服务器主机上实现文件共享的方法和工具,包括Linux主机和Windows主机的文件传输方式,Web运维和FTP/SFTP客户端运维两种方式,以及使用WinSCP工具将文件上传至Linux云服务器的操作方法。此外,还介绍了在迁移过程中需要安装迁移Agent并输入目的端服务器所在华为云的AK/SK,以及主机迁移服务会收集的源端服务器信息。 ... [详细]
  • CentOS 7部署KVM虚拟化环境之一架构介绍
    本文介绍了CentOS 7部署KVM虚拟化环境的架构,详细解释了虚拟化技术的概念和原理,包括全虚拟化和半虚拟化。同时介绍了虚拟机的概念和虚拟化软件的作用。 ... [详细]
  • 本文介绍了在CentOS上安装Python2.7.2的详细步骤,包括下载、解压、编译和安装等操作。同时提供了一些注意事项,以及测试安装是否成功的方法。 ... [详细]
  • Linux下安装免费杀毒软件ClamAV及使用方法
    本文介绍了在Linux系统下安装免费杀毒软件ClamAV的方法,并提供了使用该软件更新病毒库和进行病毒扫描的指令参数。同时还提供了官方安装文档和下载地址。 ... [详细]
  • CentOS7.8下编译muduo库找不到Boost库报错的解决方法
    本文介绍了在CentOS7.8下编译muduo库时出现找不到Boost库报错的问题,并提供了解决方法。文章详细介绍了从Github上下载muduo和muduo-tutorial源代码的步骤,并指导如何编译muduo库。最后,作者提供了陈硕老师的Github链接和muduo库的简介。 ... [详细]
  • 本文详细介绍了在Centos7上部署安装zabbix5.0的步骤和注意事项,包括准备工作、获取所需的yum源、关闭防火墙和SELINUX等。提供了一步一步的操作指南,帮助读者顺利完成安装过程。 ... [详细]
author-avatar
借钱买黄瓜
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有