1、下载oracle11g文件
linux.x64_11gR2_database_1of2.zip 和 linux.x64_11gR2_database_2of2.zip。可以下载到本地再用ftp上传到服务器。
2、创建用户组和oracle用户并分配权限
oracle各用户组
groupadd oinstal
groupadd dba
useradd -g oinstall -g dba -m oracle
groups oracle
passwd oracle
3、创建oracle安装目录并分配权限
mkdir -p /data/oracle
mkdir -p /data/oraIn
mkdir -p /data/database
chown -R oracle:oinstall /data/oracle
chown -R oracle:oinstall /data/oraInventory
chown -R oracle:oinstall /data/database
4、修改centos系统标识
vim /etc/redhat-release
cat /etc/redhat-release
readhat-7
5、安装oracle依赖环境
yum install binutils-2.* compat-libstdc++-33* elfutils-libelf-0.* elfutils-libelf-devel-* gcc-4.* gcc-c++-4.* glibc-2.* glibc-common-2.* glibc-devel-2.* glibc-headers-2.* ksh-2* libaio-0.* libaio-devel-0.* libgcc-4.* libstdc++-4.* libstdc++-devel-4.* make-3.* sysstat-7.* unixODBC-2.* unixODBC-devel-2.* pdksh*
6、关闭防火墙和selinux
systemctl status firewalld.service
systemctl stop firewalld.service
systemctl status firewalld.service
vim /etc/selinux/config
cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
sysctl -p #执行使参数生效
7、对oracle用户设置限制,提高软件运行性能
su root
vim /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
#加在#End of file 之前
8、配置环境变量
vim /home/oracle/.bash_profile
cat /home/oracle/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
export ORACLE_BASE=/data/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=orcl
export ORACLE_TERM=xterm
export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export LANG=C
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
source /home/oracle/.bash_profile #生效
9、解压并安装
unzip linux.x64_11gR2_database_1of2.zip -d /data/database/ #解压文件1
unzip linux.x64_11gR2_database_2of2.zip -d /data/database/ #解压文件2
因为是静默安装所以要配置安装文件
vim /data/database/database/response/db_install.rsp
oracle.install.option=INSTALL_DB_SWONLY # 安装类型
ORACLE_HOSTNAME=oracle.server # 主机名称
UNIX_GROUP_NAME=oinstall # 安装组
INVENTORY_LOCATION=/data/oraInventory # INVENTORY目录
SELECTED_LANGUAGES=en,zh_CN # 选择语言
ORACLE_HOME=/data/oracle/product/11.2.0/db_1 # oracle_home
ORACLE_BASE=/data/oracle # oracle_base
oracle.install.db.InstallEdition=EE # oracle版本
oracle.install.db.DBA_GROUP=dba # dba用户组
oracle.install.db.OPER_GROUP=oinstall # oper用户组
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE # 数据库类型
oracle.install.db.config.starterdb.globalDBName=orcl # globalDBName
oracle.install.db.config.starterdb.SID=orcl # SID
oracle.install.db.config.starterdb.characterSet=AL32UTF8 # 默认数据库编码
oracle.install.db.config.starterdb.memoryLimit=800 # 自动管理内存的最小内存(M)
oracle.install.db.config.starterdb.password.ALL=oracle # 设定所有数据库用户使用同一个密码
DECLINE_SECURITY_UPDATES=true # 设置安全更新
安装命令
/data/database/database/runInstaller -silent -responseFile /data/database/database/response/db_install.rsp -ignorePrereq
ps:可能会遇到空间不足的情况需要扩容。可以参考
https://www.linuxprobe.com/hyperv-data-centos7.html
使用sqlplus 连接
参考: