linux下命令行装oracle

1.验证Oracle所需要的系统依赖程序包是否完整。

rpm -qa binutils compat-db control-center gcc gcc-c++ glibc glibc-common libstdc++ libstdc++-devel make libaio libXp

2.验证系统要求

Oracle所需最小 RAM 为 512MB,而所需最小交换空间为 1GB。对于 RAM 小于或等于 2GB 的系统,交换空间应为 RAM 数量的两倍;对于 RAM 大于 2GB 的系统,交换空间应为 RAM 数量的一到两倍。Oracle 10g 软件还需要 2.5GB 的可用磁盘空间,而数据库则另需 1.2GB 的可用磁盘空间。/tmp 目录至少需要 400MB 的可用空间。

3.创建Oracle用户组和用户

 创建用户组oinstall和dba。

创建用户oracle,同属于oinstall和dba用户组,并且建立了oracle的home目录。

修改oracle用户的登录密码。

$su - root

#groupadd dba //数据库系统管理理组

#groupadd oinstall //Oracle文件所有者的组

#useradd -g oinstall -G dba -m -s /bin/bash oracle

#passwd oracle

#chown -R oracle.oinstall /home/oracle

4.配置内核参数

#vi /etc/sysctl.conf

编辑文件/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#应用程序可使用的IPv4端口范围。

net.core.rmem_default = 1048576 # 套接字接收缓冲区大小的缺省值

net.core.rmem_max = 1048576 # 套接字接收缓冲区大小的最大值

net.core.wmem_default = 262144 # 套接字发送缓冲区大小的缺省值

net.core.wmem_max = 262144 # 套接字发送缓冲区大小的最大值

5.解压缩安装文件

unzip 10201_database_linux32.zip

6.修改gennttab

解压缩filegroup6.jar。

cd database/stage/Components/oracle.network.rsf/10.2.0.1.0/1/DataFiles/

unzip filegroup6.jar bin/gennttab

修改解压出来的gennttab文件。

vi bin/gennttab

 

 改为:

即把`s/ ///`中的后面的”/”改为”n”,同时要注意把n后的空格删除,否则在安装监听器时会报错。

将gennttab添加到filegroup6.jar中。

zip -vu filegroup6.jar bin/gennttab

7. Oracle 建议对每个 Linux 帐户可以使用的进程数和打开的文件数设置限制。

要进行这些更改,以 root 用户的身份执行下列命令:

vi /etc/security/limits.conf

添加如下内容:

   oracle soft nproc 2047

   oracle hard nproc 16384

   oracle soft nofile 1024

   oracle hard nofile 65536

8.设置环境变量

以oracle用户登录。

vi  ~/.bash_profile

添加如下内容:

    export TMP=/tmp

    export TMPDIR=/tmp

    export ORACLE_BASE=/home/oracle

    export ORACLE_SID=ora10g

    export ORACLE_HOME=$ORACLE_BASE/product/10.2.0.1/db_1

    export PATH=$PATH:$ORACLE_HOME/bin

9.修改enterprise.rsp文件,在oracle安装目录下可以找到/database/response/enterprise.rsp

ORACLE_HOME="/home/oracle/product/10.2.0.1/db_1"

ORACLE_HOME_NAME="Oracle10g"

s_nameForDBAGrp="dba"

s_nameForOPERGrp="dba"

n_configurationOption=3

说明:

ORACLE_HOME Oracle服务器的主目录位置,必须是绝对路径。

ORACLE_HOME_NAME Oracle服务器的名称,必须以字母开头。

s_nameForDBAGrp 用于Oracle系统管理的linux用户组名,该组的用户拥有管理Oracle服务器的权限。

s_nameForOPERGrp 用于Oracle数据库常规操作的linux用户组名,该组的用户拥有常规操作Oracle数据库的权限。

n_configurationOption 安装类型(1为在安装后创建数据库,2为安装后创建一个自动存储管理实例,3为只安装服务器软件)。

