centos7静默安装数据库oralce11gr2

author author     2023-01-01     624

关键词:

一、系统版本

操作系统: CentOS Linux release 7.3.1611 (Core)

二、oracle软件版本

oracle版本:linux.x64_11gR2
linux.x64_11gR2_database_1of2.zip
linux.x64_11gR2_database_2of2.zip

三、创建用户、组

A) 创建用户和组

groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
passwd oracle

B) 创建数据库安装目录

mkdir -p /opt/oracle ##$ORACLE_BASE
mkdir -p /opt/oracle/product/112010/db_1 ##$ORACLE_HOME
mkdir /opt/oracle/oradata ##存放数据库目录
mkdir /opt/oracle/inventory
mkdir /opt/oracle/flash_recovery_area
chown -R oracle:oinstall /opt/oracle
chmod -R 775 /opt/oracle

C) 将oracle使用者加入到sudo群组中
vi /etc/sudoers
输入上面的命令后,打开sudoers文件进行编辑,找到
root ALL=(ALL) ALL

这行,并且在底下再加入以下命令:
oracle ALL=(ALL) ALL

四、修改系统参数、及环境变量

1、关闭selinux
vi /etc/selinux/config
修改: SELINUX=disabled

2、关闭防火墙
systemctl stop firewalld.service #停止服务|firewall
systemctl disable firewalld.service #禁止firewall开机启动

3、修改/etc/hosts文件
vi /etc/hosts
10.143.200.188 DATAFS

4、修改内核参数
vi /etc/sysctl.conf

修改以下内容
kernel.shmall = 2097152
kernel.shmmax = 1073741824

添加以下内容
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576

#sysctl -p

5、修改用户限制文件

#vi /etc/security/limits.conf
行末添加以下内容

oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240

6、关联设置
vi /etc/pam.d/login
行末添加以下内容:
session required /lib64/security/pam_limits.so
session required pam_limits.so

7、修改/etc/profile
#vi /etc/profile
添加以下内容:

if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi

source /etc/profile

8、Oralce用户修改用户环境变量

#vi /home/oracle/.bash_profile
在最底下加入以下内容
#For Oracle
export ORACLE_BASE=/opt/oracle;
export ORACLE_HOME=/opt/oracle/product/112010/db_1
export ORACLE_SID=orcl
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export LC_ALL="en_US"
export LANG="en_US"
export NLS_LANG="AMERICAN_AMERICA.ZHS16GBK"
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"

if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022

fi

source /home/oracle/.bash_profile
查看命令:# env

五、安装依赖包

安装依赖包比较多,最好服务器能够访问外网,这样就简单多了,如果真的无法访问外网只能下载对应的rpm包安装了.

yum -y install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel glibc glibc-common glibc-devel gcc gcc-c++ libaio-devel libaio libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel pdksh ksh libaio.i686 glibc.i686 compat-libstdc++-33.i686 libaio-devel.i686 libgcc.i686 libstdc++.i686 unixODBC.i686 unixODBC-devel.i686

rpm包安装:#rpm -ivh * --force --nodeps

六、正式开始安装数据库

1、安装包解压命令(使用oracle用户解压 )

$unzip linux.x64_11gR2_database_1of2.zip
$unzip linux.x64_11gR2_database_2of2.zip
修改目录所属用户
chown -R oracle:oinstall database

解压完成后会生成database目录,解压后的文件中database/response下有有db_install.rsp、dbca.rsp和netca.rsp三个应答文件,分别数据库安装文件、建立数据库实例和监听配置安装文件,在下面的步骤中会用到这3个文件.

