Red Hat 4 安装 oracle database 11g

Get wget address

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

Choose 11G version

Select download file

Both need to be downloaded.

After logging in, download and start copying

Shaped like:

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 download starts:

cd to the specified path.

Enter the wget command:

wget "${Download address copied above and paste here}"

Install dependencies

The following are the dependent installation packages

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

Install with 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*.i686

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-devel

Detect installed dependencies

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

Detect dependencies that are not installed

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"

If the installation is complete, there is no result when executing this command. This command is to detect the dependency packages that are not installed. If they are all installed, the result will be empty.

 

Modify configuration system parameters

Create oracle user

According to the official Oracle documentation, you need to create oinstall, dba, user group and oralce user

root ➜  groupadd oinstall
root ➜  groupadd dba
root ➜  useradd -g oinstall -G dba oracle
root ➜  passwd oracle #Set         the password of the oracle user
Change the password of the user oracle.
New password:
Invalid password: Password failed dictionary check - it is based on dictionary words
Retype new password:
passwd: All authentication tokens have been successfully updated.

Modify kernel parameters

root ➜  vi  /etc/sysctl.conf

kernel.shmall = 2097152 -- the total amount of shared memory is 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

After modification, run sysctl-p to make the modification take effect

root ➜  sysctl  -p

Create oracle installation directory

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

Enter the oracle user and set environment variables for the oracle user

root ➜  su -l oracle

oracle ➜  vi .bash_profile

add after

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

Execute the following command to make the configuration take effect immediately

oracle ➜  source ~/.bash_profile

Modify the configuration files such as user restrictions and authentication, and switch to the root user

root ➜  su -l root

Modify the /etc/security/limits.conf file

root ➜  vi  /etc/security/limits.conf

Add the following parameters after

oracle           soft    nproc           2047
oracle           hard    nproc           16384
oracle           soft    nofile          1024
oracle           hard    nofile          65536
oracle           soft    stack           10240

Modify User Authentication Options

Modify the /etc/pam.d/login file

root ➜  vi /etc/pam.d/login

If the following parameters are not added

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

Edit /etc/profile and add the following statement

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
  be
be

Install ORACLE software

Unzip the installation package and move to the installation directory

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

root ➜  mv   database /u01/       Move the database to the u01 directory we built 

Backup the db_install.rsp file

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

Edit the /tmp/database/response/db_install.rsp file

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

oracle.install.option = INSTALL_DB_SWONLY // installation type
 ORACLE_HOSTNAME = ghgroup-dev-24 // host name (hostname query)
 UNIX_GROUP_NAME = oinstall // installation group
 INVENTORY_LOCATION = /u01/oraInventory //INVENTORY directory (if not filled in, the default value)
 SELECTED_LANGUAGES = en,zh_CN,zh_TW // select language
 ORACLE_HOME = /u01/oracle/product/11.2.0/db_1 //oracle_home
 ORACLE_BASE = /u01/oracle //oracle_base
 oracle.install.db.InstallEdition = EE //oracle version
 oracle.install.db.isCustomInstall = false //Custom installation, no, use the default component
 oracle.install.db.DBA_GROUP= dba //dba user group
 oracle.install.db.OPER_GROUP = oinstall //oper user group
 oracle.install.db.config.starterdb.type = GENERAL_PURPOSE //database type
 oracle.install.db.config.starterdb.globalDBName = orcl //globalDBName
 oracle.install.db.config.starterdb.SID = orcl //SID
 oracle.install.db.config.starterdb.memoryLimit = 2574 //Memory for automatic memory management (M)
 oracle.install.db.config .starterdb.password.ALL = oracle //Set all database users to use the same password
 SECURITY_UPDATES_VIA_MYORACLESUPPORT = false //(manually write false)
 DECLINE_SECURITY_UPDATES = true //Set security updates
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

Perform a silent install

root ➜ su - oracle

oracle ➜ cd /u01/database

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

View the installation log

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

Info : Validating state <finish>
 Warning : Validation disabled for the state finish
 Info : Completed validating state <finish>
 Info : Terminating all background operations
 Info : Terminated all background operations
 Info : Successfully executed the flow in SILENT mode
 Info : Finding the most appropriate exit status for the current application
 Info : Exit Status is 0
 Info : Shutdown Oracle Database 11g Release 2 Installer
Info : Unloading Setup Driver

Switch root user to run scripts

root ➜ sh /u01/oraInventory/orainstRoot.sh

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

Log in with oracle user to configure monitoring

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

Output the above information to modify 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

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324425179&siteId=291194637