Linux Centos 6.6安装Oracle 11g

本文采用界面安装方式,适用于局域网远程安装Oracle和直接在Linux服务器上安装。

通过互联网环境安装没有试验过,互联网环境采用静默方式安装比较好。

本文在Red Hat Enterprise Linux 6 64 位系统、Centos 6.6系统下安装通过。

本文使用的工具:

Xshell 4Xftp 4VMware 10.0.3

安装的Oracle版本为:

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

使用的Oracle安装包:

p10404530_112030_Linux-x86-64_1of7.zip

p10404530_112030_Linux-x86-64_2of7.zip



目录

一、修改配置文件
1.1、修改/etc/security/limits.conf文件,修改用户的SHELL的限制。
1.2、修改/etc/pam.d/login 文件。
1.3、修改linux内核,修改/etc/sysctl.conf文件。
1.4、修改/etc/profile。
1.5、创建用户和组。
1.6、创建数据库软件目录和数据文件存放目录。
1.7、配置oracle用户的环境变量。
1.8、上传Oracle安装文件
1.9、解压安装文件
二、安装Oracle 11.2产品
三、数据库建库
四、配置监听及本地网络服务
五、启动Oracle服务和监听器



一、修改配置文件

1.1、修改/etc/security/limits.conf文件,修改用户的SHELL的限制。

输入命令:vi /etc/security/limits.conf,将下列内容加入该文件。

oracle   soft    nproc    2047
oracle   hard    nproc    16384
oracle   soft    nofile   1024
oracle   hard    nofile   65536

Insert键进入编辑状态,编辑完成后按Esc键退出编辑状态,按键输入英文冒号wq:wq”保存退出。不想保存:按Esc键,然后按Ctrl+Z

[root@localhost ~]# su - root

[root@localhost ~]# vi /etc/security/limits.conf





1.2修改/etc/pam.d/login 文件

输入命令:vi  /etc/pam.d/login,将下列内容加入该文件。

session   required    /lib/security/pam_limits.so 
session   required    pam_limits.so



1.3、修改linux内核,修改/etc/sysctl.conf文件。

输入命令vi  /etc/sysctl.conf ,将下列内容加入该文件。

fs.file-max = 6815744 
fs.aio-max-nr = 1048576 
kernel.shmall = 2097152 
kernel.shmmax = 2147483648 
kernel.shmmni = 4096 
kernel.sem = 250 32000 100 128 
net.ipv4.ip_local_port_range = 9000 65500 
net.core.rmem_default = 4194304 
net.core.rmem_max = 4194304 
net.core.wmem_default = 262144 
net.core.wmem_max = 1048576



用#符号注释掉原有的配置。

# Controls the maximum shared segment size, in bytes

#kernel.shmmax = 68719476736

 

# Controls the maximum number of shared memory segments, in pages

#kernel.shmall = 4294967296

 

输入命令:sysctl  -p,使/etc/sysctl.conf配置文件立即生效。




1.4、修改/etc/profile

输入命令:vi  /etc/profile,将下列内容加入该文件。

if [ $USER = "oracle" ]; then 
if [ $SHELL = "/bin/ksh" ]; then 
  ulimit -p 16384 
  ulimit -n 65536 
else 
  ulimit -u 16384 -n 65536 
fi
fi



1.5、创建用户和组。

创建用户组,输入命令:

groupadd  oinstall 
groupadd  dba


创建oracle用户,主组为oinstall,副组dba,输入命令:

useradd -g oinstall -g dba -m oracle


设置用户oracle密码,输入两次密码,输入命令:

passwd  oracle

1.6、创建数据库软件目录和数据文件存放目录。

mkdir /home/oracle/app
mkdir /home/oracle/app/oracle
mkdir /home/oracle/app/oradata
mkdir /home/oracle/app/oracle/product

修改目录权限,更改目录属主为Oracle用户所有,输入命令:

chown -R oracle:oinstall /home/oracle/app

1.7、配置oracle用户的环境变量。

用命令su - oracle切换到oracle用户下。

su - oracle

输入命令:vi .bash_profile,将下列内容加入该文件。

umask 022
export ORACLE_BASE=/home/oracle/app
export ORACLE_HOME=$ORACLE_BASE/oracle/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib


