ºìÁªLinuxÃÅ»§
Linux°ïÖú

Oracle 10g for ubuntu °²×°Ö¸ÄÏ

·¢²¼Ê±¼ä:2006-10-17 22:46:55À´Ô´:ºìÁª×÷Õß:linuxcms
×÷ÕߣºËï¸ßÓÂ
±¾ÎÄÊÇÔÚununtu linuxÏÂOracle10gµÄ°²×°±Ê¼Ç¡£ÎÒ¼ÙÉèÄúÒѾ­³É¹¦µÄ°²×°²¢ÅäÖÃÁËununtu Linux¡£²¢ÇÒ°²×°ºÃÁËgcc, make, binutils, lesstif2, libc6, and rpm libaio1 awk rpm j2reµÄÔËÐл·¾³,¿Éͨ¹ýapt-get install Íê³É°²×°(ununtuºÍdebianµÄÕâÖÖ°²×°·½Ê½Âù·½±ãµÄ)¡£
1. ´´½¨Óû§ºÍ×é
oracle°²×°ÐèÒªÁ½¸öunixÓû§×éºÍÒ»¸öÔËÐÐʱµÄoracleÓû§¡£
#addgroup oinstall
#addgroup dba
#addgroup nobody
#useradd -g oinstall -G dba -p passwd -d /home/oracle -s /bin/bash oracle
#usermod -g nobody nobody

