Grid+ASM+Oracle Database 12c安裝配置教程
備註:工作需要開始學習oracle,之前只學習過mysql的一些基礎東東,oracle對我而言是一個新的資料體系,作為初學者,很多地方可能寫的不對,只是個人理解,誤導之處,請諒解,求指正![Byrd:2016年7月3日]
環境基礎:
虛擬機器IP(LINUX):1.1.1.212
本地IP(WIN):1.1.1.1
變數配置:
[[email protected] ~]# uname -a
Linux oracle01.db.hangzhou.t4x.org 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
[
ASM配置:
[[email protected] tools]# rpm -ivh oracleasm-support-2.1.8-1.el6.x86_64.rpm warning: oracleasm-support-2.1.8-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY Preparing... ########################################### [100%] 1:oracleasm-support ########################################### [100%] [[email protected] tools]# rpm -ivh oracleasmlib-2.0.4-1.el6.x86_64.rpm warning: oracleasmlib-2.0.4-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY error: Failed dependencies: oracleasm >= 1.0.4 is needed by oracleasmlib-2.0.4-1.el6.x86_64 [[email protected] tools]# yum install oracleasmlib* [[email protected] tools]# /etc/init.d/oracleasm configure Configuring the Oracle ASM library driver. This will configure the on-boot properties of the Oracle ASM library driver. The following questions will determine whether the driver is loaded on boot and what permissions it will have. The current values will be shown in brackets ('[]'). Hitting <ENTER> without typing an answer will keep that current value. Ctrl-C will abort. Default user to own the driver interface []: grid Default group to own the driver interface []: asmadmin Start Oracle ASM library driver on boot (y/n) [n]: y Scan for Oracle ASM disks on boot (y/n) [y]: y Writing Oracle ASM library driver configuration: done Initializing the Oracle ASMLib driver: [FAILED] [[email protected] tools]# find / -name oracleasm.ko /lib/modules/2.6.32-642.el6.x86_64/extra/oracleasm/oracleasm.ko /lib/modules/2.6.32-642.1.1.el6.x86_64/weak-updates/oracleasm/oracleasm.ko [[email protected] tools]# reboot Last login: Fri Jul 1 23:24:29 2016 from 1.1.1.1 [[email protected] ~]# /etc/init.d/oracleasm configure Configuring the Oracle ASM library driver. This will configure the on-boot properties of the Oracle ASM library driver. The following questions will determine whether the driver is loaded on boot and what permissions it will have. The current values will be shown in brackets ('[]'). Hitting <ENTER> without typing an answer will keep that current value. Ctrl-C will abort. Default user to own the driver interface [grid]: Default group to own the driver interface [asmadmin]: Start Oracle ASM library driver on boot (y/n) [y]: Scan for Oracle ASM disks on boot (y/n) [y]: Writing Oracle ASM library driver configuration: done Initializing the Oracle ASMLib driver: [ OK ] Scanning the system for Oracle ASMLib disks: [ OK ] [[email protected] ~]# /etc/init.d/oracleasm status Checking if ASM is loaded: yes Checking if /dev/oracleasm is mounted: yes [[email protected] ~]# fdisk /dev/sdf [[email protected] ~]# /etc/init.d/oracleasm createdisk DISK1 /dev/sdb1 Marking disk "DISK1" as an ASM disk: [FAILED] [[email protected] ~]# setenforce 0 [[email protected] ~]# /etc/init.d/oracleasm createdisk DISK1 /dev/sdb1 Marking disk "DISK1" as an ASM disk: [ OK ] [[email protected] ~]# /etc/init.d/oracleasm createdisk DISK2 /dev/sdc1 Marking disk "DISK2" as an ASM disk: [ OK ] [[email protected] ~]# /etc/init.d/oracleasm createdisk DISK3 /dev/sdd1 Marking disk "DISK3" as an ASM disk: [ OK ] [[email protected] ~]# /etc/init.d/oracleasm createdisk DISK4 /dev/sde1 Marking disk "DISK4" as an ASM disk: [ OK ] [[email protected] ~]# /etc/init.d/oracleasm createdisk DISK5 /dev/sdf1 Marking disk "DISK5" as an ASM disk: [ OK ] [[email protected] ~]# /etc/init.d/oracleasm listdisks DISK1 DISK2 DISK3 DISK4 DISK5 grid安裝:
[[email protected] ~]# chown grid /byrd/tools/linuxamd64_12102_grid_* [[email protected] ~]# chown grid /byrd/tools/ [[email protected] ~]# su - grid [[email protected] ~]$ cd /byrd/tools/ [[email protected] tools]$ unzip linuxamd64_12102_grid_1of2.zip [[email protected] tools]$ unzip linuxamd64_12102_grid_2of2.zip [[email protected] ~]$ export DISPLAY=1.1.1.1:0.0 [[email protected] tools]$ /byrd/tools/grid/runInstaller #####################安裝一個Xmanager Enterprise 5--Xmanager - Passive##################### #####################安裝過程請看下面的圖片##################### [[email protected] tools]$ cat /data/app/oraInventory/ContentsXML/inventory.xml #檢視安裝資訊
ASM:配置 [[email protected] ~]# tail -1 /home/grid/.bash_profile export PATH=$ORACLE_HOME/bin:$PATH [[email protected] ~]$ . .bash_profile [[email protected] ~]$ echo $PATH /data/app/grid/product/12.1.0/grid/bin:/data/app/grid/product/12.1.0/grid/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/grid/bin:/home/grid/bin [[email protected] ~]$ export DISPLAY=1.1.1.1:0.0 [[email protected] ~]$ xhost + access control disabled, clients can connect from any host [[email protected] tools]$ asmca #####################安裝過程請看下面的圖片##################### 1:建立asm恢復組
2:配置Fast Recovery Area
oRACLE安裝: [[email protected] tools]# chown oracle.oinstall linuxamd64_12102_database_* [[email protected] tools]# chown oracle linuxamd64_12102_database_* [[email protected] tools]# chown oracle ../tools/ [[email protected] tools]# su - oracle [[email protected] ~]$ cd /byrd/tools/ [[email protected] tools]$ unzip linuxamd64_12102_database_1of2.zip [[email protected] tools]$ unzip linuxamd64_12102_database_2of2.zip [[email protected] tools]$ /byrd/tools/database/runInstaller >>> Ignoring required pre-requisite failures. Continuing... Preparing to launch Oracle Universal Installer from /tmp/OraInstall2016-07-02_10-29-26AM. Please wait ...[[email protected] tools]$ You can find the log of this install session at: /data/app/oraInventory/logs/installActions2016-07-02_10-29-26AM.log #####################安裝過程請看下面的圖片##################### 建立oracle資料庫: [[email protected] tools]# tail -1 /home/oracle/.bash_profile export PATH=$ORACLE_HOME/bin:$PATH [[email protected] tools]$ . ~/.bash_profile [[email protected] tools]$ export DISPLAY=1.1.1.1:0.0 [[email protected] tools]$ dbca #####################安裝過程請看下面的圖片#####################
檢視狀態: [[email protected] ~]$ crs_stat -t -v CRS-275: This command is not supported in Oracle Restart environment. [[email protected] ~]$ crsctl status res -t -------------------------------------------------------------------------------- Name Target State Server State details -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.DATA.dg ONLINE ONLINE oracle01 STABLE ora.FRA.dg ONLINE ONLINE oracle01 STABLE ora.LISTENER.lsnr ONLINE ONLINE oracle01 STABLE ora.asm ONLINE INTERMEDIATE oracle01 CHECK TIMED OUT,STAB LE ora.ons OFFLINE OFFLINE oracle01 STABLE -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.cssd 1 ONLINE ONLINE oracle01 STABLE ora.diskmon 1 OFFLINE OFFLINE STABLE ora.evmd 1 ONLINE ONLINE oracle01 STABLE ora.orcl.db 1 ONLINE ONLINE oracle01 Open,STABLE -------------------------------------------------------------------------------- [[email protected] tools]$ sqlplus / as sysdba SQL*Plus: Release 12.1.0.2.0 Production on Sat Jul 2 14:07:10 2016 Copyright (c) 1982, 2014, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics and Real Application Testing options 核心配置建議: kernel.shmmax 關於核心引數kernel.shmmax,oracle 建議,kernel.shmmax的值不能少於實體記憶體的一半,而且要大於Oracle中sga-max-size的值,否則會造成oracle效能下降 一般32bit作業系統,直接設定為系統支援的最大記憶體即可,64bit作業系統設定大於sga-max-size的值即可 如:當前記憶體為2G 則kernel.shmmax = 2*1024*1024=2097152 當前記憶體為8G則 kernel.shmmax = 7*1024*1024=7340032 Kernel.shmall Shmall指系統一次可以使用的共享記憶體段的最大數量,以頁為單位。Oracle預設設定為 kernel.shmall = 2097152 即最大8G(2097152*4/1024/1024),(在調整SGA時需要注意,SGA大小設定不可超過該值),根據系統記憶體大小和使用的不同可以參考如下:設定的一般規律 kernel.shmall = 8G/4k=8388608k/4k=2097152 ---記憶體8G kernel.shmall = 16G/4k=16777216k/4k=4194304 ---記憶體16G kernel.shmall = 32G/4k=33554432k/4k=8388608 ---記憶體32G (RedHat linux系統中頁大小為4096即4K,實際環境以getconf PAGE_SIZE結果為準) kernel.shmmni shmmni 指系統共享記憶體段的最大數量 oracle設定預設值為4096,一般是足夠用了,不需要調整 檔案控制代碼數的相關核心引數設定 fs.file-max fs.file-max指系統能夠開啟最大的檔案控制代碼數 oracle建議設定為65536,一般不用修改 訊號的相關核心引數設定 kernel.sem kernel.sem是指 semmsl,semmns,semopm,semmni這4個引數 semmsl 指每個線號集的最大訊號數,Oracle建議是設定為oracle的最大程序數+10 semmni 指整個系統的訊號集的最大數量 semmns 指整個系統的訊號總數,也就是semmni*semmsl的結果 semopm 指每個semop系統呼叫可以執行的訊號操作的最大數量 oracle預設設定 semmsl=250 semmns=3200 semopm=100 semmni=128 即kernel.sem= 250 3200 100 128 例:在oracle ora.init檔案引數中設定PROCESSES引數為5000 則semmsl=5010,semmni=128,semmns=semmsl* semmni=641280 另外semopm建議設定等於semmsl值即5010 那麼kernel.sem=5010 641280 5010 128 網路相關的核心引數設定 net.core.rmem_default net.core.rmem_default 指網路套接字的預設接收緩衝區的大小,oracle建議設定為265K即262144 net.core.rmem_max net.core.rmem_max 指網路套接字的最大接收緩衝區的大小,oracle10g及以前版本建議設定為256k即262144 oracle11g建議設定為4M 即4194304 net.core.wmem_default net.core.wmem_default指網路套接字的預設傳送緩衝區的大小,oracle建議設定為265K即262144 net.core.wmem_max net.core.wmem_max 指網路套接字的最大發送緩衝區的大小,oracle10g及以前版本建議設定為256k即262144 oracle11g建議設定為1M即1048576 net.ipv4.ip_local_port_range net.ipv4.ip_local_port_range ,指本地的允許開啟隨機埠範圍 oracle10g前建議埠範圍為1024 65000,oracle11g建議埠範圍為: 9000 65500 並忽略oracle安裝程式任何關於這個引數的警告 Asynchronous I/O相關的核心引數設定 fs.aio-max-nr fs.aio-max-nr 指系統允許的最大的非同步IO請求大小 oracle預設設定為1M即1048576,一般不用更改