vi /etc/hostname
vi /etc/hosts
# rpm -qa binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers glibc-static kernel-headers pdksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++-devel libstdc++-static make numactl-devel sysstat unixODBC unixODBC-devel
yum -y install binutils compat-libstdc++-33 compat-libstdc++-33.i686 elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc.i686 glibc-common glibc-devel glibc-devel.i686 glibc-headers glibc-static ksh libaio libaio.i686 libaio-devel libaio-devel.i686 libgcc libgcc.i686 libstdc++ libstdc++.i686 libstdc++-devel make sysstat kernel-headers pdksh libgomp libstdc++-static numactl-devel unixODBC unixODBC-devel
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 |grep "not installed"
无输出则正确
yum updates
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba -m oracle
passwd oracle
id oracle #检验
mkdir /data/oracle/app
mkdir /data/oracle/app/oracle
mkdir /data/app/oracle/oradata
mkdir /data/app/oracle/oraInventory
chown -R oracle:oinstall /data/app/oracle
chmod -R 777 /data/app
systemctl stop firewalld.service
systemctl disable firewalld.service
vi /etc/selinux/config
SELINUX=disabled
配置要求,配置大于系统数据需要配置更改,否则不需要配置:
vi /etc/sysctl.conf
fs.file-max = 6815744
fs.aio-max-nr = 1048576
kernel.shmall = 2097152
kernel.shmmax = <本机物理内存Byte字节数的一半>
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
sysctl -p
#vi /etc/security/limits.conf 末尾添加
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
#在空白处添加
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
#vi /etc/pam.d/login,将下列内容加入该文件。
session required /lib/security/pam_limits.so
session required pam_limits.so
#上传使用scp命令/ftp工具上传到/data/tools目录
unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip
chmod -R 775 /data/tools
chown -R oracle:oinstall /data/tools
su - oracle
vi .bash_profile
#for oracle
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
export ORACLE_PID=orcl
export ORACLE_SID=orcl
#export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export LANG="zh_CN.UTF-8"
export NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"
export NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss'
source ~/.bash_profile
cd /home/oracle
vi db_install.rsp
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME= oracledb #hostname名
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/data/app/oracle/oraInventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/data/app/oracle/db_1
ORACLE_BASE=/data/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=dba
DECLINE_SECURITY_UPDATES=true
sudo reboot #重启
su - oracle #切换到oracle用户
source .bash_profile #使环境变量生效
cd /data/tools/database/ #切换到oracle安装包解压后的目录下
./runInstaller -silent -ignorePrereq -ignoreSysPrereqs -responseFile /home/oracle/db_install.rsp
#出现warnning不用管,会暂时卡住,不要退出
#当出现提示:用root执行脚本的命令之后,重开一个终端以root用户执行提示中的脚本内容,返回此终端,enter继续
在oracle用户下:
netca /silent /responsefile /home/oracle/netca.rsp
检验:在 /data/app/oracle/db_1/network/admin/
中生成 listener.ora
和 sqlnet.or
netstat -tnul | grep 1521
dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbname orcl -sid orcl -sysPassword syc -systemPassword syc -responseFile NO_VALUE -datafileDestination /data/app/oracle/oradata -redoLogFileSize 50 -recoveryAreaDestination /data/app/oracle/fast_recovery_area -storageType FS -characterSet ZHS16GBK -nationalCharacterSet AL16UTF16 -sampleSchema true -memoryPercentage 30 -totalMemory 200 -databaseType OLTP -emConfiguration NONE
lsnrctl status
未启动可执行命令:
lsnrctl start
sqlplus sys/change_on_install AS sysdba
sql>