码迷,mamicode.com
首页 > 数据库 > 详细

Oracle 12C R2静默安装文档

时间:2018-05-25 01:38:39      阅读:820      评论:0      收藏:0      [点我收藏+]

标签:session   kernel   ams   生效   pool   1.0   mem   schema   std   

禁用防火墙
/etc/init.d/iptables stop
/etc/init.d/ip6tables stop
chkconfig iptables off


禁用SELinux
cat /etc/selinux/config
-- 改成SELINUX=disabled
# 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 these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted


临时关闭selinux
setenforce 0


vi /etc/sysctl.conf 添加如下内容:
kernel.msgmnb = 65536
fs.file-max = 6815744
kernel.msgmni = 2878
kernel.msgmax = 8192
kernel.msgmnb = 65536
kernel.sem = 250 32000 100 142
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
kernel.sysrq = 1
net.core.rmem_default = 1048576
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
fs.aio-max-nr = 3145728
net.ipv4.ip_local_port_range = 9000 65500
vm.min_free_kbytes = 51200


生效:
sysctl -p

vi /etc/security/limits.conf 添加如下内容:
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768


vi /etc/pam.d/login
session required pam_limits.so

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

创建组和用户
/usr/sbin/groupadd oinstall
/usr/sbin/groupadd dba
/usr/sbin/useradd -g oinstall -G dba oracle

如果oracle用户已经存在
[oracle@hcdb response]$ /usr/sbin/usermod -g oinstall -G dba oracle

[oracle@hcdb response]$ echo oracle | passwd --stdin oracle


安装依赖软件包
# linux 6
yum install -y gcc gcc-c++ glibc glibc-devel libaio libaio-devel libgcc libstdc++ libstdc++-devel libXext libXtst libX11 libXau libXi make sysstat unixODBC-devel unixODBC ksh compat-libcap1 compat-libstdc++-33

# linux 7
yum install -y binutils* compat-libcap1* compat-libstdc++* glibc* glibc-devel* ksh* libX11* libXau* libXi* libXtst* libaio* libaio-devel* libgcc* libstdc++* libstdc++-devel* libxcb* make* net-tools* nfs-utils* smartmontools* sysstat* unixODBC* binutils*686* compat-libcap1*686* compat-libstdc++*686* glibc*686* glibc-devel*686* ksh*686* libX11*686* libXau*686* libXi*686* libXtst*686* libaio*686* libaio-devel*686* libgcc*686* libstdc++*686* libstdc++-devel*686* libxcb*686* make*686* net-tools*686* nfs-utils*686* smartmontools*686* sysstat*686* unixODBC*686*

创建目录结构

mkdir -p /home/software
mkdir -p /home/app/oracle
mkdir -p /home/app/oracle/admin/lgjdb/adump
mkdir -p /home/app/oracle/admin/lgjdb/dpdump
mkdir -p /home/app/oracle/admin/lgjdb/pfile
mkdir -p /home/app/oracle/audit
mkdir -p /home/app/oracle/cfgtoollogs/dbca/lgjdb
mkdir -p /home/app/oracle/oradata/lgjdb
mkdir -p /home/app/oracle/product/12.2.0.1/db_1/dbs

[oracle@hcdb response]$ chown -R oracle:oinstall /home/app
[oracle@hcdb response]$ chmod -R 775 /home/app

 

设置环境变量
[oracle@hcdb response]$ vi /home/oracle/.bash_profile
export ORACLE_BASE=/home/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0.1/db_1/
export ORACLE_SID=lgjdb
export PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin
export PATH

 

 

[oracle@hcdb response]$ cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.56.18 hcdb


调整应答文件模版

oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v12.2.0
oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/home/app/oraInventory
ORACLE_HOME=/home/app/oracle/product/12.2.0.1/db_1
ORACLE_BASE=/home/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.OSDBA_GROUP=dba
oracle.install.db.OSOPER_GROUP=dba
oracle.install.db.OSBACKUPDBA_GROUP=dba
oracle.install.db.OSDGDBA_GROUP=dba
oracle.install.db.OSKMDBA_GROUP=dba
oracle.install.db.OSRACDBA_GROUP=dba
oracle.install.db.rac.configurationType=
oracle.install.db.CLUSTER_NODES=
oracle.install.db.isRACOneInstall=false
oracle.install.db.racOneServiceName=
oracle.install.db.rac.serverpoolName=
oracle.install.db.rac.serverpoolCardinality=
oracle.install.db.config.starterdb.type=
oracle.install.db.config.starterdb.globalDBName=
oracle.install.db.config.starterdb.SID=
oracle.install.db.ConfigureAsContainerDB=
oracle.install.db.config.PDBName=
oracle.install.db.config.starterdb.characterSet=AL32UTF8
oracle.install.db.config.starterdb.memoryOption=
oracle.install.db.config.starterdb.memoryLimit=16384
oracle.install.db.config.starterdb.installExampleSchemas=
oracle.install.db.config.starterdb.password.ALL=
oracle.install.db.config.starterdb.password.SYS=
oracle.install.db.config.starterdb.password.SYSTEM=
oracle.install.db.config.starterdb.password.DBSNMP=
oracle.install.db.config.starterdb.password.PDBADMIN=
oracle.install.db.config.starterdb.managementOption=
oracle.install.db.config.starterdb.omsHost=
oracle.install.db.config.starterdb.omsPort=
oracle.install.db.config.starterdb.emAdminUser=
oracle.install.db.config.starterdb.emAdminPassword=
oracle.install.db.config.starterdb.enableRecovery=
oracle.install.db.config.starterdb.storageType=
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=
oracle.install.db.config.asm.diskGroup=
oracle.install.db.config.asm.ASMSNMPPassword=
MYORACLESUPPORT_USERNAME=
MYORACLESUPPORT_PASSWORD=
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
DECLINE_SECURITY_UPDATES=true
oracle.installer.autoupdates.option=SKIP_UPDATES
PROXY_HOST=
PROXY_PORT=
PROXY_USER=
PROXY_PWD=
COLLECTOR_SUPPORTHUB_URL=


