当前位置:网站首页>Oracle 11g静默安装
Oracle 11g静默安装
2022-08-03 05:26:00 【养了一只皮卡丘】
Oracle 11g静默安装
环境说明:
centos7 4G 2核
Oracle11g zip包,放到tmp,unzip解压 百度网盘下载提取码 xing
[[email protected] tmp]# ls
database //解压后的东西
hsperfdata_oracle
logs
p13390677_112040_Linux-x86-64_1of7.zip //百度网盘下载
p13390677_112040_Linux-x86-64_2of7.zip //百度网盘下载
systemd-private-62827135a4d14897b640b279c5f94087-chronyd.service-rUau8v
vmware-root
关闭防火墙,selinux
关闭防火墙:
# systemctl disable --now firewalld
关闭selinux:
# sed -i 's/enforcing/disabled/' /etc/selinux/config # 永久
重启查看状态:
# getenforce
Disabled
修改hosts
添加hosts,ip+主机名:
# cat >> /etc/hosts << EOF
192.168.143.139 localhost localhost
开始配置安装
安装Oracle 11g依赖包
yum -y 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
添加oinstall 、dba 组,新建oracle用户并加入oinstall、dba组中,设置密码
# groupadd oinstall
# groupadd dba
# useradd -g oinstall -G dba oracle
# passwd oracle
修改内核参数:
# vi /etc/sysctl.conf 添加以下参数
。。。。以上省略
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 1073741824
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
# /sbin/sysctl -p 生效
修改用户的限制文件
# 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
# End of file
修改/etc/pam.d/login文件
# vi /etc/pam.d/login
。。。。以上省略
# pam_selinux.so close should be the first session rule
session required pam_selinux.so close
session required pam_loginuid.so
session optional pam_console.so
//添加此二行
#session required /lib64/security/pam_limits.so
session required pam_limits.so
# pam_selinux.so open should only be followed by sessions to be executed in the user context
session required pam_selinux.so open
session required pam_namespace.so
session optional pam_keyinit.so force revoke
session include system-auth
session include postlogin
-session optional pam_ck_connector.so
修改/etc/profile文件
# vi /etc/profile
。。。。以上省略
# /usr/share/doc/setup-*/uidgid file
if [ $UID -gt 199 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; then
umask 002
else
umask 022
fi
//添加此8行(注意语言间距)
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
for i in /etc/profile.d/*.sh /etc/profile.d/sh.local ; do
if [ -r "$i" ]; then
if [ "${-#*i}" != "$-" ]; then
. "$i"
else
. "$i" >/dev/null
fi
fi
done
unset i
unset -f pathmunge
# source /etc/profile //读取文件
创建安装目录、修改文件权限
//执行命令
mkdir -p /u01/app/oracle/product/11.2.0
mkdir /u01/app/oracle/oradata
mkdir /u01/app/oracle/inventory
mkdir /u01/app/oracle/fast_recovery_area
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01/app/oracle
//切换到oracle用户,设置oracle用户环境变量,执行命令:
# su oracle
# vi /home/oracle/.bash_profile
。。。。以上省略
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
//添加此7行
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
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss'
export PATH
# source /home/oracle/.bash_profile 读取文件
编辑静默安装响应文件,可以替换下面文件,修改ORACLE_HOSTNAME为主机名称。
执行命令
# su root
# vi /tmp/database/response/db_install.rsp
//需要修改的参数
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=localhost
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
DECLINE_SECURITY_UPDATES=true
安装数据库监听
安装Oracle 11g
# cd /tmp/database
# ./runInstaller -silent -force -ignorePrereq -responseFile /tmp/database/response/db_install.rsp
切换root用户运行脚本
su root
sh /u01/app/oracle/inventory/orainstRoot.sh
sh /u01/app/oracle/product/11.2.0/root.sh
用oracle用户登录配置监听
# su oracle
# netca -silent -responseFile /tmp/database/response/netca.rsp
# yum install libXtst-deve
查看是否有端口
# netstat -tnulp | grep 1521
建立新库和实例
配置数据库
# vi /tmp/database/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"
静默配置
# su - oracle
# dbca -silent -responseFile /tmp/database/response/dbca.rsp
完成建库后进行实例检查
# ps -ef | grep ora_ | grep -v grep
# 查看监听状态:lsnrctl status
登录查看实例状态
启动数据库
# sqlplus / as sysdba
关闭数据库
# SQL> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.
开启数据库
# SQL> startup
ORACLE instance started.
Total System Global Area 1720328192 bytes
Fixed Size 2253944 bytes
Variable Size 1056967560 bytes
Database Buffers 654311424 bytes
Redo Buffers 6795264 bytes
Database mounted.
Database opened.
设置oracle开启启动
oracle用户新增启动文件
# vi /u01/app/oracle/start_ora.sh
#!/bin/sh
lsnrctl start
echo "Oracle just have been started!"
echo "Begin to start the oracle!"
sqlplus /nolog <<EOF
connect / as sysdba
startup
exit
EOF
exit
rc.local文件下添加脚本
# vi /etc/rc.d/rc.local
。。。。以上多行省略
su - oracle -c "/u01/app/oracle/start_ora.sh"
root用户,增加执行权限:
# chmod 755 /etc/rc.d/rc.local
# chmod 755 /u01/app/oracle/start_ora.sh
重启测试,如果不能启动,可能是环境变量没有生效。
使用source /oracle/home/.bash_profile命令使orale用户环境变量即时生效
如果重启后oracle用户环境变量每次都没有加载,可以root用户把环境变量配置到/etc/profile文件中
#以成功开机自启
[[email protected] ~]# su - oracle
上一次登录:二 2月 22 19:46:35 CST 2022
[[email protected] ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Tue Feb 22 19:47:55 2022
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
边栏推荐
猜你喜欢
随机推荐
Automatic ticket issuance based on direct reduction of China Southern Airlines app
内网渗透之PPT票据传递攻击(Pass the Ticket)
BurpSuite 进阶玩法
域名管理常见问题:IP、域名和DNS之间的区别和关系
IP数据包的格式(1)
笛卡尔积处理商品属性sku
数组与字符串14-使用双指针移除元素
pandoc -crossref插件实现markdwon文档转word后公式编号自定义
看了都收藏的3D游戏建模全流程解析,角色模型就该这么做!
守望先锋英雄角色模型分享,obj文件+材质贴图,3dmax游戏建模
ue4学习日记4(植被,光照,光束遮挡,天空球)
2-php学习笔记之控制语句,函数
贴片电阻的结构是怎样的?唯样商城
增强光学系统设计 | Zemax 全新 22.2 版本产品现已发布!
ZEMAX | 探究 OpticStudio 偏振分析功能
ZEMAX | 如何创建简单的非序列系统
802.1AS 延迟测量理解
001_旭日X3派初探:开箱测试
二层交换机,三层交换机,路由器内容总结记录
cb板上常用的电子元器件都有哪些?