当前时区为 UTC + 8 小时



发表新帖 回复这个主题  [ 4 篇帖子 ] 
作者 内容
1 楼 
 文章标题 : [wiki]oracle10g-ubuntu
帖子发表于 : 2005-11-09 12:07 
论坛管理员

注册: 2005-03-27 0:06
帖子: 10110
系统: Ubuntu 12.04
送出感谢: 7
接收感谢: 127
Table of Contents
1. Installation Prep

1.1. Setting up Users
1.2. Create Directories and Set Permissions
1.3. Configuration Changes
1.4. Installation
1.5. Starting/Stopping Services

1. Installation Prep

As a minimum you should have the following things before beginning:

*

500 MB ram
*

1 GB swap partition
*

gcc, make, binutils, lesstif2, libc6, and rpm installed

*You should also make sure dns and/or your /etc/hosts file is set up properly so that your ip address resolves to the correct hostname.
1.1. Setting up Users

You need to create an oracle user and two groups for installing. It's a good idea to make sure they don't exist first:

$grep oinstall /etc/group
$grep dba /etc/group
$grep nobody /etc/group

As long as they're not there, go ahead and create them

#addgroup oinstall
#addgroup dba
#addgroup nobody
#useradd -g oinstall -G dba -p passwd -d /home/oracle -s /bin/bash oracle
#usermod -g nobody nobody

1.2. Create Directories and Set Permissions

Note: The oracle directory default is /u01 and /u02. We chose to be a little more FHS compliant and put things in /opt/oracle and /opt/oradata:

#mkdir -p /opt/oracle
#mkdir -p /opt/oradata
#chown -R oracle:oinstall /opt/ora*
#chmod -R 775 /opt/ora*

1.3. Configuration Changes

Begin by adding the following lines to /etc/sysctl.conf:

kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000

To update the changes you just made, run:

#sysctl -p

Add the following lines to /etc/security/limits.conf file:

* soft nproc 2407
* hard nproc 16384
* soft nofile 1024
* hard nofile 65536

Create the following symlinks:

#ln -s /usr/bin/awk /bin/awk
#ln -s /usr/bin/rpm /bin/rpm
#ln -s /usr/bin/basename /bin/basename

Trick the installer by making it think we are running Red-Hat. Add the following to new file /etc/redhat-release:

Red Hat Linux release 2.1 (drupal)

1.4. Installation

Login as oracle and copy the installation files to a temporary directory.

#su oracle
$cp -r /installer/files/here/ `mktemp -d`

Start the installer. Note: if you get an error about the display variable, try restarting gdm and logging in as oracle from there.

$./runInstaller

If everything is working you should see a nice GUI pop upp and you will be prompted twice during the installation to stop and run a script as root. The first is straight forward and just sets permissions for you. When you get to the second prompt to run the root.sh script do the following things first:

#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
#/path/to/root.sh

Oracle installs a service called init.cssd. The root.sh script waits 600 seconds (10 minutes) for the service to be started before going on. You need to do some setting up while it waits for you! The message on the console will show: Expecting the CRS daemons to be up within 600 seconds. There are three things to do. First, the /etc/inittab file needs a line to set the active runlevels to 23 (the Debian defaults) instead of 35 (the Red Hat and Suse defaults). Change it from:

h1:35:respawn:/etc/init.d/init.cssd run >/dev/null 2>&1 </dev/null

to

h1:23:respawn:/etc/init.d/init.cssd run >/dev/null 2>&1 </dev/null

Next, the inittab runs /etc/rc.d/init.d/init.cssd. Exit this script and, at line 83, replace:

SU="/bin/su -l"

with

SU="/bin/su"

Finally, make init restart the service:

#init q

The root.sh script should now continue and finish as expected and you should be done with the graphical installer.
1.5. Starting/Stopping Services

At this point you need to add another init script to make oracle startup whenever you reboot. But first, you need to take care of some broken links that the installer creates for you.

#rm /etc/rc2.d/[SK]96*
#rm /etc/rc3.d/[SK]96*
#rm /etc/rc5.d/[SK]96*
#update-rc.d init.cssd defaults 96

Below is the init script that I customized for our needs that starts/stops the instance, listener, and the enterprise management web interface.

