Oracle數(shù)據(jù)庫在Linux 中的安裝與啟動動 |
發(fā)布時間: 2012/8/18 17:01:43 |
到目前為止,Oracle數(shù)據(jù)庫算是我在linux安裝的眾多軟件中最難安裝的一個。值得慶幸的是,就在剛剛我成功的把oracle database安裝到了linux os,F(xiàn)在回想起來裝個oracle也并非難事;蛟S自己將來還是安裝oracle,下面就簡要回憶一下我的安裝過程,用來提示將來的自己和第一次要在linux上安裝oracle的朋友。 首先看一下我的軟件環(huán)境: - GUEST(vm):CentOS 5.5。眾所周知,linux有很多發(fā)行版,我們必須要選擇一個發(fā)行版去安裝Oracle,這個時候最好是選擇oracle安裝手冊中提到那幾個發(fā)行版,比如Asianux 、 Oracle Enterprise Linux 、Red Hat Enterprise Linux、 SUSE Linux Enterprise Server 等。因為這樣安裝會簡單很多。 DATABASE:Oracle Database 11g Release 2 下面是安裝steps: Step1. 創(chuàng)建用戶和組(#表示以root身份,$表示以普通用戶身份) 下面是Oracle 數(shù)據(jù)庫文檔中的一段話,依照下面的話去創(chuàng)建或修改DB所需的用戶和組: The following local operating system groups and users are required if you are installing Oracle Database: *The Oracle Inventory group (typically, oinstall) *The OSDBA group (typically, dba) *The Oracle software owner (typically, oracle) *The OSOPER group (optional. Typically, oper) To determine whether these groups and users already exist, and if necessary, to create them, follow these steps: 1.To determine whether the oinstall group exists, enter the following command: # more /etc/oraInst.loc If the output of this command shows the oinstall group name, then the group already exists. If the oraInst.loc file exists, then the output from this command is similar to the following: inventory_loc=/u01/app/oraInventory inst_group=oinstall The inst_group parameter shows the name of the Oracle Inventory group, oinstall. 2.To determine whether the dba group exists, enter the following command: # grep dba /etc/group If the output from this commands shows the dba group name, then the group already exists. 3.If necessary, enter the following commands to create the oinstall and dba groups: # /usr/sbin/groupadd oinstall # /usr/sbin/groupadd dba 4. To determine whether the Oracle user exists and belongs to the correct groups, enter the following command: # id Oracle If the Oracle user exists, then this command displays information about the groups to which the user belongs. The output should be similar to the following, indicating that oinstall is the primary group and dba is a secondary group: uid=440(Oracle) gid=200(oinstall) groups=201(dba),202(oper) 5.If necessary, complete one of the following actions: *If the Oracle user exists, but its primary group is not oinstall or it is not a member of the dba group, then enter the following command: # /usr/sbin/usermod -g oinstall -G dba Oracle *If the Oracle user does not exist, enter the following command to create it: # /usr/sbin/useradd -g oinstall -G dba Oracle This command creates the Oracle user and specifies oinstall as the primary group and dba as the secondary group. 6.Enter the following command to set the password of the Oracle user: # passwd Oracle Step2. 進入db的解壓目錄執(zhí)行runInstaller,下面是我當時的操作: [Oracle@DBServer ~]$ ls Desktop linux_11gR2_database [Oracle@DBServer ~]$ cd linux_11gR2_database/ [Oracle@DBServer linux_11gR2_database]$ ls doc install response rpm runInstaller sshsetup stage welcome.html [Oracle@DBServer linux_11gR2_database]$ ./runInstaller 接下來就是完全的圖形界面操作了,這里面就沒什么好說的了。 Step3. 安裝系統(tǒng)缺失軟件與修改系統(tǒng)配置參數(shù) 關于這一步你可以按照安裝文檔里的要求那樣做。但是有一個更簡單的辦法,安裝程序會檢查系統(tǒng)配置參數(shù),當有參數(shù)不滿足配置的時候,你要做的就是修復并重新檢查,這個時候安裝程序會生成一個修復腳本并提示你腳本所在的位置及你要如何操作。對于系統(tǒng)缺少的軟件,修復腳本不會安裝,需要自己手動安裝。當所有的軟件配置參數(shù)都滿足的時候,你就可以一直next而不會再遇到什么困難了。 當初我安裝的時候選擇的是僅安裝數(shù)據(jù)庫軟件,所以我現(xiàn)在需要創(chuàng)建一個監(jiān)聽和數(shù)據(jù)庫。下面的Oracle_HOME需要你在配置文件(~/.bash_profile)中手動設置,當然最好是把$ORACLE_HOME/bin加入到PATH中去,這樣的話我們就可以在任何地方直接輸入命令了 [Oracle@DBServer ~]$ cd $ORACLE_HOME [Oracle@DBServer dbhome_1]$ pwd /home/Oracle/app/oracle/product/11.2.0/dbhome_1 [Oracle@DBServer dbhome_1]$ cd bin/ [Oracle@DBServer bin]$ netca 注:netca配置監(jiān)聽,圖形界面 [Oracle@DBServer bin]$ dbca 注:dbca 創(chuàng)建數(shù)據(jù)庫,圖形界面 上述step執(zhí)行完后,數(shù)據(jù)庫就可以使用了
默認情況下,linux中的Oracle是不會隨系統(tǒng)啟動而啟動的。當我們reboot系統(tǒng)的時候,可以用如下steps啟動我們的db: [Oracle@DBServer ~]$ lsnrctl start注:啟動監(jiān)聽 LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 10-DEC-2010 11:05:02 Copyright (c) 1991, 2009, Oracle. All rights reserved. Starting /home/Oracle/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait... TNSLSNR for Linux: Version 11.2.0.1.0 - Production System parameter file is /home/Oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora Log messages written to /home/Oracle/app/oracle/diag/tnslsnr/DBServer/listener/alert/log.xml Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=DBServer)(PORT=1521))) Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=DBServer)(PORT=2484)))
STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production Start Date 10-DEC-2010 11:05:02 Uptime 0 days 0 hr. 0 min. 0 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /home/Oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora Listener Log File /home/Oracle/app/oracle/diag/tnslsnr/DBServer/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=DBServer)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=DBServer)(PORT=2484))) The listener supports no services The command completed successfully [Oracle@DBServer ~]$ dbstart注:啟動數(shù)據(jù)庫 Oracle_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener Usage: /home/Oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbstart ORACLE_HOME Processing Database instance "orcl": log file /home/Oracle/app/oracle/product/11.2.0/dbhome_1/startup.log 以下steps關閉db: [Oracle@DBServer ~]$ dbshut注:關閉數(shù)據(jù)庫 Oracle_HOME_LISTNER is not SET, unable to auto-stop Oracle Net Listener Usage: /home/Oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbshut ORACLE_HOME Processing Database instance "orcl": log file /home/Oracle/app/oracle/product/11.2.0/dbhome_1/shutdown.log [Oracle@DBServer ~]$ lsnrctl stop注:關閉監(jiān)聽 LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 10-DEC-2010 11:06:50 Copyright (c) 1991, 2009, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=DBServer)(PORT=1521))) The command completed successfully [Oracle@DBServer ~]$ 不幸的是如果是第一次這么做,我們可能會失敗,原因我們可以在dbstart腳本中發(fā)現(xiàn)。我把有用的內(nèi)容摘錄如下: # This script will start all databases listed in the oratab file # whose third field is a "Y". If the third field is set to "Y" and # there is no Oracle_SID for an entry (the first field is a *), # then this script will ignore that entry. 看完這段內(nèi)容我想你已經(jīng)明白該如何做了,沒錯修改/etc/oratab中的內(nèi)容: orcl:/home/Oracle/app/oracle/product/11.2.0/dbhome_1:N 把其中的‘N’改為‘Y’ 到此數(shù)據(jù)庫啟動的問題都解決了,以后我們可以放心使用我們的db了。GOOK LUCK 本文出自:億恩科技【mszdt.com】 |