2. ´´½¨Ä¿Â¼
ÓкܶàÎĵµ£¬½¨ÒéÄú½«oracle°²×°µ½Ò»¸ö¶ÀÁ¢µÄ·ÖÇøÉÏÃæ¡£±ÈÈ磺/opt¡£ÇëÄú¸ù¾ÝÄúµÄÐèҪѡÔñºÏÊÊ×Ô¼ºµÄ°²×°Ä¿Â¼¡£ÔÚ±¾ÎĵµÖУ¬ÎÒÃǼÙÉè oracleµÄ°²×°Ä¿Â¼Îª/opt/ora10¡£È·±£ÓÐÖÁÉÙ3.0GµÄ¿ÉÓÿռ䡣(ÔÎËÀ£¬ÎÒÈ«²¿µÄÊ£Óà¿Õ¼äѽ:()
#mkdir -p /opt/ora10
#mkdir -p /opt/ora10
#chown -R oracle:oinstall /opt/ora*
#chmod -R 775 /opt/ora*
ÄúÉú³ÉÁËoracleµÄÔËÐÐʱ·¾¶£¬²¢ÇÒÊÚдȨÏÞ¸øoracleÓû§£¬Ö´ÐÐȨÏÞ¸ødba×é¡£
3 ÉèÖÃÄں˲ÎÊý
3.1ÐÞ¸Äsysctl.conf
Ìí¼ÓÈçϵÄÐе½/etc/sysctl.confÖУº
kernel.shmmax = 3147483648
kernel.shmmni = 4096
kernel.shmall = 2097152
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
×¢£ºshmmax(×î´ó¹²ÏíÄÚ´æ)ÊÇÒ»¸öºÜÖØÒª²ÎÊý£¬¸ù¾ÝÄúµÄ»úÆ÷µÄÄÚ´æÀ´É趨¡£Èç¹ûÄúÉèÖò»ºÏÊʵĻ°£¬ÔÚ´´½¨Êý¾Ý¿âµ½Ô¼86%µÄʱºò¾Í»á¹Òµô¡£×£ÄúºÃÔË¡£^_^
3.2 ÐÞ¸Älimits.conf
Ìí¼ÓÏÂÃæµÄÐе½/etc/security/limits.confÒÔÐÞ¸ÄÄãµÄ×ÊÔ´ÏÞÖÆ£º
oracle soft nofile 65536
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384


3.3 ÈÃÐÞ¸ÄÉúЧ
ÐÞ¸ÄÁËÒÔÉÏÎļþºó£¬Äú±ØÐëÈÃÆäÉúЧ£¬ÄúÖØÆôϵͳ£¬»òÕßÇл»µ½rootÓû§ÏÂÓÃÒÔϵķ½Ê½¸Ä±äÄÚºËÔËÐвÎÊý£º
#sysctl -p
3.4 ´´½¨³ÌÐòÁ´½Ó
#ln -s /usr/bin/awk /bin/awk
#ln -s /usr/bin/rpm /bin/rpm
#ln -s /usr/bin/basename /bin/basename
4 .ÉèÖÃOracleÓû§»·¾³
ÒÔoracleÓû§µÇ¼£º
~$su oracle
ÐÞ¸Ä~/.bash_profileÎļþ£¬È¥µôÏÂÁÐÈýÐеÄ×¢ÊÍ·û£¬Ê¹.bashrcÎļþÉúЧ£º
#if [ -f ~/.bashrc ]; then
# . ~/.bashrc
#fi
ununtuĬÈÏÊÇûÓÐ×¢Ê͵ģ¬debianÓû§ÐèҪȡÏûµôÕâ¸ö¡£

Ìí¼ÓÏÂÁÐÐе½~/.bashrc:
# oracle 10g
export ORACLE_BASE=/opt/ora10
export ORACLE_HOME=/opt/ora10
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin:$PATH
export ORACLE_OWNER=oracle
export ORACLE_SID=compiere
export ORACLE_TERM=xterm

# Edit paths
export LD_LIBRARY_PATH=/opt/ora10/lib:/opt/ora10/lib/stubs/:$LD_LIBRARY_PATH
export PATH=/opt/ora10/bin:$PATH
ÎÒÊǽ«ÉÏÃæµÄÄÚÈݱ£´æµ½ÁíÒ»¸öÎļþÖУ¬.bash_oracle£¬È»ºóÔÚ.bashrcÖÐʹÓÃsource .bash_oracle½øÐе÷Óõġ£Äú¿ÉÒÔ¸ù¾ÝÄúµÄºÃ¶ñ½øÐÐÉèÖá£ÄúÐèҪעÒâµÄÊÇ£¬ORACLE_BASEºÍORACLE_HOMEµÄÉèÖÃÒ»¶¨µÃºÍÄúÔÚÇ°Ãæ´´½¨µÄĿ¼Ïà·û¡£ ORACLE_SIDÊÇĬÈÏÊý¾Ý¿âµÄÃû³Æ£¬ÔÚ±¾ÎĵµÖУ¬ÎÒÃǼÙÉèĬÈϵÄÊý¾Ý¿âÃû½Ðcompiere£¬Èç¹ûÄúÏëÓÃÆäËûµÄÃû×Ö£¬ÇëÄú×÷ÏàÓ¦µÄÐ޸ġ£


5 Ö´Ðа²×°
5.1 ½»»»·ÖÇøµÄµ÷Õû
ÒÔoracleÓû§Æô¶¯X£¬½øÐа²×°¡£
²îµãÍüÁË£¬ÎªÁË°²×°Oracle 10g,oracleÍƼöÖÁÉÙ512MÄÚ´æºÍÖÁÉÙ400M½»»»¿Õ¼ä¡£Äڴ棬ºÃÏó²»¹»¹ØϵҲ²»´ó£¬µ«Êǽ»»»·ÖÇø ÄØ£¬Äú»¹ÊÇ´ó·½Ò»µã°É¡£Èç¹ûÄúµÄ½»»»·ÖÇø²»¹»400M£¬ÄÇôÄú»¹ÊÇÏÈ¿´¿´ÕâÒ»²½°É¡£
ÖØÉè½»»»·ÖÇø¿ÉÒÔʹÓÃÈçϲÙ×÷£º
shell# dd if=/dev/zero of=tmp_swap bs=1k count=900000
shell# chmod 600 tmp_swap
shell# mkswap tmp_swap
shell# swapon tmp_swap
Íê³É°²×°ÒԺ󣬿ÉÒÔÊÍ·ÅÕâ¸ö¿Õ¼ä£º
shell# swapoff tmp_swap
shell# rm tmp_swap
countÖµÊǸù¾ÝÄúÐèÒªµ÷ÕûµÄ½»»»·ÖÇø´óС¶ø¶¨¡£

5.2°²×°Ç°µÄ×¼±¸
ÖÕÓÚ¿ÉÒÔ°²×°ÁË¡£ÎÒÃǼÙÉèÏÂÔصݲװÎļþλÓÚ/home/sungaoyong/oracleÏ£¬Ãû³ÆΪ10201_database_linux32.zip ½âѹºó¡£
´´½¨Ò»¸öÎļþ /etc/redhat-release:Ìí¼ÓÈçÏÂÄÚÈÝ¡£
Red Hat Linux release 3.1 (drupal)
oracle½«»á°ÑϵͳÈÏΪÊÇredhat 3ÁË£º£©

5.3 javaÖÐÎĵÄÏÔʾ
½øÈëjavaµÄ°²×°Â·¾¶
$ cd /usr/lib/j2se/1.4/lib

$ sudo cp font.properties.zh_CN_UTF8.Sun font.properties
½«×îÏÂÃæµÄÒ»ÐиÄΪÈçÏ£º
filename.-misc-fzsongti-medium-r-normal--*-%d-*-*-p-*-iso10646- 1=/usr/share/fonts/VeraSansYuanTi/VeraSansYuanTi-Regular.ttf

appendedfontpath=/usr/share/fonts/VeraSansYuanTi
java¾ÍÖ§³ÖÖÐÎÄÏÔʾÁË¡£

5.4ÔËÐÐInstaller
½øÈëoracleÊý¾Ý¿â½âѹµÄĿ¼
./runInstaller -jreLoc /usr/lib/j2se/1.4/jre
Ö¸¶¨jreµÄÄ¿µÄ¾ÍÊÇʼ°²×°½çÃæ¿ÉÒÔÏÔʾÖÐÎÄ£¬·ñÔò°²×°½çÃæµÄÖÐÎĶ¼ÊÇС¿ò¿ò£¬²»ÐÅÊÔÊÔ£¬ºÙºÙ£¡

½ÓϵÄÒ»°ãÑ¡ÔñĬÈÏÉèÖþͿÉÒÔÁË¡£

6.Æô¶¯Êý¾Ý¿â
1.Æô¶¯
$ sqlplus " scott/tiger as sysdba"
½«³öÏÖÈçÏÂÁ¬½ÓÊý¾Ý¿âÐÅÏ¢£º
SQL*Plus: Release 10.1.0.2.0 - Production on ÐÇÆÚÈý 3ÔÂ 24 16:23:27 2004
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Á¬½Óµ½:
Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL>

±íÃ÷µÇ¼Êý¾Ý¿âϵͳ³É¹¦£¬ÔËÐÐstartupÃüÁîÆô¶¯Êý¾Ý¿â¡£

SQL> startup
ORACLE instance started.

Total System Global Area 336356520 bytes
Fixed Size 279720 bytes
Variable Size 268435456 bytes
Database Buffers 67108864 bytes
Redo Buffers 532480 bytes
Database mounted.
Database opened.
SQL>
±íʾÊý¾Ý¿âÕý³£Æô¶¯¡£
2. ¹Ø±ÕOracle10g Êý¾Ý¿â
$ sqlplus "scott/tiger as sysdba" //ÒÔsysdbaÓû§µÇ¼Êý¾Ý¿â

³É¹¦µÇ¼Êý¾Ý¿âϵͳºó£¬ÔËÐÐshudownÃüÁî¹Ø±ÕÊý¾Ý¿â¡£
SQL> shutdown

3. Æô¶¯Oracle10g¼àÌý³ÌÐò
OracleµÄ¼àÌý³ÌÐòÖ÷ÒªÊÇΪ¿Í»§¶ËµÄÁ¬½ÓÌṩ½Ó¿Ú£¬ÔÚ¿ØÖÆ̨´°¿Ú¼üÈëÈçÏÂÃüÁ
$ lsnrctl
½«³öÏÖÈçϼàÌý³ÌÐòÐÅÏ¢£º
LSNRCTL for 32-bit Windows: Version 10.1.0.2.0 - Production on 24-3ÔÂ -2004 16
:59:51
Copyright (c) 1991, 2004, Oracle. All rights reserved.
»¶Ó­À´µ½LSNRCTL, Çë¼üÈë"help"ÒÔ»ñµÃÐÅÏ¢¡£
LSNRCTL>

±íÃ÷µÇ¼¼àÌý³ÌÐò¿ØÖÆ̨³É¹¦£¬ÔËÐÐstartÃüÁîÆô¶¯¼àÌý³ÌÐò¡£

LSNRCTL> start
½«³öÏÖ¼àÌý³ÌÐòµÄһϵÁÐÆô¶¯ºÍÅäÖÃÇé¿öÐÅÏ¢ÁÐ±í¡£
ÐÅÏ¢ÐеÄ×îºóÒ»ÐÐÊÇ¡°The command completed successfully¡±×ÖÑùʱ£¬¼àÌý³ÌÐòÆô¶¯³É
¹¦¡£

4. ¹Ø±ÕOracle10g¼àÌý³ÌÐò
ÔËÐÐstopÃüÁî¹Ø±Õ¼àÌý³ÌÐò¡£
LSNRCTL> stop
7.´´½¨×ÔÆô¶¯½Å±¾
´´½¨oracledb½Å±¾µ½/etc/init.d/oracledb,ÄÚÈÝÈçÏÂ
#!/bin/bash
#
# /etc/init.d/oracledb
#
# Run-level Startup script for the Oracle Instance, Listener, and
# Web Interface


export ORACLE_HOME=/opt/ora10
export ORACLE_SID=compiere
export PATH=$PATH:$ORACLE_HOME/bin

ORA_OWNR="oracle"

# if the executables do not exist -- display error

if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
then
echo "Oracle startup: cannot start"
exit 1
fi

# depending on parameter -- startup, shutdown, restart
# of the instance and listener or usage display

case "$1" in
start)
# Oracle listener and instance startup
echo -n "Starting Oracle: "
su $ORA_OWNR -c "$ORACLE_HOME/bin/lsnrctl start"
su $ORA_OWNR -c $ORACLE_HOME/bin/dbstart
touch /var/lock/oracle

