【转】江枫:在ubuntu10.04上安装oracle 10g(学习一下)

1.下载ORACLE的安装程序:
在这里下http://www.oracle.com/technology/software/products/database /oracle10g/htdocs/10201linx8664soft.html
这个是FOR 64位系统的。下的时候下10201_database_linux_x86_64.cpio.gz就可以了。
用 gunzip <filename>把文件解包,然后在资源管理器里再解一次,知道解除DATABASE文件夹为止。

2
安装必需的包

apt-get install gcc make binutils lesstif2 libc6 libc6-dev rpm libmotif3 libaio1 

3

 

创建用户

# adduser oracle
正在添加用户"oracle"...
正在添加新组"oracle" (1001)...
正在添加新用户"oracle" (1002) 到组"oracle"...
创建主目录"/home/oracle"...
正在从"/etc/skel"复制文件...
输入新的 UNIX 密码:
重新输入新的 UNIX 密码:
passwd:已成功更新密码
Changing the user information for oracle
Enter the new value, or press ENTER for the default
Full Name []: oracle
Room Number []:
Work Phone []:
Home Phone []:
Other []:

adduser 命令系统会自动创建oracle用户的文件


创建目录: 假设 oracle的安装目录为/opt/ora10

#mkdir -p /opt/ora10
#chown -R oracle /opt/ora*

设置swap区

Oracle10g至少需要500M的内存和400M的交换空间,要查看swap区是否足够大小,用 fdisk -l 命令去查,如果小于400M的空间,那么就要增加swap的大小 重设交换分区可以使用如下操作:

dd if=/dev/zero of=tmp_swap bs=1k count=900000
chmod 600 tmp_swap
mkswap tmp_swap
swapon tmp_swap

完成安装以後,可以释放这个空间:

swapoff tmp_swap
rm tmp_swap

count 值是根据你需要调整的交换分区大小而定。

 

修改 sysctl.conf

添加如下的行到/etc/sysctl.conf 中:

root@jiangjiang-desktop:~# gedit /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

修改 limits.conf

添加如下的行到/etc/security/limits.conf中:

root@jiangjiang-desktop:~# gedit /etc/security/limits.conf
* soft nproc 2407
* hard nproc 16384
* soft nofile 1024
* hard nofile 65536


让修改生效

修改了以上文件後,必须让其生效,或重启系统,或切换到 root 用户下用以下的方式改变内核运行参数: sysctl -p

[编 辑 ] E.产生相应的软连接

# gedit kk


创建一个文件如 kk,内容如下:

#!/bin/bash
ln -s /usr/bin/awk /bin/awk
ln -s /usr/bin/rpm /bin/rpm
ln -s /usr/bin/basename /bin/basename
mkdir /etc/rc.d
ln -s /etc/rc0.d /etc/rc.d/rc0.d
ln -s /etc/rc2.d /etc/rc.d/rc2.d
ln -s /etc/rc3.d /etc/rc.d/rc3.d
ln -s /etc/rc4.d /etc/rc.d/rc4.d
ln -s /etc/rc5.d /etc/rc.d/rc5.d
ln -s /etc/rc6.d /etc/rc.d/rc6.d
ln -s /etc/init.d /etc/rc.d/init.d

创建後,切换到 root 用户去执行一下。

# chmod 775 kk

#  ./kk

[编 辑 ] F.创建RedHat的版本声明文件

# gedit /etc/redhat-release

在/etc/redhat-release中添加以下语句,以使安装程序认为正在一个RedHat的系统上安装:

Red Hat Linux release 3.1 (drupal)

[编 辑 ] G.修改环境变量

注销原来的用户,改用oracle用户登录。

编辑 /home/oracle/.bashrc,增加以下export 的内容。 (注意,在Ubnutu 7.04中用户的profile文件已改名为~/.profile,有很多安装教程都是用 ~/.bash_profile,在7.04中不行的)

export ORACLE_HOME=/opt/ora10
export ORACLE_OWNER=oracle
export ORACLE_SID=ora1
export ORACLE_TERM=xterm
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin:$PATH

[编 辑 ] 第五步,开始安装

用env查看一下环境变量是否生效。