[root@localhost ~]# su - oracle

[oracle@localhost ~]$ vi .bash_profile



1.8、上传Oracle安装文件

上传Oracle安装文件到Linux服务器。

打开Xshell,新建连接,输入IP地址和端口,使用SSH协议连接。




输入用户名和密码。


利用XshellXftp工具上传文件,在Xshell中连接上Linux后,点击图中红色线框标注的图标,打开Xftp




上传安装文件

p10404530_112030_Linux-x86-64_1of7.zip

p10404530_112030_Linux-x86-64_2of7.zip

上传到/tmp目录下面。


1.9、解压安装文件

进入tmp目录,使用unzip命令解压文件。

[root@localhost tmp]# cd /
[root@localhost /]# cd /tmp
[root@localhost tmp]# unzip p10404530_112030_Linux-x86-64_1of7.zip -d /tmp
[root@localhost tmp]# unzip p10404530_112030_Linux-x86-64_2of7.zip -d /tmp

解压完成后,在tmp目录下会有一个database的文件夹。


二、安装Oracle 11.2产品

用命令su - oracle切换到oracle用户,执行安装命令./runInstaller,具体如下。

[root@localhost database]# su - oracle
[oracle@localhost ~]$ cd /tmp/database
[oracle@localhost database]$ DISPLAY=192.168.0.107:0.0
[oracle@localhost database]$ export DISPLAY
[oracle@localhost database]$ export  LANG=en-US
[oracle@localhost database]$ ./runInstaller

如果是远程连接Linux服务器安装,需要输入命令

DISPLAY=192.168.0.107:0.0 //此处为本地电脑的IP地址,不是服务器的IP地址
export DISPLAY      //将安装界面映射显示到本地电脑
export LANG=en-US //如果安装界面出现乱码,文字显示不了,需要输入该命令

如果是直接在Linux服务器上安装,则不需要输入上面三行命令,只需要输入

su - oracle
cd /tmp/database
./runInstaller

本文下面部分内容相似的地方都按此方式处理。


执行安装命令./runInstaller后,会显示出如下信息:

Starting Oracle Universal Installer...

 

Checking Temp space: must be greater than 120 MB.   Actual 25737 MB    Passed

Checking swap space: must be greater than 150 MB.   Actual 4090 MB    Passed

Checking monitor: must be configured to display at least 256 colors.    Actual 16777216    Passed

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2015-06-29_08-23-35PM. Please wait ...[oracle@localhost database]$

翻译:

正在启动 Oracle Universal Installer...

 

检查临时空间必须大于 120 MB。   实际为 32694 MB    通过

检查交换空间可用的交换空间为 4096 MB, 所需的交换空间为 150 MB。    通过

检查监视器监视器配置至少必须显示 256 种颜色。    实际为 16777216    通过

 

准备从以下地址启动 Oracle Universal Installer /tmp/OraInstall2015-06-29_08-23-35PM. 请稍候...


























根据实际情况安装缺少的组件。没有的组件可以百度谷歌搜索下载,然后上传上去安装,安装好后点击Check Again按钮进行检查,安装的版本适用就可以通过了。

rpm -ivh pdksh-5.2.14-37.el5_8.1.x86_64.rpm

rpm -ivh libaio-devel-0.3.105-2.x86_64.rpm

rpm -ivh elfutils-libelf-devel-0.152-1.el6.x86_64.rpm

rpm -ivh compat-libstdc++-33-3.2.3-69.el6.x86_64.rpm

yum -y install libstdc++-devel*

yum -y install libstdc++-devel-4.4.7-11.el6.x86_64.rpm

yum install gcc-c++-*














root权限执行2shell脚本,新开启一个终端,输入命令:

[root@localhost ~]# su - root
[root@localhost ~]# cd /home/oracle/oraInventory/
[root@localhost oraInventory]# sh orainstRoot.sh
显示出下面类似信息

Changing permissions of /home/oracle/oraInventory.

Adding read,write permissions for group.

Removing read,write,execute permissions for world.

 

Changing groupname of /home/oracle/oraInventory to dba.

The execution of the script is complete.

