Oracle Linux 6.5 安装Oracle 11G 配置安装环境准备
vi /etc/selinux/config-------永久关闭selinux
SELINUX=disabled--------然后重启服务器
setenforce 0 命令设置临时关闭
iptables -F 临时关闭防火墙
chkconfig iptables off 重启永久关闭防火墙
0-. 开始安装基础包(放入光盘、或挂载ISO文件)
mount /dev/cdrom /mnt
cd /mnt/cdrom/Server/Packages
rpm -Uvh binutils-2*x86_64*
rpm -Uvh glibc-2*x86_64* nss-softokn-freebl-3*x86_64*
rpm -Uvh glibc-2*i686* nss-softokn-freebl-3*i686*
rpm -Uvh compat-libstdc++-33*x86_64*
rpm -Uvh glibc-common-2*x86_64*
rpm -Uvh glibc-devel-2*x86_64*
rpm -Uvh glibc-devel-2*i686*
rpm -Uvh glibc-headers-2*x86_64*
rpm -Uvh elfutils-libelf-0*x86_64*
rpm -Uvh elfutils-libelf-devel-0*x86_64*
rpm -Uvh gcc-4*x86_64*
rpm -Uvh gcc-c++-4*x86_64*
rpm -Uvh ksh-*x86_64*
rpm -Uvh libaio-0*x86_64*
rpm -Uvh libaio-devel-0*x86_64*
rpm -Uvh libaio-0*i686*
rpm -Uvh libaio-devel-0*i686*
rpm -Uvh libgcc-4*x86_64*
rpm -Uvh libgcc-4*i686*
rpm -Uvh libstdc++-4*x86_64*
rpm -Uvh libstdc++-4*i686*
rpm -Uvh libstdc++-devel-4*x86_64*
rpm -Uvh make-3.81*x86_64*
rpm -Uvh numactl-devel-2*x86_64*
rpm -Uvh sysstat-9*x86_64*
rpm -Uvh compat-libstdc++-33*i686*
rpm -Uvh compat-libcap*
(1) 确认安装以下包
# rpm -q binutils compat-libstdc++-33 compat-gcc-34-c++ elfutils-libelf
elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel
glibc-headers kernel-headers ksh libaio libaio-devel libgcc libgomp
libstdc++ libstdc++-devel make sysstat numactl-devel unixODBC
unixODBC-devel openmotif22 openmotif compat-db libXp
binutils-2.20.51.0.2-5.36.el6.x86_64
compat-libstdc++-33-3.2.3-69.el6.x86_64
compat-libstdc++-33-3.2.3-69.el6.i686
package compat-gcc-34-c++ is not installed
elfutils-libelf-0.152-1.el6.x86_64
elfutils-libelf-devel-0.152-1.el6.x86_64
gcc-4.4.7-4.el6.x86_64
gcc-c++-4.4.7-4.el6.x86_64
glibc-2.12-1.132.el6.x86_64
glibc-2.12-1.132.el6.i686
glibc-common-2.12-1.132.el6.x86_64
glibc-devel-2.12-1.132.el6.x86_64
glibc-devel-2.12-1.132.el6.i686
glibc-headers-2.12-1.132.el6.x86_64
kernel-headers-2.6.32-431.el6.x86_64
ksh-20120801-10.el6.x86_64
libaio-0.3.107-10.el6.x86_64
libaio-0.3.107-10.el6.i686
libaio-devel-0.3.107-10.el6.x86_64
libaio-devel-0.3.107-10.el6.i686
libgcc-4.4.7-4.el6.x86_64
libgcc-4.4.7-4.el6.i686
libgomp-4.4.7-4.el6.x86_64
libstdc++-4.4.7-4.el6.x86_64
libstdc++-4.4.7-4.el6.i686
libstdc++-devel-4.4.7-4.el6.x86_64
make-3.81-20.el6.x86_64
sysstat-9.0.4-22.el6.x86_64
numactl-devel-2.0.7-8.el6.x86_64
package unixODBC is not installed
package unixODBC-devel is not installed
package openmotif22 is not installed
package openmotif is not installed
package compat-db is not installed
package libXp is not installed
(2) 安装相关包
# rpm -ivh compat-db-4.6.21-15.el6.x86_64.rpm compat-db42-4.2.52-15.el6.x86_64.rpm compat-db43-4.3.29-15.el6.x86_64.rpm
# rpm -ivh compat-gcc-34-c++-3.4.6-19.el6.x86_64.rpm compat-gcc-34-3.4.6-19.el6.x86_64.rpm
# rpm -ivh unixODBC-2.2.14-12.el6_3.x86_64.rpm unixODBC-devel-2.2.14-12.el6_3.x86_64.rpm
# rpm -ivh openmotif-2.3.3-6.1.el6_4.x86_64.rpm openmotif22-2.2.3-19.el6.x86_64.rpm libXp-1.0.0-15.1.el6.x86_64.rpm
(3) 替换sqlplus工具
# tar zxvf rlwrap-0.37.tar.gz
# cd rlwrap-0.36
# ./configure
# make
# make check
# make install
0-1. 创建oracle安装相关用户组及用户帐号
1)创建oinstall,dba组和oracle用户(用root身份)
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
passwd oracle
2)创建Oralce HOME目录
mkdir -p /u01/app/oracle/product/11.2.0/db_1
chmod -R 775 /u01/app
chown -R oracle:oinstall /u01
1. 修改内核支持
# vi /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
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 = 1048586
加载后报错 sysctl -p-----解决方法
error: "net.bridge.bridge-nf-call-ip6tables" is an unknown key
error: "net.bridge.bridge-nf-call-iptables" is an unknown key
error: "net.bridge.bridge-nf-call-arptables" is an unknown key
3个参数依赖于bridge模块,该模块如果没有加载则会现上面的输出错误 ------参数不明白……
加载模块即可解决
modprobe bridge
lsmod|grep bridge
在重新加载 sysctl -p
2. 修改文件描述符
cat >> /etc/security/limits.conf << EOF
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
EOF
3. 修改登陆认证模块
cat >> /etc/pam.d/login << EOF
session required /lib64/security/pam_limits.so
EOF
4. 修改本地hosts文件
# vi /etc/hosts
192.168.31.19 hostname
5. 修改Oracle用户环境变量
(1) 配置系统环境变量,加入到最后。
cat >> /etc/profile << EOF
if [ \$USER = "oracle" ]; then
if [ \$SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
EOF
(2) 配置oracle环境变量
# su - oracle
cat >> /home/oracle/.bash_profile << EOF
export EDITOR=vi
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=orcl
export PATH=\$ORACLE_HOME/bin:\$PATH
export NLS_LANG="AMERICAN_AMERICA.ZHS16GBK"
export LANG=en_US
export LC_ALL=en_US
export LD_LIBRARY_PATH=/lib:/usr/lib:\$ORACLE_HOME/lib
export CLASSPATH=\$ORACLE_HOME/JRE:\$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
alias sqlplus="rlwrap sqlplus"
alias rman="rlwrap rman"
umask 022
EOF
重新加载 source .bash_profile
6.解压数据库
cd /tool
unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip
chmod -R 777 /tool/database
7.安装Oracle 11G数据库--------重启服务器 init6 或者 reboot
以oracle用户登陆 密码:HanZheng.123
cd /tool/database
./runInstaller
去掉I wish to receive security updates via My Oracle Surrport选项,点击Next。
选择Install database software only,点击Next。
选择Single instance database installation,点击Next。
在Available Languages中点选English、Simplified Chinese、Traditional Chinese,点击两个框中间的>,
将选中的语言加入到右边的Selected Languages中,然后点击Next。
按照实际情况,选择企业版本,如下图
填写Oracle的软件路径和基本路径,如下图:
选择安装日志目录,如下图所示:
选择dba组
继续下一步安装操作
可以忽略,因为CentOS版本较高,所以11g check的时候不识别高版本lib包
继续安装
安装中,这个时间比较漫长
需要等待中,大概20分钟左右
点击OK,继续
然后点击close,结束
最后要在root执行以下两条脚本
# /u01/app/oraInventory/orainstRoot.sh
# /u01/app/oracle/product/11.2.0/db_1/root.sh
8. 创建数据库
$ dbca
# 选择gernel purpose,在SID和全局名称中,选择你在.bash_profile中创建的SID.
# 数据库的字符集选项中选择ZHS16GBK, 其它默认OK,完成.
Database Configuration Assistant图形界面启动。标题同时指明了步骤的编号和步骤的名称。在步骤名称为Welcome的
欢迎窗口,直接点击next。
等待下一步NEXT
选择Custom Database
,Global Database Name框:输入前面确定的数据库名SID框:自动出现和数据库名相同的内容作为数据库实例名,
单实例情况下不作改动
继续默认
Database Credentials
Use Different Administrative Passwords表格的Password和Confirm Password列中分别为User Name列
SYS、SYSTEM、DBSNMP和SYSMAN用户输入口令并重复一次输入(如密码设置过于简单,下一步前会有
弹出窗口提示确认接受安全风险)sys和system密码设置可以在数据库建立后修改。
密码为HanZheng.123
Database File LocationsStorage Locations:选择Use Common Location for All Database FilesDatabase File Location
框:输入/Oracle/data_ora
Recovery ConfigurationSpecify Fast Recovery Area如果前面Management Options步骤选择了自动备份,
则保留勾选,并在下方:Fast Recovery Area框:修改为快速恢复区的目录名Fast Recovery Area Size框:
调整快速恢复区的大小
Enable Archiving根据是否归档日志的实际需求决定是否选择(重要的生产系统必须打开归档,测试系统一般关闭归
档节省服务器空间)点击旁边的Edit Archive Mode Parameters…,在弹出窗口中:Automatic Archiving:保持默认
勾选Archive Log File Format框:修改为%t_%s_%r.arcArchive Log Destinations表格:第一行中输入
/Oracle/data_ora/archive点击OK返回主窗口Database ContentDatabase Components页面
Initialization Parameters,内存分配20%(测试库所以分小一些,生产库可以分配较大的比如40%60%等),
字符集选择兼容utf8的选项
点击File Location Variables,里面可以看到一些基础参数信息,返回,然后直接下一步,如下图所示:
选择Generate Database Creation Scripts,默认为 /oracle/app/oracle/admin/powerdes/scripts,如下图:
点击Finish按钮,如下图所示:
点击OK按钮,有报错说/etc/oratab读取错误,报错如下图所示
所以去建立下这个目录
[root@powerlong4 rpms]# mkdir /etc/oratab
[root@powerlong4 rpms]# chown -R Oracle.oinstall /etc/oratab
之后点击OK按钮,开始创建数据库,如下图所示:
等待35分钟后,数据库创建完毕,之后点击,如下所示:
创建监听服务
su - oracle
$ netca # 参数一律默认即可
$ ps -ef |grep ora_
启动Oracle数据库----------------sqlplus登录到数据库
[oracle@hostname ]$ sqlplus / as sysdba 登陆oracle
SQL> startup //起动数据库
起动监听服务
[oracle@hostname ]$ cd $ORACLE_HOME/bin //进入oracle安装目录
[oracle@hostname bin]$ lsnrctl start //起动监听
9,验证数据库
[oracle@powerlong4 ~]$ sqlplus "/ as sysdba"
SQL*Plus: Release 11.2.0.1.0 Production on Sat Jan 24 14:51:10 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> create table z_test(id number,name varchar(20));
Table created.
SQL> insert into z_test select 1,'a' from dual;
1 row created.
SQL> select * from z_test;
ID NAME
---------- ----------------------------------------
1 a
SQL> commit;
Commit complete.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options