oracle@jiangjiang-desktop:~$ env
ORBIT_SOCKETDIR=/tmp/orbit-oracle
SSH_AGENT_PID=5951
TERM=xterm
SHELL=/bin/bash
XDG_SESSION_COOKIE=4f40be95071a930722d80e5a4c1d4c71-1277127944.398612-1912101358
WINDOWID=73400324
GNOME_KEYRING_CONTROL=/tmp/keyring-YX8UZw
ORACLE_OWNER=oracle
GTK_MODULES=canberra-gtk-module
USER=oracle
LS_COLORS=rs=0:di=01;34:ln=01;36:hl=44;37:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:
ORACLE_SID=ora1
SSH_AUTH_SOCK=/tmp/keyring-YX8UZw/ssh
DEFAULTS_PATH=/usr/share/gconf/gnome.default.path
SESSION_MANAGER=local/jiangjiang-desktop:@/tmp/.ICE-unix/5916,unix/jiangjiang-desktop:/tmp/.ICE-unix/5916
USERNAME=oracle
XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg
DESKTOP_SESSION=gnome
PATH=/opt/ora10/bin:/opt/ora10/Apache/Apache/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
QT_IM_MODULE=xim
PWD=/home/oracle
XMODIFIERS=@im=ibus
GDM_KEYBOARD_LAYOUT=us
LANG=zh_CN.UTF-8
GNOME_KEYRING_PID=5898
MANDATORY_PATH=/usr/share/gconf/gnome.mandatory.path
GDM_LANG=zh_CN.UTF-8
ORACLE_TERM=xterm
GDMSESSION=gnome
SPEECHD_PORT=7561
SHLVL=1
HOME=/home/oracle
LANGUAGE=zh_CN:zh
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
LOGNAME=oracle
XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-aEnRZva0FU,guid=7fb843c210fba7007c1198044c1f6d08
LESSOPEN=| /usr/bin/lesspipe %s
DISPLAY=:0.0
ORACLE_HOME=/opt/ora10
GTK_IM_MODULE=ibus
LESSCLOSE=/usr/bin/lesspipe %s %s
XAUTHORITY=/var/run/gdm/auth-for-oracle-Jq69kd/database
COLORTERM=gnome-terminal
_=/usr/bin/env
oracle@jiangjiang-desktop:~$






然後进行/ora_ins_disk中进行安装

cd/ora_ins_disk
./runInstaller
假如出现oracle安装界面乱码的话,在命令行下执行:
oracle@jiangjiang-desktop:~/myoracle/database$ LANG=zh_CN


