http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.htmlhtml
兩個都須要下載。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 "${上邊複製得下載地址粘貼到這}"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
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官方文檔所述,須要建立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
root ➜ sysctl -p
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
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 ➜ su -l root
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
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
解壓
root ➜ unzip linux_11gR2_database_1of2.zip
root ➜ unzip linux_11gR2_database_2of2.zip
root ➜ mv database /u01/ 將database移至咱們建好的u01目錄
root ➜ cp /u01/database/response/db_install.rsp /u01/database/response/db_install.rsp.bak
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 ➜ sh /u01/oraInventory/orainstRoot.sh
root ➜ sh /u01/oracle/product/11.2.0/db_1/root.sh
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
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