0

0

Oracle数据库在Linux 中的安装与启动动

php中文网

php中文网

发布时间:2016-06-07 16:59:15

|

1077人浏览过

|

来源于php中文网

原创

到目前为止,oracle数据库算是我在linux安装的众多软件中最难安装的一个。值得庆幸的是,就在刚刚我成功的把oracle database安装

到目前为止,Oracle数据库算是我在linux安装的众多软件中最难安装的一个。值得庆幸的是,就在刚刚我成功的把oracle database安装到了linux os。现在回想起来装个oracle也并非难事。或许自己将来还是安装oracle,下面就简要回忆一下我的安装过程,用来提示将来的自己和第一次要在linux上安装oracle的朋友。

首先看一下我的软件环境:

HOST:Ubuntu 10.04(lucid),呵呵,我并不是要把db装到这个里面,我喜欢把这些软件装到vm(virtual machine)中。这么做有很多好处,当然也有一点坏处就是系统资源会增加一点点,但是这些增加的消耗是完全值得的。vm software我选用的是vbox(一款很不错的open-soruce软件)

GUEST(vm):CentOS 5.5。众所周知,linux有很多发行版,我们必须要选择一个发行版去安装oracle,这个时候最好是选择oracle安装手册中提到那几个发行版,比如Asianux 、 Oracle Enterprise Linux 、Red Hat Enterprise Linux、 SUSE Linux Enterprise Server 等。因为这样安装会简单很多。

DATABASE:Oracle Database 11g Release 2

下面是安装steps:

Step1. 创建用户和组(#表示以root身份,$表示以普通用户身份)

下面是oracle 数据库文档中的一段话,,依照下面的话去创建或修改DB所需的用户和组:

The following local operating system groups and users are required if you are installing Oracle Database:

*The Oracle Inventory group (typically, oinstall)

*The OSDBA group (typically, dba)

*The Oracle software owner (typically, oracle)

*The OSOPER group (optional. Typically, oper)

To determine whether these groups and users already exist, and if necessary, to create them, follow these steps:

1.To determine whether the oinstall group exists, enter the following command:

# more /etc/oraInst.loc

If the output of this command shows the oinstall group name, then the group already exists.

If the oraInst.loc file exists, then the output from this command is similar to the following:

inventory_loc=/u01/app/oraInventory

inst_group=oinstall

The inst_group parameter shows the name of the Oracle Inventory group, oinstall.

2.To determine whether the dba group exists, enter the following command:

# grep dba /etc/group

If the output from this commands shows the dba group name, then the group already exists.

3.If necessary, enter the following commands to create the oinstall and dba groups:

# /usr/sbin/groupadd oinstall

# /usr/sbin/groupadd dba

4.

To determine whether the oracle user exists and belongs to the correct groups, enter the following command:

# id oracle

If the oracle user exists, then this command displays information about the groups to which the user belongs. The output should be similar to the following, indicating that oinstall is the primary group and dba is a secondary group:

uid=440(oracle) gid=200(oinstall) groups=201(dba),202(oper)

5.If necessary, complete one of the following actions:

*If the oracle user exists, but its primary group is not oinstall or it is not a member of the dba group, then enter the following command:

# /usr/sbin/usermod -g oinstall -G dba oracle

*If the oracle user does not exist, enter the following command to create it:

# /usr/sbin/useradd -g oinstall -G dba oracle

This command creates the oracle user and specifies oinstall as the primary group and dba as the secondary group.

6.Enter the following command to set the password of the oracle user:

# passwd oracle

Step2. 进入db的解压目录执行runInstaller,下面是我当时的操作:

[oracle@DBServer ~]$ ls

Desktop linux_11gR2_database

[oracle@DBServer ~]$ cd linux_11gR2_database/

[oracle@DBServer linux_11gR2_database]$ ls

doc install response rpm runInstaller sshsetup stage welcome.html

[oracle@DBServer linux_11gR2_database]$ ./runInstaller

接下来就是完全的图形界面操作了,这里面就没什么好说的了。

Step3. 安装系统缺失软件与修改系统配置参数

关于这一步你可以按照安装文档里的要求那样做。但是有一个更简单的办法,安装程序会检查系统配置参数,当有参数不满足配置的时候,你要做的就是修复并重新检查,这个时候安装程序会生成一个修复脚本并提示你脚本所在的位置及你要如何操作。对于系统缺少的软件,修复脚本不会安装,需要自己手动安装。当所有的软件配置参数都满足的时候,你就可以一直next而不会再遇到什么困难了。

当初我安装的时候选择的是仅安装数据库软件,所以我现在需要创建一个监听和数据库。下面的ORACLE_HOME需要你在配置文件(~/.bash_profile)中手动设置,当然最好是把$ORACLE_HOME/bin加入到PATH中去,这样的话我们就可以在任何地方直接输入命令了

[oracle@DBServer ~]$ cd $ORACLE_HOME

[oracle@DBServer dbhome_1]$ pwd

/home/oracle/app/oracle/product/11.2.0/dbhome_1

[oracle@DBServer dbhome_1]$ cd bin/

[oracle@DBServer bin]$ netca

注:netca配置监听,图形界面

SmartB2B行业电子商务
SmartB2B行业电子商务

SmartB2B 是一款基于PHP、MySQL、Smarty的B2B行业电子商务网站管理系统,系统提供了供求模型、企业模型、产品模型、人才招聘模型、资讯模型等模块,适用于想在行业里取得领先地位的企业快速假设B2B网站,可以运行于Linux与Windows等多重服务器环境,安装方便,使用灵活。 系统使用当前流行的PHP语言开发,以MySQL为数据库,采用B/S架构,MVC模式开发。融入了模型化、模板

下载

[oracle@DBServer bin]$ dbca

注:dbca 创建数据库,图形界面

上述step执行完后,数据库就可以使用了


下面讨论如何启动和关闭数据库,我们只讨论一种最简单的方法:

默认情况下,linux中的oracle是不会随系统启动而启动的。当我们reboot系统的时候,可以用如下steps启动我们的db:

[oracle@DBServer ~]$ lsnrctl start注:启动监听

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 10-DEC-2010 11:05:02

Copyright (c) 1991, 2009, Oracle. All rights reserved.

Starting /home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.1.0 - Production

System parameter file is /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

Log messages written to /home/oracle/app/oracle/diag/tnslsnr/DBServer/listener/alert/log.xml

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=DBServer)(PORT=1521)))

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=DBServer)(PORT=2484)))

 


Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=DBServer)(PORT=1521)))

