1)檢查系統的版本linux
# more /etc/redhat-releasec++
2)關閉SELinux,須要restartsql
# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config數據庫
3)關閉防火牆vim
# systemctl is-active firewalld bash
# systemctl disable firewalld服務器
# systemctl stop firewalldcookie
4)修改/etc/sysctl.conf文件,添加下面內容到該文件中,否則安裝oracle的時候檢查os kernel會出現不少warningsession
kernel.sysrq = 0oracle
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 4294967295
kernel.shmall = 268435456
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
fs.file-max = 6815744
fs.aio-max-nr = 1048576
/sbin/sysctl -p
5)重啓服務
#init 6
1)在本地磁盤上要求最小4.7GB空閒空間
2)使用root登陸
3)檢查內存大小,最小要求1GB,推薦是使用2GB或者更大
使用命令查看內存大小:
#grep "Mem" /proc/meminfo
MemTotal: 131746360 kB
MemFree: 129482536 kB
MemAvailable: 129273660 kB
5)檢查/tmp目錄空閒空間,要求大於400MB
#df -h /tmp
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rhel-root 130G 16G 115G 12%
6)檢查交換區大小
若是物理內存大小是1GB到16GB,那麼交換區大小必須是該內存大小的1.5倍;
若是物理內存大小大於16GB,那麼交換區大小必須與該內存大小相同;
#free -m
total used free shared buff/cache available
Mem: 128658 3089 114357 3211 11211 121391
Swap: 131071 0 131071
7)檢查Linux內核
#getconf LONG_BIT
64
1)在安裝oracle數據庫以前確保依賴包已經被安裝,可使用 rpm -qa|grep xxx或者rpm -q一次查詢
# rpm -q binutils compat-db compat-libstdc++-33 dos2unix elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel zlib-devel pdksh
2)在官網上找到oracle 11g安裝在rh7須要的依賴包,而後從本地傳到/tmp目錄下,能夠一個個執行rpm -ivh xxx或者rmp -ivh全部的依賴包,注意的是一個個執行的時候,可能存在依賴包之間相互的依賴關係,也就是若是一個沒裝以前安裝另外一個會提示失敗
# rpm -ivh xxx...
3)vim /etc/security/limits.conf添加下面的內容:
session required /lib64/security/pam_limits.so
session required pam_limits.so
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
4)vim /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文件的須要用oracle用戶操做
1)建立DBA用戶組:oinstall和dba
oinstall是主要的組,用於安裝數據庫
dba是次要的組,用於管理數據庫
#groupadd oinstall
#groupadd dba
2)添加一個用戶名oracle,並設置密碼,一個用戶可與屬於多個用戶組,能指定一個組爲主組
useradd:建立用戶,把/opt/oracle目錄做爲oracle用戶的主目錄或登陸默認目錄,-g表示這個用戶的主組初始組爲oinstall,-G表示oracle用戶同時屬於dba組,作數據維護,和數據庫管理工做
#useradd -d /opt/oracle -g oinstall -G dba oracle
#echo oracle|passwd --stdin oracle *密碼設置爲oracle
#chown -R *-R: 對目前目錄下的全部文件與子目錄進行相同的擁有者變動
3)安裝準備
1. oracle用戶經過SSH Secure file Transfer將oracle 11g程序文件上傳到服務器,或者將root用戶下的文件複製oracle用戶
2. 經過安裝VNC Viewer軟件,支持遠程操做Linux GUI
執行如下命令:
#rpm -ivh tigervnc-server-1.8.0-1.el7.x86_64.rpm
#vncserver
#vncpasswd
#vncserver -list
Expected output, for example
[root@BLRDB01 lib]# vncserver -list
TigerVNC server sessions:
X DISPLAY # PROCESS ID
:4 161451
3.安裝完成以後,使用vncviwer登陸,格式server IP:4
登陸進去以後桌面顯示:
4. vim /opt/oracle/.bash_profile添加下面內容:
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
export ORACLE_SID=orcl
export ORACLE_BASE=/opt/oracle/app
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:ORACLE_HOME/lib
export ORACLE_HOME=/opt/oracle/app/product/11.2.0/dbhome_1
export ORACLE_HOME_LISTNER=$ORACLE_HOME
PATH=$PATH:$HOME/.local/bin:$HOME/bin:$ORACLE_HOME/bin
umask 022
export PATH
5.解壓程序文件,解壓完成以後產生database文件
#su - oracle
#cd /opt/Orgin_files/oracle/
#unzip -oq p13390677_112040_Linux-x86-64_1of7.zip
#unzip -oq p13390677_112040_Linux-x86-64_2of7.zip
#su - oracle
#cd /opt/Orgin_files/database/
#chmod u+x runInstaller
#./runInstaller
1.Select Installation Option
2.Grid Installation Options
3. Select Product Language
4. Select Database Edition
5. Specify Installation Location
6. Create Inventory
7.Privileged Operating System Group
8.Perform Prerequisite Checks
9.Summery
當出現 Error in invoking target 'agent nmhs' of makefile '/u01/app/oracle/product/11.2.0.4/sysman/lib/ins_emagent.mk'.
解決辦法:
Vi $ORACLE_HOME/sysman/lib/ins_emagent.mk
搜索:$(MK_EMAGENT_NMECTL)
替換:$(MK_EMAGENT_NMECTL) -lnnz11
而後點擊retry
10.Execute Configuration scripts
打開一個新的窗口,切換到root,使用如下命令執行scripts:
#cd /home/oracle/oraInventory
#chmod u+x orainstRoot.sh
#./orainstRoot.sh
#cd /home/oracle/app/product/11.2.0/dbhome_1
#chmod u+x root.sh
#./root.sh --->回車
scripts執行完成以後,點擊OK
11.Finish
1.Database Configuration Assistant:Welcome
2.Database Configuration Assistant: Operations
3.Database Configuration Assistant: Database Templates
4.Database Configuration Assistant: Database Identification
5.Database Configuration Assistant: Management Options
6.Database Configuration Assistant: Database Credentials
7.Database Configuration Assistant: Database File Locations
8.Database Configuration Assistant: Recovery Configuration
9.Database Configuration Assistant: Database Content
10. Initialization Parameters-Memory
11.Initialization Parameters-Character Sets
12. Database Storage
13. Creation Options
14.confirmation
15. Database Configuration Assistant
16. Database Configuration Assistant
17. Oracle Net Configuration Assistant: Welcome
18.Listener Configuration,Listener
19.Listener Configuration,Listener Name
20.Listener Configuration,Select Protocols
21.Listener Configuration,TCP/IP Protocol
22. Listener Configuration,More Listener
23.Oracle Net Configuration Assistant:Welcome
24.Net Service Name Configuration
25.Net Service Name Configuration,Service Name
26.Net Service Name Configuration,Select Protocols
27.Net Service Name Configuration,TCP/IP Protocol
28. Net Service Name Configuration,Test
29.Net Service Name Configuration,Connecting
30. Net Service Name Configuration,Net Service Name
31.Net Service Name Configuration,Another
32.Net Service Name Configuration,Done
#sqlplus / as sysdba
登陸正常
#su - oracle
#sqlplus orcl/orcl as sysdba
SQL>alter system set deferred_segment_creation=false scope=spfile;
SQL>shutdown immediate;
SQL>startup;
SQL>exit;