VM虚拟机下在LINUX上安装ORACLE 11G单实例数据库
1.环境及安装前规划:虚拟机及OS如下
环境:VMware Wordstation ACE版 6.0.2
操作系统:OracleLinux-R5-U8-Server-i386-dvd 3.2G
操作系统下载地址:http://mirrors.dotsrc.org/oracle-linux/
安装操作系统,这里需要注意的是磁盘空间要预留足够。
我的规划是:
虚拟机分配1024M内存,当然如果主机内存足够,安装时内存设置2048M可以更快。
虚拟机分配一块磁盘,30G磁盘空间。
/boot 100M ext3
/ 20G ext3
swap 2048M
剩余的近8G空间留着做ASM时用。
同时最好安装系统时选择图形模式安装,直接安装好图形模式,比较省事。
2.OS的配置:
操作系统安装好后,暂时需要配置以下内容
固定IP及DNS /etc/sysconfig/network-scripts/ifcfg-eth0
主机名 /etc/sysconfig/network
修改开机运行级别 /etc/inittab
关闭SELINUX /boot/grub/menu.lst
修改sshd_config,解决SSH超时自动断开问题
login as: root
root@192.168.1.212's password:
Last login: Wed Jun 5 09:11:26 2013
[root@oel-01 ~]# hostname
oel-01
[root@oel-01 ~]# cat/etc/sysconfig/network-scripts/ifcfg-eth0
# Advanced Micro Devices [AMD] 79c970[PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=none
HWADDR=00:0C:29:99:8B:C9
ONBOOT=yes
NETMASK=255.255.255.128
IPADDR=192.168.1.212
GATEWAY=192.168.1.254
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
[root@oel-01 ~]# cat /etc/resolv.conf
nameserver 222.88.88.88
[root@oel-01 ~]# cat /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=yes
HOSTNAME=oel-01
[root@oel-01 ~]# vi /etc/inittab
id:3:initdefault:
[root@oel-01 ~]# vi /boot/grub/menu.lst
在kernel 行末尾增加selinux=0关闭SELINUX。也可以在安装完系统时的图形配置界面中关闭。
[root@oel-01 ~]# cd /etc/ssh/
[root@oel-01 ssh]# grep"ClientAlive" sshd_config
#ClientAliveInterval 0
#ClientAliveCountMax 3
[root@oel-01 ssh]# cp sshd_configsshd_config.bak
[root@oel-01 ssh]# sed -i"s/#ClientAliveInterval 0/ClientAliveInterval 60/g" sshd_config
[root@oel-01 ssh]# grep"ClientAlive" sshd_config
ClientAliveInterval 60
#ClientAliveCountMax 3
[root@oel-01 ssh]# sed -i"s/#ClientAliveCountMax 3/ClientAliveCountMax 10/g" sshd_config
[root@oel-01 ssh]# grep"ClientAlive" sshd_config
ClientAliveInterval 60
ClientAliveCountMax 10
[root@oel-01 ssh]# service sshd restart
Stopping sshd: [ OK ]
Starting sshd: [ OK ]
到此应该将系统重启,验证以上各项配置是否生效。如生效,关机,在VMWARE中做快照
3.创建安装ORACLE的用户组
[root@oel-01 ~]# groupadd -g 1000 oinstall
[root@oel-01 ~]# groupadd -g 1031 dba
[root@oel-01 ~]# groupadd -g 1032 oper
[root@oel-01 ~]# useradd oracle
[root@oel-01 ~]# passwd oracle
Changing password for user oracle.
New UNIX password:
BAD PASSWORD: it is based on a dictionaryword
Retype new UNIX password:
passwd: all authentication tokens updatedsuccessfully.
[root@oel-01 ~]# usermod -g oinstall -Gdba,oper oracle
[root@oel-01 ~]# mkdir -p/u01/app/oracle/product/11.2.0/dbhome_1
[root@oel-01 ~]# chown -R oracle:oinstall/u01/
[root@oel-01 ~]# chmod 775 /u01/
[root@oel-01 app]# pwd
/u01/app
[root@oel-01 app]# ls -al
total 16
drwxrwxr-x 4 oracle oinstall 4096 Jun 5 10:56 .
drwxrwxr-x 3 oracle oinstall 4096 Jun 5 10:55 ..
drwxrwxr-x 2 oracle oinstall 4096 Jun 5 10:55 oracle
4.挂载光盘,安装软件
[root@oel-01 ~]# cd /etc/yum.repos.d/
[root@oel-01 yum.repos.d]# ls
[root@oel-01 yum.repos.d]# viOEL_CDROM.repo
[root@oel-01 yum.repos.d]# catOEL_CDROM.repo
[OEL5.8]
name=oracle linux
baseurl=file:///mnt/cdrom/Server
enabled=1
gpgcheck=0
[root@oel-01 yum.repos.d]# cd /mnt/
[root@oel-01 mnt]# mkdir cdrom
[root@oel-01 mnt]# mount /dev/cdrom/mnt/cdrom
mount: block device /dev/cdrom iswrite-protected, mounting read-only
[root@oel-01 mnt]# ls
cdrom
[root@oel-01 mnt]# cd cdrom/
[root@oel-01 cdrom]# ls
blafdoc.css eula.py README-en.html Server
Cluster GPL RELEASE-NOTES-en supportinfo
ClusterStorage images RELEASE-NOTES-en.html TRANS.TBL
EULA isolinux RPM-GPG-KEY VT
eula.en_US README-en RPM-GPG-KEY-oracle
[[root@oel-01 Server]# pwd
/mnt/cdrom/Server
[root@oel-01 Server]# ls /etc/pki/rpm-gpg/
RPM-GPG-KEY RPM-GPG-KEY-fedora RPM-GPG-KEY-oracle
RPM-GPG-KEY-EL4 RPM-GPG-KEY-fedora-test
[root@oel-01 Server]# rpm --import/etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
开始安装软件
方法一:
[root@oel-01 Server]# yum -y installoracleasm-support-2.1.7-1.el5.i386.rpm
[root@oel-01 Server]# yum -y installreadline-devel-5.1-3.el5.i386.rpm
[root@oel-01 Server]# yum -y installunixODBC
[root@oel-01 Server]# yum -y install make* gcc* glibc* compat-db* compat-gcc*compat-gcc* compat-libstdc++* compat-libstdc* openmotif* setarch*
[root@oel-01 Server]# yum -y installelfutils-libelf-devel-* libaio-devel-0.3.106-5.i386.rpm sysstat-7.0.2-11.el5.i386.rpm unixODBC-devel-2.2.11-10.el5.i386.rpm
安装rlwrap-0.37.tar.gz,这里我也是上传上去的,这个软件可以在网上自己找。
[root@oel-01 ~]# ls
anaconda-ks.cfg install.log rlwrap-0.37
Desktop install.log.syslog rlwrap-0.37.tar.gz
[root@oel-01 ~]# tar -zxvfrlwrap-0.37.tar.gz
[root@oel-01 rlwrap-0.37]# pwd
/root/rlwrap-0.37
[root@oel-01 rlwrap-0.37]# ./configure
[root@oel-01 rlwrap-0.37]# make
[root@oel-01 rlwrap-0.37]# make install
方法二:批量安装
挂载光盘后
[root@oel-01 mnt]#mkdir cdrom
[root@oel-01 mnt]# mount /dev/cdrom/mnt/cdrom/
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@oel-01 mnt]# cd /etc/yum.repos.d/
[root@oel-01 yum.repos.d]# vi public-yum-el5.repo
[oel5]
name = Enterprise Linux 5.7 DVD
baseurl=file:///mnt/cdrom/Server/
gpgcheck=0
enabled=1
[root@oel-01 yum.repos.d]# yum installoracle-validated
如果是OEL5: yum install oracle-validated
如果是OEL6: yum install oracle-rdbms-server-11gR2-preinstall
5.修改LINUX中的环境变量
修改oracle的.bash_profile,示例如下:oracle_sid之类要提前规划好。
[root@oel-01 oracle]# pwd
/home/oracle
[root@oel-01 oracle]# cat .bash_profile
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
PATH=$PATH:$HOME/bin
#after is add by admin.
#
ORACLE_SID=bys001
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
PATH=$ORACLE_HOME/bin:$PATH:/user/sbin
export ORACLE_BASE ORACLE_SID ORACLE_HOMEPATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib:/usr/X11R6/lib/
exportCLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
使用ORACLE用户验证下
[oracle@oel-01 ~]$ source .bash_profile
[oracle@oel-01 ~]$ sqlplus
rlwrap: Cannot execute sqlplus: No suchfile or directory
[oracle@oel-01 ~]$ rman
rlwrap: Cannot execute rman: No such fileor directory
说明:其它的内核参数等可以不修改,在安装时检查系统环境时可以使用ORACLE给出的脚本进行修改,我这里就用的这种方法。
6.把ORACLE DATABASE软件上传并解压
我这里使用的是SSH Secure Shell.这个软件里的传文件功能
注意要用ORACLE用户上传并解压文件,避免文件权限问题。
[oracle@oel-01 u01]$ ls
app linux_11gR2_database_2of2.zip
linux_11gR2_database_1of2.zip
[oracle@oel-01 u01]$ du -sh /u01/linux*
1.2G /u01/linux_11gR2_database_1of2.zip
951M /u01/linux_11gR2_database_2of2.zip
[oracle@oel-01 u01]$ unziplinux_11gR2_database_1of2.zip
[oracle@oel-01 u01]$ unziplinux_11gR2_database_2of2.zip
解压后删除原压缩文件节省磁盘空间
[oracle@oel-01 u01]$ du -sh database/
2.3G database/
[oracle@oel-01 u01]$ rm -rf linux_11gR2_*
[oracle@oel-01 u01]$ ls
app database
[oracle@oel-01 u01]$
到此,关机,做一次快照。安装前准备工作完成。
7.使用OUI图形界面安装
[root@oel-01 ~]# init 5
ORACLE软件的安装
去图形界面,使用oracle用户登陆,然后在桌面右键菜单中,打开一个命令行终端窗口
[oracle@oel-01 ~]$ cd /u01/database/
[oracle@oel-01 database]$ ls
doc install response rpm runInstaller sshsetup stage welcome.html
[oracle@oel-01 database]$ ./runInstaller
安装时的注意事项:
在安装时过程中,要查看ORACLE_BASE/HOME等是否正确。
在安装到检查安装环境时,会出现一些内核参数调整、缺少包(如果缺少包,按我这个说明上的环境及软件如果都安装的话是不会缺少包的)等提示。
根据提示框中 Fixable下有YES参数的,都是ORACLE可以自动修复的。
选择上方的FIX&CHECK AGAIN。
这时打开一个终端,注意要使用root用户.根据对话框提示,打开一个终端输入下面:
[root@oel-01 ~]# sh/tmp/CVU_11.2.0.1.0_oracle/runfixup.sh
Response file being used is :/tmp/CVU_11.2.0.1.0_oracle/fixup.response
Enable file being used is:/tmp/CVU_11.2.0.1.0_oracle/fixup.enable
Log file location:/tmp/CVU_11.2.0.1.0_oracle/orarun.log
Setting Kernel Parameters...
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
uid=501(oracle) gid=1000(oinstall)groups=1000(oinstall),1031(dba),1021(asmdba)
[root@oel-01 ~]#
再点击对话框中OK选项。
此时重新检查,发现这些参数都自动修复了。
如果有未安装的包再进行安装并重新检查环境。
此时再进行检查,发现就SWAP SIZE未通过,这个可以直接选择IGNORE-ALL。
然后在下一步时检查一下配置是否正确,然后点击下一步进行安装。
#######################################################
安装到启动NETCA时会出错,不能启动,需要打一个补丁
其实我的打了补丁还是不行,安装完成后手动修改了下LISTNER.ORA文件
[INS-20802] Oracle Net ConfigurationAssistant failed
Cause-The plug-in failed in its performmethod
解决方案:
需打名为p8670579_112010_LINUX.zip的补丁。
出现此错误时,先不要关闭安装程序:
使用oracle用户上传和解压文件以及操作
unzip p8670579_112010_LINUX.zip
cd 8670579
/u01/app/oracle/product/11.2.0/dbhome_1/OPatch/opatchapply -invPtrLoc /u01/app/oracle/product/11.2.0/dbhome_1/oraInst.loc
其中/apps/oracle/product/11.2.0/db_1/为ORACLE_HOME,可使用$ORACLE_HOME代替
补丁打好后,点击安装程序的retry,继续安装即可。
查看系统中安装的补丁
[oracle@orasrv 8670579]$/u01/app/oracle/OPatch/opatch lsinventory
#########################################################
安装完成后根据提示运行以下两个脚本。
[root@oel-01 Server]# sh/u01/app/oraInventory/orainstRoot.sh
Changing permissions of/u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions forworld.
Changing groupname of /u01/app/oraInventoryto oinstall.
The execution of the script is complete.
[root@oel-01 Server]# sh/u01/app/oracle/product/11.2.0/dbhome_1/root.sh
Running Oracle 11g root.sh script...
The following environment variables are setas:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/11.2.0/dbhome_1
Enter the full pathname of the local bindirectory: [/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/oratabfile as needed by
Database Configuration Assistant when adatabase is created
Finished running generic part of root.shscript.
Now product-specific root actions will beperformed.
Finished product-specific root actions.
8.安装完成后续工作
端口
[root@oel-01 ~]# iptables-I INPUT 1 -p tcp --dport 1521 -j ACCEPT
[root@oel-01 ~]# /etc/rc.d/init.d/iptablessave
Saving firewall rules to/etc/sysconfig/iptables: [ OK ]
[root@oel-01 ~]# services iptables restart
-bash: services: command not found
[root@oel-01 ~]# service iptablesrestart
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT:filter [ OK ]
Unloading iptables modules: [ OK ]
Applying iptables firewall rules: [ OK ]
Loading additional iptables modules: ip_conntrack_netbios_ns
2.配置LISTENER---如安装过程中已经正常配置完成可以不做。
安装完成后,启动LISTENER
[oracle@oel-01 admin]$ lsnrctl start
输出的最后两句:
The listener supports no services
The command completed successfully
这样启动后远程连接会报错:
oracle ORA-12514:TNS:listener does notcurrently know of service requested in connect descriptor
原因:数据库实例没注册到listener
在listener.ora里面添加了如下内容:--配置为静态监听。
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(SID_NAME = orcl)
)
)
注:里面的orcl根据你安装的数据库实例名确定,我用此法解决了这个报错。
解决方法二:这个网上看的,我自己没使用,使用第一种就解决了。
这种应该是解决非动态注册问题的,要手动注册实例到listener
登录数据库:
$sqlplus / as sysdba
显示服务名:
SQL>show parameter service_names
强制注册服务:
SQL>alter system register;
查看监听状态:
$lsnrctl status
9.配置数据库开机自启动
安装好Oracle数据库后:执行 dbstart和dbshut会提示:
[oracle@oracle11g ~]$ dbstart
ORACLE_HOME_LISTNER is not SET, unable toauto-start Oracle Net Listener
Usage:/u01/app/oracle/oracle/product/10.2.0/db_1/bin/dbstart ORACLE_HOME
错误原因是:dbstart和dbshut脚本文件中ORACLE_HOME_LISTNER的设置有问题,
分别打开两个文件找到:ORACLE_HOME_LISTNER=$1,(在文件开头,比较好找)修改为
ORACLE_HOME_LISTNER=$ORACLE_HOME
修改后保存退出,问题已解决;
测试:
1.SQLPLUS能否启动,如不能,检查.bash_profile中环境变量 ORACLE_HOME PATH等,按我的方法做就可以。
2.使用SQLPLUS登陆测试
sqlplus / as sysdba
需要解锁SCOTT用户,并配置/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
[oracle@oel-01 admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File:/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
BYS001 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.212)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = bys001)
)
)
sqlplus scott/tiger@bys001
sqlplusscott/tiger@192.168.1.212:1521/bys001
3.正常情况下数据库实例未启动,此时用SYS登陆,启动数据库,看数据库能否启动
4.实现开机ORACLE自动启动监听和实例
第一步:修改/etc/oratab文件,命令如下:
格式如下:
--------------------------------------------------------------------------------
SID:ORACLE_HOME:AUTO
--------------------------------------------------------------------------------
[oracle@oracle11g ~]$ vi /etc/oratab
添加或修改成(默认好像是N)这一句:
bys001:/u01/app/oracle/product/11.2.0/dbhome_1/:Y
[root@oel-01 ~]# cat /etc/oratab
bys001:/u01/app/oracle/product/11.2.0/dbhome_1:Y
第二步:把lsnrctl start和dbstart添加到rc.local文件中,命令如下:
[oracle@oracle11g ~]$ vi /etc/rc.d/rc.local
添加如下内容:
su oracle -lc"/u01/app/oracle/product/11.2.0/dbhome_1/bin/lsnrctl start"
su oracle -lc"/u01/app/oracle/product/11.2.0/dbhome_1/bin/dbstart"
[root@oel-01 ~]# cat /etc/rc.d/rc.local
#!/bin/sh
#
# This script will be executed *after* allthe other init scripts.
# You can put your own initialization stuffin here if you don't
# want to do the full Sys V style initstuff.
touch /var/lock/subsys/local
su oracle -lc"/u01/app/oracle/product/11.2.0/dbhome_1/bin/lsnrctl start"
su oracle -lc "/u01/app/oracle/product/11.2.0/dbhome_1/bin/dbstart"
第三步,重启后直接用SQLPLUS登陆测试数据库是否已经打开哈哈。
VM虚拟机下在LINUX上安装ORACLE 11G单实例数据库的更多相关文章
- 在 Oracle Linux 6.5 上安装 Oracle 11g 单实例数据库
Checking the Hardware Requirements 系统必须满足下面最小的硬件要求 Memory Requirements Minimum: 1 GB of RAMRecommend ...
- 转://Window下安装Oracle ASM单实例数据库
之前做的Oracle ASM实验都是基于Linux或者Unix操作系统的,最近想试试如何在Windows环境下使用Oracle ASM.本文介绍如何在windows下创建裸设备,并创建ASM磁盘组以及 ...
- linux上安装Oracle 11g R2 标准版 64位
一.Oracle 安装前的准备 检查一下包,必须全部安装: binutils-2.20.51.0.2-5.43.el6.x86_64 compat-libstdc++-296-2.96-144.el6 ...
- 数据库系统入门 | Oracle Linux上部署Oracle 11g服务,并实现SSH远程登录管理
文章目录 写在前面 一.实验内容 二.实验前期准备 1.软件目录 2.准备一些配置文件.脚本文件 三.实验方案(具体步骤) (一)在虚拟机上安装Oracle Linux (二)在Linux上安装Ora ...
- [转载]linux上安装oracle
原文地址:linux上安装oracle作者:天涯恨客 1.创建oinstall组 [root@xieqing ~]# groupadd oinstall 创建dba组 [root@xieqing ~] ...
- linux上安装oracle
Linux上安装Oracle 10g: http://69520.blog.51cto.com/59520/91156
- Red Hat Enterprise Linux 6上安装Oracle 11G(11.2.0.4.0)缺少pdksh包的问题
RHEL 6上安装Oracle 11G警告缺少pdksh包 前言 相信很多刚刚接触学习Oracle的人,在RHEL6上安装11.2.0.3 or 11.2.0.4这两个版本的时候, 都遇到过先决条件检 ...
- CentOS Linux 系统 安装oracle 11g
CentOS Linux 系统 安装oracle 11g 在Linux系统上安装oracle是比较麻烦,需要配置各种变量啥的,o(︶︿︶)o ,但是没办法,有些东西你总的去接触,而且接触理解的越早越深 ...
- Linux平台oracle 11g单实例 + ASM存储 安装部署 快速参考
操作环境:Citrix虚拟化环境中申请一个Linux6.4主机(模板)目标:创建单机11g + ASM存储 数据库 1. 主机准备 2. 创建ORACLE 用户和组成员 3. 创建以下目录并赋予对应权 ...
随机推荐
- 读懂IL代码(三)
由于要写毕业论文的缘故,最近比较没有时间写,总是要抽出时间抽出时间.诶,这样的生活比较烦躁. 这一篇主要写委托.类.方法的IL代码,一一来说明. 委托:搞过C#的都应该清楚,委托实际上是一个类.编译器 ...
- Open judge 07和为给定数
总时间限制: 1000ms 内存限制: 65536kB 传送门 类似的题传送门 描述 给出若干个整数,询问其中是否有一对数的和等于给定的数. 输入 共三行: 第一行是整数n(0 < n < ...
- 安装sql server 2008,提示要删除SQL Server 2005 Express 工具 怎么解决?
x86 修改注册表:HKLM\Software\Microsoft\Microsoft SQL Server\90\Tools\ShellSEM,把 ShellSEM重命名即可. x64 ...
- demo_03HTML5中的动画效果
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- [jQuery编程挑战]008 生成逗号分隔数字
<!DOCTYPE html> <html lang="zh"> <head> <meta charset="utf-8&quo ...
- directUI
MFC界面开发中,习惯了使用控件,亦或者是自绘制控件来美化界面,但操作起来繁琐,还不太美观.DirectUI的出现,对于界面开发,给了我们一个新的选择,目前很多公司使用了该技术对其产品进行了美化,效果 ...
- Python定义常量
用Python实现常量 定义 # coding=utf-8 # const.py class ConstAssignError(Exception): pass class _const(object ...
- Python 学习笔记(3) - 控制流、函数
控制流语句if.while.for.break.continue以上从最终作用效果来讲,同学过的其他语言没有什么不同.需要注意的只是语法,而Python 在语法上是如此让人赞叹和喜欢啊. 控制流语句的 ...
- 很少有人知道的c++中的try块函数
c++有一些在现实世界中很少看到的结构.这些结构有着自己的用法,但是要特别小心保守的予以运用.就像是网站 The Old New Thing首页标题上面的说的那样: “代码通常被读的次数原因超过了被写 ...
- classpath目录
WEB-INF/ 是资源目录, 客户端不能直接访问, 这话是没错,不过现在的IDE编译器在编译时会把src下的文件(是文件,不是.java)移到WEB-INF/classes下.不过值得注意的是,sp ...