CentOS7上静默(silent)模式安装Oracle12C Release 2 (12.2)
CentOS7上静默(silent)模式安装Oracle12C Release 2 (12.2)参考:http://dbaora.com/install-oracle-in-silent-mode-12c-release-2-12-2-on-oel7/安装依赖虚拟机环境:http://dbaora.com/install-oracle-linux-7/oracle下载:http://...
·
CentOS7上静默(silent)模式安装Oracle12C Release 2 (12.2)
安装依赖
- 虚拟机环境:http://dbaora.com/install-oracle-linux-7/
- oracle下载:http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html
- 安装包:linuxamd64_12201_database.zip
系统设置
- 关闭防火墙,禁用selinux,使用root用户配置os信息
# cat /etc/hosts
eg: <IP-address> <fully-qualified-machine-name> <machine-name>
eg: x.x.x.x yb-oracle yb-oracle.example.com
- 设置主机名
hostnamectl set-hostname yb-oracle.example.com --static
- 添加组
#groups for database management
groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
groupadd -g 54324 backupdba
groupadd -g 54325 dgdba
groupadd -g 54326 kmdba
groupadd -g 54327 asmdba
groupadd -g 54328 asmoper
groupadd -g 54329 asmadmin
groupadd -g 54330 racdba
- 添加oracl用户
useradd -u 54321 -g oinstall -G dba,oper,backupdba,dgdba,kmdba,racdba oracle
# 更改oracle密码
passwd oracle
安装依赖包
- 检查没有安装的依赖包
rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE}(%{ARCH})\n' binutils \
compat-libcap1 \
compat-libstdc++-33 \
glibc \
glibc-devel \
ksh \
libaio \
libaio-devel \
libX11 \
libXau \
libXi \
libXtst \
libgcc \
libstdc++ \
libstdc++-devel \
libxcb \
make \
nfs-utils \
smartmontools \
net-tools \
sysstat
直接用yum安装没有安装的软件包
yum install libaio-devel*.x86_64
yum install ksh*.x86_64
- 更改内核参数/etc/sysctl.conf
fs.file-max = 6815744
kernel.sem = 500 64000 200 256 # 注意这个参数
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
kernel.panic_on_oops=1
- 应用内核参数
/sbin/sysctl -p
- 在文件/etc/security/ limit.conf中为用户oracle设置shell限制
# shell limits for users oracle 12gR2
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 2048
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
oracle soft memlock 3145728
oracle hard memlock 3145728
配置oracle用户的环境变量
- 在oracle用户下添加下面内容到.bash_profile里
# Oracle Settings
export TMP=/tmp
export ORACLE_HOSTNAME=oel7.dbaora.com
export ORACLE_UNQNAME=ORA12C
export ORACLE_BASE=/ora01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/db_1
export ORACLE_SID=ORA12C
PATH=/usr/sbin:$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;
alias cdob='cd $ORACLE_BASE'
alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias envo='env | grep ORACLE'
umask 022
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -u 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
envo
- 在root用户下创建目录结构
# ORACLE_BASE – /ora01/app/oracle
# ORACLE_HOME – /ora01/app/oracle/product/12.2.0/db_1
mkdir -p /ora01/app/oracle/product/12.2.0/db_1
chown oracle:oinstall -R /ora01
备注:在Oracle Enterprise Linux 7 /tmp数据存储在tmpfs上,它消耗内存,而且太小。使用
systemctl mask tmp.mount
将其恢复为存储,笔者的tmp单独挂载出来的,此步骤没有操作
- 准备安装数据库
# su - oracle
unzip linuxamd64_12201_database.zip -d /ora01
# 定义oracle用户的环境变量,并查看
alias envo cdob cdoh tns
alias envo='env | grep ORACLE'
alias cdob='cd $ORACLE_BASE'
alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
eg:
[oracle@yb-oracle ~]$ envo
ORACLE_UNQNAME=ORA12C
ORACLE_SID=ORA12C
ORACLE_BASE=/ora01/app/oracle
ORACLE_HOSTNAME=yb-oracle.paic.com.cn
ORACLE_BIN=/ora01/app/oracle/product/12.2.0/db_1/bin # 后面追加的
ORACLE_HOME=/ora01/app/oracle/product/12.2.0/db_1
-- 执行别名 cdob & cdoh
[oracle@yb-oracle ~]$ cdob
[oracle@yb-oracle oracle]$ cdoh
[oracle@yb-oracle db_1]$ pwd
/ora01/app/oracle/product/12.2.0/db_1
oracle配置文件更改
oracle主要配置文件
- db_install.rsp: 用于安装oracle二进制文件,以静默模式安装/升级数据库
- dbca.rsp: 用于在静默模式下安装/配置/删除数据库
- netca.rsp: 用于在静默模式下为oracle数据库配置简单网络
$ cd /ora01/database/response/
$ ls
dbca.rsp db_install.rsp netca.rsp
- 安装oracle
# 编辑db_install.rsp前备份
cp db_install.rsp /ora01/database/response/db_install.rsp.bak
# eg:
$ egrep -v "^#|^$" /ora01/database/response/db_install.rsp
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v12.2.0
oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/ora01/app/oraInventory
ORACLE_HOME=/ora01/app/oracle/product/12.2.0/db_1
ORACLE_BASE=/ora01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.OSDBA_GROUP=dba
oracle.install.db.OSOPER_GROUP=oper
oracle.install.db.OSBACKUPDBA_GROUP=backupdba
oracle.install.db.OSDGDBA_GROUP=dgdba
oracle.install.db.OSKMDBA_GROUP=kmdba
oracle.install.db.OSRACDBA_GROUP=racdba
oracle.install.db.rac.configurationType=
oracle.install.db.CLUSTER_NODES=
oracle.install.db.isRACOneInstall=
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=
oracle.install.db.config.starterdb.memoryOption=
oracle.install.db.config.starterdb.memoryLimit=
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=
DECLINE_SECURITY_UPDATES=
PROXY_HOST=
PROXY_PORT=
PROXY_USER=
PROXY_PWD=
COLLECTOR_SUPPORTHUB_URL=
- 配置文件更改完成后,执行命令安装如下:
cd /ora01/database
./runInstaller -silent -responseFile /ora01/database/response/db_install.rsp -ignorePrereq -ignoreSysPrereqs
- 以root用户运行下面两个脚本
/ora01/app/oraInventory/orainstRoot.sh
/ora01/app/oracle/product/12.2.0/db_1/root.sh
- 配置ORACLE_BIN,验证安装
$ sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Thu Sep 20 14:25:10 2018
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to an idle instance.
- 配置网络
更改配置文件
cd /ora01/database/response
cp netca.rsp netca.rsp.bak
- 以标准配置启动LISTENER
netca -silent -responseFile /ora01//database/response/netca.rsp
lsnrctl start
- 检查LISTENER 状态
lsnrctl status
配置数据库
- 最后一个设置是使用一个可插入的数据库PORA12C1创建新的容器数据库ORA12C.dbaora.com,并配置和启用oracle db express
# 创建数据库目录及flash recovery 目录
mkdir /ora01/app/oracle/oradata
mkdir /ora01/app/oracle/flash_recovery_area
- 备份response文件
cd /ora01/database/response
cp dbca.rsp dbca.rsp.bak
# eg:
[oracle@yb-oracle response]$ egrep -v "^#|^$" dbca.rsp
responseFileVersion=/oracle/assistants/rspfmt_dbca_response_schema_v12.2.0
bName=ORA12C.dbaora.com
▽id=ORA12C
databaseConfigType=
RACOneNodeServiceName=
policyManaged=
createServerPool=
serverPoolName=
cardinality=
force=
pqPoolName=
pqCardinality=
createAsContainerDatabase=true
numberOfPDBs=1
pdbName=PORA12C1
useLocalUndoForPDBs=
pdbAdminPassword=Oracle12c
nodelist=
templateName=General_Purpose.dbc
sysPassword=Oracle12c
systemPassword=Oracle12c
oracleHomeUserPassword=
emConfiguration=DBEXPRESS
emExpressPort=5500
runCVUChecks=
dbsnmpPassword=Oracle12c
omsHost=
omsPort=
emUser=
emPassword=
dvConfiguration=
dvUserName=
dvUserPassword=
dvAccountManagerName=
dvAccountManagerPassword=
olsConfiguration=
datafileJarLocation=
datafileDestination=/ora01/app/oracle/oradata
recoveryAreaDestination=/ora01/app/oracle/flash_recovery_area
storageType=FS
diskGroupName=
asmsnmpPassword=
recoveryGroupName=
characterSet=AL32UTF8
nationalCharacterSet=AL16UTF16
registerWithDirService=
dirServiceUserName=
dirServicePassword=
walletPassword=
listeners=LISTENER
variablesFile=
variables=
initParams=
sampleSchema=true
memoryPercentage=
databaseType=OLTP
automaticMemoryManagement=FALSE
totalMemory=4096
- 执行数据库安装
cd /ora01/database/
dbca -silent -createDatabase -responseFile /ora01/database/response/dbca.rsp
Copying database files
1% complete
13% complete
25% complete
Creating and starting Oracle instance
26% complete
30% complete
31% complete
35% complete
38% complete
39% complete
41% complete
Completing Database Creation
42% complete
43% complete
44% complete
46% complete
47% complete
50% complete
Creating Pluggable Databases
55% complete
75% complete
Executing Post Configuration Actions
100% complete
Look at the log file "/ora01/app/oracle/cfgtoollogs/dbca/ORA12C/ORA12C.log" for further details.
- 确认连接
sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Thu Sep 20 11:34:00 2018
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> show parameter db_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string ORA12C
SQL> alter session set container=PORA12C1;
Session altered.
SQL> show con_id
CON_ID
------------------------------
3
SQL> show con_name
CON_NAME
------------------------------
PORA12C1
SQL> select DBMS_XDB_CONFIG.GETHTTPSPORT
2 from dual;
GETHTTPSPORT
------------
0
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
- 编辑“/etc/oratab”文件,将ORA12C的重启标志设置为“Y”
ORA12C:/ora01/app/oracle/product/12..0/db_1:Y
到此,oracle安装已经全部完成
安装oracle报错
[oracle@yb-oracle response]$ dbca -silent -createDatabase -responseFile /ora01/database/response/dbca.rsp
[FATAL] [DBT-11211] The Automatic Memory Management option is not allowed when the total physical memory is greater than 4GB.
CAUSE: The current total physical memory is 15GB.
解决: automaticMemoryManagement=FALSE
> [FATAL] [DBT-06103] The port (5,500) is already in use.
ACTION: Specify a free port.
解决:hosts解析问题,eg:oracleip yb-oracle yb-oracle.example.com
更多推荐
已为社区贡献19条内容
所有评论(0)