Install Oracle under Linux command line
Installation Environment
Operating System: RedHat 6.4 Bits: 64 Oracle release: 11.2.0 Oracle Compilation Environment:
yum install -y compat-libstdc*
yum install -y elfutils-libelf*
yum install -y gcc*
yum install -y glibc*
yum install -y ksh*
yum install -y libaio*
yum install -y libgcc*
yum install -y libstdc*
yum install -y make*
yum install -y sysstat*
yum install libXp* -y
yum install -y glibc-kernheaders
Environment configuration
- Create users and user groups:
groupadd oracle
useradd oracle -g oracle
id oracle #只是看一眼,^v^
passwd oracle
- Create installation directory
mkdir -p /home/oracle/u0/oracle
#这个路径在安装oracle的时候用
mkdir -p /home/oracle/u0/oracle/oraInventory
chown -R oracle:oracle /home/oracle/u0/oracle
- Configure LINUX kernel parameters, SHELL restrictions, all the following commands are executed under root
- Modify the /etc/sysctl.conf file
#vi /etc/sysctl.conf
Modify the file as follows:
kernel.shmall = 268435456
kernel.shmmax = 4294967295
#config for oracle
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 4194304
net.core.wmem_default = 1048576
net.core.rmem_max = 4194304
net.core.wmem_max = 1048576
# kernel.shmall,kernel.shmmax如果已经配置,无需重复配置
#/sbin/sysctl -p
Execute this command to make the configuration take effect
- Modify the /etc/security/limits.conf file:
# vi /etc/security/limits.conf
Append the following to the file:
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
- Modify the /etc/pam.d/login file:
# vi /etc/pam.d/login
Append the following to the file:
session required /lib/security/pam_limits.so
- Modify the /etc/profile file:
# vi /etc/profile
Append the following to the file:
#for oracle env set
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
- Environment variables and parameter configuration
- Under the Oracle user (
#su - oracle
), execute the following command:
$ vi /home/oracle/.bash_profile
Append the following command after the file:
ORACLE_SID=SID
export ORACLE_SID
ORACLE_BASE=/home/oracle/u0/oracle
export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db
export ORACLE_HOME
PATH=$PATH:$ORACLE_HOME/bin
export PATH
Execute the command to make the configuration take effect:$source /home/oracle/.bash_profile
- Modify the /etc/hosts file: it needs to be modified under the root user
# vi /etc/hosts
Add the following:
# 使用hostname查看名称是否和hosts里配置相同
#如果提示端口被占,使用hostname查看名称是否和hosts里配置相同,如果不同,
#修改/etc/sysconfig/network中的HOSTNAME
#终极方法:sysctl kernel.hostname=HOSTNAME
IP HOSTNAME
Oracle file configuration
- Modify /disk/oracle64/database/response/db_install.rsp as follows:
# 仅安装数据库软件
oracle.install.option=INSTALL_DB_SWONLY
#
ORACLE_HOSTNAME=HOSTNAME
UNIX_GROUP_NAME=oracle
INVENTORY_LOCATION=/home/oracle/u0/oracle/oraInventory
# 安装过程用英文就够了
SELECTED_LANGUAGES=en
#
ORACLE_HOME=/home/oracle/u0/oracle/product/11.2.0/db
ORACLE_BASE=/home/oracle/u0/oracle
# 安装企业版
oracle.install.db.InstallEdition=EE
# 默认安装组件
oracle.install.db.isCustomInstall=false
#
oracle.install.db.DBA_GROUP=oracle
oracle.install.db.OPER_GROUP=oracle
# 这个必须设置为true
DECLINE_SECURITY_UPDATES=true
- Modify /disk/oracle64/database/response/netca.rsp as follows:
INSTALL_TYPE=""custom"" #安装的类型
LISTENER_NUMBER=1 #监听器数量
LISTENER_NAMES={"LISTENER"} #监听器的名称列表
LISTENER_PROTOCOLS={"TCP;1521"} #监听器使用的通讯协议列表
LISTENER_START=""LISTENER"" #监听器启动的名称
- Modify /disk/oracle64/database/response/dbca.rsp as follows:
GDBNAME = "DANAME" # 数据库全局名称,自己的数据库名
SID = "SID" # 数据库的 SID,自己修改
SYSPASSWORD = "oracle" # SYS 用户的初始密码
SYSTEMPASSWORD = "oracle" #SYSTEM 用户的初始密码
CHARACTERSET = "ZHS16GBK " # 数据库字符集(中文为 ZHS16GBK )
NATIONALCHARACTERSET= "AL16UTF16"# 数据库国家字符集
Database installation
- Database installation
- implement
./runInstaller -silent -responseFile /disk/oracle64/database/response/db_install.rsp
- If the report is executed
Exception in thread "main" java.lang.NoClassDefFoundError
, it needs to be executedunset DISPLAY
Note :/disk/oracle64/database/response/db_install.rsp
This path must be an absolute path
- After the installation is successful, open another window and use root to execute:
sh /home/oracle/u0/oracle/oraInventory/orainstRoot.sh
sh /home/oracle/u0/oracle/product/11.2.0/db/root.sh
- Create a listener under the Oracle user:
-
$ORACLE_HOME/bin/netca /silent /responseFile /disk/oracle64/database/response/netca.rsp
Note:/disk/oracle64/database/response/netca.rsp
this path must be an absolute path
and this parameter is used/
instead of-
-
And modify $ORACLE_HOME/bin/dbstart
vi $ORACLE_HOME/bin/dbstart
to modify the following: ORACLE_HOME_LISTNER=$ORACLE_HOME
- Continue to use oracle user installation:
$ORACLE_HOME/bin/dbca -silent -responseFile /disk/oracle64/database/response/dbca.rsp -cloneTemplate
Note:/disk/oracle64/database/response/dbca.rsp
This path must be an absolute path Note: Password expiration problemALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;