star帶你玩轉Oracle-零基礎openfiler共享儲存安裝Oracle 11G RAC-(3/8)-orastar

orastar發表於2017-05-10

10、作業系統_配置(htdb1、htdb2)



10.1  修改/etc/hosts

root執行指令碼

  1. cat>>/etc/hosts<<EOF
  2. #Public
  3. 192.168.1.115 htdb1
  4. 192.168.1.117 htdb2
  5.  
  6. #Private
  7. 10.10.10.115 htdb1-priv
  8. 10.10.10.117 htdb2-priv
  9.  
  10. #Virtual
  11. 192.168.1.116 htdb1-vip
  12. 192.168.1.118 htdb2-vip
  13.  
  14. #SCAN
  15. 192.168.1.119 htdb-scan
  16. EOF


10.2  配置YUM

10.2.1    首次掛載報錯

[root@htdb1 ~]# mount /dev/cdrom /mnt

mount: you must specify the filesystem type

10.2.2    處理報錯方法



[root@htdb1 ~]# mount /dev/cdrom /mnt

mount: block device /dev/sr0 is write-protected, mounting read-only


#vi /etc/yum.repos.d/rhel-source.repo   --說明: 先清空該檔案,再新增以下內容。   有同學反應,yum無法正常安裝rpm包,因為沒有正常該檔案造成。

[rhel-oracle-lib]

name=oracle

baseurl=file:///mnt

enabled=1

gpgcheck=0


#yum clean all

#yum list |head




10.3  安裝RPM包

10.4  安裝Oracle安裝所需RPM包


  1. yum install-y gcc compat-gcc-34 elfutils-libelf-devel compat-libstdc++-33 elfutils-libelf gcc-c++glibc-headers libaio libaio-devel libgcc libstdc++libstdc++-devel make ksh sysstat unixODBC compat-libcap1 libXp



[root@htdb2 ~]# yum install -y  gcc compat-gcc-34 elfutils-libelf-devel compat-libstdc++-33 elfutils-libelf gcc-c++ glibc-headers libaio libaio-devel libgcc libstdc++ libstdc++-devel make ksh sysstat unixODBC compat-libcap1 libXp

Loaded plugins: product-id, refresh-packagekit, search-disabled-repos, security, subscription-manager

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

Setting up Install Process

Package elfutils-libelf-0.164-2.el6.x86_64 already installed and latest version

Package glibc-headers-2.12-1.192.el6.x86_64 already installed and latest version

Package libaio-0.3.107-10.el6.x86_64 already installed and latest version

Package libgcc-4.4.7-17.el6.x86_64 already installed and latest version

Package libstdc++-4.4.7-17.el6.x86_64 already installed and latest version

Package 1:make-3.81-23.el6.x86_64 already installed and latest version

Package sysstat-9.0.4-31.el6.x86_64 already installed and latest version

Resolving Dependencies

--> Running transaction check

---> Package compat-gcc-34.x86_64 0:3.4.6-19.el6 will be installed

---> Package compat-libcap1.x86_64 0:1.10-1 will be installed

---> Package compat-libstdc++-33.x86_64 0:3.2.3-69.el6 will be installed

---> Package elfutils-libelf-devel.x86_64 0:0.164-2.el6 will be installed

---> Package gcc.x86_64 0:4.4.7-17.el6 will be installed

--> Processing Dependency: cpp = 4.4.7-17.el6 for package: gcc-4.4.7-17.el6.x86_64

--> Processing Dependency: cloog-ppl >= 0.15 for package: gcc-4.4.7-17.el6.x86_64

---> Package gcc-c++.x86_64 0:4.4.7-17.el6 will be installed

--> Processing Dependency: libmpfr.so.1()(64bit) for package: gcc-c++-4.4.7-17.el6.x86_64

---> Package ksh.x86_64 0:20120801-33.el6 will be installed

---> Package libXp.x86_64 0:1.0.2-2.1.el6 will be installed

---> Package libaio-devel.x86_64 0:0.3.107-10.el6 will be installed

---> Package libstdc++-devel.x86_64 0:4.4.7-17.el6 will be installed

---> Package unixODBC.x86_64 0:2.2.14-14.el6 will be installed

--> Running transaction check

---> Package cloog-ppl.x86_64 0:0.15.7-1.2.el6 will be installed

--> Processing Dependency: libppl.so.7()(64bit) for package: cloog-ppl-0.15.7-1.2.el6.x86_64

--> Processing Dependency: libppl_c.so.2()(64bit) for package: cloog-ppl-0.15.7-1.2.el6.x86_64

