https://docs.oracle.com/en/database/oracle/oracle-database/index.html 官方手冊
centos 1810 3.10.0-957.el7.x86_64 圖形化安裝 關閉firewalld selinux
硬件要求
RAM 1GB 扣除分配給HugePages的內存
swap RAM*2 最高16GB
自動內存管理 df -h /dev/shm/
軟件要求
軟件依賴
binutils-2.23.52.0.1-12.el7.x86_64
compat-libcap1-1.10-3.el7.x86_64
compat-libstdc++-33-3.2.3-71.el7.i686
compat-libstdc++-33-3.2.3-71.el7.x86_64
gcc-4.8.2-3.el7.x86_64
gcc-c++-4.8.2-3.el7.x86_64
glibc-2.17-36.el7.i686
glibc-2.17-36.el7.x86_64
glibc-devel-2.17-36.el7.i686
glibc-devel-2.17-36.el7.x86_64
ksh
libaio-0.3.109-9.el7.i686
libaio-0.3.109-9.el7.x86_64
libaio-devel-0.3.109-9.el7.i686
libaio-devel-0.3.109-9.el7.x86_64
libgcc-4.8.2-3.el7.i686
libgcc-4.8.2-3.el7.x86_64
libstdc++-4.8.2-3.el7.i686
libstdc++-4.8.2-3.el7.x86_64
libstdc++-devel-4.8.2-3.el7.i686
libstdc++-devel-4.8.2-3.el7.x86_64
libXi-1.7.2-1.el7.i686
libXi-1.7.2-1.el7.x86_64
libXtst-1.2.2-1.el7.i686
libXtst-1.2.2-1.el7.x86_64
make-3.82-19.el7.x86_64
sysstat-10.1.5-1.el7.x86_64
unixODBC-2.3.1-6.el7.x86_64 or later
unixODBC-2.3.1-6.el7.i686 or later
unixODBC-devel-2.3.1-6.el7.x86_64 or later
unixODBC-devel-2.3.1-6.el7.i686 or later
yum install binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ ksh libaio libaio-devel libXi libXtst sysstat
yum install unixODBC unixODBC-devel
創建組和用戶
/usr/sbin/groupadd oinstall
/usr/sbin/groupadd dba
/usr/sbin/useradd -g oinstall -G dba oracle
passwd oracle
調整內核參數 /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
檢查資源限制 切換到安裝用戶
檢查命令
ulimit -Sn 打開文件描述符軟限制
ulimit -Hn
ulimit -Su 進程數軟限制
ulimit -Hu
ulimit -Ss 堆棧設置
ulimit -Hs
修改參數用戶資源限制參數 注意用戶名 /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 32768
創建數據目錄配置權限
mkdir -p /mount_point/app/
chown -R oracle:oinstall /mount_point/app/
chmod -R 775 /mount_point/app/
chown oracle:oinstall /oracle/
安裝圖形化
yum -y install xorg*
yum groups install "GNOME Desktop"
VNC (windows遠程linux圖形)
1、yum install tigervnc-server -y 安裝vnc
2、vncpasswd 設置密碼
3、vncserver 啟動軟件
配置oracle用戶環境變量 vim /home/oracle/.bash_profile
ORACLE_BASE=/mount_point/app/ 之前創建的Oracle基本目錄
ORACLE_SID=sales 數據庫名稱
export ORACLE_BASE ORACLE_SID
執行安裝
./runInstaller -jreLoc /usr/lib/jvm/jre-openjdk
只安裝數據庫軟件
重新打開一個終端,輸入 dbca 命令即可彈出相應的數據庫創建向導
/oracle/app/product/11.2.0/dbhome_1/bin/dbca
/oracle/app/product/11.2.0/dbhome_1/bin/netca
ORACLE_HOME=/oracle/app/product/11.2.0/dbhome_1/ 添加到環境變量中
sqlplus / AS SYSDBA
安裝日志
tail -f /tmp/OraInstall2019-05-16_09-34-10AM/installActions2019-05-16_09-34-10AM.log
報錯
SEVERE: [FATAL] [INS-32033] Central Inventory location is not writable.
CAUSE: Central Inventory location was not writable.
ACTION: Ensure that the inventory location is writable.
可能是第二遍安裝的問題,換一個有權限的新路徑 或刪除指定的目錄
靜默安裝11g
檢查操作系統 檢查硬件
安裝依賴
yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33i686 compat-libstdc++-33.devel compat-libstdc++-33 compat-libstdc++-33.devel gcc gcc-c++ glibc glibc.i686 glibc-devel glibc-devel.i686 ksh libaio libaio.i686 libaio-devel libaio-devel.devel libgcc libgcc.i686 libstdc++ libstdc++.i686 libstdc++-devel libstdc++-devel.devel libXi libXi.i686 libXtst libXtst.i686 make sysstat unixODBC unixODBC.i686 unixODBC-devel unixODBC-devel.i686
檢查依賴 (31)
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 | wc
創建用戶組
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
passwd oracle
配置內核參數. /etc/sysctl.conf 根據實際情況修改
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
修改用戶限制 vim /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 32768
vim /etc/pam.d/login
session required /lib64/security/pam_limits.so
session required pam_limits.so
vim /etc/profile
oracle user configuration
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
創建安裝目錄
mkdir -p /u01/app/
chmod -R 775 /u01/
chown -R oracle:oinstall /u01/
配置環境變量
vim .bash_profile
export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=dbsrv2
source .bash_profile
解壓安裝包 unzip
mkdir etc
cp /home/oracle/database/response/* /home/oracle/etc/
vim etc/db_install.rsp
./runInstaller -silent -responseFile /home/oracle/etc/db_install.rsp
<embed style="cursor:pointer;" type="application/octet-stream" src="BE796A6A-7276-4A5D-96A9-529028FEFAFB.rsp">
vim .bash_profile
#for oracle
export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=dbsrv2
export ROACLE_PID=ora11g
#export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
export PATH=$PATH:$ORACLE_HOME/bin
export LANG="zh_CN.UTF-8"
export NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"
export NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss'
/u01/app/oracle/product/11.2.0/db_1/bin/netca -silent -responsefile /home/oracle/etc/netca.rsp
vim etc/dbca.rsp
<embed style="cursor:pointer;" type="application/octet-stream" src="5A8BD985-2326-42CA-B4D2-C74D0E8C717D.rsp">
/u01/app/oracle/product/11.2.0/db_1/bin/dbca -silent -responsefile etc/dbca.rsp
vim /u01/app/oracle/cfgtoollogs/dbca/dbsrv2/dbsrv2.log
參考資料