10.修改操作系统发行版本

由于oracle还没有推出支持CentOS的安装包,所以需要修改发行版本,以便通过oracle的安装检查,发行版本文件的位置为/etc/redhat-release

将CentOS release 5 (Final)

修改成

Red Hat Enterprise Linux AS release 3 (Taroon)

安装完成后再改回来。

11.关闭SELINUX工作模式

SELINUX属性配置文件位置为/etc/selinux/config

# 设置SELINUX为disabled

   SELINUX=disabled

12.开始安装

./runInstaller -ignoreSysPrereqs -silent -responseFile /home/oracle/database/response/enterprise.rsp

说明:

ignoreSysPrereqs 让Oracle忽略系统检查,因为Oracle官方声明只支持Linux服务器产品,所以要在非服务器产品的Linux上安装就必须指定此参数。

silent 让安装程序以静默模式运行。

responseFile 指定一个应答文件。

注意:如果ORACLE_HOME和ORACLE_BASE目录设在相同的位置,或者ORACLE_HOME所在目录不为空的话,会有如下错误:

SEVERE:OUI-10029:You have specified a non-empty directory to install this product. It is recommended to specify either an empty or a non-existent directory. You may, however, choose to ignore this message if the directory contains Operating System generated files or subdirectories like lost+found.

如果仍然要以当前配置安装的话,请在安装时添加-force参数进行强制安装。

13.oracle系统初始化

以root管理员运行$ORACLE_HOME/root.sh进行Oracle的系统初始化工作,通常一路按回车用默认值即可。

14.安装网络监听器

编辑oracle安装目录下的netca.rsp应答文件,地址为:/database/response/netca.rsp,主要查看以下参数配置:

INSTALL_TYPE=""custom"" 安装的类型

LISTENER_NUMBER=1 监听器数量

LISTENER_NAMES={"LISTENER"} 监听器的名称列表

LISTENER_PROTOCOLS={"TCP;1521"} 监听器使用的通讯协议列表

LISTENER_START=""LISTENER"" 监听器启动的名称

运行安装命令:

$ORACLE_HOME/bin/netca /silent /responseFile /home/oracle/database/response/netca.rsp

注意:在此处可能会有错误oracle需要的软件包不全。请根据1中列出的软件包,确保所有的软件包都已经正确安装(2)6中对gennttab文件的修改不正确,本人就是没有去掉n后的空格导致了该错误。

15.修改dbstart

vi $ORACLE_HOME/bin/dbstart

    ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle

改为:

    ORACLE_HOME_LISTNER=$ORACLE_HOME

确保数据库启动时,网络监听器同时启动。

16.安装数据库实例

编辑Oracle安装源文件夹response目录下的dbca.rsp应答文件:

vi /home/oracle/database/response/dbca.rsp

根据自己的需要修改下列参数:

GDBNAME  = “orcl10g”  #数据库全局名称

SID = “ora”  #数据库的SID

SYSPASSWORD = “sys”  # SYS用户的初始密码

SYSTEMPASSWORD = ”sys” #SYSTEM用户的初始密码

CHARACTERSET = “ZHS16GBK” #数据库字符集(中文为 ZHS16GBK)

NATIONALCHARACTERSET = ”ZHS16GBK” # 数据库国家字符集

运行安装命令:

$ORACLE_HOME/bin/dbca -silent -responseFile /home/oracle/database/response/dbca.rsp -cloneTemplate

数据库创建成功后需要修改一些信息:

vi /etc/oratab

ora10g:/opt/oracle/product/10.2.0.1/db_1:N

改为:

ora10g:/opt/oracle/product/10.2.0.1/db_1:Y

保证数据库实例能自动启动。

17.启动数据库实例

$ORACLE_HOME/bin/dbstart

18.测试

sqlplus "/as sysdba"

19. 配置EM资料库,数据库和监听都必须已经启动并正常工作