---> Package cpp.x86_64 0:4.4.7-17.el6 will be installed

---> Package mpfr.x86_64 0:2.4.1-6.el6 will be installed

--> Running transaction check

---> Package ppl.x86_64 0:0.10.2-11.el6 will be installed

--> Finished Dependency Resolution


Dependencies Resolved


=========================================================================================================================

 Package                            Arch                Version                       Repository                    Size

=========================================================================================================================

Installing:

 compat-gcc-34                      x86_64              3.4.6-19.el6                  rhel-oracle-lib              3.7 M

 compat-libcap1                     x86_64              1.10-1                        rhel-oracle-lib               17 k

 compat-libstdc++-33                x86_64              3.2.3-69.el6                  rhel-oracle-lib              183 k

 elfutils-libelf-devel              x86_64              0.164-2.el6                   rhel-oracle-lib               32 k

 gcc                                x86_64              4.4.7-17.el6                  rhel-oracle-lib               10 M

 gcc-c++                            x86_64              4.4.7-17.el6                  rhel-oracle-lib              4.7 M

 ksh                                x86_64              20120801-33.el6               rhel-oracle-lib              761 k

 libXp                              x86_64              1.0.2-2.1.el6                 rhel-oracle-lib               29 k

 libaio-devel                       x86_64              0.3.107-10.el6                rhel-oracle-lib               13 k

 libstdc++-devel                    x86_64              4.4.7-17.el6                  rhel-oracle-lib              1.6 M

 unixODBC                           x86_64              2.2.14-14.el6                 rhel-oracle-lib              378 k

Installing for dependencies:

 cloog-ppl                          x86_64              0.15.7-1.2.el6                rhel-oracle-lib               93 k

 cpp                                x86_64              4.4.7-17.el6                  rhel-oracle-lib              3.7 M

 mpfr                               x86_64              2.4.1-6.el6                   rhel-oracle-lib              156 k

 ppl                                x86_64              0.10.2-11.el6                 rhel-oracle-lib              1.3 M


Transaction Summary

=========================================================================================================================

Install      15 Package(s)


Total download size: 27 M

Installed size: 70 M

Downloading Packages:

-------------------------------------------------------------------------------------------------------------------------

Total                                                                                     33 MB/s |  27 MB     00:00    

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

  Installing : mpfr-2.4.1-6.el6.x86_64                                                                              1/15

  Installing : cpp-4.4.7-17.el6.x86_64                                                                              2/15

  Installing : libstdc++-devel-4.4.7-17.el6.x86_64                                                                  3/15

  Installing : ppl-0.10.2-11.el6.x86_64                                                                             4/15

  Installing : cloog-ppl-0.15.7-1.2.el6.x86_64                                                                      5/15

  Installing : gcc-4.4.7-17.el6.x86_64                                                                              6/15

  Installing : gcc-c++-4.4.7-17.el6.x86_64                                                                          7/15

  Installing : libXp-1.0.2-2.1.el6.x86_64                                                                           8/15

  Installing : compat-libstdc++-33-3.2.3-69.el6.x86_64                                                              9/15

  Installing : compat-gcc-34-3.4.6-19.el6.x86_64                                                                   10/15

  Installing : libaio-devel-0.3.107-10.el6.x86_64                                                                  11/15

  Installing : unixODBC-2.2.14-14.el6.x86_64                                                                       12/15

  Installing : ksh-20120801-33.el6.x86_64                                                                          13/15

  Installing : elfutils-libelf-devel-0.164-2.el6.x86_64                                                            14/15

  Installing : compat-libcap1-1.10-1.x86_64                                                                        15/15

rhel-oracle-lib/productid                                                                         | 1.6 kB     00:00 ...

  Verifying  : compat-libcap1-1.10-1.x86_64                                                                         1/15

  Verifying  : elfutils-libelf-devel-0.164-2.el6.x86_64                                                             2/15

  Verifying  : ksh-20120801-33.el6.x86_64                                                                           3/15

  Verifying  : ppl-0.10.2-11.el6.x86_64                                                                             4/15

  Verifying  : unixODBC-2.2.14-14.el6.x86_64                                                                        5/15

  Verifying  : libaio-devel-0.3.107-10.el6.x86_64                                                                   6/15

  Verifying  : compat-gcc-34-3.4.6-19.el6.x86_64                                                                    7/15

  Verifying  : mpfr-2.4.1-6.el6.x86_64                                                                              8/15

  Verifying  : libstdc++-devel-4.4.7-17.el6.x86_64                                                                  9/15

  Verifying  : gcc-c++-4.4.7-17.el6.x86_64                                                                         10/15

  Verifying  : gcc-4.4.7-17.el6.x86_64                                                                             11/15

  Verifying  : compat-libstdc++-33-3.2.3-69.el6.x86_64                                                             12/15

  Verifying  : libXp-1.0.2-2.1.el6.x86_64                                                                          13/15

  Verifying  : cpp-4.4.7-17.el6.x86_64                                                                             14/15

  Verifying  : cloog-ppl-0.15.7-1.2.el6.x86_64                                                                     15/15


