1. 创建用户和用户组
[[email protected] ~]# groupadd oinstall
[[email protected] ~]# groupadd dba
[[email protected] ~]# useradd -g oinstall -G dba oracle
[[email protected] ~]# passwd oracle
Changing password for user oracle.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
2. 创建oracle安装所需要的目录
[[email protected] ~]# mkdir /u01
[[email protected] ~]# chown -R oracle:oinstall /u01
[[email protected] ~]# ls -l / |grep u01
drwxr-xr-x 2 oracle oinstall 4096 Jul 31 09:40 u01
3. 配置oracle用户的环境变量,并利用环境变量创建安装所需要的目录
[[email protected] ~]# su - oracle
[[email protected] ~]$ vi .bash_profile
[[email protected] ~]$ . .bash_profile
[[email protected] ~]$ more .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=sky
export PATH=$ORACLE_HOME/bin:$PATH
[[email protected] ~]$ mkdir -p $ORACLE_HOME
[[email protected] ~]$ tree /u01
/u01
`-- app
`-- oracle
`-- product
`-- 11.2.0
`-- db_1
5 directories, 0 files
[[email protected] ~]# mkdir /u01/oraData
[[email protected] ~]# chown -R oracle:oinstall /u01/oraData
[[email protected] ~]# mkdir /u01/oraInventory
[[email protected] ~]# chown -R oracle:oinstall /u01/oraInventory
4. vi /etc/sysctl.conf (root用户)
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
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 = 1048586
使用root执行以下命令,使修改生效
sysctl -p
[[email protected] ~]# sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 4294967295
kernel.shmall = 268435456
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
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 = 1048586
5. /etc/security/limits.conf (root用户)
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
6. /etc/pam.d/login (root用户)
session required pam_limits.so
7. /etc/profile (root用户)
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
8. 使用vmware共享目录的功能,挂载linux安装镜像到/mnt/iso目录
(1) 创建yum的配置文件
vi /etc/yum.repos.d/mysky.repo
[dvdinfo]
name=mysky
baseurl=file:///mnt/iso/Server
enabled=1
gpgcheck=0
(2) 创建yum的元数据
yum makecache
[[email protected] ~]# yum makecache
Loaded plugins: security
dvdinfo | 1.1 kB 00:00
dvdinfo/filelists | 2.3 MB 00:00
dvdinfo/other | 7.0 MB 00:00
dvdinfo/group | 1.0 MB 00:00
dvdinfo/primary | 795 kB 00:00
dvdinfo 2278/2278
dvdinfo 2278/2278
dvdinfo 2278/2278
Metadata Cache Created
(3) 检查系统中是否已经安装了Oracle安装和运行所需要的软件包
rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' binutils \
compat-libstdc++-33 \
elfutils-libelf \
elfutils-libelf-devel \
gcc \
gcc-c++ \
glibc \
glibc-common \
glibc-devel \
glibc-headers \
ksh \
libaio \
libaio-devel \
libXp \
libXp-devel \
libgcc \
libstdc++ \
libstdc++-devel \
make \
sysstat \
unixODBC \
unixODBC-devel
执行的结果如下:
[[email protected] ~]# rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' binutils \
> compat-libstdc++-33 \
> elfutils-libelf \
> elfutils-libelf-devel \
> gcc \
> gcc-c++ \
> glibc \
> glibc-common \
> glibc-devel \
> glibc-headers \
> ksh \
> libaio \
> libaio-devel \
> libXp \
> libXp-devel \
> libgcc \
> libstdc++ \
> libstdc++-devel \
> make \
> sysstat \
> unixODBC \
> unixODBC-devel
binutils-2.17.50.0.6-12.el5 (i386)
compat-libstdc++-33-3.2.3-61 (i386)
elfutils-libelf-0.137-3.el5 (i386)
elfutils-libelf-devel-0.137-3.el5 (i386)
gcc-4.1.2-46.el5 (i386)
gcc-c++-4.1.2-46.el5 (i386)
glibc-2.5-42 (i686)
glibc-common-2.5-42 (i386)
glibc-devel-2.5-42 (i386)
glibc-headers-2.5-42 (i386)
ksh-20080202-14.el5 (i386)
libaio-0.3.106-3.2 (i386)
package libaio-devel is not installed
package libXplibXp-devellibgcc is not installed
libstdc++-4.1.2-46.el5 (i386)
libstdc++-devel-4.1.2-46.el5 (i386)
make-3.81-3.el5 (i386)
package sysstat is not installed
package unixODBC is not installed
package unixODBC-devel is not installed
(4) 使用YUM安装Oracle安装和运行所需要的软件包
yum install -y compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers ksh libaio libaiodevel libXp libXp-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel
9. 创建静默安装的rsp响应文件
(1)进入oracle用户下创建响应文件目录/home/oracle/database/response
(2)创建响应文件db_install.rsp
[[email protected] response]$ more db_install.rsp
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.db.customComponents=oracle.server:11.2.0.1.0,oracle.sysman.ccr:10.2.7.0.0,oracle.xdk:11.2.0.1.0,oracle.rdbms.oci:11.2.0.1.0,oracle.network:11.2.0.1.0,oracle.network.listener:11.2.0.1.0,oracle.rdbms:11.2.0.1.0,oracle.options:11.2.0.1.0,oracle.rdbms.partitioning:11.2.0.1.0,oracle.oraolap:11.2.0.1.0,oracle.rdbms.dm:11.2.0.1.0,oracle.rdbms.dv:11.2.0.1.0,orcle.rdbms.lbac:11.2.0.1.0,oracle.rdbms.rat:11.2.0.1.0
oracle.install.db.CLUSTER_NODES=
oracle.install.db.config.starterdb.characterSet=AL32UTF8
oracle.install.db.config.starterdb.memoryOption=true
oracle.install.db.config.starterdb.memoryLimit=
oracle.install.db.config.starterdb.installExampleSchemas=false
oracle.install.db.config.starterdb.enableSecuritySettings=true
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.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.dbcontrol.enableEmailNotification=false
oracle.install.db.config.starterdb.dbcontrol.emailAddress=
oracle.install.db.config.starterdb.dbcontrol.SMTPServer=
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=
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=
oracle.install.db.config.asm.diskGroup=
oracle.install.db.config.asm.ASMSNMPPassword=
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=hostname
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.isCustomInstall=true
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oinstall
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=sky
oracle.install.db.config.starterdb.SID=sky
oracle.install.db.config.starterdb.password.ALL=oracle
MYORACLESUPPORT_USERNAME=
MYORACLESUPPORT_PASSWORD=
SECURITY_UPDATES_VIA_MYORACLESUPPORT=
DECLINE_SECURITY_UPDATES=true
PROXY_HOST=
PROXY_PORT=
PROXY_USER=
PROXY_PWD=
10.执行静默安装命令安装oracle软件
(1)进入解压好的oracle目录下
[[email protected] ~]$ cd /u02/database11g/
[[email protected] database11g]$ ls
doc install response rpm runInstaller sshsetup stage welcome.html
(2)执行静默安装命令
[[email protected] database11g]$ ./runInstaller -silent -force -responseFile /home/oracle/database/response/db_install.rsp
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 80 MB. Actual 9632 MB Passed
Checking swap space: must be greater than 150 MB. Actual 4031 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2019-10-09_03-29-24PM. Please wait ...[[email protected] database11g]$ You can find the log of this install session at:
/u01/app/oraInventory/logs/installActions2019-10-09_03-29-24PM.log
[[email protected] database11g]$ The following configuration scripts need to be executed as the "root" user.
#!/bin/sh
#Root scripts to run
/u01/app/oraInventory/orainstRoot.sh
/u01/app/oracle/product/11.2.0/db_1/root.sh
To execute the configuration scripts:
1. Open a terminal window
2. Log in as "root"
3. Run the scripts
4. Return to this window and hit "Enter" key to continue
Successfully Setup Software.
[[email protected] database11g]$
(3)打开一个新终端,在root用户下执行提示脚本
[[email protected] ~]# /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
[[email protected] ~]# /u01/app/oracle/product/11.2.0/db_1/root.sh
Check /u01/app/oracle/product/11.2.0/db_1/install/root_sky_2019-10-09_15-35-42.log for the output of root script
[[email protected] ~]#
11. 执行静默安装命令创建数据库
[[email protected] ~]$ dbca -silent -createDatabase -templateName $ORACLE_HOME/assistants/dbca/templates/General_Purpose.dbc -gdbName sky -sid sky -sysPassword o -systemPassword oracle -datafileDestination /u02/oradata -characterSet UTF8 -automaticMemoryManagement true
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/oracle/cfgtoollogs/dbca/sky/sky.log" for further details.
[[email protected] ~]$