ubuntu8.04安装oracle11g(精简版)

ubuntu8.04安装oracle11g(精简版)

(1)首先把ubuntu升级到最新。

(2)安装重要的依赖包:build-essential, libaio1, gawk, ksh, libmotif3, alien, libtool, and lsb-rpm。

命令如下:

root@hardy:~# apt-get install build-essential libaio1 gawk ksh libmotif3 alien libtool lsb-rpm

(3)修改shell为bash(ubuntu默认为dash,原因)

root@hardy:~# cd /bin

root@hardy:/bin# ls -l /bin/sh

lrwxrwxrwx 1 root root 4 2008-04-28 19:59 /bin/sh -> dash root@hardy:/bin# ln -sf bash /bin/sh root@hardy:/bin# ls -l /bin/sh lrwxrwxrwx 1 root root 4 2008-05-01 22:51 /bin/sh -> bash

(4)增加用户和组,并修改一些配置。这一步很重要!如果不是很有把握,不要随便改。(为了便于解释,增加了行号):

01 root@hardy:/bin# cd

02 root@hardy:~# pwd /root

04 root@hardy:~# addgroup oinstall

     Adding group `oinstall' (GID 1001) ...

     Done.

07 root@hardy:~# addgroup dba

     Adding group `dba' (GID 1002) ...

     Done.