2、编辑数据库安装文件db_install.rsp
vi db_install.rsp
20 oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
29 oracle.install.option=INSTALL_DB_SWONLY #安装类型
37 ORACLE_HOSTNAME=DATAFS #主机名称
42 UNIX_GROUP_NAME=oinstall #安装组
47 INVENTORY_LOCATION=/opt/oracle/inventory #INVENTORY目录
78 SELECTED_LANGUAGES=en,zh_CN #选择语言
83 ORACLE_HOME=/opt/oracle/product/112010/db_1 #oracle_home
88 ORACLE_BASE=/opt/oracle #oracle_base
99 oracle.install.db.InstallEdition=EE ##oracle版本
108 oracle.install.db.isCustomInstall=true
142 oracle.install.db.DBA_GROUP=dba #dba用户组
147 oracle.install.db.OPER_GROUP=dba #oper用户组
160 oracle.install.db.config.starterdb.type=GENERAL_PURPOSE #数据库类型
165 oracle.install.db.config.starterdb.globalDBName=orcl #globalDBName
170 oracle.install.db.config.starterdb.SID=orcl #SID
200 oracle.install.db.config.starterdb.memoryLimit=800 #自动管理内存的最小内存(M)
233 oracle.install.db.config.starterdb.password.ALL=oracle #设定所有数据库用户使用同一个密码
385 DECLINE_SECURITY_UPDATES=true #设置安全更新

3、安装数据库软件(使用oracle用户)
#su - oracle
进入刚才的database目录
./runInstaller -silent -responseFile /ghca/database/response/db_install.rsp -ignorePrereq
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 120 MB. Actual 13773 MB Passed
Checking swap space: must be greater than 150 MB. Actual 2047 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2018-09-20_09-16-02PM. Please wait ...

接下来就是等待(有点长,不要着急!!!),快的话10分钟左右,慢一点可能需要30分钟左右,要看服务器配置。

安装过程中,如果提示[WARNING]不必理会,此时安装程序仍在后台进行,如果出现[FATAL],则安装程序已经停止了。
可以在以下位置找到本次安装会话的日志。
安装失败会打印一下信息
[FATAL] [INS-32076] English cannot be removed from the selected languages list.
CAUSE: An attempt was made to remove English from the selected languages list.
ACTION: Select English as one of the selected product languages.
A log of this session is currently saved as: /tmp/OraInstall2018-09-20_09-16-02PM/installActions2018-09-20_09-16-02PM.log. Oracle recommends that if you want to keep this log, you should move it from the temporary location to a more permanent location.

查看log日志信息:
cat /tmp/OraInstall2018-09-20_09-16-02PM/installActions2018-09-20_09-16-02PM.log. Oracle

正常安装日志信息:
[[email protected] database]$ [WARNING] [INS-32055] The Central Inventory is located in the Oracle base.
CAUSE: The Central Inventory is located in the Oracle base.
ACTION: Oracle recommends placing this Central Inventory in a location outside the Oracle base directory.
[WARNING] [INS-32055] The Central Inventory is located in the Oracle base.
CAUSE: The Central Inventory is located in the Oracle base.
ACTION: Oracle recommends placing this Central Inventory in a location outside the Oracle base directory.
You can find the log of this install session at:
/opt/oracle/inventory/logs/installActions2018-09-20_09-47-28PM.log

tail -f /opt/oracle/inventory/logs/installActions2018-09-20_09-47-28PM.log

安装成功的日志如下:
The following configuration scripts need to be executed as the "root" user.
#!/bin/sh
#Root scripts to run

/opt/oracle/inventory/orainstRoot.sh
/opt/oracle/product/112010/db_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

4、 安装后操作,按照要求执行脚本
打开新的终端,以root身份登录,执行脚本:

#/opt/oracle/inventory/orainstRoot.sh
#/opt/oracle/product/112010/db_1/root.sh

[[email protected] db_1]# /opt/oracle/inventory/orainstRoot.sh
Changing permissions of /opt/oracle/inventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /opt/oracle/inventory to oinstall.
The execution of the script is complete.
[[email protected] db_1]# /opt/oracle/product/112010/db_1/root.sh
Check /opt/oracle/product/112010/db_1/install/root_DATAFS_2018-09-20_22-36-50.log for the output of root script

