01.CentOS7静默安装oracle11g

news2024/9/21 4:20:50

CentOS7静默安装oracle11g

  • 一、下载Oracle11g安装包
  • 二、开始安装oracle11g
  • 三、配置Oracle监听程序
  • 四、添加数据库实例
  • 五、设置开机启动
  • 六、登录后解除锁定

一、下载Oracle11g安装包

下载链接:https://pan.baidu.com/s/1gcLMFGX7-8ju7OoFOFLzQA
提取码:636s
也可在oracle官网下载

  1. 关闭防火墙
service iptables stop
systemctl stop firewalld
systemctl disable firewalld
  1. 关闭selinux
    使用以下命令进入配置文件将SELINUX的值修改为disabled
vi /etc/selinux/config
# 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 three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

在这里插入图片描述
使用setenforce 0使命令生效
在这里插入图片描述

  1. 上传下载好的Oracle安装文件
    在这里插入图片描述
  2. 下载安装 unzip 软件,用来解压上传的Oracle安装文件
    命令为yum install -y unzip zip
    在这里插入图片描述
  3. 开始解压
unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip

在这里插入图片描述

二、开始安装oracle11g

  1. 安装Oracle 11g依赖包
yum install yum install gcc make binutils gcc-c++ compat-libstdc++-33 elfutils-libelf-devel elfutils-libelf-devel-static ksh libaio libaio-devel numactl-devel sysstat unixODBC unixODBC-devel pcre-devel -y

在这里插入图片描述

  1. 添加安装用户和用户组
[root@localhost opt]# groupadd oinstall
[root@localhost opt]# groupadd dba
[root@localhost opt]# useradd -g oinstall -G dba oracle
[root@localhost opt]# passwd oracle
Changing password for user oracle.
New password:              #输入密码时必须是字符+数字+特殊字符,否则不通过
Retype new password:
passwd: all authentication tokens updated successfully.
[root@localhost opt]#

在这里插入图片描述

  1. 修改参数

命令如下,进入相关配置文件

 vi /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmall = 2097152
kernel.shmmax = 4294967295
kernel.shmmni = 4096
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
net.ipv4.ip_local_port_range = 9000 65500

在这里插入图片描述
使用sysctl -p使修改的参数立即生效
在这里插入图片描述

  1. 创建安装目录和设置文件权限
[root@localhost ~]# mkdir -p /u01/app/oracle/product/11.2.0
[root@localhost ~]# mkdir /u01/app/oracle/oradata
[root@localhost ~]# mkdir /u01/app/oracle/inventory
[root@localhost ~]# mkdir /u01/app/oracle/fast_recovery_area
[root@localhost ~]# chown -R oracle:oinstall /u01/app/oracle
[root@localhost ~]# chmod -R 775 /u01/app/oracle
  1. 设置oracle用户环境变量
[root@localhost ~]# su - oracle
[oracle@localhost ~]$ vi .bash_profile
[oracle@localhost ~]$

添加以下内容

ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/11.2.0
ORACLE_SID=orcl
PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH

在这里插入图片描述

  1. 编辑静默安装响应文件
[oracle@localhost ~]$ cp -R /opt/database/response/ .
[oracle@localhost ~]$ cd response/
[oracle@localhost response]$ vi db_install.rsp
[oracle@localhost response]$ 

将其中参数值修改为以下内容:

oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oracle/inventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/u01/app/oracle/product/11.2.0
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=dba
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=orcl
oracle.install.db.config.starterdb.SID=orcl               
oracle.install.db.config.starterdb.characterSet=AL32UTF8  
oracle.install.db.config.starterdb.memoryLimit=800        
oracle.install.db.config.starterdb.password.ALL=oracle     
DECLINE_SECURITY_UPDATES=true                              
  1. 安装Oracle主程序

进入相应的database目录执行安装命令

[oracle@localhost response]$ cd /opt/database/
[oracle@localhost database]$ ./runInstaller -silent -responseFile /home/oracle/response/db_install.rsp -ignorePrereq