Installed:

  compat-gcc-34.x86_64 0:3.4.6-19.el6         compat-libcap1.x86_64 0:1.10-1   compat-libstdc++-33.x86_64 0:3.2.3-69.el6

  elfutils-libelf-devel.x86_64 0:0.164-2.el6  gcc.x86_64 0:4.4.7-17.el6        gcc-c++.x86_64 0:4.4.7-17.el6            

  ksh.x86_64 0:20120801-33.el6                libXp.x86_64 0:1.0.2-2.1.el6     libaio-devel.x86_64 0:0.3.107-10.el6     

  libstdc++-devel.x86_64 0:4.4.7-17.el6       unixODBC.x86_64 0:2.2.14-14.el6


Dependency Installed:

  cloog-ppl.x86_64 0:0.15.7-1.2.el6  cpp.x86_64 0:4.4.7-17.el6  mpfr.x86_64 0:2.4.1-6.el6  ppl.x86_64 0:0.10.2-11.el6


Complete!

[root@htdb2 ~]#


10.5  安裝iscsi包

使用root執行命令:yum install -y  iscsi-initiator-*


[root@htdb1 ~]# yum install -y  iscsi-initiator-*

Loaded plugins: product-id, refresh-packagekit, search-disabled-repos, security, subscription-manager

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

Setting up Install Process

Resolving Dependencies

--> Running transaction check

---> Package iscsi-initiator-utils.x86_64 0:6.2.0.873-21.el6 will be installed

--> Finished Dependency Resolution


Dependencies Resolved


=========================================================================================================================

 Package                            Arch                Version                       Repository                    Size

=========================================================================================================================

Installing:

 iscsi-initiator-utils              x86_64              6.2.0.873-21.el6              rhel-oracle-lib              730 k


Transaction Summary

=========================================================================================================================

Install       1 Package(s)


Total download size: 730 k

Installed size: 2.5 M

Downloading Packages:

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

  Installing : iscsi-initiator-utils-6.2.0.873-21.el6.x86_64                                                         1/1

  Verifying  : iscsi-initiator-utils-6.2.0.873-21.el6.x86_64                                                         1/1


Installed:

  iscsi-initiator-utils.x86_64 0:6.2.0.873-21.el6                                                                       


Complete!


10.6  安裝multipath包

yum install -y  device-mapper-multipath-*

[root@htdb1 ~]# yum install -y  device-mapper-multipath-*

Loaded plugins: product-id, refresh-packagekit, search-disabled-repos, security, subscription-manager

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

Setting up Install Process

Resolving Dependencies

--> Running transaction check

---> Package device-mapper-multipath.x86_64 0:0.4.9-93.el6 will be installed

---> Package device-mapper-multipath-libs.x86_64 0:0.4.9-93.el6 will be installed

--> Finished Dependency Resolution


Dependencies Resolved


=========================================================================================================================

 Package                                  Arch               Version                   Repository                   Size

=========================================================================================================================

Installing:

 device-mapper-multipath                  x86_64             0.4.9-93.el6              rhel-oracle-lib             128 k

 device-mapper-multipath-libs             x86_64             0.4.9-93.el6              rhel-oracle-lib             198 k


Transaction Summary

=========================================================================================================================

Install       2 Package(s)


Total download size: 326 k

Installed size: 687 k

Downloading Packages:

-------------------------------------------------------------------------------------------------------------------------

Total                                                                                     15 MB/s | 326 kB     00:00    

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

  Installing : device-mapper-multipath-libs-0.4.9-93.el6.x86_64                                                      1/2

  Installing : device-mapper-multipath-0.4.9-93.el6.x86_64                                                           2/2

  Verifying  : device-mapper-multipath-libs-0.4.9-93.el6.x86_64                                                      1/2

  Verifying  : device-mapper-multipath-0.4.9-93.el6.x86_64                                                           2/2