完成后,返回原来的终端按下回车键,等待程序安装完成.

七、监听器配置

执行命令 : netca /silent /responseFile /ghca/database/response/netca.rsp ###----此处必须写绝对路径
[[email protected] response]$ netca /silent /responseFile /ghca/database/response/netca.rsp

Parsing command line arguments:
Parameter "silent" = true
Parameter "responsefile" = /ghca/database/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:
/opt/oracle/product/112010/db_1/bin/lsnrctl start LISTENER
Listener Control complete.
Listener started successfully.
Profile configuration complete.
Oracle Net Services configuration successful. The exit code is 0

查看端口是否占用:
[[email protected] ~]# ss -tnl|grep 1521
LISTEN 0 128 :::1521 :::*
[[email protected] ~]#

查看监听状态:

[[email protected] response]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 21-SEP-2018 12:22:08

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=DATAFS)(PORT=1521)))
STATUS of the LISTENER

Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 21-SEP-2018 12:20:29
Uptime 0 days 0 hr. 1 min. 41 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/product/112010/db_1/network/admin/listener.ora
Listener Log File /opt/oracle/diag/tnslsnr/DATAFS/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=DATAFS)(PORT=1521)))
The listener supports no services
The command completed successfully

八、安装数据库实例

1 修改/ghca/database/response/dbca.rsp响应文件中的重要参数

本次安装过程中设置了下列参数:(注意下面参数视情况而定,不要照抄,原文件都有说明的)
RESPONSEFILE_VERSION ="11.2.0" #不能更改

OPERATION_TYPE ="createDatabase"

GDBNAME ="orcl" #数据库的名字

SID ="ORCL" ##对应的实例名字

TEMPLATENAME ="General_Purpose.dbc" ##建库用的模板文件

SYSPASSWORD ="oracle" ##SYS管理员密码

SYSTEMPASSWORD ="oracle" ##SYSTEM管理员密码

SYSMANPASSWORD= "oracle"

DBSNMPPASSWORD= "oracle"

DATAFILEDESTINATION =/opt/oracle/oradata ##数据文件存放目录

RECOVERYAREADESTINATION=/opt/oracle/flash_recovery_area ##恢复数据存放目录

CHARACTERSET ="ZHS16GBK" ##字符集,重要!!!建库后一般不能更改,所以建库前要确定清楚。

TOTALMEMORY ="1638" #1638MB,物理内存2G*80%。

2、 开始安装数据库实例
dbca -silent -responseFile /ghca/database/response/response/dbca.rsp
[[email protected] response]$ dbca -silent -responseFile /ghca/database/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 "/opt/oracle/cfgtoollogs/dbca/orcl/orcl.log" for further details.

到此数据库实例安装就完成了.

九、监听配置报错

配置监听时,没有使用netca.rsp相应的文件的绝对路径
[[email protected] response]$ netca /silent /responseFile netca.rsp

Parsing command line arguments:
Parameter "silent" = true
Parameter "responsefile" = ./netca.rsp
Oracle Net Configuration Assistant could not find the Response File at the given location.
Oracle Net Services configuration failed. The exit code is 1

十、数据库启停

登录数据库 sqlplus / as sysdba
启动:SQL> startup
停止:SQL> shutdown immediate;

十一、创建表空间以及用户、权限等

1、管理员用户创建表空间保存数据
create tablespace IDR_TS datafile ‘/opt/oracle/oradata/orcl/IDR_TS01.dbf‘ size 1024m;

2、创建用户数据操作用户

create user operator identified by "123456"
default tablespace operator
temporary tablespace TEMP
profile DEFAULT
quota unlimited on IDR_TS;