[root@localhost oraInventory]# cd /home/oracle/app/oracle/product/11.2.0/dbhome_1/
[root@localhost dbhome_1]# sh root.sh

显示出下面类似信息

Performing root user operation for Oracle 11g 

The following environment variables are set as:

    ORACLE_OWNER= oracle

    ORACLE_HOME=  /home/oracle/app/oracle/product/11.2.0/dbhome_1

Enter the full pathname of the local bin directory: [/usr/local/bin]: 

   Copying dbhome to /usr/local/bin ...

   Copying oraenv to /usr/local/bin ...

   Copying coraenv to /usr/local/bin ...

Creating /etc/oratab file...

Entries will be added to the /etc/oratab file as needed by

Database Configuration Assistant when a database is created

Finished running generic part of root script.

Now product-specific root actions will be performed.

Finished product-specific root actions.






执行完脚本,再点击OK按钮关闭窗口。




安装完成。显示出下面类似信息。

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2015-06-29_07-37-00PM. Please wait ...[oracle@localhost database]$ You can find the log of this install session at:

 /home/oracle/oraInventory/logs/installActions2015-06-29_07-37-00PM.log



检验安装是否成功


使用命令su - oracle切换系统账号,然后输入sqlplus命令,使用system用户和密码登录。

[root@localhost ~]# su - oracle
[oracle@localhost ~]$ sqlplus

SQL*Plus: Release 11.2.0.3.0 Production on Tue Jun 30 11:06:50 2015

 

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

 

Enter user-name: system

Enter password: 

 

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

 

SQL> 



三、数据库建库

在当前终端窗口中输入命令dbca,弹出建库界面。

[oracle@localhost database]$ dbca


[root@localhost dbhome_1]# dbca

-bash: dbca: command not found

如果没有弹出建库界面,或找不到dbca命令。按前面方式执行完两个脚本,然后按如下操作进行。

[root@localhost bin]# su - oracle
[oracle@localhost ~]$ cd /home/oracle/app/oracle/product/11.2.0/dbhome_1/bin
[oracle@localhost bin]$ DISPLAY=192.168.0.107:0.0
[oracle@localhost bin]$ export DISPLAY
[oracle@localhost bin]$ export  LANG=en-US
[oracle@localhost bin]$ ./dbca














推荐设置统一的用户密码。




点击Yes按钮。












设置数据库字符编码。














建库完成,点击Exit按钮退出。



四、配置监听及本地网络服务

在当前终端窗口中输入命令netca,弹出配置界面。

[oracle@localhost database]$ netca

[root@localhost dbhome_1]# netca

-bash: netca: command not found

如果没有弹出配置界面,或找不到netca命令。按如下操作进行。

[root@localhost bin]# su - oracle
[oracle@localhost ~]$ cd /home/oracle/app/oracle/product/11.2.0/dbhome_1/bin
[oracle@localhost bin]$ DISPLAY=192.168.0.107:0.0
[oracle@localhost bin]$ export DISPLAY
[oracle@localhost bin]$ export  LANG=en-US
[oracle@localhost bin]$ ./netca

























点击Change Login按钮,输入用户名和密码,测试连接是否成功。














配置监听及本地网络服务完成。


五、启动Oracle服务和监听器

启动Oracle服务服务

用su - oracle命令切换到Oracle用户,然后输入sqlplus "/as sysdba"连接上数据库,再输入命令startup。

[root@localhost ~]# su - oracle
[oracle@localhost ~]$ sqlplus "/as sysdba"
SQL> startup

停止Oracle服务服务

用su - oracle命令切换到Oracle用户,然后输入sqlplus "/as sysdba"连接上数据库,再输入命令shutdown immediate。

[root@localhost ~]# su - oracle
[oracle@localhost ~]$ sqlplus "/as sysdba"
SQL> shutdown immediate


检查Oracle DB监听器是否正常

用su - oracle命令切换到Oracle用户,然后输入命令lsnrctl status。

[oracle@localhost ~]$ lsnrctl status
启动监听器

用su - oracle命令切换到Oracle用户,然后输入命令lsnrctl start。

[oracle@localhost ~]$ lsnrctl start


新新:http://blog.csdn.net/xinxin19881112/article/details/46826969

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章