小编给大家分享一下如何静默安装Oracle单机,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!
一、前期准备
1.硬件检查
cat /etc/issue
uname -r (版本)
grep MemTotal /proc/meminfo (内存大小)
grep SwapTotal /proc/meminfo (交换区大小)
grep "model name" /proc/cpuinfo (CPU信息)
free (可用内存)
2.检查依赖包
[root@dgc ~]# rpm -q binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc-2.5 glibc-common glibc-devel glibc-headers ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel
binutils-2.20.51.0.2-5.42.el6.x86_64
package compat-libstdc++-33 is not installed
elfutils-libelf-0.158-3.2.el6.x86_64
package elfutils-libelf-devel is not installed
gcc-4.4.7-11.el6.x86_64
package gcc-c++ is not installed
package glibc-2.5 is not installed
glibc-common-2.12-1.149.el6.x86_64
glibc-devel-2.12-1.149.el6.x86_64
glibc-headers-2.12-1.149.el6.x86_64
package ksh is not installed
libaio-0.3.107-10.el6.x86_64
package libaio-devel is not installed
libgcc-4.4.7-11.el6.x86_64
libstdc++-4.4.7-11.el6.x86_64
package libstdc++-devel is not installed
make-3.81-20.el6.x86_64
sysstat-9.0.4-27.el6.x86_64
unixODBC-2.2.14-14.el6.x86_64
package unixODBC-devel is not installed
3.创建所需的操作系统组和用户
groupadd oinstall
groupadd dba
groupadd oper
useradd -g oinstall -G dba oracle
passwd oracle
4.创建安装目录及权限
mkdir -p /app/oracle
chown -R oracle.oinstall /app/oracle
5.修改内核参数
vi /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
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
6.修改用户限制
vi /etc/security/limits.conf
#for oracle
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
vi /etc/pam.d/login
session required /lib/security/pam_limits.so
7.创建/etc/oraInst.loc文件,内容如下
nventory_loc=/app/oracle/oraInventory
inst_group=oinstall
更改文件的权限
chown oracle:oinstall /etc/oraInst.loc
chmod 664 /etc/oraInst.loc
8.设置oracle环境变量
vi /home/oracle/.bash_profile
export PATH
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_BASE=/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11204/db
export ORACLE_SID=orcl
export ORACLE_TERM=xterm
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$CRS_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
umask 022
9.使设置生效
source /home/oracle/.bash_profile
10.配置hosts文件
vi /etc/hosts
10.102.98.231 adgc
注:
同时,在使用静默安装的时候会检查DISPLAY的设置,如果经常说检查DISPLAY不行的话,到root用户下执行 "xhost + 你的ip:0.0"
二、实施部署
1.解压oracle安装文件
unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip
2.复制响应文件模板,设置响应文件权限(注意调整个人环境路径 )
mkdir $ORACLE_BASE/etc
cp /backup/software/database/response
(2)安装DB
[oracle@dgc ~]$ dbca -silent -responsefile /app/oracle/etc/dbca.rsp
报错: 模板 new_orcl.dbc 不存在。请为数据库创建操作指定现有模板。
安装模版所在位置:
[oracle@dgc ~]$ cd /app/oracle/product/11204/db_1/assistants/dbca/templates
[oracle@dgc templates]$ ls
Data_Warehouse.dbc example.dmp New_Database.dbt Seed_Database.dfb
example01.dfb General_Purpose.dbc Seed_Database.ctl
[oracle@dgc etc]$ dbca -silent -responsefile /app/oracle/etc/dbca.rsp
输入 SYS 用户口令:
输入 SYSTEM 用户口令:
复制数据库文件
1% 已完成
3% 已完成
11% 已完成
18% 已完成
26% 已完成
37% 已完成
正在创建并启动 Oracle 实例
40% 已完成
45% 已完成
50% 已完成
55% 已完成
56% 已完成
60% 已完成
62% 已完成
正在进行数据库创建
66% 已完成
70% 已完成
73% 已完成
85% 已完成
96% 已完成
100% 已完成
有关详细信息, 请参阅日志文件 "/app/oracle/cfgtoollogs/dbca/orcl/orcl.log"。
5.安装配置网络监听
(1)安装监听
[oracle@dgc etc]$ netca -silent -responsefile /app/oracle/etc/netca.rsp
正在对命令行参数进行语法分析:
参数"silent" = true
参数"responsefile" = /app/oracle/etc/netca.rsp
完成对命令行参数进行语法分析。
Oracle Net Services 配置:
完成概要文件配置。
Oracle Net 监听程序启动:
正在运行监听程序控制:
/app/oracle/product/11204/db_1/bin/lsnrctl start LISTENER
监听程序控制完成。
监听程序已成功启动。
监听程序配置完成。
成功完成 Oracle Net Services 配置。退出代码是0
(2)检查监听状态
[oracle@dgc etc]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 12-MAR-2018 19:50:19
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 12-MAR-2018 19:49:58
Uptime 0 days 0 hr. 0 min. 21 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /app/oracle/product/11204/db_1/network/admin/listener.ora
Listener Log File /app/oracle/diag/tnslsnr/dgc/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dgc)(PORT=1521)))
The listener supports no services
The command completed successfully
(3)增加tnsnames.ora文件
[oracle@dgc admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /home/app/oracle/product/11.2.0/db/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
orcl =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dgc)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
(4)测试连接
[oracle@dgc admin]$ sqlplus sys/oracle@orcl as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Mar 12 23:00:54 2018
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> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@dgc admin]$
(5)检查并修改数据库参数(根据情况而定)
例如: memory_max_target, sga_max_size, processes, pga_aggregate_target 等等
SYS@orcl > alter system set processes=1000 scope=spfile;
System altered.
SYS@orcl > alter system set sga_max_size=20g scope=spfile;
System altered.
SYS@orcl > alter system set sga_target=20g scope=spfile;
System altered.
SYS@orcl > alter system set pga_aggregate_target=6g scope=spfile;
System altered.
SYS@orcl > alter system set nls_time_format='yyyy-mm-dd hh34:mi:ss' scope=spfile;
System altered.
以上是“如何静默安装Oracle单机”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注亿速云行业资讯频道!