以下权限是可选的,根据自己需要给用户赋权
grant connect to operator;
grant dba to operator;
grant javasyspriv to operator;
-- Grant/Revoke system privileges
grant create any sequence to operator;
grant create any table to operator;
grant create any view to operator;
grant unlimited tablespace to operator;
-- Grant/Revoke role privileges
grant connect to operator;
grant dba to operator;
grant exp_full_database to operator;
grant imp_full_database to operator;
grant javasyspriv to operator;
grant resource to operator;
-- Grant/Revoke system privileges
grant create any sequence to operator;
grant alter any table to operator;
grant alter any trigger to operator;
grant alter session to operator;
grant alter system to operator;
grant alter tablespace to operator;
grant alter user to operator;
grant analyze any to operator;
grant create any procedure to operator;
grant create any synonym to operator;
grant create any table to operator;
grant create any trigger to operator;
grant create cluster to operator;
grant create database link to operator;
grant create procedure to operator;
grant create public synonym to operator;
grant create role to operator;
grant create sequence to operator;
grant create session to operator;
grant create synonym to operator;
grant create table to operator;
grant create any view to operator;
grant delete any table to operator;
grant drop any index to operator;
grant drop any synonym to operator;
grant drop any table to operator;
grant drop any trigger to operator;
grant drop public synonym to operator;
grant execute any procedure to operator;
grant insert any table to operator;
grant lock any table to operator;
grant select any table to operator;
grant unlimited tablespace to operator;
grant update any table to operator;
到此就可以使用operator登录进行数据操作了.数据库完整的安装就结束了.

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< installation is complete >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

oracl11gr2(静默安装)(代码片段)

参考博客地址:https://blog.csdn.net/jameshadoop/article/details/48223645https://www.abcdocker.com/abcdocker/2090http://blog.51cto.com/dellinger/1973696官方地址:http://www.oracle.com/technetwork/database/enterpri 查看详情

[转]--oracle11gr2静默安装&命令行安装(代码片段)

静默安装经常搭建Oracle测试环境,有时候觉得OUI(即图形界面)方式甚是繁琐,你得一步一步进行确认,所幸,Oracle支持静默安装。在我看来,它主要有两方面的好处:一、极大地提升了效率,尤其是批量安装。二、很多时候,... 查看详情

oracle11gr2静默安装db_install.rsp文件详解(代码片段)

...sinstallation.####对整个文件的说明,该文件包含参数说明,静默文件中密码信息的保密#######################################################################-------------------------------- 查看详情

centos7(同redhat)安装oracle11gr2最全最细攻略

