Oracle安装教程
安装环境
Centos 7.9最小化安装
Oracle11gR2版本
JDK 8u202
安装教程
-
新建用户组和用户
# 新建用户数组和Oracle用户及设置Oracle用户密码 [root@ora11g ~]# groupadd dba [root@ora11g ~]# groupadd oinstall [root@ora11g ~]# useradd -g oinstall -G dba oracle [root@ora11g ~]# id oracle uid=1000(oracle) gid=1001(oinstall) groups=1001(oinstall),1000(dba) [root@ora11g ~]# passwd oracle Changing password for user oracle. New password: BAD PASSWORD: The password is shorter than 8 characters Retype new password: passwd: all authentication tokens updated successfully. [root@ora11g ~]#
-
新建安装目录并上传解压安装包
# 新建安装目录 [root@ora11g ~]# mkdir -p /data/oracle [root@ora11g ~]# mkdir -p /data/oraInventory [root@ora11g ~]# cd /data/ [root@ora11g data]# ll total 2227304 -rw-r--r--. 1 root root 1285396902 Jul 7 21:05 linux_11gR2_database_1of2.zip -rw-r--r--. 1 root root 995359177 Jul 7 21:05 linux_11gR2_database_2of2.zip drwxr-xr-x. 2 root root 6 Jul 7 21:02 oracle drwxr-xr-x. 2 root root 6 Jul 7 21:03 oraInventory [root@ora11g data]# # 解压两个安装包后得到 /data/database 目录 # 此时/data目录下一共三个文件夹分别是/data/database,/data/oracle,/data/oraInventory [root@ora11g data]# ll total 2227304 drwxr-xr-x. 8 root root 128 Aug 18 2009 database -rw-r--r--. 1 root root 1285396902 Jul 7 21:05 linux_11gR2_database_1of2.zip -rw-r--r--. 1 root root 995359177 Jul 7 21:05 linux_11gR2_database_2of2.zip drwxr-xr-x. 2 root root 6 Jul 7 21:02 oracle drwxr-xr-x. 2 root root 6 Jul 7 21:03 oraInventory [root@ora11g data]# # 根据自己需求删除安装文件,删不删都可以,就是看着乱,反正留着也没用了就删了 [root@ora11g data]# rm linux_11gR2_database_1of2.zip rm: remove regular file ‘linux_11gR2_database_1of2.zip’? y [root@ora11g data]# rm linux_11gR2_database_2of2.zip rm: remove regular file ‘linux_11gR2_database_2of2.zip’? y [root@ora11g data]# ll total 0 drwxr-xr-x. 8 root root 128 Aug 18 2009 database drwxr-xr-x. 2 root root 6 Jul 7 21:02 oracle drwxr-xr-x. 2 root root 6 Jul 7 21:03 oraInventory [root@ora11g data]#
-
修改安装目录属组
# 更改目录属组及权限 [root@ora11g data]# chown -R oracle:oinstall /data/database [root@ora11g data]# chown -R oracle:oinstall /data/oracle/ [root@ora11g data]# chown -R oracle:oinstall /data/oraInventory/ [root@ora11g data]# ll total 0 drwxr-xr-x. 8 oracle oinstall 128 Aug 18 2009 database drwxr-xr-x. 2 oracle oinstall 6 Jul 7 21:02 oracle drwxr-xr-x. 2 oracle oinstall 6 Jul 7 21:03 oraInventory [root@ora11g data]# chmod 775 -R /data/ [root@ora11g data]# ll total 0 drwxrwxr-x. 8 oracle oinstall 128 Aug 18 2009 database drwxrwxr-x. 2 oracle oinstall 6 Jul 7 21:02 oracle drwxrwxr-x. 2 oracle oinstall 6 Jul 7 21:03 oraInventory [root@ora11g data]#
-
安装依赖
yum -y install binutils* compat-libcap1* compat-libstdc++* gcc* gcc-c++* glibc* glibc-devel* ksh* libaio* libaio-devel* libgcc* libstdc++* libstdc++-devel* libXi* libXtst* make* sysstat* elfutils* unixODBC* lrzsz # 如果centos是最小化安装的,最好把下面的依赖也全装上 yum -y install xz wget gcc-c++ ncurses ncurses-devel cmake make perl openssl openssl-devel gcc* libxml2 libxml2-devel curl-devel libjpeg* libpng* freetype* make gcc-c++ cmake bison perl perl-devel perl perl-devel glibc-devel.i686 glibc-devel libaio readline-devel zlib.x86_64 zlib-devel.x86_64 libcurl-* net-tool* sysstat lrzsz dos2unix telnet.x86_64 iotop unzip ftp.x86_64 xfs* expect vim psmisc openssh-client* libaio bzip2 epel-release automake binutils bzip2 elfutils expat gawk gcc ksh less make openssh-server rpm sysstat unzip unzip cifs-utils libXext.x86_64 glibc.i686 binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel expat gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel libnsl
-
系统配置
[root@ora11g data]# cat /etc/redhat-release CentOS Linux release 7.9.2009 (Core) [root@ora11g data]# vi /etc/redhat-release # 删除原来的信息更改为redhat-7 [root@ora11g data]# cat /etc/redhat-release redhat-7 [root@ora11g data]# vi /etc/hosts # 删除原来的信息后输入以下内容 127.0.0.1 localhost 192.168.221.131 ora11g #主机IP 主机名称 [root@ora11g data]# # 关闭防火墙,且不让开机自启 [root@ora11g data]# systemctl stop firewalld [root@ora11g data]# systemctl disable firewalld Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service. Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service. [root@ora11g data]# [root@ora11g data]# setenforce 0 [root@ora11g data]# vi /etc/sysconfig/selinux [root@ora11g data]# [root@oracle ~]# vi /etc/sysctl.conf kernel.shmall = 2097152 kernel.shmmax = 4294967295 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 fs.file-max = 6553600 net.ipv4.ip_local_port_range = 1024 65000 net.core.rmem_default = 4194304 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 262144 [root@oracle ~]# sysctl -p [root@oracle ~]# vi /etc/security/limits.conf oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 oracle soft stack 10240 oracle hard stack 10240 [root@ora11g data]# vi /etc/profile if [ $USER = "oracle" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi fi
重启服务器后,下面开始用Oracle用户执行
-
安装JDK及配置环境变量
[oracle@ora11g ~]$ mv jdk1.8.0_202/ jdk8u202 [oracle@ora11g ~]$ ll total 0 drwxr-xr-x 7 oracle oinstall 245 Dec 15 2018 jdk8u202 [oracle@ora11g ~]$ pwd /home/oracle [oracle@ora11g ~]$ vi .bash_profile # JDK export JAVA_HOME=/home/oracle/jdk8u202/ export JRE_HOME=/home/oracle/jdk8u202/jre export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar # oracle export ORACLE_HOSTNAME=ora11g export ORACLE_BASE=/data/oracle export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1 export ORACLE_SID=orcl export PATH=/usr/sbin:$PATH export PATH=$ORACLE_HOME/bin:$PATH export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK export TMP=/tmp export TMPDIR=$TMP [oracle@ora11g ~]$ source .bash_profile
-
修改数据库安装响应文件
-
安装数据库软件
[oracle@ora11g database]$ ./runInstaller -silent -responseFile /data/database/response/db_install.rsp -ignorePrereq Starting Oracle Universal Installer... Checking Temp space: must be greater than 80 MB. Actual 29096 MB Passed Checking swap space: must be greater than 150 MB. Actual 4095 MB Passed Preparing to launch Oracle Universal Installer from /tmp/OraInstall2023-07-07_11-03-23PM. Please wait ...[oracle@ora11g database]$ You can find the log of this install session at: /data/oraInventory/logs/installActions2023-07-07_11-03-23PM.log The following configuration scripts need to be executed as the "root" user. #!/bin/sh #Root scripts to run /data/oraInventory/orainstRoot.sh /data/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. [oracle@ora11g database]$
-
安装监听
-
修改数据库响应文件
-
安装数据库