10 root@hardy:~# addgroup nobody

     Adding group `nobody' (GID 1003) ...

     Done.

13 root@hardy:~# usermod -g nobody nobody

14 root@hardy:~# useradd -g oinstall -G dba -p password -d /home/oracle -s /bin/bash oracle

15 root@hardy:~# passwd -l

     oracle Password changed.

17 root@hardy:~# mkdir /home/oracle

18 root@hardy:~# chown -R oracle:dba /home/oracle

19 root@hardy:~# ln -s /usr/bin/awk /bin/awk

20 root@hardy:~# ln -s /usr/bin/rpm /bin/rpm

21 root@hardy:~# ln -s /usr/bin/basename /bin/basename

22 root@hardy:~# mkdir /etc/rc.d

23 root@hardy:~# for i in 0 1 2 3 4 5 6 S ; do ln -s /etc/rc$i.d /etc/rc.d/rc$i.d ; done

24 root@hardy:~# mkdir -p /u01/app/oracle

25 root@hardy:~# chown -R oracle:dba /u01

26 root@hardy:~#

*Lines 04-12: 增加我们需要的用户和组

*Line 13: 让nobody用户的组变为nobody,这样Oracle的安装程序不会出问题。 Ubuntu默认nobody的组是nogroup。

*Lines 14-18: 创建一个oracle用户,并锁定用户,以阻止别人通过oracle用户登录系统。注意,oracle用户的HOME目录不要与ORACLE_HOME相同。

*Lines 19-23: 创建一些Oracle安装程序需要的工具的连接。因为Oracle安装程序是为 Red Hat准备的,所以有些工具的位置和Ubuntu不一样。 * Finally, on lines 24-25 创建ORACLE_BASE目录。

(5)修改一些系统默认值这些修改将会增加系统文件描述符的数量、增加共享内存大小和修改一些网络子系统参数。

这些修改是否会对你的系统带来影响我就不得而知了。

将下面这些增加到/etc/sysctl.conf文件的末尾:

fs.file-max = 65535

kernel.shmall = 2097152

kernel.shmmax = 2147483648

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

net.ipv4.ip_local_port_range = 1024 65535

net.core.rmem_default = 1048576

net.core.rmem_max = 1048576

net.core.wmem_default = 262144

net.core.wmem_max = 262144

Add this to the end of /etc/security/limits.conf:

oracle soft nproc 2047

oracle hard nproc 16383

oracle soft nofile 1023

oracle hard nofile 65535

为了强制使用刚才我们在/etc/security/limits.conf中增加的东西,我们再增加下面这些到/etc/pam.d/login文件末尾:

session required /lib/security/pam_limits.so

session required pam_limits.so

然后,重启系统加载sysctl.conf,或者利用命令sysctl -p来重新加载sysctl.conf

root@hardy:~# sysctl -p

kernel.printk = 4 4 1 7

kernel.maps_protect = 1

fs.inotify.max_user_watches = 524288

vm.mmap_min_addr = 65536

net.ipv4.conf.default.rp_filter = 1

net.ipv4.conf.all.rp_filter = 1

fs.file-max = 65535

kernel.shmall = 2097152

kernel.shmmax = 2147483648

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

net.ipv4.ip_local_port_range = 1024 65535

net.core.rmem_default = 1048576

net.core.rmem_max = 1048576

net.core.wmem_default = 262144

net.core.wmem_max = 262144

root@hardy:~#

(6)现在我们将刚才下载的oracle11g的安装包解压到/home/oracle目录下。

设置DISPLAY参数,开始安装:

root@hardy:~# su - oracle

Your account has expired; please contact your system administrator su: User account has expired (Ignored)

oracle@hardy:~$ export DISPLAY=192.168.w.z:0.0

oracle@hardy:~$ pwd /home/oracle

oracle@hardy:~$ ls -l

total 4

drwxr-xr-x 6 oracle dba 4096 2007-09-18 18:50 database

oracle@hardy:~$ cd database

oracle@hardy:~/database$ ls -l

total 28

drwxr-xr-x 11 oracle dba 4096 2007-08-06 16:02 doc

drwxr-xr-x 5 oracle dba 4096 2007-08-03 13:28 install

drwxr-xr-x 2 oracle dba 4096 2007-09-18 18:52 response

-rwxr-xr-x 1 oracle dba 2911 2007-08-03 13:28 runInstaller

drwxr-xr-x 14 oracle dba 4096 2007-08-03 13:27 stage

-rw-r--r-- 1 oracle dba 4835 2007-08-06 18:19 welcome.html

oracle@hardy:~/database$ ./runInstaller -ignoreSysPrereqs

然后就是oui安装界面,略过。安装还没有结束,继续看。

(7)当出现下面界面时,注意了: 这时候打开一个终端,以root登陆,运行如下命令:(具体路径会有所不同,参照你的机器配置,但是脚本不变)

root@hardy:~# /u01/app/oraInventory/orainstRoot.sh

Changing permissions of /u01/app/oraInventory to 770.

Changing groupname of /u01/app/oraInventory to dba.

The execution of the script is complete

root@hardy:~# /u01/app/oracle/product/11.1.0/db_1/root.sh

Running Oracle 11g root.sh script...

The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /u01/app/oracle/product/11.1.0/db_1

Enter the full pathname of the local bin directory: [/usr/local/bin]:

Copying dbhome to /usr/local/bin ...

Copying oraenv to /usr/local/bin ...

Copying coraenv to /usr/local/bin ...

Creating /etc/oratab file...

Entries will be added to the /etc/oratab file as needed by Database Configuration Assistant when a database is created Finished running generic part of root.sh script.

Now product-specific root actions will be performed.

Finished product-specific root actions.

root@hardy:~#

祝贺你! 你完成了在Ubuntu 8.04 LTS (Hardy Heron)安装Oracle 11g on Ubuntu 8.04 LTS (Hardy Heron)!

(8)收尾工作:在/etc/profile文件中加入下面几句:

export ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1

export PATH=$PATH:/u01/app/oracle/product/11.1.0/db_1/bin

创建一个Oracle 11g数据库的启动脚本,名字可以叫做:oracledb,/etc/init.d/oracledb ,内容:

#!/bin/bash

# # /etc/init.d/oracledb

# # Run-level Startup script for the Oracle Listener and Instances

# It relies on the information on /etc/oratab export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1 export ORACLE_OWNR=oracle export PATH=$PATH:$ORACLE_HOME/bin if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ] then echo "Oracle startup: cannot start" exit 1 fi case "$1" in start) # Oracle listener and instance startup echo -n "Starting Oracle: " su $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl start" su $ORACLE_OWNR -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME" touch /var/lock/oracle echo "OK"

;; stop) # Oracle listener and instance shutdown echo -n "Shutdown Oracle: " su $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop" su $ORACLE_OWNR -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME" rm -f /var/lock/oracle echo "OK" ;; reload|restart)

$0

stop $0 start

;;

*)

echo "Usage: `basename $0` start|stop|restart|reload"

exit 1

sac

exit 0

保存一下。

然后修改脚本为可执行的:

root@hardy:~# chmod a+x /etc/init.d/oracledb

如果你希望开机自动启动Oracle 11g数据库,那么就作下面的工作:

root@hardy:~# update-rc.d oracledb defaults 99

Adding system startup for /etc/init.d/oracledb ... /etc/rc0.d/K99oracledb -> ../init.d/oracledb /etc/rc1.d/K99oracledb -> ../init.d/oracledb /etc/rc6.d/K99oracledb -> ../init.d/oracledb /etc/rc2.d/S99oracledb -> ../init.d/oracledb /etc/rc3.d/S99oracledb -> ../init.d/oracledb /etc/rc4.d/S99oracledb -> ../init.d/oracledb /etc/rc5.d/S99oracledb -> ../init.d/oracledb

牢记一点:这个脚本的运行依赖于机器上数据库的运行,因此,作为oracle用户不要忘记运行dbca,并且配置使之系统启动时候就启动。创建完一个数据库后编辑/etc/oratab,, 设置最后一列 Y). 为了使事情更简单,将你的用户增加到dba组,这样你就可以以dba的角色和数据库服务器交互。

在下面的例子中,以user作为用户名:

root@hardy:~# usermod -G dba -a user

当利用dbca创建一个数据库后,不要忘记以oracle user身份这样做一下(and to export the DISPLAY environment variable)创建完成以后,你应当测试一下是否能够连接上去: oracle@hardy:~$ export ORACLE_SID=heron (注:ORACLE_SID=heron 是你安装时候设置的值) oracle@hardy:~$ sqlplus '/as sysdba' SQL*Plus: Release 11.1.0.6.0 - Production on Mon May 5 02:39:27 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> 当你得到输出,那么可以说,安装成功了!祝贺你!注:如果没有sysv-rc-conf命令,就apt-get一个。 重新登录后,你就可以使用oracle的命令了。你可以通过netca增加LISTENER,通过dbca增加数据库。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值