oracle 12c release 2 安裝

hgs19921112發表於2018-07-24

0.需要新增如下檔案幾內容  

    備註: /etc/oraInst.loc的內容為

                inventory_loc=/home/oracle/oraInventory

                inst_group=oinstall

1.     下載 Oracle 12c 的壓縮包,只有一個 zip 檔案  

2.     新增使用者組以及建立目錄:

groupadd oinstall

groupadd dba

useradd -g oinstall -G dba oracle

passwd oracle

mkdir /u01; mkdir /u02; mkdir /u03;

mkdir -p /u01/app/oracle/product/12.2.0.1/db_1

chown -R oracle:oinstall /u01

chown -R oracle:oinstall /u02

chown -R oracle:oinstall /u03

3.     修改 /etc/hosts 檔案

 

http://img.blog.itpub.net/blog/2018/07/24/a41117b7a24f318b.png?x-oss-process=style/bb

127.0.0.1       localhost localhost.localdomain localhost4 localhost4.localdomain4

192.168.6.128   dbserver

4.     修改 /etc/sysctl.conf

fs.file-max = 6815744

kernel.sem = 250 32000 100 128

kernel.shmmni = 4096

kernel.shmall = 1073741824

kernel.shmmax = 4398046511104

kernel.panic_on_oops = 1

net.core.rmem_default = 262144

net.core.rmem_max = 4194304

net.core.wmem_default = 262144

net.core.wmem_max = 1048576

net.ipv4.conf.all.rp_filter = 2

net.ipv4.conf.default.rp_filter = 2

fs.aio-max-nr = 1048576

net.ipv4.ip_local_port_range = 9000 65500

使引數生效

      sysctl -p

   5. 配置 /etc/security/limits.d/oracle-rdbms-server-12cR2-preinstall.conf

      

    oracle   soft   nofile    1024

    oracle   hard   nofile    65536

    oracle   soft   nproc    16384

    oracle   hard   nproc    16384

    oracle   soft   stack    10240

    oracle   hard   stack    32768

    oracle   hard   memlock    134217728

    oracle   soft   memlock    134217728

  6. 修改 /etc/pam.d/login

      session    required     pam_limits.so

  7. 安裝 oracle 需要的缺少的

    yum install binutils -y

    yum install compat-libcap1 -y

    yum install compat-libstdc++-33 -y

    yum install compat-libstdc++-33.i686 -y

    yum install glibc -y

    yum install glibc.i686 -y

    yum install glibc-devel -y

    yum install glibc-devel.i686 -y

    yum install ksh -y

    yum install libaio -y

    yum install libaio.i686 -y

    yum install libaio-devel -y

    yum install libaio-devel.i686 -y

    yum install libX11 -y

    yum install libX11.i686 -y

    yum install libXau -y

    yum install libXau.i686 -y

    yum install libXi -y

    yum install libXi.i686 -y

    yum install libXtst -y

    yum install libXtst.i686 -y

    yum install libgcc -y

    yum install libgcc.i686 -y

    yum install libstdc++ -y

    yum install libstdc++.i686 -y

    yum install libstdc++-devel -y

    yum install libstdc++-devel.i686 -y

    yum install libxcb -y

    yum install libxcb.i686 -y

    yum install make -y

    yum install nfs-utils -y

    yum install net-tools -y

    yum install smartmontools -y

    yum install sysstat -y

    yum install unixODBC -y

    yum install unixODBC-devel -y

    yum install gcc -y

    yum install gcc-c++ -y

    yum install libXext -y

    yum install libXext.i686 -y

    yum install zlib-devel -y

    yum install zlib-devel.i686 -y

    yum install e2fsprogs -y

    yum install e2fsprogs-libs -y

    yum install libs -y

    yum install libxcb.i686 -y

    yum install libxcb -y

  8. 修改 /etc/selinux/config

      SELINUX=permissive

      修改完後儲存執行如下

     # setenforce Permissive

9. 關閉防火牆

    # systemctl stop firewalld

    # systemctl disable firewalld

10.     新增環境變數

         #touch /etc/profile.d/setora.sh

         該檔案新增如下內容:

        # Oracle Settings

        export TMP=/tmp

        export TMPDIR=$TMP

        #export oracle.install.db.config.starterdb.globalDBName=oracle.sunyard

        export ORACLE_HOSTNAME=dbserver

        export GLOBAL_NAME=odb

        export ORACLE_UNQNAME=hgs

        export ORACLE_BASE=/u01/app/oracle

        export ORACLE_HOME=$ORACLE_BASE/product/12.2.0.1/db_1

        export ORACLE_SID=hgs

        export PATH=/usr/sbin:/usr/local/bin:$PATH

        export PATH=$ORACLE_HOME/bin:$PATH

        export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib

        export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