STATUS of the LISTENER

------------------------

Alias LISTENER

Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production

Start Date 10-DEC-2010 11:05:02

Uptime 0 days 0 hr. 0 min. 0 sec

Trace Level off

Security ON: Local OS Authentication

SNMP OFF

Listener Parameter File /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

Listener Log File /home/oracle/app/oracle/diag/tnslsnr/DBServer/listener/alert/log.xml

Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=DBServer)(PORT=1521)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=DBServer)(PORT=2484)))

The listener supports no services

The command completed successfully

[oracle@DBServer ~]$ dbstart注:启动数据库

ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener

Usage: /home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbstart ORACLE_HOME

Processing Database instance "orcl": log file /home/oracle/app/oracle/product/11.2.0/dbhome_1/startup.log

以下steps关闭db:

[oracle@DBServer ~]$ dbshut注:关闭数据库

ORACLE_HOME_LISTNER is not SET, unable to auto-stop Oracle Net Listener

Usage: /home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbshut ORACLE_HOME

Processing Database instance "orcl": log file /home/oracle/app/oracle/product/11.2.0/dbhome_1/shutdown.log

[oracle@DBServer ~]$ lsnrctl stop注:关闭监听

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 10-DEC-2010 11:06:50

Copyright (c) 1991, 2009, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=DBServer)(PORT=1521)))

The command completed successfully

[oracle@DBServer ~]$

不幸的是如果是第一次这么做,我们可能会失败,原因我们可以在dbstart脚本中发现。我把有用的内容摘录如下:

# This script will start all databases listed in the oratab file

# whose third field is a "Y". If the third field is set to "Y" and

# there is no ORACLE_SID for an entry (the first field is a *),

# then this script will ignore that entry.

看完这段内容我想你已经明白该如何做了,没错修改/etc/oratab中的内容:

orcl:/home/oracle/app/oracle/product/11.2.0/dbhome_1:N

把其中的‘N’改为‘Y’

到此数据库启动的问题都解决了,以后我们可以放心使用我们的db了。GOOK LUCK

linux

相关专题

更多
Word 字间距调整方法汇总
Word 字间距调整方法汇总

本专题整合了Word字间距调整方法,阅读下面的文章了解更详细操作。

2

2025.12.24

任务管理器教程
任务管理器教程

本专题整合了任务管理器相关教程,阅读下面的文章了解更多详细操作。

2

2025.12.24

AppleID格式
AppleID格式

本专题整合了AppleID相关内容,阅读专题下面的文章了解更多详细教程。

0

2025.12.24

csgo视频观看入口合集
csgo视频观看入口合集

本专题整合了csgo观看入口合集,阅读下面的文章了知道更多入口地址。

29

2025.12.24

yandex外贸入口合集
yandex外贸入口合集

本专题汇总了yandex外贸入口地址,阅读下面的文章了解更多内容。

58

2025.12.24

添加脚注通用方法
添加脚注通用方法

本专题整合了添加脚注方法合集,阅读专题下面的文章了解更多内容。

1

2025.12.24

重启电脑教程汇总
重启电脑教程汇总

本专题整合了重启电脑操作教程,阅读下面的文章了解更多详细教程。

3

2025.12.24

纸张尺寸汇总
纸张尺寸汇总

本专题整合了纸张尺寸相关内容,阅读专题下面的文章了解更多内容。

5

2025.12.24

Java Spring Boot 微服务实战
Java Spring Boot 微服务实战

本专题深入讲解 Java Spring Boot 在微服务架构中的应用,内容涵盖服务注册与发现、REST API开发、配置中心、负载均衡、熔断与限流、日志与监控。通过实际项目案例(如电商订单系统),帮助开发者掌握 从单体应用迁移到高可用微服务系统的完整流程与实战能力。

1

2025.12.24

热门下载

更多
网站特效
/
网站源码
/
网站素材
/
前端模板

精品课程

更多
相关推荐
/
热门推荐
/
最新课程
最新Python教程 从入门到精通
最新Python教程 从入门到精通

共4课时 | 0.6万人学习

Node.js 教程
Node.js 教程

共57课时 | 7.2万人学习

CSS3 教程
CSS3 教程

共18课时 | 3.9万人学习

关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号