oracle数据库部署

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了oracle数据库部署相关的知识,希望对你有一定的参考价值。

安装前设置

1:在windows中把需要的软件共享

2linux中挂载共享,将所需软件全拷贝到usr/src中(包括javaoracle

[[email protected]~]# mkdir /oracle (创建共享目录)

[[email protected]~]# mount -o username=administrator  //10.0.0.2/oracle11g /oracle(共享目录)

[[email protected]~]# cp /oracle/* /usr/src  (复制共享目录到/usr/src下面)

[[email protected]~]# cd /usr/src  (进入/usr/src下面)

[[email protected]]# ls  (查看)

安装java环境

[[email protected]]# ./jdk-6u21-linux-x64-rpm.bin  (安装Java环境)

3:安装先决条件所需的软件包

先检查一下都有哪些包没有安装

[[email protected]~]#rpm -qbinutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-develelfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common glibc-develglibc-headers kernel-headers ksh libaio libaio-devel libgcc libgomp libstdc++libstdc++-devel make numactl-devel sysstat unixODBC unixODBC-devel pdksh  查看环境要求

 

[[email protected]~]#mkdir /media/cdrom

[[email protected]~]#mount /dev/cdrom /media/cdrom

[[email protected]~]#cd /media/cdrom/Server

[[email protected]]# rpm -ivh sysstat-7.0.2-11.el5.x86_64.rpm

配置yum源为光盘

[[email protected]~]#vi /etc/yum.repos.d/rhel-debuginfo.repo

添加yum代码

注释掉第三行,添加一行代码

baseurl=file:///media/cdrom/Server

enabled=0(改为1)

 

yum安装所需软件包

[[email protected]~]# yum -y install libaio-devel

[[email protected]~]# yum -y install unixODBC

[[email protected]~]# yum -y install unixODBC-devel

[[email protected]~]# yum -y install pdksh

[[email protected]~]# yum -y install numactl-devel

3:内核参数调整

[[email protected] ~]# vi /etc/sysctl.conf

fs.aio-max-nr=1058576

fs.file-max=6815744

kernel.shmmni=4096

kernel.sem=25032000 100 128

net.ipv4.ip_local_port_range=900065500

net.core.rmem_default=262144

net.core.rmem_max=4194304

net.core.wmem_default=262144

net.core.wmem_max=1048586

kernel.shmmax= 68719476736                  \\已经有了,不小于536870912

kernel.shmall= 4294967296                       \\已经有了,不小于4096

[[email protected] ~]# sysctl -p                   \\重新加载内核

4:用户环境要求

[[email protected]~]# groupadd -g 500 oinstall  (创建安装组)

[[email protected]~]# groupadd -g 501 dba      (创建管理组)

[[email protected]~]# useradd -g oinstall -G dba oracle  (创建运行用户oracle

[[email protected]~]# passwd oracle           \\设置密码(aptech

[[email protected]~]# mkdir /opt/oracle

[[email protected]~]# chown -R oracle:oinstall /opt/oracle/ (属组属主归属权)

[[email protected]~]# chmod -R 775 /opt/oracle/

[[email protected]~]# sudo mkdir /opt/tmp       (创建安装时使用的临时文件夹)

[[email protected]~]# sudo chmod a+wr /opt/tmp

调整oracle用户的环境配置

[[email protected]~]#vi ~oracle/.bash_profile

添加以下内容:

umask=022                                               (文件权限掩码)

exportORACLE_BASE=/opt/oracle                        (定义基本目录)

exportORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1

exportORACLE_SID=orcl.benet.com                       (定义数据库实例名称)                         

exportLANG=zh_CN.UTF-8              (确定使用何种语言环境)

exportNLS_LANG="AMERICAN_AMERICA".ZHS16GBK

exportPATH=$ORACLE_HOME/bin:$PATH

exportDISPLAY=:0.0                     (告知默认的显示终端号)

调整全局用户配置

[[email protected]~]#vi /etc/profile

 

exportORACLE_BASE=/opt/oracle

exportORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1

exportORACLE_OWNER=oracle

exportORACLE_SID=orcl

exportORACLE_TERM=xterm

 export PATH=$PATH:$ORACLE_HOME/bin

5oracle用户资源限制调整

[[email protected]~]# vi /etc/pam.d/login

把最后一行注释掉“#”在最后添加以下两行:

session    required    /lib/security/pam_limits.so

session    required    pam_limits.so

[[email protected]~]# vi /etc/security/limits.conf

在末尾添加:

oracle  soft  nproc 2047    (进程数软限制)

oracle  hard  nproc 16384  (进程数硬限制)

oracle  soft  nofile 1024    (文件数软限制)

oracle  hard  nofile  65536    (文件数硬限制)

oracle  soft  stack 10240       (软堆栈限制)

[[email protected]~]# vi /etc/profile

在末尾添加:

 

if [ $USER ="oracle" ]; then

   if [ $SHELL = "/bin/ksh" ]; then

      ulimit -p 16384

      ulimit -n 65535

   else

      ulimit -n 16384 -n 65536

   fi

fi

 

(家目录)source /etc/profile   (输入命令生效)

重启系统

[[email protected]~]# reboot

 

二:安装过程

1:解压文件(解压后会有database文件夹)

[[email protected]~]# cd /usr/src

[[email protected]]# unzip linux.x64_11gR2_database_1of2.zip

[[email protected]]# unzip linux.x64_11gR2_database_2of2.zip

[[email protected]]# ls database/  (里面会有一个runinstall文件)

Doc install  response rpm runInstaller sshsetup   stage  welcome.html   

linux图形桌面打开终端

[[email protected]~]# xhost +   (此操作需在图形环境中执行)

[[email protected]~]$ su oracle

口令:             

[[email protected]~]$

[[email protected]~]$ cd /usr/src/database/

[[email protected]]$ ./runInstaller    (安装)

 

root账户中

 [[email protected]]# /opt/oracle/oraInventory/orainstRoot.sh      \\ oraInventory

[[email protected] database]#/opt/oracle/product/11.2.0/dbhome_1/root.sh

点确定

 

 

三:验证安装结果

1:打开浏览器,地址栏输入https//10.0.0.101158/em/

 

上图中用户名用sys,密码用数据库的密码(Aptech123),连接身份为SYSDBA

2:用命令登陆

[[email protected]]#vim /etc/oratab

orcl:/opt/oracle/product/11.2.0/dbhome_1:Y    //实例启动数据库启动

 

 

 

重启linux后如果oracle服务不启动,可用以下命令启动

[[email protected]~]# lsnrctl start

[[email protected]]$ sqlplus sys/Oracle11g AS SYSDBA

SQL>

 

3:创建数据库

[[email protected]]$ dbca           \\图形界面终端

 

 

 

[[email protected]~]# lsnrctl start

[[email protected]~]# su oracle

[[email protected]]$ sqlplus sys/Oracle11g AS SYSDBA

SQL>startup nomount

SQL>alter database open;

 

 

解决help index无法执行

[[email protected]~]$ cd /opt/oracle/product/11.2.0/dbhome_1/sqlplus/admin/help

[[email protected]]$ls

[[email protected]]$ sqlplus system/aptech

SQL>@/opt/oracle/product/11.2.0/dbhome_1/sqlplus/admin/help/helpbld.sql

Enter valuefor 1: helpus.sql

Entervalue for 2:                                               

 

SP2-0310:unable to open file "helpus.sql/hlpbld.sql"

Disconnectedfrom Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bitProduction

Withthe Partitioning, OLAP, Data Mining and Real Application Testing options

[[email protected]]$


本文出自 “12323622” 博客,请务必保留此出处http://12333622.blog.51cto.com/12323622/1916341

以上是关于oracle数据库部署的主要内容,如果未能解决你的问题,请参考以下文章

Oracle 11g数据库的部署

Oracle11 部署实践

架构04:敏捷基础设施中的Oracle数据库部署

部署Oracle 12c数据库

Oracle数据库部署

oracle数据库部署