前瞻:  1.安装Gnome桌面版X86_64版本的CentOS7系统(或者相对应版本的RedHat等)。  2.下载安装并激活XmanagerEnterprise5用于对linux系统的连接访问以及数据传输等。  3.下载解压缩oracle11gr2forlinux的程序包,并将其中的[database/stage/Co... 查看详情

centos7静默安装oracle11g

操作系统:[[email protected]~]#uname-mx86_64[[email protected]~]#cat/etc/redhat-releaseCentOSLinuxrelease7.1.1503(Core) 安装软件包:参考官方:http://docs.oracle.com/cd/E11882_01/install.112/e24326/toc. 查看详情

1.5小时!一键部署oracle11gr2rac集群

...包括安装补丁,建库。脚本下载链接:SHELL脚本进行oracle数据库一键安装,实现真正的无人值守安装GitHub:https://github.com/pc-study/InstallOracleshell一、主机准备节点主机版本主机内存主机磁盘空间主机网卡ASM盘rac01redhat7. 查看详情

centos7安装oracle11g(代码片段)

...使用Linux系统的wget命令,下载文件包;2、创建运行oracle数据库的系统用户和用户组: 查看详情

cento7静默安装oracle11g(代码片段)

安装硬件要求1、内存要求:内存最小1G,推荐2G或者更高。查看命令:grepMemTotal/proc/meminfo2、swap|RAW|Swap||:—-|:——||1G至2G|1.5倍||2G至16G|同RAW相等||16G以上|16G|查看命令:grepSwapTotal/proc/meminfo环境准备安装包:linux.x64_11gR2_database_1of2.zip... 查看详情

rac:oracle11gr2数据库一键安装(代码片段)

前言本文将演示如何使用脚本一键安装Oracle11GR2RAC2节点数据库的全过程。安装前准备在生产环境中,Linux操作系统和网络一般不是由DBA来配置,为了更贴合生产使用,本脚本仅用于安装Oracle数据库,请提前安装好Li... 查看详情

rac:oracle11gr2数据库一键安装(代码片段)

前言本文将演示如何使用脚本一键安装Oracle11GR2RAC2节点数据库的全过程。安装前准备在生产环境中,Linux操作系统和网络一般不是由DBA来配置,为了更贴合生产使用,本脚本仅用于安装Oracle数据库,请提前安装好Li... 查看详情

oracle11gr2rac数据库安装

文档控制​修改记录​日期​作者​版本​修改记录​2022年12月01日​王xx​V1.0​新建​分发者​姓名​单位​职位​审阅记录​姓名​单位​职位​1安装目标与规划​两台华为2288HV5服务器将安装Oracle11gR2RAC。​1.1安装介质版本... 查看详情

oraclelinux安装oracledatabase11gr2(代码片段)

...准备OracleLinux6.5的ISO文件OracleDatabase11gR2的Linux版本安装包数据库安装缺少的软件包XmanagerEnterprise5安装包相关文件下载链接:https://pan.baidu.com/s/1ESQUKFZdoI0EChwjO8_QtA提取码:orac1.操作系统安装安装系统之前首先根据自己的需求创建一... 查看详情

单机:oracle11gr2数据库一键安装(代码片段)

前言本文将演示如何使用脚本一键安装Oracle11GR2单机数据库的全过程。安装前准备在生产环境中,Linux操作系统和网络一般不是由DBA来配置,为了更贴合生产使用,本脚本仅用于安装Oracle数据库,请提前安装好Linux... 查看详情

单机:oracle11gr2数据库一键安装(代码片段)

前言本文将演示如何使用脚本一键安装Oracle11GR2单机数据库的全过程。安装前准备在生产环境中,Linux操作系统和网络一般不是由DBA来配置,为了更贴合生产使用,本脚本仅用于安装Oracle数据库,请提前安装好Linux... 查看详情

单机:oracle11gr2数据库一键安装(代码片段)

前言本文将演示如何使用脚本一键安装Oracle11GR2单机数据库的全过程。安装前准备在生产环境中,Linux操作系统和网络一般不是由DBA来配置,为了更贴合生产使用,本脚本仅用于安装Oracle数据库,请提前安装好Linux... 查看详情

oracle11g静默安装后lsnrctl文件0字节

CentOSrelease6.3x86_64环境下静默安装Oracle11g(linux_11gR2_database),INSTALL_DB_SWONLY安装完之后,包括lsnrctl在内的/u01/app/oracle/product/11.2.0/dbhome_1/bin目录下的好多文件都是0字节。lsnrctl程序无论如何执行都没有反应,导致无法启动监听。求... 查看详情

100天精通oracle-实战系列(第3天)超详细linux7安装单机oracle11gr2数据库

Linux7安装单机Oracle11GR2数据库(第3天)->返回总目录<-实战第2天我们讲了Linux6是Oracle11GR2最适配的操作系统,那为什么还要选择Linux7的系统来安装Oracle11GR2数据库呢?随着硬件版本的升级,Linux6版本将不再被支持安装,所以必... 查看详情

静默安装oracle查看日志重点看啥知道是不是成功安装

参考技术A1.操作系统及Oracle版本Linux版本:CentOSrelease6.3(Final)Oracle版本:OracleDatabase11gRelease2(11.2.0.1.0)forLinuxx86-64(linux.x64_11gR2_database_1of2.zip、linux.x64_11gR2_database_2of2.zip)2.硬件检测:物理内存不少于1G硬盘可以空间不少于5Gswap分区空... 查看详情