su $ORA_OWNR -c $ORACLE_HOME/bin/emctl start dbconsole
echo "OK"
;;
stop)
# Oracle listener and instance shutdown
echo -n "Shutdown Oracle: "
su $ORA_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop"
su $ORA_OWNR -c $ORACLE_HOME/bin/dbshut
rm -f /var/lock/oracle

su $ORA_OWNR -c $ORACLE_HOME/bin/emctl stop dbconsole
echo "OK"
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo "Usage: `basename $0` start|stop|restart|reload"
exit 1
esac
exit 0

ÉèÖÃȨÏÞ£¬·Åµ½Æô¶¯½Å±¾ÖÐÈ¥
#chmod 755 /etc/init.d/oracledb
#update-rc.d oracledb defaults 99
7.ʹÓÃÆóÒµ¹ÜÀíÆ÷

Æô¶¯¿ØÖÆ̨
#emctl start dbconsole
·ÃÎÊÊý¾Ý¿â¿ØÖÆÆ÷
http://localhost.localdomain:1158/em/
ÒªÌṩsys/passwd as sysdba;
ÄãÒª´ÓÒ»¸ö¿Í»§¶Ëä¯ÀÀÆ÷·ÃÎÊem Êý¾Ý¿â¿ØÖÆÆ÷,±ØÐëÒªÔËÐÐdbconsole½ø³Ì.°²×°Ö®ºó,dbconsole½ø³ÌÊÇ×Ô¶¯»áÆô¶¯µÄ.È»ºó,Èç¹ûÕâ¸ö¼¯³ÉûÓÐÆô¶¯,Äã¿ÉÒÔÏòÏÂÃæµÄÃüÁîÐÐÊÖ¹¤µÄÆô¶¯Ëü:
1.µ½$ORACLE_HOME/binĿ¼ÏÂ
2.Ö´ÐÐÏÂÃæµÄÃüÁî: emctl start dbconsole
ÕâÑùÄã¾Í¿ÉÒÔ´ò¿ªwebä¯ÀÀÆ÷,ÊäÈëÏÂÃæµÄhttp://hostnameortnumber/em
À´·ÃÎÊem db control.
hostÄÇôÊÇÄãµÄ¼ÆËã»úµÄÃû×Ö»òµØÖ·.portnumberÊÇem db control httpµÄ¶Ë¿ÚºÅ,ÕâÊÇÔÚ°²×°µÄʱºòÖ¸¶¨µÄ.
ĬÈϵÄÊÇ1158 ,Äã¿ÉÒÔÔÚ$ORACLE_HOME/install/portlist.iniÎļþÖÐÕÒµ½Õâ¸öÖµ.
Èç¹ûʵÀýÆô¶¯ÁË,EM¾Í»áÏÔʾdb controlµÇ¼ҳ.Äã±ØÐëʹÓÃÊÚȨ·ÃÎÊdb controlµÄÓû§µÇ¼µ½Êý¾Ý¿â.Ò»¿ªÊ¼ÊÇsysÓû§,
ʹÓÃÔÚ°²×°µÄʱºòÄãÈ·¶¨µÄsysÓû§µÄÃÜÂë.´Óconnect as ÏÂÀ­¿òÑ¡sysdba,È»ºóµãµÇ¼.ÕâÑù¾Í»á³öÏÖdb controlµÄÖ÷Ò³.
ÕâÊÇͬOracle 9iµÄ²»Í¬µÄ¡£ÆäËüµÄ´ó¼Ò¹²Í¬Ñ§Ï°°É£¡
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 1 ÌõÆÀÂÛ

  1. sword721 ÓÚ 2006-10-18 08:37:31·¢±í:

    ΪʲôÎÒÿ´Î°²×°,Ëû¶¼ÌáʾÎÒÎÞ·¨½âÎü±¾µØµØÖ·ÄØ?
    ÎÒµÄÊǶ¯Ì¬ip,ÊÇ·ñÐèҪһЩÅäÖÃ?
    http://sword.4000webs.com