当前位置:网站首页>Oracle 11g silent install
Oracle 11g silent install
2022-08-03 06:33:00 【Got a Pikachu】
Oracle 11g静默安装
环境说明:
centos7 4G 2核
Oracle11g zip包,放到tmp,unzip解压 百度网盘下载提取码 xing
[[email protected] tmp]# ls
database //unpacked stuff
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
//add these two lines
#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行(Pay attention to language spacing)
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 读取文件
编辑静默安装响应文件,The following files can be replaced,修改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
Install database listener
安装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
Build new libraries and instances
配置数据库
# 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
After the library is built, check the instance
# 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开启启动
oracleThe user adds a startup file
# 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
重启测试,如果不能启动,It may be that the environment variable does not take effect.
使用source /oracle/home/.bash_profile命令使oraleUser environment variables take effect immediately
如果重启后oracleUser environment variables are not loaded every time,可以rootThe user configures environment variables to /etc/profile文件中
#It starts automatically with a successful boot
[[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>
边栏推荐
猜你喜欢
随机推荐
AI智能剪辑,仅需2秒一键提取精彩片段
新手学习3DMAX游戏建模,该如何锻炼思维?请看下面
802.1AS的SystemIdentity理解
IP数据包的格式(1)
剑指 Offer II 001. 整数除法
Prometheus监控容器、pod、邮件告警
内网渗透之PPT票据传递攻击(Pass the Ticket)
BOA服务器移植之嵌入式开发板(FS4412)
【面筋1】一些没什么标准答案的问题
宝塔负载均衡配置及nfs共享
JS--正则表达式
SSL证书验证怎么做?有几种方式?
看了都收藏的3D游戏建模全流程解析,角色模型就该这么做!
TFS(Azure DevOps)禁止多人同时签出
servlet学习(七)ServletContext
php 数组元素移动
权限管理 UGO 、 ACL 、特殊权限
SQLMAP介绍及使用
DNS常见资源记录类型详解
MySql的Sql语句的练习(试试你能写出来几道呢)