RedHat Linux6.0安装Oracle 11g单机
 
Ø 第一步配置YUM仓库
1、 挂载光盘
mount /dev/cdrom /media
2、 复制光盘里头的rpm包到rpm包源目录
cp –rf  /media/Packages  /mnt (也可以直接通过桌面COPY)
(这里可以取消挂在了 umount /dev/cdrom,顺便删除media目录 rm –rf /media)
 
3、 进入你自己创建的YUM仓库,并安装createrepo工具
cd /mnt/Packages
rpm –ivh createrepo-0.4.11-3.e15.noarch.rpm(可以在桌面手动双击安装)
4、 重建仓库信息配置文件
createrepo  /mnt  (这个配置文件在 /mnt/repodata/下)
 
5、 创建YUM配置文件
cd  /etc/yum.repos.d/
touch yumredhat.repo
vim yumredhat.repo
添加如下信息:
[rhel6]
name=Red Hat Enterprise Linux6
baseurl=file:///mnt
enabled=1
gpgcheck=0
gpgfile=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
 
6、测试
yum list
yum clear all
 
Ø 第二步Oracle安装前系统参数的配置以及包的安装
 
(安装Oracle必须关闭掉防火墙以及selinux)
service iptables stop      
vim /etc/selinux/config
SELINUX=disabled
 
========================
想办法把下面2个文件传进 Linux 操作系统里面去
linux_11gR2_database_1of2.zip
linux_11gR2_database_2of2.zip
要借助一个软件 FileZilla_3.3.3_win32-setup.exe  
上传完毕后, 使用 unzip 命令解压刚才上传的2个文件, 命令格式如下:
unzip 文件名
 
======================================
检查相关的开发工具和一些包
检查命令格式如下:
rpm -qa | grep 名字
 
binutils-2.17.50.0.6
compat-libstdc++-33-3.2.3
elfutils-libelf-0.125
elfutils-libelf-devel-0.125	
#elfutils-libelf-devel-static-0.125 (RedHat Linux6.0中无此包,CentOS中有)
gcc-4.1.2
gcc-c++-4.1.2	
glibc-2.5-24
glibc-common-2.5	
glibc-devel-2.5
glibc-headers-2.5
kernel-headers-2.6.18
ksh-20060214	
libaio-0.3.106 
libaio-devel-0.3.106
libgcc-4.1.2
libgomp-4.1.2
libstdc++-4.1.2
libstdc++-devel-4.1.2	
make-3.81	 
numactl-devel-0.9.8.i386	 
sysstat-7.0.2
unixODBC-2.2.11 
unixODBC-devel-2.2.11
======================================
利用配置好的YUM仓库安装包
yum install (包名).rpm
创建用户以及修改配置参数
groupadd oinstall
groupadd dba
mkdir -p /u01/oracle     //路径可修改,看实际的生产环节
 
添加一个oracle用户, 根目录是 /u01/oracle, 主的组是 oinstall 副的组是dba
useradd -g oinstall -G dba -d /u01/oracle oracle
cp /etc/skel/.bash_profile /u01/oracle
cp /etc/skel/.bashrc /u01/oracle
cp /etc/skel/.bash_logout /u01/oracle
 
为oracle用户设置密码 123456   /111111
passwd oracle
/]#ls -l
/]#chown -R oracle:oinstall u01
/]#ls -l
 
检查 nobody 是否存在 ,  id nobody
缺省存在的。如果不存在 # /usr/sbin/useradd -g nobody
========================================
vi /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
-------------
vi /etc/security/limits.conf
 
oracle           soft    nproc   2047
oracle           hard    nproc   16384
oracle           soft    nofile  1024
oracle           hard    nofile  65536
------------
vi /etc/pam.d/login 
session    required     pam_limits.so
=================================================
设置oracle 用户环境变量
su - oracle
pwd
ls -la
---------------
vi .bash_profile
 
ORACLE_BASE=/u01
ORACLE_HOME=$ORACLE_BASE/oracle
ORACLE_SID=ORCLTEST
PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin
 
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH
===================================
mv database /u01/
cd /u01
ls -l
 chown -R oracle:oinstall database/
===========
 
Ø 第三步正式开始安装.Oracle.11g.r2(图形界面安装)
 
使用oracle账号 登陆图形界面 进行安装
运行终端 Terminal
cd /u01/database
./runInstaller
运行./runInstaller【INS-06101】IP address of localhost could not be determined 
Are you sure you want to continue?
这里需要指定一个IP与localhost
Vi /etc/hosts
#127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
10.110.12.132 ORCLDEV  ORCLDEV.ELLINGTON
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
 
运行./runInstaller出现中文汉字为方框
在运行runinstaller之前,
export LANG=C
export LC_ALL=C
 
Installation Optiong
	install database software only
 
Grid Options
	Single instance database installation
 
Product Languages
	English
 
Database Edition
	Enterprise Edition (3.95)
 
Installation Location
	Oracle Base: /u01
	Software Loacation: /u01/oracle
 
		提示: yes
 
Create Inventory
	mkdir /oraInventory
 
	chown -R oracle:oinstall oraInventory
 
Operating System Groups
	Next 
 
Prerequis ite Checks
	Ignore All
 
Summary
	Finish
 
Install Product
	安装完毕, 提示执行 2个脚本
//root用户执行
	/oraInventory/orainstRoot.sh
	/u01/oracle/root.sh
		直接按回车, 缺省值就可以
 
Finish
	The installation of Oracle Database was successful
====================================
上面只是安装了软件, 数据库没有创建, 还有配置 监听器 Listener
netca
	一直默认下一步 , 呵呵, 最后 Finish
 
ps -ef 可以查看Listener是否配置成功
 
-----------
dbca
	一直 Next,	Global Database Name 和 SID 都是输入 wilson
 
	选择 User the Same.....All Accounts
 
		密码: 123456
	选择 Sample Schemas
 
	Memory 内存分配,默认就可以了
	Character Sets 选择 中文GBK  Use Unicode(AL32UTF8)
 
	然后一直 Next , 到最后 Finish
 
弹出一个 Confirmation , 点击 OK 就可以了, 然后自动进行安装
 
安装到目录 /u01/oradata/wilson
	   /u01/等等。。。 会发现多了很多文件。
 
[oracle@localhost ~]$ sqlplus /nolog
 
//中文字符显示?号解决方法
编辑并运行.bash_profile
 
export NLS_LANG=AMERICAN_AMERICA.UTF8
(如果是GBK     
export NLS_LANG=american_america.ZHS16GBK)
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
注销后生效
这样再重新进入sqlplus
已经不会是乱码。
 
SQL*Plus: Release 11.2.0.1.0 Production on Fri Jun 25 15:05:54 2010
 
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
 
SQL> conn / as sysdba
Connected to an idle instance.
出现错误 
 
SQL> startup
 
查看当前用户的表名
SQL> select table_name from user_tables;
 
SQL> create table testUser( id integer,name char(10));
 
Table created.
 
SQL> insert into testUser values(0,'Jack');
 
1 row created.
 
SQL> commit;
 
Commit complete.
 
SQL> select * from testUser;
 
        ID NAME
---------- ----------
         0 Jack
 
关闭数据库
SQL>  shutdown immediate
 
SQL>  quit