等待一段时间…(时间的话看机器性能)
在这里插入图片描述
出现如上图所示信息,说明主程序安装成功安装成功。

三、配置Oracle监听程序

  1. 打开一个新命令窗口

执行以下命令:

sh /u01/app/oracle/inventory/orainstRoot.sh
sh /u01/app/oracle/product/11.2.0/root.sh

执行后结果如下:

C:\Users\en>ssh root@192.168.66.120
root@192.168.66.120's password:
Last login: Tue Oct 31 16:57:07 2023 from 192.168.66.1
[root@localhost ~]# sh /u01/app/oracle/inventory/orainstRoot.sh
Changing permissions of /u01/app/oracle/inventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /u01/app/oracle/inventory to oinstall.
The execution of the script is complete.
[root@localhost ~]# sh /u01/app/oracle/product/11.2.0/root.sh
Check /u01/app/oracle/product/11.2.0/install/root_localhost.localdomain_2023-10-31_17-42-41.log for the output of root script
[root@localhost ~]#
  1. 切换回oracle用户,依次执行如下命令
source .bash_profile
netca /silent /responsefile /home/oracle/response/netca.rsp

执行结果如下:

[oracle@localhost ~]$ source .bash_profile
[oracle@localhost ~]$ netca /silent /responsefile /home/oracle/response/netca.rsp

Parsing command line arguments:
    Parameter "silent" = true
    Parameter "responsefile" = /home/oracle/response/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Configuring Listener:LISTENER
Listener configuration complete.
Oracle Net Listener Startup:
    Running Listener Control:
      /u01/app/oracle/product/11.2.0/bin/lsnrctl start LISTENER
    Listener Control complete.
    Listener started successfully.
Profile configuration complete.
Oracle Net Services configuration successful. The exit code is 0
[oracle@localhost ~]$

查看1521端口是否启动,示例如下:

[oracle@localhost ~]$ netstat -tnulp| grep 1521
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp6       0      0 :::1521                 :::*                    LISTEN      9026/tnslsnr
[oracle@localhost ~]$

如若使用netstat报错,可以在root用户下执行yum install net-tools安装net-tools工具。

  1. 关于监听的开启和关闭

开启监听:/u01/app/oracle/product/11.2.0/bin/lsnrctl start
关闭监听:/u01/app/oracle/product/11.2.0/bin/lsnrctl stop

四、添加数据库实例

  1. 编辑数据库实例文件
vi /home/oracle/response/dbca.rsp

修改以下参数

GDBNAME = "orcl"
SID = "orcl"
SYSPASSWORD = "oracle"
SYSTEMPASSWORD = "oracle"
SYSMANPASSWORD = "oracle"
DBSNMPPASSWORD = "oracle"
DATAFILEDESTINATION =/u01/app/oracle/oradata
RECOVERYAREADESTINATION=/u01/app/oracle/fast_recovery_area
CHARACTERSET = "ZHS16GBK"
TOTALMEMORY = "1638"

其中TOTALMEMORY = “1638” 为1638MB,物理内存2G*80%。TOTALMEMORY的值 要根据自己实际的内存去分配

  1. 执行以下命令
dbca -silent -responseFile /home/oracle/response/dbca.rsp

执行后示例如下:

[oracle@localhost ~]$ dbca -silent -responseFile /home/oracle/response/dbca.rsp
Copying database files
1% complete
3% complete
11% complete
18% complete
26% complete
37% complete
Creating and starting Oracle instance
40% complete
45% complete
50% complete
55% complete
56% complete
60% complete
62% complete
Completing Database Creation
66% complete
70% complete
73% complete
85% complete
96% complete
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/orcl/orcl.log" for further details.
  1. 检查实例进程
