標籤:oracle oracle 11g redhat database
給想學習oracle的新手看看,老鳥請飄過
作業系統資訊:
Vbox虛擬機器軟體版本:
安裝所需要的軟體:
所需軟體:
http://pan.baidu.com/s/1mgl8kzu
具體安裝步驟:
一、建立虛擬機器,並安裝redhat5.4作業系統(64位)
注意:這裡最小也要2G記憶體
由於我是做實驗的虛擬機器,儲存我們這裡選擇動態分配。如果該虛擬機器日後可能會經常使用,可將虛擬硬碟分配模式改為固定大小,這樣效能會更好一些。
我們在這裡分配了50G的儲存空間
掛載作業系統鏡像
完成後如所示:
啟動虛擬機器:
直接跳過CD介質測試
接下來進入安裝介面:
我們選擇安裝英文作業系統
沒有序號我們選擇跳過
建立的虛擬硬碟上根本沒有資料,隨他清空去吧,我們選yes。
我們選擇它的預設分區方式。
這裡網路設定先不管他,跳過去。
時區我們選擇亞洲/上海
root密碼設定為oracle
所需要的軟體包,我們勾選software development,同時勾選customize now,這樣在後面給系統打包時可以省些力氣。
記得把作業系統對中文的支援勾上,不然還得以後用到再安裝,省得以後麻煩。
然後靜靜等待安裝。
安裝完成後重啟虛擬機器
第一次啟動進行簡單配置
為了方便日後學習,我們將防火牆和selinux關閉掉。然後一路預設下一步。
又讓你註冊,我們沒有序號,還是只能跳過。
用root使用者登入作業系統
我們會發現解析度很讓人崩潰。所以我們需要安裝Vbox增強工具。
然後我們將鏡像中的檔案拷貝到我們案頭上自己建好的檔案夾下,用root使用者安裝增強功能。
執行安裝指令碼,完成後重啟即可。我們先將機器關閉,別急著重啟。
機器已關閉,然後我們添加一塊虛擬磁碟,3G足矣,後面安裝grid時會用到。
很快將會建立完成。
然後再設定裡將網卡類型從NAT改為host only,不知道為什麼的請自行百度虛擬機器網卡類型之間的區別。
完成後再次啟動虛擬機器。
接下來要設定虛擬機器的IP了,我們已經將網卡類型改為host only,所以我們要將虛擬機器IP改成和我們物理機的host only虛擬網卡在同一網段。
我們物理機的ip是192.168.56.1,所以我們將虛擬機器ip設定為192.168.56.10
設定虛擬機器的IP
然後我們發現IP已經設定完成。
物理機ping虛擬機器可以同,沒問題。
接下來給我們剛添加的那塊小虛擬硬碟分個區。
然後我們就可以看到建立的那個分區了。
二、將安裝介質上傳到虛擬機器。
通過xshell ssh遠程道虛擬機器
IP填寫虛擬機器的IP
輸入使用者名稱密碼即可
然後我們使用xftp工具將安裝介質上傳到虛擬機器。
(xshell xftp安裝包在我共用的檔案夾裡都有,Windows下傻瓜式安裝,這裡就不在贅述)
我們在根目錄下建立u01檔案夾,然後將安裝介質都放在該檔案夾下面。
然後耐心等待上傳即可。
三、添加使用者和作業系統組
我們在這裡不進行對作業系統參數的修改,也不對作業系統進行打補丁,在安裝過程中這一切都會得到解決。
更改u01檔案夾的許可權
四、安裝GRID 11g
安裝grid時需要建立asm磁碟組,我們可以通過給裸裝置改owner來用oracle使用者建立asm磁碟組,也可以用oracle提供的asmlib來建立asm磁碟,然後再用asm磁碟建立asm磁碟組。我們在這裡使用asmlib的方式,因為即使將裸裝置的owner改為了oracle使用者,當作業系統重啟後owner又會變成root,為了避免不必要的麻煩,我們採取asmlib的方式。
首先需要用root使用者安裝asmlib
找到我們上傳上來的asmlib 的rpm包,用root使用者安裝即可。
安裝asmlib完成
然後需要對asmlib進行配置。
配置完成,然後載入asmlib模組
使用我們之前分好的那個分區建立ASM磁碟,然後listdisks看到了我們建好的ASM磁碟,叫做ASM1
接下來登出root使用者,用oracle使用者登入作業系統
運行安裝檔案。
我們選擇僅安裝軟體。
選擇所有語言支援。
標準的安裝需要osdba osoper osasm作業系統組,我們方便起見就用dba組,不會對我們後面的學習有任何影響。
目錄就用預設的這個就好
然後進行安裝預檢測
這裡安裝程式自動檢測到了不達標的作業系統參數和缺失的rpm包。我們點擊fix & check again
我們用root使用者執行這個指令碼,然後所有的作業系統參數就都改好了,而不需要我們再去手動修改。
然後根據提示打這些缺失的rpm包。
我們掛載作業系統鏡像
[[email protected] Server]# pwd/media/RHEL_5.4 x86_64 DVD/Server[[email protected] Server]# rpm -ivh libaio-devel-0.3.106-3.2.x86_64.rpmwarning: libaio-devel-0.3.106-3.2.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186Preparing... ########################################### [100%] 1:libaio-devel ########################################### [100%][[email protected] Server]# rpm -ivh libaio-devel-0.3.106-3.2.i386.rpmwarning: libaio-devel-0.3.106-3.2.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186Preparing... ########################################### [100%] 1:libaio-devel ########################################### [100%][[email protected] Server]# rpm -ivh sysstat-7.0.2-3.el5.x86_64.rpmwarning: sysstat-7.0.2-3.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186Preparing... ########################################### [100%] 1:sysstat ########################################### [100%] [[email protected] Server]# rpm -ivh unixODBC-2.2.11-7.1.i386.rpmwarning: unixODBC-2.2.11-7.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186Preparing... ########################################### [100%] 1:unixODBC ########################################### [100%][[email protected] Server]# rpm -ivh unixODBC-2.2.11-7.1.x86_64.rpmwarning: unixODBC-2.2.11-7.1.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186Preparing... ########################################### [100%] 1:unixODBC ########################################### [100%][[email protected] Server]# rpm -ivh unixODBC-devel-2.2.11-7.1.x86_64.rpmwarning: unixODBC-devel-2.2.11-7.1.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186Preparing... ########################################### [100%] 1:unixODBC-devel ########################################### [100%][[email protected] Server]# rpm -ivh unixODBC-devel-2.2.11-7.1.i386.rpmwarning: unixODBC-devel-2.2.11-7.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186Preparing... ########################################### [100%] 1:unixODBC-devel ########################################### [100%]
然後只剩這一個問題,點擊忽略。
然後開始執行安裝
安裝快結束時會提示執行兩個指令碼:
將這兩個指令碼用root使用者執行一遍。
注意:第二個指令碼執行的時候要看返回的資訊
[[email protected] ~]# /u01/app/11.2.0/grid/root.shRunning Oracle 11g root.sh script...The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /u01/app/11.2.0/gridEnter the full pathname of the local bin directory: [/usr/local/bin]: Copying dbhome to /usr/local/bin ... Copying oraenv to /usr/local/bin ... Copying coraenv to /usr/local/bin ...Creating /etc/oratab file...Entries will be added to the /etc/oratab file as needed byDatabase Configuration Assistant when a database is createdFinished running generic part of root.sh script.Now product-specific root actions will be performed.To configure Grid Infrastructure for a Stand-Alone Server run the following command as the root user:/u01/app/11.2.0/grid/perl/bin/perl -I/u01/app/11.2.0/grid/perl/lib -I/u01/app/11.2.0/grid/crs/install /u01/app/11.2.0/grid/crs/install/roothas.plTo configure Grid Infrastructure for a Cluster perform the following steps:1. Provide values for Grid Infrastructure configuration parameters in the file - /u01/app/11.2.0/grid/crs/install/crsconfig_params. For details on how to do this, see the installation guide. 2. Run the following command as the root user: /u01/app/11.2.0/grid/perl/bin/perl -I/u01/app/11.2.0/grid/perl/lib -I/u01/app/11.2.0/grid/crs/install /u01/app/11.2.0/grid/crs/install/rootcrs.plTo update inventory properties for Grid Infrastructure, perform the followingsteps. If a pre-11.2 home is already configured, execute the following:11.2_Home/oui/bin/runInstaller -updateNodeList -silent -local CRS=false ORACLE_HOME=pre-11.2_HomeAlways execute the following to register the current home:11.2_Home/oui/bin/runInstaller -updateNodeList -silent -local CRS=true ORACLE_HOME=11.2_Home.If either home is shared, provide the additional argument -cfs.
這裡看似第二個指令碼執行完了,其實
這裡還要再執行另一個指令碼。
我們按照提示執行需要執行的指令碼:
[[email protected] ~]# /u01/app/11.2.0/grid/perl/bin/perl -I/u01/app/11.2.0/grid/perl/lib -I/u01/app/11.2.0/grid/crs/install /u01/app/11.2.0/grid/crs/install/roothas.pl2015-05-04 14:51:10: Checking for super user privileges2015-05-04 14:51:10: User has super user privileges2015-05-04 14:51:10: Parsing the host nameUsing configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_paramsCreating trace directoryLOCAL ADD MODE Creating OCR keys for user 'oracle', privgrp 'dba'..Operation successful.CRS-4664: Node localhost successfully pinned.Adding daemon to inittabCRS-4123: Oracle High Availability Services has been started.ohasd is startinglocalhost 2015/05/04 14:51:29 /u01/app/11.2.0/grid/cdata/localhost/backup_20150504_145129.olrSuccessfully configured Oracle Grid Infrastructure for a Standalone Server
這樣才是真正的安裝完成。
五、安裝資料庫軟體
我們沒有support帳號所以取消這個鉤。
我們選擇僅安裝軟體
安裝單一實例資料庫軟體
選擇安裝企業版,不然很多功能沒法使用
然後耐心等待安裝。
同樣使用root使用者執行指令碼
[[email protected] u01]# /u01/app/oracle/product/11.2.0/dbhome_1/root.shRunning Oracle 11g root.sh script...The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /u01/app/oracle/product/11.2.0/dbhome_1Enter the full pathname of the local bin directory: [/usr/local/bin]:The file "dbhome" already exists in /usr/local/bin. Overwrite it? (y/n)[n]: y Copying dbhome to /usr/local/bin ...The file "oraenv" already exists in /usr/local/bin. Overwrite it? (y/n)[n]: y Copying oraenv to /usr/local/bin ...The file "coraenv" already exists in /usr/local/bin. Overwrite it? (y/n)[n]: y Copying coraenv to /usr/local/bin ...Entries will be added to the /etc/oratab file as needed byDatabase Configuration Assistant when a database is createdFinished running generic part of root.sh script.Now product-specific root actions will be performed.Finished product-specific root actions.You have mail in /var/spool/mail/root
執行完成。
後面就dbca建庫了,可以建在檔案系統上,但是由於我們裝了Grid,當然也可以建在asm磁碟組上。
六、ASM磁碟組的建立
我們進入grid的bin目錄下,執行asmca命令
然後建立ASM磁碟組
指定ASM磁碟
將路徑改為我們的ASM磁碟坐在路徑
我們的ASM磁碟在這個路徑下
修改完成即可發現ASM磁碟。
我們將磁碟組命名為DATA,資料冗餘模式為外部冗餘。
然後建立ASM
七、在ASM磁碟組上建立資料庫
進到資料庫軟體的bin目錄下執行dbca進行建庫
這裡我們可以選擇檔案系統,當然,也可以選擇ASM
然後指定我們建好的ASM磁碟組即可
其他的步驟和單一實例的資料庫建庫沒什麼區別了,在此不再贅述。
一步一步教你在redhat linux 下安裝oracle 11g grid + database