基本都是用Oracle身份執行命令
1. 驗證 Oracle 所需要的系統依賴程式包是否完整。
rpm -qa binutils compat-db control-center gcc gcc-c++ glibc glibc-common libstdc++ libstdc++-devel make libaio libXp
2. 驗證系統要求
Oracle 所需最小 RAM 為 512MB ,www.bkjia.com而所需最小交換空間為 1GB 。對於 RAM 小於或等於 2GB 的系統,交換空間應為 RAM 數量的兩倍;對於 RAM 大於 2GB 的系統,交換空間應為 RAM 數量的一到兩倍。 Oracle 10g 軟體還需要 2.5GB 的可用磁碟空間,而資料庫則另需 1.2GB 的可用磁碟空間。 /tmp 目錄至少需要 400MB 的可用空間。
3. 建立 Oracle 使用者組和使用者
建立使用者組 oinstall 和 dba 。
建立使用者 oracle ,同屬於 oinstall 和 dba 使用者組,並且建立了 oracle 的 home 目錄。
修改 oracle 使用者的登入密碼。
$su - root
#groupadd dba // 資料庫系統管理理組
#groupadd oinstall //Oracle 檔案所有者的組
#useradd -g oinstall -G dba -m -s /bin/bash oracle
#passwd oracle
#chown -R oracle.oinstall /home/oracle
4. 配置核心參數
#vi /etc/sysctl.conf
編輯檔案 /etc/sysctl.conf ,修改以下項目,如果沒有可以自己添加。
kernel.shmall = 2097152# 可以使用的共用記憶體的總量。
kernel.shmmax = 2147483648# 最大共用記憶體段大小。
kernel.shmmni = 4096# 整個系統共用記憶體段的最大數目。
kernel.sem = 250 32000 100 128 # 每個訊號對象集的最大訊號對象數;系統範圍內最大訊號對象數;每個訊號對象支援的最大運算元;系統範圍內最大訊號對象集數。
fs.file-max = 65536# 系統中所允許的檔案控制代碼最大數目。
net.ipv4.ip_local_port_range = 1024 65000# 應用程式可使用的 IPv4 連接埠範圍。
net.core.rmem_default = 1048576 # 通訊端接收緩衝區大小的預設值
net.core.rmem_max = 1048576 # 通訊端接收緩衝區大小的最大值
net.core.wmem_default = 262144 # 通訊端發送緩衝區大小的預設值
net.core.wmem_max = 262144 # 通訊端發送緩衝區大小的最大值
5. 解壓縮安裝檔案
unzip 10201_database_linux32.zip
6. 修改 gennttab
解壓縮 filegroup6.jar 。
cd database/stage/Components/oracle.network.rsf/10.2.0.1.0/1/DataFiles/
unzip filegroup6.jar bin/gennttab
修改解壓出來的 gennttab 檔案。
vi bin/gennttab
改為:
即把 `s/ /\\` 中的後面的” \ ”改為” n ”,同時要注意把 n 後的空格刪除,否則在安裝監聽器時會報錯。
將 gennttab 添加到 filegroup6.jar 中。
zip -vu filegroup6.jar bin/gennttab
7. Oracle 建議對每個 Linux 帳戶可以使用的進程數和開啟的檔案數設定限制。
要進行這些更改,以 root 使用者的身份執行下列命令:
vi /etc/security/limits.conf
添加如下內容:
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
8. 設定環境變數
以 oracle 使用者登入。
vi ~/.bash_profile
添加如下內容:
export TMP=/tmp
export TMPDIR=/tmp
export ORACLE_BASE=/home/oracle
export ORACLE_SID=ora10g
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0.1/db_1
export PATH=$PATH:$ORACLE_HOME/bin
9. 修改 enterprise.rsp 檔案,在 oracle 安裝目錄下可以找到 /database/response/enterprise.rsp
ORACLE_HOME="/home/oracle/product/10.2.0.1/db_1"
ORACLE_HOME_NAME="Oracle10g"
s_nameForDBAGrp="dba"
s_nameForOPERGrp="dba"
n_configurationOption=3
說明:
ORACLE_HOME Oracle 伺服器的主目錄位置,必須是絕對路徑。
ORACLE_HOME_NAME Oracle 伺服器的名稱,必須以字母開頭。
s_nameForDBAGrp 用於 Oracle 系統管理的 linux 使用者組名,該組的使用者擁有管理 Oracle 伺服器的許可權。
s_nameForOPERGrp 用於 Oracle 資料庫常規操作的 linux 使用者組名,該組的使用者擁有常規操作 Oracle 資料庫的許可權。
n_configurationOption 安裝類型( 1 為在安裝後建立資料庫, 2 為安裝後建立一個自動儲存管理執行個體, 3 為只安裝伺服器軟體)。
10. 修改作業系統發行版本
由於 oracle 還沒有推出支援 CentOS 的安裝包,所以需要修改發行版本,以便通過 oracle 的安裝檢查,發行版本檔案的位置為 /etc/RedHat-release
將 CentOS release 5 (Final)
修改成
Red Hat Enterprise Linux AS release 3 (Taroon)
安裝完成後再改回來。
11. 關閉 SELINUX 工作模式
SELINUX 屬性設定檔位置為 /etc/selinux/config
# 設定 SELINUX 為 disabled
SELINUX=disabled
12. 開始安裝
./runInstaller -ignoreSysPrereqs -silent -responseFile /home/oracle/database/response/enterprise.rsp
說明 :
ignoreSysPrereqs 讓 Oracle 忽略系統檢查,因為 Oracle 官方聲明只支援 Linux 伺服器產品,所以要在非伺服器產品的 Linux 上安裝就必須指定此參數。
silent 讓安裝程式以靜默模式運行。
responseFile 指定一個應答檔案。
注意 : 如果 ORACLE_HOME 和 ORACLE_BASE 目錄設在相同的位置 , 或者 ORACLE_HOME 所在目錄不為空白的話 , 會有如下錯誤 :
SEVERE:OUI-10029:You have specified a non-empty directory to install this product. It is recommended to specify either an empty or a non-existent directory. You may, however, choose to ignore this message if the directory contains Operating System generated files or subdirectories like lost+found.
如果仍然要以當前配置安裝的話 , 請在安裝時添加 -force 參數進行強制安裝。
13.oracle 系統初始化
以 root 管理員運行 $ORACLE_HOME/root.sh 進行 Oracle 的系統初始化工作,通常一路按斷行符號用預設值即可。
14. 安裝網路監聽器
編輯 oracle 安裝目錄下的 netca.rsp 應答檔案,地址為: /database/response/netca.rsp ,主要查看以下參數配置:
INSTALL_TYPE=""custom"" 安裝的類型
LISTENER_NUMBER=1 監聽器數量
LISTENER_NAMES={"LISTENER"} 監聽器的名稱列表
LISTENER_PROTOCOLS={"TCP;1521"} 監聽器使用的通訊協議列表
LISTENER_START=""LISTENER"" 監聽器啟動的名稱
運行安裝命令:
$ORACLE_HOME/bin/netca /silent /responseFile /home/oracle/database/response/netca.rsp
注意:在此處可能會有錯誤 oracle 需要的軟體包不全。請根據 1 中列出的軟體包,確保所有的軟體包都已經正確安裝( 2 ) 6 中對 gennttab 檔案的修改不正確,本人就是沒有去掉 n 後的空格導致了該錯誤。
15. 修改 dbstart
vi $ORACLE_HOME/bin/dbstart
ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle
改為:
ORACLE_HOME_LISTNER=$ORACLE_HOME
確保資料庫啟動時,網路監聽器同時啟動。
16. 安裝資料庫執行個體
編輯 Oracle 安裝源檔案夾 response 目錄下的 dbca.rsp 應答檔案:
vi /home/oracle/database/response/dbca.rsp
根據自己的需要修改下列參數:
GDBNAME = “ orcl10g ” # 資料庫全域名稱
SID = “ ora ” # 資料庫的 SID
SYSPASSWORD = “ sys ” # SYS 使用者的初始密碼
SYSTEMPASSWORD = ” sys ” #SYSTEM 使用者的初始密碼
CHARACTERSET = “ ZHS16GBK ” # 資料庫字元集(中文為 ZHS16GBK )
NATIONALCHARACTERSET = ” ZHS16GBK ” # 資料庫國家字元集
運行安裝命令:
$ORACLE_HOME/bin/dbca -silent -responseFile /home/oracle/database/response/dbca.rsp -cloneTemplate
資料庫建立成功後需要修改一些資訊:
vi /etc/oratab
ora10g:/opt/oracle/product/10.2.0.1/db_1:N
改為:
ora10g:/opt/oracle/product/10.2.0.1/db_1:Y
保證資料庫執行個體能自動啟動。
17. 啟動資料庫執行個體
$ORACLE_HOME/bin/dbstart
18. 測試
sqlplus "/as sysdba"
19. 配置 EM 資料庫,資料庫和監聽都必須已經啟動並正常工作
配置 dbcontrol
[oracle@oracle10 ~]$ emca -config dbcontrol db
STARTED EMCA at Oct 27, 2007 9:33:48 AM
EM Configuration Assistant, Version 10.2.0.1.0 Production
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Enter the following information:
Database SID: orcl
Database Control is already configured for the database orcl
You have chosen to configure Database Control for managing the database orcl
This will remove the existing configuration and the default settings and perform a fresh configuration
Do you wish to continue? [yes(Y)/no(N)]: Y
Listener port number: 1521
Password for SYS user:
Password for DBSNMP user:
Password for SYSMAN user:
Email address for notifications (optional):
Outgoing Mail (SMTP) server for notifications (optional):
-----------------------------------------------------------------
You have specified the following settings
Database ORACLE_HOME ................ /opt/oracle/product/10.2.0/Database
Database hostname ................ oracle10
Listener port number ................ 1521
Database SID ................ orcl
Email address for notifications ...............
Outgoing Mail (SMTP) server for notifications ...............
-----------------------------------------------------------------
Do you wish to continue? [yes(Y)/no(N)]: Y
Oct 27, 2007 9:35:12 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /opt/oracle/product/10.2.0/Database/cfgtoollogs/emca/orcl/emca_2007-10-27_09-33-46-AM.log.
Oct 27, 2007 9:35:33 AM oracle.sysman.emcp.util.DBControlUtil stopOMS
INFO: Stopping Database Control (this may take a while) ...
Oct 27, 2007 9:36:39 AM oracle.sysman.emcp.ParamsManager getLocalListener
WARNING: Error retrieving listener for oracle10
Oct 27, 2007 9:36:54 AM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) ...
Oct 27, 2007 9:39:51 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: Database Control started successfully
Oct 27, 2007 9:39:53 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: >>>>>>>>>>> The Database Control URL is http://oracle10:5500/em <<<<<<<<<<<
Enterprise Manager configuration completed successfully
FINISHED EMCA at Oct 27, 2007 9:39:53 AM
[oracle@oracle10 ~]$
刪除資料庫的 Database Control 配置
[oracle@oracle10 ~]$ emca -deconfig dbcontrol db
STARTED EMCA at Oct 27, 2007 10:44:24 AM
EM Configuration Assistant, Version 10.2.0.1.0 Production
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Enter the following information:
Database SID: orcl
Do you wish to continue? [yes(Y)/no(N)]: Y
Oct 27, 2007 10:44:47 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /opt/oracle/product/10.2.0/Database/cfgtoollogs/emca/orcl/emca_2007-10-27_10-44-22-AM.log.
Oct 27, 2007 10:44:52 AM oracle.sysman.emcp.util.DBControlUtil stopOMS
INFO: Stopping Database Control (this may take a while) ...
Oct 27, 2007 10:48:13 AM oracle.sysman.emcp.EMReposConfig stopDBMSJobs
WARNING: Error initializing SQL connection. SQL operations cannot be performed
Oct 27, 2007 10:48:13 AM oracle.sysman.emcp.EMReposConfig invoke
WARNING: Unable to remove DBMS jobs.
Enterprise Manager configuration completed successfully
FINISHED EMCA at Oct 27, 2007 10:51:01 AM
[oracle@oracle10 ~]$
20.uninstall oracle if you want:
./runInstaller -silent -deinstall -removeallfiles -removeAllPatches "REMOVE_HOMES={$ORACLE_HOME}" -responseFile ~oracle/database/response/enterprise.rsp