[oracle@localhost ~]$ ps -ef | grep ora_ | grep -v grep
oracle    11293      1  0 18:46 ?        00:00:00 ora_pmon_orcl
oracle    11295      1  0 18:46 ?        00:00:01 ora_vktm_orcl
oracle    11299      1  0 18:46 ?        00:00:00 ora_gen0_orcl
oracle    11301      1  0 18:46 ?        00:00:00 ora_diag_orcl
oracle    11303      1  0 18:46 ?        00:00:00 ora_dbrm_orcl
oracle    11305      1  0 18:46 ?        00:00:00 ora_psp0_orcl
oracle    11307      1  0 18:46 ?        00:00:00 ora_dia0_orcl
oracle    11309      1  0 18:46 ?        00:00:00 ora_mman_orcl
oracle    11311      1  0 18:46 ?        00:00:00 ora_dbw0_orcl
oracle    11313      1  0 18:46 ?        00:00:00 ora_lgwr_orcl
oracle    11315      1  0 18:46 ?        00:00:00 ora_ckpt_orcl
oracle    11317      1  0 18:46 ?        00:00:00 ora_smon_orcl
oracle    11319      1  0 18:46 ?        00:00:00 ora_reco_orcl
oracle    11321      1  0 18:46 ?        00:00:00 ora_mmon_orcl
oracle    11323      1  0 18:46 ?        00:00:00 ora_mmnl_orcl
oracle    11325      1  0 18:46 ?        00:00:00 ora_d000_orcl
oracle    11327      1  0 18:46 ?        00:00:00 ora_s000_orcl
oracle    11339      1  0 18:46 ?        00:00:00 ora_qmnc_orcl
oracle    11373      1  0 18:46 ?        00:00:00 ora_cjq0_orcl
oracle    11522      1  0 18:46 ?        00:00:00 ora_q000_orcl
oracle    11524      1  0 18:46 ?        00:00:00 ora_q001_orcl
[oracle@localhost ~]$
  1. 查看监听zhuangtai
[oracle@localhost ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 31-OCT-2023 18:50:27

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                31-OCT-2023 18:08:07
Uptime                    0 days 0 hr. 42 min. 20 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@localhost ~]$
  1. 登录查看实例状态
[oracle@localhost ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Tue Oct 31 18:52:23 2023

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> select status from v$instance;

STATUS
------------
OPEN

SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@localhost ~]$

五、设置开机启动

  1. 修改 /u01/app/oracle/product/11.2.0/bin路径下的dbstart dbshut脚本,将两个脚本中的ORACLE_HOME_LISTNER=$1,修改为ORACLE_HOME_LISTNER=$ORACLE_HOME
[oracle@localhost ~]$ vi /u01/app/oracle/product/11.2.0/bin/dbstart
[oracle@localhost ~]$ vi /u01/app/oracle/product/11.2.0/bin/dbshut

在这里插入图片描述

  1. 修改/etc/oratab文件,将orcl:/u01/app/oracle/product/11.2.0:N中最后的N改为Y,成为orcl:/u01/app/oracle/product/11.2.0:Y
vi /etc/oratab

在这里插入图片描述

  1. 修改rc.local文件
[oracle@localhost ~]$ vi /etc/rc.d/rc.local

添加以下内容:

su oracle -lc "/u01/app/oracle/product/11.2.0/bin/lsnrctl start"  #加上引号才能把空格后的start,当作命令的一部分
su oracle -lc /u01/app/oracle/product/11.2.0/bin/dbstart

在这里插入图片描述

  1. 重启后执行netstat -tpln,示例如下:
[oracle@localhost ~]$ netstat -tpln
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      -
tcp6       0      0 :::1521                 :::*                    LISTEN      1032/tnslsnr
tcp6       0      0 :::28084                :::*                    LISTEN      1319/ora_d000_orcl
tcp6       0      0 :::22                   :::*                    LISTEN      -
tcp6       0      0 ::1:25                  :::*                    LISTEN      -
[oracle@localhost ~]$

发现有1521监听端口存在,配置成功

六、登录后解除锁定

