Oracle 11g安装记录(详细)
安装环境:CentOS 6 64位:CentOS-6.9-x86_64-bin-DVD1
Oracle 11g:p13390677_112040_Linux-x86-64_1of7
p13390677_112040_Linux-x86-64_2of7
pdksh-5.2.14-30.x86_64
-
关闭防火墙、关闭linux增强
关闭防火墙的方法为:
a)永久性生效
开启:chkconfig iptables on
关闭:chkconfig iptables off
b)即时生效,重启后失效
开启:service iptables start
关闭:service iptables stop
c)防火墙还需要关闭ipv6的防火墙:
chkconfig ip6tables off
并且可以通过如下命令查看状态:chkconfig --list iptables
d)关闭Linux增强
永久有效
修改 /etc/selinux/config 文件中的 SELINUX="" 为 disabled ,然后重启。
即时生效:setenforce 0 -
创建安装文件夹 /home/allen/Software/db
-
软件包检查
[[email protected] ~]# yum install binutils*
[[email protected] ~]# yum install compat*
[[email protected] ~]# yum install glibc*
[[email protected] ~]# yum install ksh*
[[email protected] ~]# yum install libgcc*
[[email protected] ~]# yum install libstdc*
[[email protected] ~]# yum install libaio*
[[email protected] ~]# yum install make*
[[email protected] ~]# yum install sysstat*可以提前检查 也可以安装报错缺少包时再yum安装具体包
-
修改资源配置
[[email protected] ~]# cp /etc/security/limits.conf /etc/security/limits.conf.bak
[[email protected] ~]# vim /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] ~]# tail -8 /etc/security/limits.conf
-
修改内核参数
建议编辑前给虚拟机做快照备份!![[email protected] ~]# cp /etc/sysctl.conf /etc/sysctl.conf.bak [[email protected] ~]# vi /etc/sysctl.conf fs.aio-max-nr = 1048576 fs.file-max = 6815744 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 = 1048576
[[email protected] ~]# tail -16 /etc/sysctl.conf
重启,验证
[[email protected] ~]# reboot
-
软件安装环境准备
6.1 创建用户和组创建组 [[email protected] ~]# groupadd oinstall [[email protected] ~]# groupadd dba [[email protected] ~]# groupadd oper
创建⽤户 设置密码 oracle:oracle
[[email protected] ~]# useradd -g oinstall -G dba,oper oracle
[[email protected] ~]# passwd oracle
SecureCRT创建连接 使⽤oracle⽤户登录测试
[[email protected] ~]$ id
6.2 创建目录
[[email protected] ~]# mkdir -p /u01/app/oracle
[[email protected] ~]# chown -R oracle:oinstall /u01
[[email protected] ~]# chmod -R 775 /u01/app/oracle
-
设置环境变量
使⽤oracle⽤户连接 编辑/home/oracle/.bash_profile
[[email protected] ~]$ vim .bash_profile
unset TNS_ADMIN
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=ORACLE_HOME/bin:$PATH[[email protected] ~]$ source .bash_profile 验证 [[email protected] ~]$ echo $ORACLE_BASE [[email protected] ~]$ echo $ORACLE_HOME [[email protected] ~]$ echo $ORACLE_SID [[email protected] ~]$ echo $PATH
-
解压软件,修改属主属组权限
使用sftp 192.168.XXX.XXX上传压缩包(put)
root⽤户解压软件包 先后解压1、2
[[email protected] db]# cd /software/db
[[email protected] db]# ls
[[email protected] db]# unzip p10404530_112030_Linux-x86-64_1of7.zip
[[email protected] db]# unzip p10404530_112030_Linux-x86-64_2of7.zip
解压得到database⽬录 约2.5G
修改属主 属组 权限
[[email protected] db]# chown -R oracle:oinstall database/
[[email protected] db]# chmod -R +x database/
-
启动Xmanager-passive执行安装
启动Xmanager-passive
oracle⽤户设置DISPLAY 将图形化界⾯显⽰在宿主机
[[email protected] ~]$ export DISPLAY=192.168.6.6:0.0
[[email protected] ~]$ echo $DISPLAY
在oracle⽤户home⽬录执⾏安装操作
[[email protected] ~]$ cd /software/db/database/
[[email protected] database]$ ll
[[email protected] database]$ ./runInstaller
- 安装Oracle文件
yum进行安装
可以使⽤yum安装第⼀个包
[[email protected] db]# yum install elfutils-libelf-devel
第三个包pdksh包可以从rhel5光盘中找到
上传后可以rpm -ivh 安装 但与ksh冲突,需要先rpm -e 卸载ksh
如果内核参数、资源限制等配置有问题,检查环节还会显⽰有其他错误,可先使⽤Fix &
Check Again
弹出的对话框会提⽰,仔细阅读提⽰内容。 使⽤root⽤户执⾏相应脚本,执⾏完成后再点
OK
[[email protected] ~]# /u01/app/oraInventory/orainstRoot.sh
[[email protected] ~]# /u01/app/oracle/product/11.2.0/dbhome_1/root.sh
-
netca配置监听
oracle用户执行netca命令xmanager启动状态 [[email protected] ~]$ netca
配置完成lsnrctl status查看监听状态
[[email protected] ~]$ lsnrctl status
-
dbca建库
oracle用户执行dbca命令创建数据库Xmanager启动状态 [[email protected] ~]$ dbca
-
Password Management
-
解锁scott用户,设置默认密码tiger
dbca建库后查看相关进程
[[email protected] ~]$ ps -ef | grep ora_ | grep -v grep
-
建库后相关配置
sqlplus命令提示符[[email protected] ~]$ cd $ORACLE_HOME/sqlplus/admin [[email protected] admin]$ vi glogin.sql define _editor=vi set linesize 100 set pagesize 9999 set sqlprompt "_user'@'_connect_identifier>"
[[email protected] ~]$ sqlplus / as sysdba
- scott用户
[email protected]>conn scott/tiger
[email protected]>show user
账户锁定后,使用alter user USERNAME account unlock解锁
[email protected]>select * from emp;
[email protected]>select * from dept;
- 正常关闭数据库
关闭操作系统之前,必须先使⽤sys⽤户正常关闭数据库实例。
[email protected]>conn / as sysdba
[email protected]>show user
[email protected]>shutdown immediate;
相关进程已不存在
- 启动数据库命令
[[email protected] ~]$ sqlplus / as sysdba
idle instance 说明数据库实例没有启动
[email protected]>startup
[email protected]>select status from v$instance;