配置dbcontrol

[oracle@oracle10 ~]$ emca -config dbcontrol db

STARTED EMCA at Oct 27, 2007 9:33:48 AM

EM Configuration Assistant, Version 10.2.0.1.0 Production

Copyright (c) 2003, 2005, Oracle. All rights reserved.

Enter the following information:

Database SID: orcl

Database Control is already configured for the database orcl

You have chosen to configure Database Control for managing the database orcl

This will remove the existing configuration and the default settings and perform a fresh configuration

Do you wish to continue? [yes(Y)/no(N)]: Y

Listener port number: 1521

Password for SYS user:

Password for DBSNMP user:

Password for SYSMAN user:

Email address for notifications (optional):

Outgoing Mail (SMTP) server for notifications (optional):

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

You have specified the following settings

Database ORACLE_HOME ................ /opt/oracle/product/10.2.0/Database

Database hostname ................ oracle10

Listener port number ................ 1521

Database SID ................ orcl

Email address for notifications ...............

Outgoing Mail (SMTP) server for notifications ...............

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

Do you wish to continue? [yes(Y)/no(N)]: Y

Oct 27, 2007 9:35:12 AM oracle.sysman.emcp.EMConfig perform

INFO: This operation is being logged at /opt/oracle/product/10.2.0/Database/cfgtoollogs/emca/orcl/emca_2007-10-27_09-33-46-AM.log.

Oct 27, 2007 9:35:33 AM oracle.sysman.emcp.util.DBControlUtil stopOMS

INFO: Stopping Database Control (this may take a while) ...

Oct 27, 2007 9:36:39 AM oracle.sysman.emcp.ParamsManager getLocalListener

WARNING: Error retrieving listener for oracle10

Oct 27, 2007 9:36:54 AM oracle.sysman.emcp.util.DBControlUtil startOMS

INFO: Starting Database Control (this may take a while) ...

Oct 27, 2007 9:39:51 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration

INFO: Database Control started successfully

Oct 27, 2007 9:39:53 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration

INFO: >>>>>>>>>>> The Database Control URL is http://oracle10:5500/em <<<<<<<<<<<

Enterprise Manager configuration completed successfully

FINISHED EMCA at Oct 27, 2007 9:39:53 AM

[oracle@oracle10 ~]$

删除数据库的 Database Control配置

[oracle@oracle10 ~]$ emca -deconfig dbcontrol db

STARTED EMCA at Oct 27, 2007 10:44:24 AM

EM Configuration Assistant, Version 10.2.0.1.0 Production

Copyright (c) 2003, 2005, Oracle. All rights reserved.

Enter the following information:

Database SID: orcl

Do you wish to continue? [yes(Y)/no(N)]: Y

Oct 27, 2007 10:44:47 AM oracle.sysman.emcp.EMConfig perform

INFO: This operation is being logged at /opt/oracle/product/10.2.0/Database/cfgtoollogs/emca/orcl/emca_2007-10-27_10-44-22-AM.log.

Oct 27, 2007 10:44:52 AM oracle.sysman.emcp.util.DBControlUtil stopOMS

INFO: Stopping Database Control (this may take a while) ...

Oct 27, 2007 10:48:13 AM oracle.sysman.emcp.EMReposConfig stopDBMSJobs

WARNING: Error initializing SQL connection. SQL operations cannot be performed

Oct 27, 2007 10:48:13 AM oracle.sysman.emcp.EMReposConfig invoke

WARNING: Unable to remove DBMS jobs.

Enterprise Manager configuration completed successfully

FINISHED EMCA at Oct 27, 2007 10:51:01 AM

[oracle@oracle10 ~]$

20.uninstall oracle if you want:

   ./runInstaller -silent -deinstall -removeallfiles -removeAllPatches "REMOVE_HOMES={$ORACLE_HOME}" -responseFile ~oracle/database/response/enterprise.rsp

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值