安装Oracle软件
[oracle@hcdb response]$ pwd
/home/software/database

[oracle@hcdb response]$ chmod 700 /home/software/database/response/my_db_install.rsp


[oracle@hcdb response]$ ./runInstaller -silent -force -ignorePrereq -responseFile /home/software/database/response/my_db_install.rsp

 

当出现:
As a root user, execute the following script(s):
1. /home/app/oraInventory/orainstRoot.sh
2. /home/app/oracle/product/12.2.0.1/db_1/root.sh

 

Successfully Setup Software.

切换到root用户执行一下提示的脚本
确认执行

成功。到此已经静默的安装了Oracle软件。

 

静默配置监听

[oracle@hcdb response]$ netca -silent -responsefile /home/software/database/response/netca.rsp

 

静默创建数据库

创建数据文件存放位置
[oracle@hcdb response]$ mkdir –p /home/oradata
[oracle@hcdb response]$ chown oracle:oinstall /home/oradata

dbca -silent -createDatabase -templateName General_Purpose.dbc \
-gdbname lgjdb -sid lgjdb \
-responseFile NO_VALUE \
-sysPassword oracle \
-systemPassword oracle \
-emConfiguration NONE \
-recoveryAreaDestination NONE \
-datafileDestination /home/oradata \
-redoLogFileSize 200 \
-sampleSchema false \
-automaticMemoryManagement true \
-initParams processes=500,audit_trail=NONE \
-characterSet AL32UTF8 \
-nationalCharacterSet AL16UTF16 \
-memoryPercentage 40

参数说明:
1. gdbname表示全局数据库名称
2. sid表示数据库实例名,单实例环境下sid默认跟service_name一样
3. –responseFile应答文件,这里没有用所以是NO_VALUE
4. SysPassword, systemPassword 分别是sys,system用户的密码
5. –emConfiguration ,recoveryAreaDestination这里是关闭了OEM,闪回区的功能,现网的使用中一般都不会开启这些功能
6. DatafileDestination表示数据文件存放位置
7. redoLogFileSize 重做日志的大小,单位是M,默认只有50M,应该根据实际需要进行调整,这里调整为200M
8. sampleSchema 是否需要创建示例用户(SCOTT,SH,…)
9. automaticMemoryManagement 是否启用内存自动管理
10. initParams后面可以跟多个参数=值的形式,用逗号间隔,这里测试了调整数据库连接数和关闭数据库审计功能两个参数,可以根据需要配置需要的参数。
11. characterSet 设置字符集,数据库创建完成后,就不可以调整了,或者说调整非常困难,因此一定要在执行前确认好使用哪种字符集
12. nationalCharacterSet 设置国家字符集
13. memoryPercentage设置Oracle总共使用服务器的物理内存百分比


登录验证:
set linesize 500
set pagesize 999
col COMP_ID for a20
col comp_name for a40
col VERSION for a20
col STATUS for a20
select comp_id,comp_name,version,status from sys.dba_registry;


COMP_ID COMP_NAME VERSION STATUS
-------------------- ---------------------------------------- -------------------- --------------------
CATALOG Oracle Database Catalog Views 12.2.0.1.0 VALID
CATPROC Oracle Database Packages and Types 12.2.0.1.0 VALID
JAVAVM JServer JAVA Virtual Machine 12.2.0.1.0 VALID
XML Oracle XDK 12.2.0.1.0 VALID
CATJAVA Oracle Database Java Packages 12.2.0.1.0 VALID
APS OLAP Analytic Workspace 12.2.0.1.0 VALID
RAC Oracle Real Application Clusters 12.2.0.1.0 OPTION OFF
XDB Oracle XML Database 12.2.0.1.0 VALID
OWM Oracle Workspace Manager 12.2.0.1.0 VALID
CONTEXT Oracle Text 12.2.0.1.0 VALID
ORDIM Oracle Multimedia 12.2.0.1.0 VALID
SDO Spatial 12.2.0.1.0 VALID
XOQ Oracle OLAP API 12.2.0.1.0 VALID
OLS Oracle Label Security 12.2.0.1.0 VALID
DV Oracle Database Vault 12.2.0.1.0 VALID

15 rows selected.

 


查看监听状态
[oracle@hcdb response]$ lsnrctl status

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 24-MAY-2018 01:18:41

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hcdb)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date 24-MAY-2018 00:36:52
Uptime 0 days 0 hr. 41 min. 49 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /home/app/oracle/product/12.2.0.1/db_1/network/admin/listener.ora
Listener Log File /home/app/oracle/diag/tnslsnr/hcdb/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=hcdb)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "lgjdb" has 1 instance(s).
Instance "lgjdb", status READY, has 1 handler(s) for this service...
Service "lgjdbXDB" has 1 instance(s).
Instance "lgjdb", status READY, has 1 handler(s) for this service...
The command completed successfully

Oracle 12C R2静默安装文档

标签:session   kernel   ams   生效   pool   1.0   mem   schema   std   

原文地址:https://www.cnblogs.com/liang545621/p/9085961.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!