1環境準備1.1.linux系統安裝
版本
RHAS4:RedHat Enterprise Linux Advance Server 4.0
1.2.檢查環境
Hard Disk Space
[root@localhost /]#df –h
(目標安裝目錄) >2 G +1G(軟體封裝來源目錄)
/tmp >400M
Mem>1G,swap>1G
[root@localhost /]#cat /proc/meminfo|grep Total
依賴軟體版本
名稱 最低版本 查詢命令
kernel 2.6.9 #uname –a或 uname -r
glibc 2.3.2.95.27 #rpm -q glibc
gcc 3.2 #rpm -q gcc
make 3.79 #rpm -q make
binutils 2.14 #rpm -q binutils
libaio 0.3 #rpm -q libaio
openmotif 2.2.2-16 #rpm -q openmotif
setarch 1.3-1 #rpm -q setarch
1.3.檢查並配置核心參數
檢查當前參數
/sbin/sysctl -a | grep 參數名
配置核心參數
1) 執行 [root@localhost /]#vi /etc/sysctl.conf 添加如下內容
kernel.shmall = 2097152 # OS範圍內共用記憶體的最大頁面數量, 單位4K, 預設2097152
kernel.shmmax = 536870912 # OS範圍內每個共用記憶體段的最大尺寸. 單位Byte,預設32M
kernel.shmmni = 4096 #OS範圍內共用記憶體段的最大數目,預設值4096
kernel.sem = 250 32000 100 128 #訊號量參數
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default=262144
net.core.wmem_defaut=262144
net.core.rmem_max=262144
net.core.wmem_max=262144
2) 生效[root@localhost /]# /sbin/sysctl -p
1.4.建立Oracle組及使用者
建立使用者組oinstall,dba
建立安裝資料庫時所需要使用的使用者組oinstall,dba
[root@localhost /]#groupadd oinstall
[root@localhost /]#groupadd dba
建立使用者oracle
建立使用者oracle並將oinstamll,dba組定義成oracle使用者的主次組
[root@localhost /]# useradd -g oinstall -G dba oracle (設定oracle使用者為oinstall、dba使用者組的成員)
[root@localhost /]#passwd oracle (設定oracle使用者的密碼)
設定shell限制(可選)
(Oracle建議對每個Linux帳戶可以使用的進程數和開啟的檔案數設定限制)
1)執行[root@localhost /]#vi /etc/security/limits.conf添加以下四行
oracle soft nofile 65536
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384
2)修改安全限制,執行[root@localhost /]# vi /etc/pam.d/login加入如下1行
session required /lib/security/pam_limits.so
1.5.配置相關目錄
建立Oracle系統的安裝目錄和資料庫檔案存放的目錄
[root@localhost /]# mkdir -p /oracle/product/ 10.2.0 (建立資料目錄)
[root@localhost /]# mkdir -p /oracle/oradata(建立資料檔案目錄)
[root@localhost /]# mkdir -p /oracle/flash_recovery_area(建立閃回目錄)
[root@localhost /]# mkdir -p /oracle/arc_pstat(建立歸檔日誌目錄)
[root@localhost /]# mkdir -p /home/oracle/install_temp(建立oracle安裝檔案臨時存放目錄
[root@localhost /]# chown -R oracle.oinstall /home/oracle/install_temp
[root@localhost /]# chown -R oracle.oinstall /oracle
[root@localhost /]# chmod -R 775 /oracle (設定目錄的讀寫權限)
1.6.配置環境變數
確定ORACLE_SID
確定oracle_sid=oracletest #後續安裝後建立資料庫時的服務名也保持一致,
以oracle使用者登入,修改oracle使用者下的 .bash_profile 檔案,完成後重啟或或執行soure .bash_profile(. .bash_profile)或重登入生效
[oracle@localhost ~]$ vi /home/oracle/.bash_profile增加以下內容
umask 022
ORACLE_BASE=/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10.2.0; export ORACLE_HOME
#圖形介面安裝時要使用的變數
ORACLE_TERM=xterm; export ORACLE_TERM
ORACLE_OWNER=oracle; export ORACLE_OWNER
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_SID= oracletest
export ORACLE_SID
退出後查看PATH source /home/oracle/.bash_profile
[oracle@localhost ~]$ set|grep PATH
2安裝Oracle1.1.oracle安裝檔案準備
版本
oracle10g01_10.2.0.1.0_database_linux32
檔案準備
1)拷貝oracle10g01_10.2.0.1.0_database_linux32.zip
到目錄/home/oracle/install_temp/下
2)解壓:
unzip oracle10g01_10.2.0.1.0_database_linux32.zip
1.2.安裝
1.1開始
[oracle@localhost ~]$cd /home/oracle/install_temp/
[oracle@localhost ~]$cd database
[oracle@localhost ~]$ ./runInstaller #開始執行安裝,等待一會出現
1.1後續安裝與window上基本一致(略)
後續安裝與windows上基本一致,最後完成後出現如,切換使用者到root下執行下兩個配置指令碼即可:
執行[root@localhost /]#/oracle/oraInventory/orainRoot.sh
執行[root@localhost /]#/oracle/product/10.2.0/root.sh如下所示,輸入/oracle/product/ 10.2.0/bin/
3配置Oracle1.1.建立資料庫oracletest
執行[oracle@localhost ~]$dbca或圖形菜單進行,注意下面一致即可(sys/oracletest)
1.2.配置監聽,TNS
[oracle@localhost ~]$netca或圖形菜單
最終 listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = oracletest)
(ORACLE_HOME = /oracle/product/10.2.0/)
(SID_NAME = oracletest)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
tnsnames.ora
ORACLETEST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = oracletest)
)
)
1.3.EM
[oracle@localhost ~]$ emctl start| stop| status dbconsole
http://hostname:1158/em
1.4.isqlplus
[oracle@localhost ~]$ isqlplusctl startstart| stop| status
http://hostname:5560/isqlplus
1.5.配置自動啟動
配置機器啟動時自動啟動資料庫,監聽與EM管理平台
停止時自動停止資料庫,監聽與EM管理平台
修改Oracle系統設定檔/etc/oratab,把AUTO域由預設的N設定為Y,使oracle 內建的dbstart和dbshut才能夠發揮作用
[root@localhost /]#vi /etc/oratab
建立啟動指令碼
1)[oracle@localhost ~] vi $ORACLE_HOME/bin/dbstart 找到第78行ORACLE_HOME_LISTNER=…
改為ORACLE_HOME_LISTNER=$ORACLE_HOME,
[oracle@localhost ~]cd $ORACLE_HOME/bin/
手動運行 [oracle@localhost ~] ./ dbstart
[oracle@localhost ~] ./ dbshut
測試正常與否
(日誌:$ORACLE_HOME/startup.log與$ORACLE_HOME/shutdown.log)
2) [root@localhost /]#vi /etc/init.d/oracle10g
#!/bin/sh
# description: Oracle auto start-stop script.
# chkconfig: - 20 80
# Set ORA_HOME to be equivalent to the $ORACLE_HOME
# from which you wish to execute dbstart and dbshut;
#
# Set ORA_OWNER to the user id of the owner of the
# Oracle database in ORA_HOME.
ORA_HOME=/oracle/product/10.2.0/
ORA_OWNER=oracle
if [ ! -f $ORA_HOME/bin/dbstart ]
then
echo "Oracle startup: cannot start"
exit
fi
case "$1" in
'start')
# Start the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORA_OWNER -c $ORA_HOME/bin/dbstart
#su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
su - $ORA_OWNER -c "$ORA_HOME/bin/emctl start dbconsole"
;;
'stop')
# Stop the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORA_OWNER -c "$ORA_HOME/bin/emctl stop dbconsole"
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
su - $ORA_OWNER -c $ORA_HOME/bin/dbshut
;;
'restart')
$0 stop
$0 start
;;
esac
3) [root@localhost ~]# chmod 750 /etc/init.d/oracle10g
[root@localhost ~]# ln -s /etc/init.d/oracle10g /etc/rc0.d/K10oracle10g
[root@localhost ~]#ln -s /etc/init.d/oracle10g /etc/rc3.d/S99oracle10g
[root@localhost ~]# chkconfig --list oracle10g
[root@localhost ~]# chkconfig --level 345 oracle10g on
[root@localhost ~]# chkconfig --list oracle10g