[oracle@localhost ~]$ source .bash_profile
[oracle@localhost ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Tue Oct 31 19:23:34 2023

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> alter user SYSTEM account unlock;

User altered.

SQL>
  1. 配置navicat

用navicat连接测试
用户名:SYSTEM
密码:oracle
此时可能会报错如下图所示oracle library is not loaded

在这里插入图片描述
进入https://www.oracle.com/database/technologies/instant-client/winx64-64-downloads.html下载如下图所示文件
在这里插入图片描述
解压文件,将 oci.dll ,文件路径拷贝到OCI环境,重启Navicat 即可。
在这里插入图片描述
在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1153473.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

python_PyQt5日周月K线纵向对齐显示_3_聚焦某段图形

目录 写在前面: 结果显示: 代码: 写在前面: “PyQt5日周月K线纵向对齐显示”,将分三篇博文描述 1 数据处理。将数据处理成适合图形显示的格式。(已写,请看往期博文) 2 显示工具…

搜维尔科技:Varjo在心理学、医学研究、技术、工程学等领域都在使用

该软件用于心理学、医学研究、可用性、品牌和营销等领域。vajio头显组合到了运动8.0平台中,提供了在高保真虚拟环境中进行的行为研究,否则这些环境的成本太高,不切实际,甚至无法在现实世界中再现。 在心理学、医学研究、可用性、技术、工程学、市场营销等领域工作的学术和商业研…

【项目管理】生命周期风险评估

规划阶段目标:识别系统的业务战略,以支撑系统的安全需求及安全战略 规划阶段评估重点:1、本阶段不需要识别资产和脆弱性;2、应根据被评估对象的应用对象、应用环境、业务状况、操作要求等方面识别威胁; 设计阶段目标…

草莓熊代码

话不多说直接上代码 如果需要exe文件电脑可以不依赖环境直接运行请评论或者私信 注意: 不需要年月日显示 注释 879-894 行不需要雪花显示 注释 895-908 行不需要礼物显示 注释 771 行653行 可以修改 祝你节日快乐内容657行 可以修改 草莓熊 内容修改程序标题 第 16 行# -*- co…

Tower for Mac—Git客户端 支持M1

Tower是一款Mac OS X系统上的Git客户端软件,它提供了丰富的功能和工具,帮助用户更加方便地管理和使用Git版本控制系统。以下是Tower的一些特点: 1. 界面友好:Tower的界面友好,使用户能够轻松地掌握软件的使用方法。 …

使用考试培训系统定制适合不同学生需求的教学内容

考试培训系统是一种方便高效的教育工具,可以根据不同学生的需求定制教学内容。通过使用这个系统,教师可以为学生提供个性化的学习计划,帮助他们提高学习效果。以下将详细介绍如何使用考试培训系统定制适合不同学生需求的教学内容。 考试培训系…

联手皇室企业 哪吒汽车发力阿联酋

布局阿联酋,哪吒汽车全球化战略加速落地。10月27日,哪吒汽车与阿联酋知名企业——EIH Automotive &Trading,在上海签署战略合作协议,并宣布2024年将为阿联酋带去多款车型。拥有皇室背景的EIH Automotive &Trading,将成为哪吒汽车在阿联酋的首家战略经销商,加速哪吒汽车…

【深度学习实验】网络优化与正则化(二):基于自适应学习率的优化算法详解:Adagrad、Adadelta、RMSprop

文章目录 一、实验介绍二、实验环境1. 配置虚拟环境2. 库版本介绍 三、实验内容0. 导入必要的库1. 随机梯度下降SGD算法a. PyTorch中的SGD优化器b. 使用SGD优化器的前馈神经网络 2.随机梯度下降的改进方法a. 学习率调整b. 梯度估计修正 3. 梯度估计修正:动量法Momen…

Termux SFTP如何实现远程文件传输

文章目录 1. 安装openSSH2. 安装cpolar3. 远程SFTP连接配置4. 远程SFTP访问4. 配置固定远程连接地址 SFTP(SSH File Transfer Protocol)是一种基于SSH(Secure Shell)安全协议的文件传输协议。与FTP协议相比,SFTP使用了…

LSH 复习(考试向)

LSH Review OverallMinhash SignaturesBinary Matrix(bit-vector)Construct MinHash matrixGenerate simulated permutationsJaccard similarities Tuning Parameters for rNNS Overall hash就是将不同长度规则的文本转化成相同长度的字符串&#xff0c…

问CHAT:以“重要性”为题写一篇作文

今天小编带大家看看,如何利用CHAT 写一篇作文,那我们来根据要求来问它。 问CHAT :以“重要性”为题写一篇作文,非语言交流的基础”根据下面的提纲来写作文。 1)非言语交际概述。 (暗示:暗示、敏感、情感、非语言) 2)非言语交际的…

