Solaris10 x86 u1 下安裝 Oracle 10g Release 2
關鍵字
Solaris、Oracle
操作環境
Dell 2850
Solaris 10 x86 u1
Oracle 10g Release 2
Bash shell
綜合知識
Solaris 10 x86 u1會在Dell 2850下以64位模式運行。
Oracle 10g Release 2就是64位架構
參考資料
安裝文件10201_database_solx86_64.zip內的幫助文檔
http://www.dbspecialists.com/presentations/oracle10gsolaris.html
http://download-west.oracle.com/docs/html/B13972_01/toc.htm
下載文件
http://www.oracle.com/technology/software/products/database/oracle10g/index.html
注冊后點擊
Oracle Database 10g Release 2 (10.2.0.1.0) for Solaris Operating System (x86-64)
下載
10201_database_solx86_64.zip
檢查系統環境
確保系統可以運行圖形界面或可以遠程運行圖形界面,在此使用的遠程桌面是X Manager 2.0
打開XBrowser,輸入服務器的IP地址即可連上。
查看系統版本(要求5.10 64-bit)
? uname -a
SunOS javasvr 5.10 Generic_118844-26 i86pc i386 i86pc
? isainfo -kv
64-bit amd64 kernel modules
查看物理內存(要求512MB以上,按具體情況)
? /usr/sbin/prtconf | grep "Memory size"
Memory size: 2048 Megabytes
查看交換文件(要求1G以上)
? /usr/sbin/swap -l
swapfile???????????? dev? swaplo blocks?? free
/dev/dsk/c0t0d0s1?? 55,65????? 8 4192952 4192952
臨時文件空間(要求400M以上)
? df -h /tmp
Filesystem???????????? size?? used? avail capacity? Mounted on
swap?????????????????? 3.1G???? 8K?? 3.1G???? 1%??? /tmp
這里的物理內存為2G,理論上為2G*1.5=3G合適,這里再添加512MB
創建一個512MB的交換文件:
# mkfile 512M /export/home/swapone
添加剛創建的交換文件:
# swap -a /export/home/swapone
檢查一下:
# swap -l
swapfile???????????? dev? swaplo blocks?? free
/dev/dsk/c0d0s1???? 102,1?????? 8 1056376 1056376
/export/home/swapone? -??????? 8 1048568 1048568
下面設置交換文件在重啟后自動加載使用:
# vi /etc/vfstab
/export/home/swapone??? -?????? -?????? swap??? -?????? no????? -
查看硬盤空間(要求3.7G以上)
?df -h
Filesystem???????????? size?? used? avail capacity? Mounted on
/dev/dsk/c0t0d0s0?????? 29G?? 3.1G??? 25G??? 12%??? /
......
swap?????????????????? 3.1G?? 636K?? 3.1G???? 1%??? /etc/svc/volatile
......
/dev/dsk/c0t0d0s7?????? 27G?? 6.3G??? 20G??? 24%??? /export/home
查看以下軟件包是否存在
? pkginfo -i SUNWarc SUNWbtool SUNWhea SUNWlibm? SUNWlibms SUNWsprot SUNWtoo SUNWi1of? SUNWi1cs SUNWi15cs SUNWxwfnt
system????? SUNWarc?? Lint Libraries (usr)
system????? SUNWbtool CCS tools bundled with SunOS
system????? SUNWhea?? SunOS Header Files
system????? SUNWi1of? ISO-8859-1 (Latin-1) Optional Fonts
system????? SUNWlibm? Math & Microtasking Library Headers & Lint Files (Usr)
system????? SUNWlibms Math & Microtasking Libraries (Usr)
system????? SUNWsprot Solaris Bundled tools
system????? SUNWtoo?? Programming Tools
system????? SUNWxwfnt X Window System platform required fonts
ERROR: information for "SUNWi1cs" was not found
ERROR: information for "SUNWi15cs" was not found
這里需要安裝兩個包:SUNWi1cs和SUNWi15cs
這里從下載的安裝鏡像文件安裝
加載存放鏡像文件分區
? mkdir /mnt/storage
? mount -F pcfs /dev/dsk/c0t0d0p4:1 /mnt/storage
以塊設備加載鏡像文件
? lofiadm -a /mnt/storage/solaris10/sol-10-u1-ga-x86-dvd.iso
/dev/lofi/1
? mount -F hsfs -o ro /dev/lofi/1 /mnt/isoimg
安裝這兩個包
? pkgadd -d /mnt/isoimg/Solaris_10/Product SUNWi1cs
? pkgadd -d /mnt/isoimg/Solaris_10/Product SUNWi15cs
卸載加載的文件
? umount /mnt/isoimg/
? lofiadm -d /dev/lofi/1
? umount /mnt/storage/
由于使用的Solaris 10 u1比較新,就不打補丁了。
創建用戶和組
需要創建兩個組oinstall和dba,兩個用戶oracle和nobody
先查看是否已存在
? grep oinstall /etc/group
? grep dba /etc/group
? id -a oracle
? id -a nobody
uid=60001(nobody) gid=60001(nobody) groups=60001(nobody)
創建組
? groupadd oinstall
? groupadd dba
創建用戶
? useradd -g oinstall -G dba -d /export/home/oracle -s /usr/bin/bash -c 'Oracle software owner' -m oracle
? id -a oracle
uid=107(oracle) gid=104(oinstall) groups=105(dba)
設置密碼
? passwd oracle
***
創建所需目錄
需要創建兩個目錄oracle和oradata,一個用來存儲程序文件,一個用來存儲數據文件
查看磁盤空間
? df -kh
創建目錄oracle(需要3G以上)
? mkdir -p /opt/oracle
? chown -R oracle:oinstall /opt/oracle
? chmod -R 775 /opt/oracle
創建目錄oradata(需要1.2G以上)
? mkdir -p /export/home/oradata
? chown -R oracle:oinstall /export/home/oradata
? chmod -R 775 /export/home/oradata
調整內核參數
備份配置文件
? cp /etc/system /etc/system.orig
修改配置文件,添加如下幾行
? vi /etc/system
* for install oracle 10g
set noexec_user_stack=1
set semsys:seminfo_semmni=100
set semsys:seminfo_semmns=1024
set semsys:seminfo_semmsl=256
set semsys:seminfo_semvmx=32767
set shmsys:shminfo_shmmax=4294967295
set shmsys:shminfo_shmmin=1
set shmsys:shminfo_shmmni=100
set shmsys:shminfo_shmseg=10
重啟系統
? reboot
準備安裝文件
解壓安裝文件:
? unzip 10201_database_solx86_64.zip
得到文件夾database
配置環境參數
用oracle登錄
? su - oracle
設置環境參數
? vi .profile
umask 022
ORACLE_BASE=/opt/oracle
ORACLE_SID=cdtdb
export ORACLE_BASE ORACLE_SID
重新登錄查看
-bash-3.00$ umask
0022
? env | more
-bash-3.00$ env | more
......
ORACLE_SID=cdtdb
ORACLE_BASE=/opt/oracle
......
開始安裝過程
用Xmanager登錄到服務器
用oracle用戶
運行database目錄下的runInstaller
Select Installation Method
? Advanced Installation
Specify Inventory directory and credentials
? /opt/oracle/oraInventory
? oinstall
Select Installation Type
? Enterprise Edition
Sepcify Home Details
? Name: OraDb10g_home1
? Path: /opt/oracle/oracle/product/10.2.0/db_1
Product-Specific Prerequisite Checks
? 全部通過即可!
Select Configuration Option
? Create a database
Select Database Configuration
? General Purpose
Specify Database Configuration Options
Global Database Name:cdtdb?? ?SID:cdtdb
Select Database Character set: Simplified Chinese ZHS16GBK
選中Create database with sample schemas
Select Database Management Option
選中Use Database Control for Database Management
?? ?Enable Email Notification
?? ??? ?61.144.43.235
?? ??? ?chenliqun@pyp.edu.cn
Specify Database Storage Option
選中File System
?? ?location:/export/home/oradata
Specify Backup and Recovery Options
選中Do not enable Automated backups
Specify Database Schema Passwords
統一使用一個密碼:***
Summary
Execute Configuration Scripts
按照提示,用root用戶運行腳本
安裝完成!
安裝日志:
/opt/oracle/oracle/product/10.2.0/db_1/cfgtoollogs/dbca/cdtdb
iSQL*Plus URL:
http://192.168.200.11:5560/isqlplus
iSQL*Plus DBA URL:
http://192.168.200.11:5560/isqlplus/dba
Enterprise Manager 10g Database Control URL:
http://192.168.200.11:1158/em
用sys用戶以sysdba身份登錄
完成服務配置
用oracle登錄
? su - oracle
修改配置文件
? vi .profile
stty istrip
PS1='# '
umask 022
MAIL=/usr/mail/${LOGNAME:?}
PATH=/usr/bin:/usr/sbin:/usr/sadm/bin:/usr/sfw/bin:/usr/local/bin:/usr/ucb:/etc:.
ORACLE_SID=cdtdb
ORAENV_ASK=NO
ORACLE_BASE=/opt/oracle
export PS1 PATH ORACLE_BASE ORACLE_SID ORAENV_ASK
. oraenv
正確配置數據庫實例入口
? vi /var/opt/oracle/oratab
cdtdb:/opt/oracle/oracle/product/10.2.0/db_1:Y
創建自動運行腳本
? vi /etc/init.d/oracle
#!/bin/sh
ORA_HOME=/opt/oracle/oracle/product/10.2.0/db_1
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 and listeners
??????????? 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"
??????????? su - $ORA_OWNER -c "$ORA_HOME/bin/isqlplusctl start"
??????????? ;;
?? 'stop')? # Stop the Oracle databases and listeners
??????????? su - $ORA_OWNER -c "$ORA_HOME/bin/isqlplusctl stop"
??????????? 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"
??????????? ;;
esac
建立符號連接
? ln -s /etc/init.d/oracle /etc/rc2.d/S99oracle
? ln -s /etc/init.d/oracle /etc/rc0.d/K10oracle
其它配置和錯誤排除
解決em和isqlplus中文按鈕亂碼問題
# cd $ORACLE_HOME/jre/1.4.2/lib
# cp font.properties font.properties.orig
# cp font.properties.zh_CN_UTF8 font.properties
# cd $ORACLE_HOME/jdk/jre/lib/
# cp font.properties font.properties.orig
# cp font.properties.zh_CN_UTF8 font.properties
清除緩存的文件
# cd $ORACLE_HOME/oc4j/j2ee/oc4j_applications/applications/em/em/cabo/images/cache/zhs
# rm *.*
# cd $ORACLE_HOME/oc4j/j2ee/oc4j_applications/applications/isqlplus/isqlplus/cabo/images/cache/zhs
# rm *.*
排除tnslsnr啟動錯誤:
錯誤信息:Failed to auto-start Oracle Net Listene using /ade/vikrkuma_new/oracle/bin/tnslsnr
這里的Listene應該是Listener吧!
# vi $ORACLE_HOME/bin/dbstart
將 ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle
改為 ORACLE_HOME_LISTNER=$ORACLE_HOME
可見,這是由于Oracel工程師手誤引起!非常不應該!
啟動Oracle時啟動Apache出錯
查看錯誤提示
# vi /var/adm/messages
Mar 30 08:31:50 javasvr svc.startd[7]: [ID 652011 daemon.warning] svc:/network/http:apache2: Method "/
lib/svc/method/http-apache2 start" failed with exit status 1.
? svcs -a | grep apache2
maintenance??? Mar_31?? svc:/network/http:apache2
上面說明apache2沒有正常運行
應該是Oracle安裝時,想啟動Apache2,但Apache2作為SMF服務,不允許外部程序單獨啟用。
如果不需要Apache2服務,關閉它
? svcadm disable http:apache2
如果需要,就啟用它
? svcadm disable http:apache2
? svcadm enable http:apache2
注意,em和isqlplus使用的是oc4j服務器。