官方安装指南:
Oracle® Database Quick Installation Guide
环境准备
Oracle安装
首先请去官网下载软件包:
Oracle 11.2.0.4.0下载地址
https://updates.oracle.com/Orion/Services/download/p13390677_112040_Linux-x86-64_1of7.zip?aru=16716375&patch_file=p13390677_112040_Linux-x86-64_1of7.zip
https://updates.oracle.com/Orion/Services/download/p13390677_112040_Linux-x86-64_2of7.zip?aru=16716375&patch_file=p13390677_112040_Linux-x86-64_2of7.zip
1.1 安装前准备
1.1.1 内存及swap要求
查看内存
grep MemTotal /proc/meminfo
grep SwapTotal /proc/meminfo
Between 1 GB and 2 GB 1.5 times the size of the RAM
Between 2 GB and 16 GB Equal to the size of the RAM
More than 16 GB 16 GB
dd if=/dev/zero of=/srv/swapfile_1.0G bs=1M count=1024 && mkswap /srv/swapfile_1.0G && chmod 0600 /srv/swapfile_1.0G && swapon -p 100 /srv/swapfile_1.0G && swapon -s && free -mh
1.2 硬盘空间
Installation TypeRequirement for Software Files (GB)
Enterprise Edition4.7
Standard Edition4.6
1.3 修改主机名,及ip对应关系
设置主机名,也可以直接修改/etc/hostname,不过这个是重启之后才起作用
#sed - i"s/HOSTNAME=localhost.localdomain/HOSTNAME=database/g"/etc/sysconfig/netwok
如果不想重启,则使用下面命令,使当前生效
#hostname database
添加主机名与**IP对应记录**
#vi /etc/hosts
10.10.0.48 oracle
1.4 关闭Selinux
我自己没有关闭过selinux,这个是网上提供说需要关闭的
sed -i "s/SELINUX=enforcing/SELINUX=disabled/"/etc/selinux/config
setenforce 0
1.5上传软件
上传到/home/oracle/ 解压Oracle安装文件
# cd /home/oracle/
# unzip linux.x64_11gR2_database_1of2.zip -d /software/
# unzip linux.x64_11gR2_database_2of2.zip -d /software/
1.6 系统配置
创建用户和组
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
echo "72RDyZZMaU61tlw"|passwd --stdin oracle
id oracle
创建相应安装目录
mkdir -p /u01/app/oracle
mkdir -p /u01/app/oraInventory
mkdir -p /u01/app/oracle/oradata
mkdir -p /u01/app/oracle/recovery_data
chown -R oracle:oinstall /u01/app/
chmod -R 755 /u01/app/
修改系统内核参数
[root@oradg1 ~]vim /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100128
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 #使配置生效
调整会话限制
[root@oradg1 ~]# vim /etc/pam.d/login 文件最后添加:
session required pam_limits.so
调整oracle用户的进程数与最大文件句柄数
[root@oradg1 ~]# vim /etc/security/limits.conf 文件的最后添加:
oracle soft nproc 10000
oracle hard nproc 16384
oracle soft nofile 52768
oracle hard nofile 6553
root soft nproc 2047
root hard nproc 16384
root soft nofile 1024
root hard nofile 65536
soft是最小值,hard是最大值,nofile是文件句柄,也就是这个用户能打开的文件数,nproc是进程数
1.7 增加环境变量
oracle用户变量
[root@oradg1 ~]# vim /home/oracle/.bash_profile
umask 022
export ORACLE_BASE=/u01/app
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
export ORACLE_SID=orcl
export LANG=en_US.UTF-8
#export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"
PATH=$PATH:$HOME/.local/bin:$HOME/bin:$ORACLE_HOME/bin
添加全局变量
[root@oradg1 ~]# vi /etc/profile
export PATH=$PATH:/u01/app/oracle/product/11.2.0/db_1/bin
不要忘了让环境变生效
source /etc/profile
source /home/oracle/.bash_profile
1.8 安装oracle
安装依赖包
The following or later version of packages for Oracle Linux 7, and Red Hat Enterprise Linux 7 must be installed:
binutils-2.23.52.0.1-12.el7.x86_64
compat-libcap1-1.10-3.el7.x86_64
compat-libstdc++-33-3.2.3-71.el7.i686
compat-libstdc++-33-3.2.3-71.el7.x86_64
gcc-4.8.2-3.el7.x86_64
gcc-c++-4.8.2-3.el7.x86_64
glibc-2.17-36.el7.i686
glibc-2.17-36.el7.x86_64
glibc-devel-2.17-36.el7.i686
glibc-devel-2.17-36.el7.x86_64
ksh
libaio-0.3.109-9.el7.i686
libaio-0.3.109-9.el7.x86_64
libaio-devel-0.3.109-9.el7.i686
libaio-devel-0.3.109-9.el7.x86_64
libgcc-4.8.2-3.el7.i686
libgcc-4.8.2-3.el7.x86_64
libstdc++-4.8.2-3.el7.i686
libstdc++-4.8.2-3.el7.x86_64
libstdc++-devel-4.8.2-3.el7.i686
libstdc++-devel-4.8.2-3.el7.x86_64
libXi-1.7.2-1.el7.i686
libXi-1.7.2-1.el7.x86_64
libXtst-1.2.2-1.el7.i686
libXtst-1.2.2-1.el7.x86_64
make-3.82-19.el7.x86_64
sysstat-10.1.5-1.el7.x86_64
执行命令查看是否有依赖包:rpm -q binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXi libXtst make sysstat unixODBC unixODBC-devel
执行命令安装缺少的包:yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33i686 compat-libstdc++-33.devel compat-libstdc++-33 compat-libstdc++-33.devel gcc gcc-c++ glibc glibc.i686 glibc-devel glibc-devel.i686 ksh libaio libaio.i686 libaio-devel libaio-devel.devel libgcc libgcc.i686 libstdc++ libstdc++.i686 libstdc++-devel libstdc++-devel.devel libXi libXi.i686 libXtst libXtst.i686 make sysstat unixODBC unixODBC.i686 unixODBC-devel unixODBC-devel.i686
yum -y install binutils-* compat-libstdc++-* elfutils-libelf-* elfutils-libelf-devel-* gcc-* gcc-c++-* glibc-* glibc-common-* glibc-devel-* glibc-headers-* ksh-* libaio-* libaio-devel-* libgcc-* libgomp-* libstdc++-* libstdc++-devel* make-* sysstat-* unixODBC-* libXp ksh readline readline-devel
到这里前期的准备工作全部完成啦,建议重启下系统让各项配置生效。当然也可以不重启
1.9 应答文件修改 /home/oracle/database/response
此种应答文件是安装并配置数据库,直接产生orcl数据库实例
应答文件模版在解压后的文件夹中。
/home/oracle/database/response/db_install.rsp
模版中重要的配置项含义如下
ORACLE_HOSTNAME 主机名
ORACLE_BASE oracle的基础安装目录
ORACLE_HOME oracle的安装目录
INVENTORY_LOCATION oracle日志目录
oracle.install.db.config.starterdb.globalDBName
oracle.install.db.config.starterdb.password.ALL
1.1.1 db_install.rsp文件中追加-
[root@localhost response]# grep -v '^#' db_install.rsp | grep -v '^$'
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=node100
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oraInventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.EEOptionsSelection=false
oracle.install.db.optionalComponents=oracle.rdbms.partitioning:11.2.0.4.0,oracle.oraolap:11.2.0.4.0,oracle.rdbms.dm:11.2.0.4.0,oracle.rdbms.dv:11.2.0.4.0,oracle.rdbms.lbac:11.2.0.4.0,oracle.rdbms.rat:11.2.0.4.0
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oinstall
oracle.install.db.CLUSTER_NODES=
oracle.install.db.isRACOneInstall=
oracle.install.db.racOneServiceName=
oracle.install.db.config.starterdb.type=
oracle.install.db.config.starterdb.globalDBName=orcl
oracle.install.db.config.starterdb.SID=orcl
oracle.install.db.config.starterdb.characterSet=ZHS16GBK
oracle.install.db.config.starterdb.memoryOption=true
oracle.install.db.config.starterdb.memoryLimit=512
oracle.install.db.config.starterdb.installExampleSchemas=false
oracle.install.db.config.starterdb.enableSecuritySettings=true
oracle.install.db.config.starterdb.password.ALL=sys
oracle.install.db.config.starterdb.password.SYS=
oracle.install.db.config.starterdb.password.SYSTEM=
oracle.install.db.config.starterdb.password.SYSMAN=
oracle.install.db.config.starterdb.password.DBSNMP=
oracle.install.db.config.starterdb.control=DB_CONTROL
oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL=
oracle.install.db.config.starterdb.automatedBackup.enable=false
oracle.install.db.config.starterdb.automatedBackup.osuid=
oracle.install.db.config.starterdb.automatedBackup.ospwd=
oracle.install.db.config.starterdb.storageType=
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=/u01/app/oracle/oradata
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=/u01/app/oracle/recovery_data
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
PROXY_HOST=
PROXY_PORT=
PROXY_USER=
PROXY_PWD=
PROXY_REALM=
COLLECTOR_SUPPORTHUB_URL=
oracle.installer.autoupdates.option=
oracle.installer.autoupdates.downloadUpdatesLoc=
AUTOUPDATES_MYORACLESUPPORT_USERNAME=
AUTOUPDATES_MYORACLESUPPORT_PASSWORD=
创建oraInst.loc(可选)
新建一个文件,没有此文件会报错
vim /etc/oraInst.loc ,其内容如下:
inventory_loc=/u01/app/oraInventory
inst_group=oinstall
开放权限:
chown oracle:oinstall /etc/oraInst.loc
chmod 664 /etc/oraInst.loc
然后执行-注意:这里直接通过参数配置的方式运行静默安装数据库软件,运行如下命令就可以了
su - oracle
/home/oracle/database/runInstaller -silent -debug -force -ignoreSysPrereqs -ignorePrereq FROM_LOCATION=/home/oracle/database/stage/products.xml oracle.install.option=INSTALL_DB_SWONLY UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=/u01/app/oraInventory ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 ORACLE_HOSTNAME=node100 ORACLE_BASE=/u01/app/oracle oracle.install.db.InstallEdition=EE oracle.install.db.isCustomInstall=false oracle.install.db.DBA_GROUP=dba oracle.install.db.OPER_GROUP=oinstall UNIX_GROUP_NAME=oinstall DECLINE_SECURITY_UPDATES=true oracle.install.db.config.starterdb.characterSet=ZHS16GBK oracle.install.db.config.starterdb.globalDBName=orcl oracle.install.db.config.starterdb.SID=orcl SELECTED_LANGUAGES=en,zh_CN oracle.install.db.config.starterdb.memoryLimit=512 oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=/u01/app/oracle/oradata oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=/u01/app/oracle/recovery_data
参数可选:-invPtrLoc /home/oracle/oraInst.loc -ignoreSysPrereqs
#查看日志看进度 /u01/app/oraInventory/logs/installActions2018-05-29_07-17-34PM.log
成功后显示:
......
CAUSE: Some of the optional prerequisites are not met. See logs for details. /u01/app/oraInventory/logs/installActions2022-03-17_08-27-18PM.log
ACTION: Identify the list of failed prerequisite checks from the log: /u01/app/oraInventory/logs/installActions2022-03-17_08-27-18PM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.
You can find the log of this install session at:
/u01/app/oraInventory/logs/installActions2022-03-17_08-27-18PM.log
The installation of Oracle Database 11g was successful.
Please check '/u01/app/oraInventory/logs/silentInstall2022-03-17_08-27-18PM.log' for more details.
As a root user, execute the following script(s):
1. /u01/app/oracle/product/11.2.0/db_1/root.sh
Successfully Setup Software.
root权限执行安装后的配置脚本
su - root
sh /u01/app/oracle/product/11.2.0/db_1/root.sh
1.10 静默建库
vim /home/oracle/database/response/dbca.rsp, 覆盖以下选项:
注意:一定要按原来的参数所在的位置修改,不然报错
[root@localhost response]# grep -v '^#' dbca.rsp | grep -v '^$'
[GENERAL]
RESPONSEFILE_VERSION = "11.2.0" //不能更改
OPERATION_TYPE = "createDatabase"
[CREATEDATABASE]
GDBNAME = "orcl" //全局数据库的名字=SID+主机域名
SID = "orcl"//对应的实例名字
TEMPLATENAME = "General_Purpose.dbc" //建库用的模板文件
SYSPASSWORD = "sys" // sys管理员密码
SYSTEMPASSWORD = "sys" //system管理员密码
DATAFILEDESTINATION =/u01/app/oracle/oradata //数据文件存放目录
RECOVERYAREADESTINATION=/u01/app/oracle/recovery_data //恢复数据存放目录
CHARACTERSET = "ZHS16GBK"//字符集,重要!!! 建库后一般不能更改,所以建库前要确定清楚。
[createTemplateFromDB]
SOURCEDB = "myhost:1521:orcl"
SYSDBAUSERNAME = "system"
TEMPLATENAME = "My Copy TEMPLATE"
[createCloneTemplate]
SOURCEDB = "orcl"
TEMPLATENAME = "My Clone TEMPLATE"
[DELETEDATABASE]
SOURCEDB = "orcl"
[generateScripts]
TEMPLATENAME = "New Database"
GDBNAME = "orcl11.us.oracle.com"
[CONFIGUREDATABASE]
[ADDINSTANCE]
DB_UNIQUE_NAME = "orcl11g.us.oracle.com"
NODELIST=
SYSDBAUSERNAME = "sys"
[DELETEINSTANCE]
DB_UNIQUE_NAME = "orcl11g.us.oracle.com"
INSTANCENAME = "orcl11g"
SYSDBAUSERNAME = "sys"
TOTALMEMORY = "470" //ORACLE内存
1.11oracle用户执行配置完之后,执行命令
dbca -silent -responseFile /home/oracle/database/response/dbca.rsp
建库输出过程--------------------
Copying database files
1% complete
3% complete
11% complete
18% complete
26% complete
37% complete
Creating and starting Oracle instance
40% complete
45% complete
50% complete
55% complete
56% complete
60% complete
62% complete
Completing Database Creation
66% complete
70% complete
73% complete
85% complete
96% complete
100% complete
Look at the log file "/u01/app/cfgtoollogs/dbca/orcl/orcl.log" for further details.
1.12配置监听
netca -silent -responseFile /home/oracle/database/response/netca.rsp
创建监听输出过程------------
Parsing command line arguments:
Parameter "silent" = true
Parameter "responsefile" = /software/database/response/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Oracle Net Listener Startup:
Running Listener Control:
/u01/app/oracle/product/11.2.0/db_1/bin/lsnrctl start LISTENER
Listener Control complete.
Listener started successfully.
Listener configuration complete.
Oracle Net Services configuration successful. The exit code is 0
启动服务
linux下开启oracle
su - oracle
sqlplus /nolog
conn /as sysdba
startup
exit
.启动监听
lsnrctl start
1.12.1 关闭数据库服务
linux下关闭oracle
su - oracle
sqlplus /nolog
conn /as sysdba
shutdown immediate
exit
2023-06-23
oracle 11g R2(静默安装)for Centos7
评论
发表评论
姓 名: