Red Hat 4 安裝 oracle database 11g

獲取wget地址

http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.htmlhtml

選擇11G版本

選擇下載文件

兩個都須要下載。java

登錄後下載開始複製linux

形如:c++

http://download.oracle.com/otn/linux/oracle11g/R2/linux.x64_11gR2_database_1of2.zip?AuthParam=1523514438_58e281a349dc65bb8245a2fc75da5c1a數據庫

http://download.oracle.com/otn/linux/oracle11g/R2/linux.x64_11gR2_database_2of2.zip?AuthParam=1523514441_c7eb1283c916871e361d6d68af3b6746安全

wget下載開始:

cd到指定路徑。

輸入wget命令:

wget "${上邊複製得下載地址粘貼到這}"bash

安裝依賴包

如下爲所依賴的安裝包

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進行安裝

root ➜  yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*i686 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*.i686session

root ➜  yum -y install gcc make binutils gcc-c++ compat-libstdc++-33 elfutils-libelf-devel elfutils-libelf-devel-static elfutils-libelf-devel ksh libaio libaio-devel numactl-devel sysstat unixODBC unixODBC-devel pcre-develoracle

檢測安裝好的依賴包

root ➜  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-develapp

檢測未安裝的依賴包

root ➜  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"

安裝完成的話,執行這段命令是沒有結果的,這段命令是檢測未安裝的依賴包,若是都安裝了,結果就爲空

 

修改配置系統參數

建立oracle用戶

根據oracle官方文檔所述,須要建立oinstall、dba、用戶組和oralce用戶

root ➜  groupadd oinstall
root ➜  groupadd dba
root ➜  useradd -g oinstall -G dba oracle
root ➜  passwd oracle        #設置oracle用戶的密碼
更改用戶 oracle 的密碼 。
新的 密碼:
無效的密碼: 密碼未經過字典檢查 - 它基於字典單詞
從新輸入新的 密碼:
passwd:全部的身份驗證令牌已經成功更新。

修改內核參數

root ➜  vi  /etc/sysctl.conf

kernel.shmall = 2097152  --則一共是8G的共享內存總量
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.aio-max-nr = 1048576
fs.file-max = 6815744

修改後運行sysctl–p 使修改生效

root ➜  sysctl  -p

建立oracle的安裝目錄

root ➜  mkdir -p /u01/oracle/product/11.2.0/db_1
root ➜  mkdir /u01/dataLocation
root ➜  mkdir /u01/oraInventory
root ➜  mkdir /u01/oracle/oradata
root ➜  mkdir /u01/oracle/inventory
root ➜  mkdir /u01/oracle/fast_recovery_area
root ➜  chown -R oracle:oinstall /u01
root ➜  chmod -R 775 /u01
root ➜  chmod 777 /u01/dataLocation
root ➜  chmod 777 /u01/oraInventory

進入oracle用戶下,爲 oracle 用戶設置環境變量

root ➜  su -l oracle

oracle ➜  vi .bash_profile

在後面加上

ORACLE_BASE=/u01/oracle
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
ORACLE_SID=orcl
ORACLE_PID=ora11g
LD_LIBRARY_PATH=$ORACLE_HOME/inventory/Scripts/ext/lib
PATH=$PATH:$ORACLE_HOME/bin
NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"
DISPLAY=localhost:0.0
export ORACLE_BASE ORACLE_HOME ORACLE_SID ORACLE_PID LD_LIBRARY PATH NLS_LANG DISPLAY

/u01/oracle/product/11.2.0/db_1/inventory/Scripts/ext/lib/libclntsh.so.11.1

執行如下命令讓配置立刻生效

oracle ➜  source ~/.bash_profile

修改用戶的限制和驗證等配置文件,切換到root用戶

root ➜  su -l root

修改 /etc/security/limits.conf文件

root ➜  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

修改用戶驗證選項

修改/etc/pam.d/login文件

root ➜  vi /etc/pam.d/login

若是裏面沒有 加上以下參數

session    required     /lib/security/pam_limits.so
session    required     pam_limits.so

編輯/etc/profile加入如下語句

root ➜  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軟件

解壓安裝包 移動到安裝目錄

解壓
root ➜  unzip linux_11gR2_database_1of2.zip
root ➜  unzip linux_11gR2_database_2of2.zip

root ➜  mv  database   /u01/       將database移至咱們建好的u01目錄

備份db_install.rsp文件