在安装过程中,请使用 Advanced Installation,然後一路按默认的设置进行往下设置,到窗单名为 “Specify Database Configuration Options”的时候,要修改以下设置: Database Character Set 中选择 Simplified Chinese ZHS16GBK 在安装的後期,系统提示需要用 root 用户去运行两个脚本文件orainstRoot.sh和root.sh,安装完毕後,Oracle是正常启动着的,你可以试一下连接数据库,同时也可以使 用浏览器去设置一下Oracle,(url:http: //localhost:1158/em/)(Oracle 10g与之前的版本都不一样,使用WEB页的企业管理器来代替以前的C/S版JAVA企业管理器)

运行root.sh
屏幕显示:
Enter the full pathname of the local bin directory:[/usr/local/bin]:   回车,
执行完毕,退出此界面,返回前一界面,按OK.

[编 辑 ] 第六步,设置自启动

创建自启动脚本 创建 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=ora1
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin:$PATH

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

还需要编辑一下/etc/oratab,把其中的N改成Y,不然上述脚本中所调用的$ORACLE_HOME /bin/dbstart在执行时不会 自动启动相应的数据库实例(这里的数据库实例是ora1)。文件内容如下:

#



# This file is used by ORACLE utilities. It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.

# A colon, ':', is used as the field terminator. A new line terminates
# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
ora1:/opt/ora10:Y

我的 oralce 的安装盘中可能有些问题,所以如果只用上述的脚本是不能启动 listener的,要修改一下: 修改 /opt/ora10/bin/dbstart文件 查找:(本步骤修改后需重新安装?——(不需要重新安装呀Sutra 2010年6月10日 (四) 21:31 (CST)))

# Set this to bring up Oracle Net Listener
ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle

将其改为:

# Set this to bring up Oracle Net Listener
ORACLE_HOME_LISTNER=$ORACLE_HOME

设置後,测试一下

/etc/init.d/./oracledb reload

如果一切正常的话,会关闭一次Oracle又再重新打开。

/home/oracle/oracle/product/10.2.0/db_1


linux下的oracle
启动数据库步骤如下:

注:
$ORACLE_HOME为oracle的安装路径

1,以oracle用户登录
su oracle
2,启动TNS监听器
$ORACLE_HOME/bin/lsnrctl start
3,用sqlplus启动数据库
$ORACLE_HOME/bin/sqlplus /nolog
SQL> connect system/change_on_install as sysdba
SQL> startup

出现如下显 示,表示Oracle已经成功启动
ORACLE instance started.

Total System Global Area  205520896 bytes
Fixed Size                   778392 bytes
Variable Size              74456936 bytes
Database Buffers          130023424 bytes
Redo Buffers                 262144 bytes
Database mounted.
Database opened.

4,用 sqlplus停止数据库

$ORACLE_HOME/bin/sqlplus /nolog
SQL> connect system/change_on_install as sysdba
SQL> shutdown

注:shutdown 可加关闭选项,从最温和到最粗暴的行为选项为(shutdown、shutdown transactional、shutdown immediate、shutdown abort)
命令解释如下
shutdown:关闭,等待每个用户退出系统戓 被取消后退出关闭数据库。

shutdown transactional:事务性关闭,等待每个用户提交戓回退当前的事务,然后oracle取消对话,在所有用户退出系统后执行关闭。

shutdown immediate:直接关闭,取消所有用户对话(促使回退),执行正常的关闭程序。

shutdown abort:终止关闭,关闭数据库时没有自动检查点戓日志开关。

出 现如下显示,表示oracle已经停止
Database closed.
Database dismounted.
ORACLE instance shut down.


江枫个人的安装说明:安装完后启动监听器,提示说找不到路径,然后我打开/opt/ora10一看发现是空的文件夹,这说明我的oracle没有安装到这 个文件夹中,可能是环境变量没设置好,也可能是安装时没有选择路径,用它默认的结果是装到/home/oracle/oracle/product /10.2.0/db_1
中去了,这时候怎么办呢,打开
/home/oracle/.bashrc  把 export ORACLE_HOME=/opt/ora10改成 export ORACLE_HOME= /home/oracle/oracle/product/10.2.0。就可以启动sqlplus了。不过发现EM和ISQL打不开了。。睡觉先,明天再搞。估计是路径问题。

如何启动OEM:
从Oracle10g开始,Oracle极大的增强了OEM工具,并通过服务器端进行EM工具全面展现。
在10g中,客户端可以不必安装任何Oracle客户端工具,仅凭浏览器就可以调用强大的EM工具。

在Server端,可以通过如下命令启动EM工具控制台:

emctl start dbconsole



以下是启动过程:

[oracle@danaly ~]$ emctl start dbconsole
TZ set to PRC
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.
http://danaly.hurrray.com.cn:1158/em/console/aboutApplication
Starting Oracle Enterprise Manager 10g Database Control .......................... started.
------------------------------------------------------------------
Logs are generated in directory /opt/oracle/product/10.2.0/danaly.hurrray.com.cn_danaly/sysman/log

动之后我们就可以通过在浏览器端输入以下url访问:
http://danaly.hurrray.com.cn:1158/em/ Oracle10g OEM
同样停止OEM可以输入如下命令:

emctl stop dbconsole



以下是停止过程:

[oracle@danaly ~]$ emctl stop dbconsole
TZ set to PRC
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.
http://danaly.hurrray.com.cn:1158/em/console/aboutApplication
Stopping Oracle Enterprise Manager 10g Database Control ...... Stopped.


也可以直接键入emctl查看emctl支持的选项:

[oracle@danaly ~]$ emctl
TZ set to PRC
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.
Invalid arguments

Unknown command option
Usage::
Oracle Enterprise Manager 10g Database Control commands:
emctl start| stop| status| setpasswd dbconsole
emctl secure

emctl set ssl test|off|on em
emctl set ldap
emctl blackout options can be listed by typing "emctl blackout"
emctl config options can be listed by typing "emctl config"
emctl secure options can be listed by typing "emctl secure"
emctl ilint options can be listed by typing "emctl ilint"
emctl deploy options can be listed by typing "emctl deploy"



http://www.eygle.com/archives/2005/10/howto_control_10goem.html

linux下oracle 10G启动EM和isqlplus



注: $ORACLE_HOME 为oracle的安装路径

1,使用EM(enterprise managment)
1.1启动EM

$ORACLE_HOME/bin/emctl start dbconsole
如果出现下面相关信息,说明服务启动
TZ set to PRC
Oracle Enterprise Manager 10g Database Control Release 10.1.0.3.0
Copyright (c) 1996, 2004 Oracle Corporation.  All rights reserved.
http://localhost.localdomain:5500/em/console/aboutApplication
Starting Oracle Enterprise Manager 10g Database Control ................................. started.
1.2使用EM
在浏览器地址中输入如下地址:
http://localhost.localdomain:5500/em/console/
如 果不出现登录对话页面,请确保你的数据库服务与监听服务正常启动了

注意:如果监听程序不启动,可以通过sqlplus登录,但在此 页面中不能正常显示.

现在你就可以正常使用EM了!
2,使用isqlplus
2.1启动isqlplus
$ORACLE_HOME/bin/isqlplusctl start
如果出 现如下信息,说明正常启动.
iSQL*Plus 10.1.0.3.0
Copyright (c) 2004 Oracle.  All rights reserved.
Starting iSQL*Plus ...
iSQL*Plus started.
2.2使用isqlplus
在浏览器地址中输入如下地址:
http://localhost.localdomain:5560/isqlplus/
这 样就出现了isqlplus的登录界面,就可使用isqlplus了.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值