11. linuxx64_12201_database.zip 上傳伺服器,並解壓,解壓後目錄為

        http://img.blog.itpub.net/blog/2018/07/24/c43c48560c42d033.png?x-oss-process=style/bb

         以靜默方式安裝需要配置 responseFile

        配置目錄下的 database/response/db_install.rsp ,關鍵修改一下配置,否則安裝時會報錯,按照自己著真實配置

        INVENTORY_LOCATION=/home/oracle/oraInventory

        ORACLE_HOME=/u01/app/oracle/product/12.2.0.1/db_1

        ORACLE_BASE=/u01/app/oracle

        oracle.install.db.OSDBA_GROUP=oinstall

        oracle.install.db.OSOPER_GROUP=oinstall

        oracle.install.db.OSBACKUPDBA_GROUP=oinstall

        oracle.install.db.OSDGDBA_GROUP=oinstall

        oracle.install.db.OSKMDBA_GROUP=oinstall

        oracle.install.db.OSRACDBA_GROUP=oinstall

        oracle.install.db.config.starterdb.globalDBName=orcle12c

        oracle.install.db.config.starterdb.SID=hgs

        oracle.install.db.config.starterdb.characterSet=AL32UTF8

        oracle.install.db.config.starterdb.memoryLimit=1024

        oracle.install.db.config.starterdb.password.SYS=HGShgs912122_

        oracle.install.db.config.starterdb.password.SYSTEM=HGShgs912122_

        oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=/u02

         儲存檔案

12. 安裝  

        http://img.blog.itpub.net/blog/2018/07/24/dd4990837b1239e8.png?x-oss-process=style/bb

        圖中標識的就是要執行的檔案

        可以 ./runInstaller  --help 檢視幫助

        執行如下安裝

        ./runInstaller -silent -responseFile /u03/database/response/db_install.rsp -showProgress

         會有進度提示

13. 建立資料庫

        cd $ORACLE_HOME/dbs

        cp  init.ora  inithgs.ora

        chown oracle:oinstall  inithgs.ora

          inithgs.ora 修改如下 記憶體大小根據真實情況調整

        

        *.audit_file_dest='/u01/app/oracle/admin/orcl/adump'

        *.audit_trail='db'

        *.compatible='11.2.0'

        *.control_files='/u01/app/oracle/controls/ora_control1','/u01/app/oracle/controls/ora_control2'

        *.db_block_size=8192

        *.db_domain=''

        *.db_name='hgs'

        *.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'

        *.db_recovery_file_dest_size=2G

        *.diagnostic_dest='<ORACLE_BASE>'

        *.dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'

        *.memory_target=3G

        *.open_cursors=300

        *.processes=150

        *.remote_login_passwordfile='EXCLUSIVE'

        #*.undo_tablespace='UNDOTBS1'

        切換到 oracle 使用者

       su - oracle

        sqlplus / as sysdba

        startup nomount

        

         CREATE DATABASE hgs

           USER SYS IDENTIFIED BY sys_password

           USER SYSTEM IDENTIFIED BY system_password

           LOGFILE GROUP 1 ('/u01/app/oracle/oradata/hgs/redo01.log') SIZE 1000M,

                   GROUP 2 ('/u01/app/oracle/oradata/hgs/redo02.log') SIZE 1000M,

                   GROUP 3 ('/u01/app/oracle/oradata/hgs/redo03.log') SIZE 1000M

           MAXLOGFILES 16

           MAXLOGMEMBERS 2

           MAXLOGHISTORY 1

           MAXDATAFILES 100

           CHARACTER SET AL32UTF8

           NATIONAL CHARACTER SET AL16UTF16

           EXTENT MANAGEMENT LOCAL

           DATAFILE '/u01/app/oracle/oradata/hgs/system01.dbf' SIZE 1024M REUSE

           SYSAUX DATAFILE '/u01/app/oracle/oradata/hgs/sysaux01.dbf' SIZE 1024M REUSE

           DEFAULT TABLESPACE users

              DATAFILE '/u01/app/oracle/oradata/hgs/users01.dbf'

              SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED

           DEFAULT TEMPORARY TABLESPACE tempts1

              TEMPFILE '/u01/app/oracle/oradata/hgs/temp01.dbf'

              SIZE 500M REUSE

           UNDO TABLESPACE undotbs

              DATAFILE '/u01/app/oracle/oradata/hgs/undotbs01.dbf'

              SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;

         建立完成後需要執行幾個 sql 指令碼

        sys使用者

        @?/rdbms/admin/catalog.sql

        @?/rdbms/admin/catproc.sql

     system 使用者

        @?/sqlplus/admin/pupbld.sql

         至此,安裝 oracle 以及建立資料庫完畢

最後的建立資料庫可參考 oracle 官網    

      

最後本文有參考其他的部落格,沒有新增連結請見諒!

 


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

相關文章