root ➜  cp /u01/database/response/db_install.rsp /u01/database/response/db_install.rsp.bak

編輯 /tmp/database/response/db_install.rsp文件

root ➜  vi /u01/database/response/db_install.rsp

oracle.install.option=INSTALL_DB_SWONLY   // 安裝類型
ORACLE_HOSTNAME=ghgroup-dev-24   // 主機名稱(hostname查詢)
UNIX_GROUP_NAME=oinstall   // 安裝組
INVENTORY_LOCATION=/u01/oraInventory   //INVENTORY目錄(不填就是默認值)
SELECTED_LANGUAGES=en,zh_CN,zh_TW   // 選擇語言
ORACLE_HOME=/u01/oracle/product/11.2.0/db_1    //oracle_home
ORACLE_BASE=/u01/oracle     //oracle_base
oracle.install.db.InstallEdition=EE     // oracle版本
oracle.install.db.isCustomInstall=false   //自定義安裝,否,使用默認組件
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.memoryLimit=2574   //自動管理內存的內存(M)
oracle.install.db.config.starterdb.password.ALL=oracle   //設定全部數據庫用戶使用同一個密碼
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false   //(手動寫了false)
DECLINE_SECURITY_UPDATES=true   //設置安全更新
oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=/u01/dataLocation
oracle.install.db.config.starterdb.password.ALL=P#ssw0rd
oracle.install.db.config.starterdb.password.SYS=P#ssw0rd
oracle.install.db.config.starterdb.password.SYSTEM=P#ssw0rd
oracle.install.db.config.starterdb.password.SYSMAN=P#ssw0rd
oracle.install.db.config.starterdb.password.DBSNMP=P#ssw0rd

執行靜默安裝

root ➜ su - oracle

oracle ➜ cd /u01/database

oracle ➜ ./runInstaller -silent -ignorePrereq -ignoreSysPrereqs -responseFile /u01/database/response/db_install.rsp

查看安裝日誌

root ➜ tail -f /u01/oraInventory/logs/installActions2018-04-13_04-14-20PM.log

信息: Validating state <finish>
警告: Validation disabled for the state finish
信息: Completed validating state <finish>
信息: Terminating all background operations
信息: Terminated all background operations
信息: Successfully executed the flow in SILENT mode
信息: Finding the most appropriate exit status for the current application
信息: Exit Status is 0
信息: Shutdown Oracle Database 11g 發行版 2 安裝程序
信息: Unloading Setup Driver

切換root用戶運行腳本

root ➜ sh /u01/oraInventory/orainstRoot.sh

root ➜ sh /u01/oracle/product/11.2.0/db_1/root.sh

用oracle用戶登陸配置監聽

oracle ➜ netca -silent -responseFile /u01/database/response/netca.rsp

UnsatisfiedLinkError exception loading native library: njni11
java.lang.UnsatisfiedLinkError: /u01/oracle/product/11.2.0/db_1/lib/libnjni11.so: libclntsh.so.11.1: cannot open shared object file: No such file or directory
java.lang.UnsatisfiedLinkError: jniGetOracleHome
at oracle.net.common.NetGetEnv.jniGetOracleHome(Native Method)
at oracle.net.common.NetGetEnv.getOracleHome(Unknown Source)
at oracle.net.ca.NetCALogger.getOracleHome(NetCALogger.java:230)
at oracle.net.ca.NetCALogger.initOracleParameters(NetCALogger.java:215)
at oracle.net.ca.NetCALogger.initLogger(NetCALogger.java:130)
at oracle.net.ca.NetCA.main(NetCA.java:404)
Error: jniGetOracleHome

輸出如上信息修改LD_LIBRARY_PATH

oracle ➜ su - root

oracle ➜ find / -name libclntsh.so.11.1

/u01/database/stage/ext/lib/libclntsh.so.11.1
/u01/oracle/product/11.2.0/db_1/inventory/Scripts/ext/lib/libclntsh.so.11.1
/u01/oracle/product/11.2.0/db_1/inventory/backup/2018-04-13_04-14-20PM/Scripts/ext/lib/libclntsh.so.11.1
/u01/oracle/product/11.2.0/db_1/inventory/backup/2018-04-13_03-56-09PM/Scripts/ext/lib/libclntsh.so.11.1

oracle ➜  vi .bash_profile

LD_LIBRARY_PATH=$ORACLE_HOME/inventory/Scripts/ext/lib
相關文章
相關標籤/搜索