經過三天的勞動,完成了oracle的安裝。下面是自己的安裝筆記︰
Oracle 9i 在Solaris 9 上的安裝
一. 實驗環境:
硬件環境﹕一台含有2G memory, 2*73GB HDD的 Sun Fire 120
操作系統﹕Solaris 9
二. 需安裝的軟件:
Oracle 9的原程序﹕ solaris64_9.2.0.1.0.Disk1.cpio.gz
solaris64_9.2.0.1.0.Disk2.cpio.gz
solaris64_9.2.0.1.0.Disk3.cpio.gz
三. 安裝過程﹕
1. 解壓原程序
# cd /export/software
# gunzip *.gz
# cpio –i –cvd -I solaris64_9.2.0.1.0.Disk1.cpio
# cpio –i –cvd -I solaris64_9.2.0.1.0.Disk2.cpio
# cpio –i –cvd -I solaris64_9.2.0.1.0.Disk3.cpio
2. 創建 oracle 用戶
# groupadd –g 101 dba
# useradd –u 1111 –g 101 –d /space/home/oracle –m –c “DBA account” –s /bin/ksh oracle
3. 修改 oracle 用戶的 profile (如果是csh, 則修改 $HOME/.login)
$ more $HOME/.profile
#
# Copyright (c) 2001 by Sun Microsystems, Inc.
# All rights reserved.
#
# ident "@(#)local.profile 1.10 01/06/23 SMI"
stty istrip
PATH=/usr/bin:/usr/ucb:/etc:.
export PATH
#For install oracle
DISPLAY=10.86.3.200:0.0
ORACLE_BASE=/apps/oracle
ORACLE_HOME=$ORACLE_BASE/product/9.2.0
ORACLE_SID=songtest
#NLS_LANG=AMERICAN_AMERICA_US7ASCII
NLS_LANG=AMERICAN_AMERICA.UTF8
ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/openwin/lib:/usr/dt/lib
TMPDIR=/tmp
PATH=/usr/bin:/usr/ucb:/usr/sbin:/etc:$ORACLE_HOME/bin:/usr/ccs/bin:
PS1=$LOGNAME"_"$ORACLE_SID"$"
export ORACLE_BASE ORACLE_HOME NLS_LANG ORACLE_SID ORA_NLS33 LD_LIBRARY_PATH TMP
DIR PATH PS1
對 Bourn shell 和 Korn shell 來講, 執行如下的指令使變量生效:
$ cd
$ . $HOME/.profile
對 C shell 來講, 執行如下的指令使變量生效:
% cd; source $HOME/.login
4. 確定是否系統中是否有cc
$ /usr/bin/which cc
需要確定cc 的路徑已包含在$PATH中,cc相關的庫的路徑已包含在$LID_LIBRARY_PATH中.
5. 修改/etc/system 文件來設置 系統核心變量。
# more /etc/system
set shmsys:shminfo_shmmax=1073741824
set shmsys:shminfo_shmmin=1
set shmsys:shminfo_shmmni=100
set shmsys:shminfo_shmseg=10
set semsys:seminfo_semmni=100
set semsys:seminfo_semmsl=256
set semsys:seminfo_semmns=1024
set semsys:seminfo_semopm=100
set semsys:seminfo_semvmx=32767
修改完系統核心變量後,需重新啟動系統。
系統重新啟動後,執行kstat來查看系統核心變量是否生效。
6. 安裝oracle, 需以oracle用戶登入系統,執行如下指令
$ cd /export/software/Disk1
$ ./runInstaller
7. 修改oracle database的配置文件。
編輯 /var/opt/oracle/oratab 文件,增加如下條目:
songtest:/apps/oracle/product/9.2.0:Y
其中,songtest 是 $ORACLE_SID, /apps/oracle/product/9.2.0 是 $ORACLE_HOME, y表示允許 dbstart/dbshut腳本 開啟/關閉數據庫。
因為是使用Oracle Database Configuration Assistant 創建的database, 默認的init 文件位於 /$ORACLE_BASE/admin/sid/pfile. 而另一個模板文件是/$ORACLE_HOME/dbs/init.ora.
實際上使用的是 $ORACLE_HOME/dbs/spfileSID.ora
8. 創建自動開啟/關閉數據庫的腳本。
在 /etc/init.d 目錄下建立一個名為oracled的腳本,其內容如下:
# more /etc/init.d/oracled
#!/bin/sh
# 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.
#
# 2005.7.6 Created by singer.he
ORA_HOME=/apps/oracle/product/9.2.0
ORA_OWNER=oracle
case "" in
start)
# Start the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
if [ ! -x $ORA_HOME/bin/dbstart ]; then
echo "Oracle startup: cannot start. "
exit
fi
su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart"
if [ $? != "0" ]; then
echo "Can not start the oracle database."
exit
fi
sleep 5
# To start the oracle listenter
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start "
;;
stop)
# Stop the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
if [ ! -x $ORA_HOME/bin/dbshut ]; then
echo "The $ORA_HOME/bin/dbshut is not exist. "
exit
fi
su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut"
if [ $? != "0" ]; then
echo " Can not shut down the oracle database. "
exit
fi
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
;;
*)
echo "Usage "
exit 1
;;
esac
將改文件的權限改為755.
# chmod 755 oracled
建立啟動/關閉數據庫的 link 文件。
# ln -s /etc/init.d/oracled /etc/rc3.d/S99oracled
# ln -s /etc/init.d/oracled /etc/rc0.d/K01oracled
9. 在oracle 9i install guide 中,在創建,升級和遷移一個數據庫後,建議執行 utlrp.sql 腳本。
用以下的腳本開啟 SQL* Plus
$ sqlplus /nolog
用以下的命令以SYS用戶身分連接數據庫:
SQL> connect SYS/password as SYSDBA
如果需要,用以下的指令開啟數據庫:
SQL> startup
執行utlrp.sql腳本.
SQL> @$ORACLE_HOME/rdbms/admin/utlrp.sql
10. 1
四. 注意事項﹕
1. 注意在安裝過程中語言的設定必須與$HOME/.profile中的NLS_LANG設定一致,否則,在安裝時會出錯。
2.
五. 常用命令:
1. oracle database configuration assistant: $ORACLE_HOME/bin/dbca
2. oracle net configuration assistant: $ORACLE_HOME/bin/netca