#!/bin/bash
#
# /etc/init.d/oracledb
#
# Run-level Startup script for the Oracle Instance, Listener, and
# Web Interface


export ORACLE_HOME=/your/oracle/home/goes/here
export ORACLE_SID=oraclesidgoeshere
export PATH=$PATH:$ORACLE_HOME/bin

ORA_OWNR="oracleownergoeshere"

# 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


Once this is in place, make it executable, and link it to all the runlevels:

#chmod 755 /etc/init.d/oracledb
#update-rc.d oracledb defaults 99

Before we can run this we have to do a couple more customizations. The following files need to have their environment variables changed for your respective setup:

/usr/local/bin/dbhome -- change ORAHOME, ORASID, and ORATAB (/etc/oratab)
$ORACLE_HOME/bin/dbhome -- same as above
$ORACLE_HOME/bin/dbstart -- change ORATAB
$ORACLE_HOME/bin/dbshut -- same as above

For all the databases that you create or want started at boot time you will need to edit the /etc/oratab file. Here is an example:

oracle:/opt/oracle/:N

to

oracle:/opt/oracle:Y

At this point you should be ready to roll. Just reboot and set your ORACLE_HOME, ORACLE_SID, and PATH variables through the command line or through startup file (i.e. .bashrc); also try running sqlplus or logging in through the web interface (http://urlhere.com:5500/em) to test everything. Enjoy :)


http://csee.wvu.edu/~ccole/oracle10g-ubuntu


_________________
当净其意如虚空,远离妄想及诸取,令心所向皆无碍


页首
 用户资料  
 
2 楼 
 文章标题 :
帖子发表于 : 2005-11-09 14:41 
头像

注册: 2005-10-16 12:40
帖子: 29
送出感谢: 0 次
接收感谢: 0 次
目录
1. 安装准备

1.1. 设置用户
1.2. 创建目录和设置权限
1.3. 更改配置
1.4. 安装
1.5. 启动/停止Oracle

1. 安装准备

安装开始前,确认你的系统符合Oracle的最小安装要求:

*

500 MB 内存
*

1 GB 交换分区
*

确认你已经安装了gcc, make, binutils, lesstif2, libc6, 和 rpm包

*最好确认 dns 和/或 你的 /etc/hosts 文件已经正确配置了,以保证你的IP地址和hostname能正确解析.

1.1. 设置用户

我们需要为安装程序创建一个oracle 用户和两个组. 首先检查它们是否已经存在:

$grep oinstall /etc/group
$grep dba /etc/group
$grep nobody /etc/group

如果它们还不在系统中,那么创建它们。

#addgroup oinstall
#addgroup dba
#addgroup nobody
#useradd -g oinstall -G dba -p passwd -d /home/oracle -s /bin/bash oracle
#usermod -g nobody nobody

1.2. 创建目录和设置权限

注意: oracle缺省目录是 /u01 和 /u02. 我们为了和FHS有更好的兼容性,更改为 /opt/oracle 和 /opt/oradata:

#mkdir -p /opt/oracle
#mkdir -p /opt/oradata
#chown -R oracle:oinstall /opt/ora*
#chmod -R 775 /opt/ora*

1.3. 更改配置

添加以下行到 /etc/sysctl.conf文件中:

kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000

更新系统, 运行:

#sysctl -p

添加以下行到 /etc/security/limits.conf 文件中:

* soft nproc 2407
* hard nproc 16384
* soft nofile 1024
* hard nofile 65536

建立软连接:

#ln -s /usr/bin/awk /bin/awk
#ln -s /usr/bin/rpm /bin/rpm
#ln -s /usr/bin/basename /bin/basename

通过创建一个新文件/etc/redhat-release并添加以下行,欺骗安装程序让它以为我们的系统是RedHat:

Red Hat Linux release 2.1 (drupal)

1.4. 安装

用oracle用户登录,将安装文件拷贝到一个临时目录.

#su oracle
$cp -r /installer/files/here/ `mktemp -d`

启动安装程序。注意:如果系统说显示变量错误,试一试重启gdm(gnome显示管理器),然后用oracle用户登录.

$./runInstaller

当正确运行时,你将看到一个GUI窗口界面。安装过程中,安装程序将两次提醒你用root权限停止和运行脚本。当它第一次提醒你时,让它过,它只是设置相应的权限,第二次时,它要求运行root.sh脚本,你需要先做下面的事情:

#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
#/path/to/root.sh

Oracle在系统中安装一个init.cssd服务. root.sh脚本将等待 600 秒 (10 分钟) 让这个服务启动,当它在等待时,你需要做一些设置。控制台消息会显示: Expecting the CRS daemons to be up within 600 seconds. 需要做三件事情,首先, 修改 /etc/inittab 文件,将 运行级 从35(RedHat和Suse缺省值)改到23 (Debian缺省值) :


h1:35:respawn:/etc/init.d/init.cssd run >/dev/null 2>&1 </dev/null

改成

h1:23:respawn:/etc/init.d/init.cssd run >/dev/null 2>&1 </dev/null

然后, inittab 将运行 /etc/rc.d/init.d/init.cssd. 退出这个脚本, 修改第 83 行, 替换:

SU="/bin/su -l"



SU="/bin/su"

最后,重启服务:

#init q

root.sh 将继续运行直至成功,图形安装界面会显示结束.

1.5. 启动/停止服务

这里我们需要添加另外一个init脚本来使得Oracle在重启系统后自动启动,首先,删除安装程序创建的一些损坏的连接.

#rm /etc/rc2.d/[SK]96*
#rm /etc/rc3.d/[SK]96*
#rm /etc/rc5.d/[SK]96*
#update-rc.d init.cssd defaults 96

下面这个init脚本内,我为我们的需求定制了启动/停止Oracle实例、监听器方式和企业管理器web界面.

#!/bin/bash
#
# /etc/init.d/oracledb
#
# Run-level Startup script for the Oracle Instance, Listener, and
# Web Interface


export ORACLE_HOME=/your/oracle/home/goes/here
export ORACLE_SID=oraclesidgoeshere
export PATH=$PATH:$ORACLE_HOME/bin

ORA_OWNR="oracleownergoeshere"

# 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

在我们运行这个配置文件前哦我们还需要做一些相关的定制工作. 下面这些文件需要为我们的安装程序更改它们的环境变量:

/usr/local/bin/dbhome -- 更改 ORAHOME, ORASID, 和 ORATAB (/etc/oratab)
$ORACLE_HOME/bin/dbhome -- 同上
$ORACLE_HOME/bin/dbstart -- 更改 ORATAB
$ORACLE_HOME/bin/dbshut -- 同上

如果你希望在系统启动时启动你创建的所有数据库实例,那么需要修改 /etc/oratab 文件. 下面是一个例子:

oracle:/opt/oracle/:N

修改为

oracle:/opt/oracle:Y

现在你可以开始运行了。重启你的系统,先通过命令行设置ORACLE_HOME, ORACLE_SID, 和 PATH 变量variables(或者用户配置文件,如 .bashrc); 可以试一试运行sqlplus或者通过web登录管理界面(http://urlhere.com:5500/em) 来测试你的系统.

Enjoy Smile


页首
 用户资料  
 
3 楼 
 文章标题 :
帖子发表于 : 2005-11-10 21:09 
论坛管理员

注册: 2005-03-27 0:06
帖子: 10110
系统: Ubuntu 12.04
送出感谢: 7
接收感谢: 127
http://www.ubuntu.org.cn/support/docume ... howto_view


页首
 用户资料  
 
4 楼 
 文章标题 :
帖子发表于 : 2006-07-29 22:36 
头像

注册: 2005-07-02 14:41
帖子: 4133
系统: Ubuntu 14.04 (Kylin)
送出感谢: 53
接收感谢: 11
http://wiki.ubuntu.org.cn/index/databas ... 0gInBreezy


_________________
https://weakish.github.io


页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 4 篇帖子 ] 

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:没有注册用户 和 4 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

前往 :  
本站点为公益性站点,用于推广开源自由软件,由 DiaHosting VPSBudgetVM VPS 提供服务。
我们认为:软件应可免费取得,软件工具在各种语言环境下皆可使用,且不会有任何功能上的差异;
人们应有定制和修改软件的自由,且方式不受限制,只要他们自认为合适。

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
简体中文语系由 王笑宇 翻译