Leetcode刷题---搜索插入位置(Java实现二分查找算法)

题目描述&#xff1a; 题解一 class Solution {public int searchInsert(int[] nums, int target) {int i0;while(i<nums.length){if(nums[i]>target){return i;}if(nums[i]<target ){i;}}return i;} }题解二—使用二分查找算法 使用算法前提&#xff1a;数组是一…

52张扑克牌(Python字符串替换)

输入a~d的字母对应扑克牌黑、红、梅、方花色 1~13数字对应扑克牌点数&#xff1b;输出“字母数字”字符串对应的扑克牌花色和点数。 (本笔记适合熟悉Python循环和str字符串处理的coder翻阅) 【学习的细节是欢悦的历程】 Python 官网&#xff1a;https://www.python.org/ Free…

【二叉树经典题目】

根据二叉树创建字符串 本题的关键在于什么情况要省略括号&#xff0c;什么情况不能省略&#xff1a; 左右为空可以省略括号 左不为空&#xff0c;右为空可以省略括号左为空,右不为空不能省略括号 class Solution { public://1.左右为空可以省略括号//2.左不为空&#xff0c;右…

杰林码纠错算法库(lib、dll)以及AWGN信道BPSK信号下的仿真程序(C/C++)

2023年10月30日此次是我最后一次在国内发布纠错算法的测试程序&#xff0c;这个算法2018年左右就出来了第一个版本&#xff0c;部分网络上也能下载到测试程序&#xff0c;尽管以前的版本效率跟不上&#xff0c;而且码率比较固定只能支持0.63。通过几年的努力&#xff0c;我这次…

分享一下怎么做一个同城配送小程序

如何制作一个同城配送小程序&#xff1a;功能特点、使用指南及未来展望 一、引言 随着互联网的快速发展&#xff0c;人们对于生活服务的需求越来越高。同城配送作为连接消费者与商家的桥梁&#xff0c;越来越受到人们的关注。本文将详细介绍如何制作一个同城配送小程序&#…

oracel处理XML时,报ORA-31011、ORA-19202。

原字段为clob&#xff0c; 查询 SELECT XMLTYPE(字段) FROM TABLE_A报错如下&#xff1a; ORA-31011: XML 语法分析失败 ORA-19202: XML 处理 LPX-00217: invalid character 12 (U000C) Error at line 1559时出错 ORA-06512: 在 "SYS.XMLTYPE", line 272 ORA-0651…

3ds Max2022安装教程(最新最详细)

目录 一.简介 二.安装步骤 网盘资源见文末 一.简介 3DS Max是由Autodesk公司开发的一款专业三维建模、动画和渲染软件&#xff0c;广泛应用于影视、游戏、建筑和工业设计等领域。 3DS Max的主要特点和功能包括&#xff1a; 三维建模&#xff1a;3DS Max提供了各种强大的建…

【数据结构】数组和字符串(十一):字符串的定义与存储(顺序存储、链式存储及其C语言实现)

文章目录 4.3 字符串4.3.1 字符串的定义与存储1. 顺序存储2. 链式存储3. C语言实现顺序存储4. C语言实现链式存储代码优化 4.3 字符串 字符串(String)是由零个或多个字符(char)顺序排列组成的有限序列&#xff0c;简称为串。例如 “good morning”就是由12个字符构成的一个字符…

优思学院|制作SPC控制图一定要用Minitab吗?

如果是使用SPC控制图作为一种控制过程变异的工具&#xff0c;无需使用Minitab&#xff0c;用Excel已经相当足够。但无论你使用哪种工具&#xff0c;你都应该要先明白SPC或者控制图工具的目的是什么&#xff0c;以及如何选择合适的控制图&#xff0c;以及如何去解读它等等。 要…