Installed:

  device-mapper-multipath.x86_64 0:0.4.9-93.el6            device-mapper-multipath-libs.x86_64 0:0.4.9-93.el6          


Complete!



10.7   關閉防火牆及selinux

/sbin/iptables -F; /sbin/ip6tables -F

/sbin/chkconfig iptables off; /sbin/chkconfig ip6tables off


/bin/sed -i s/SELINUX=enforcing/SELINUX=disabled/ /etc/selinux/config

/usr/sbin/setenforce 0





10.8   修改/etc/sysctl.conf引數


  1. cat>>/etc/sysctl.conf<<EOF
  2. #fororacle
  3. kernel.shmmni=4096
  4. kernel.sem=250 32000 100 128
  5. fs.aio-max-nr=1048576
  6. fs.file-max=6815744
  7. net.ipv4.ip_local_port_range=9000 65500
  8. net.core.rmem_default=262144
  9. net.core.rmem_max=4194304
  10. net.core.wmem_default=262144
  11. net.core.wmem_max=1048576
  12. kernel.shmmni=4096
  13. kernel.sem=250 32000 100 128
  14. EOF




10.9   修改/etc/security/limits.conf引數


  1. cat>>/etc/security/limits.conf<<EOF
  2. #fororacle
  3. grid soft nproc 2047
  4. grid hard nproc 16384
  5. grid soft nofile 1024
  6. grid hard nofile 65536
  7. grid soft stack 10240
  8. grid hard stack 10240
  9. oracle soft nproc 2047
  10. oracle hard nproc 16384
  11. oracle soft nofile 1024
  12. oracle hard nofile 65536
  13. oracle soft stack 10240
  14. oracle hard stack 10240
  15. EOF

10.10    修改/etc/pam.d/login引數


  1. cat>>/etc/pam.d/login<<EOF
  2. #fororacle
  3. session required pam_limits.so
  4. EOF

10.11    修改/etc/profile引數


  1. cat >> /etc/profile <<EOF
    #for oracle
    if [ \$USER = "oracle" ] || [ \$USER = "grid" ]; then
    if [ \$SHELL = "/bin/ksh" ]; then
    ulimit -p 16384
    ulimit -n 65536
    else
    ulimit -u 16384 -n 65536
    fi
    fi
    EOF

10.12    建立使用者


  1. /usr/sbin/groupadd -g 1000 oinstall
  2. /usr/sbin/groupadd -g 1001 dba
  3. /usr/sbin/groupadd -g 1002 oper
  4. /usr/sbin/groupadd -g 1003 asmadmin
  5. /usr/sbin/groupadd -g 1004 asmoper
  6. /usr/sbin/groupadd -g 1005 asmdba
  7. /usr/sbin/useradd –u 1000-g oinstall-G dba,oper,asmdba oracle
  8. /usr/sbin/useradd –u 1001-g oinstall-G dba,asmadmin,asmdba,asmoper grid
  9. /bin/echo"grid"|/usr/bin/passwd --stdin grid
  10. /bin/echo"oracle"|/usr/bin/passwd --stdin oracle

10.13     建立目錄

  1. /bin/mkdir -p /u01/app/grid
  2. /bin/mkdir -p /u01/app/11.2.0/grid
  3. /bin/mkdir -p /u01/app/oracle
  4. /bin/chown -R grid:oinstall /u01
  5. /bin/chown -R oracle:oinstall /u01/app/oracle
  6. /bin/chmod -R 775 /u01

10.14    修改環境變數

GRID使用者:


  1. cat >> /home/grid/.bash_profile <<EOF
  2. export ORACLE_BASE=/u01/app/grid
  3. export ORACLE_HOME=/u01/app/11.2.0/grid
  4. export ORACLE_SID=+ASM1
  5. export PATH=\$ORACLE_HOME/OPatch:\$ORACLE_HOME/bin:\$PATH
  6. umask=022
  7. EOF


ORACLE使用者:

  1. cat >> /home/oracle/.bash_profile <<EOF
  2. export ORACLE_BASE=/u01/app/oracle
  3. export ORACLE_HOME=\$ORACLE_BASE/product/11.2.0/db_1
  4. export ORACLE_SID=htdb1
  5. export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
  6. export LD_LIBRARY_PATH=\$ORACLE_HOME/lib
  7. export PATH=\$ORACLE_HOME/OPatch:\$ORACLE_HOME/bin:\$PATH
  8. umask=022
  9. EOF



來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31442014/viewspace-2138823/,如需轉載,請註明出處,否則將追究法律責任。

相關文章