码迷,mamicode.com
首页 > 数据库 > 详细

Oracle实验手册

时间:2017-07-26 19:24:33      阅读:239      评论:0      收藏:0      [点我收藏+]

标签:lan   shm   packages   limited   创建用户   .bashrc   关闭防火墙   library   touch   

oracle安装

  1. 安装virtualbox:

# yum install gcc kernel-devel kernel-headers

# yum install virtualbox-5....

# /etc/init.d/vboxdrv setup               手动编译内核模块,安装时自动完成

# usermod -G vboxusers root

  1. 安装linux:

创建虚拟机:

名称:oracle11gR2_OEL6.4_x64

类型:linux 64bit

内存:2048MB

硬盘大小:100GB

 

设置:

双向粘贴 处理器数量:2 存储:加载光盘

启动顺序:硬盘,网络

网络:网卡1,host -only

去除声音、usb设备

 

安装:desktop方式

主机名:node1.test.com,ip使用dhcp,swap 4GB,其余给/

  1. 调整linux系统:

关闭防火墙:

# service iptables stop

# service ip6tables stop

# chkconfig iptables off

# chkconfig ip6tables off

管理工具中disabled防火墙

 

关闭selinux:

# vi /etc/selinux/config

SELINUX=disabled

配置yum:                      (配置资料库)

# df -h                              (找到光盘路径)

# rm -f /etc/yum.repos.d/*

# vi /etc/yum.repos.d/oel6.repo

[Server]

name=Server

baseurl=file:///media/" /media/OL6.4 x86_64 Disc 1 20130225"/Server

enabled=1

gpgcheck=0

 

[root@node1 yum.repos.d]# yum repolist all           (查看资料库是否配置成功)

Loaded plugins: refresh-packagekit, security

repo id                        repo name                          status

InstallMedia                   Oracle Linux 6.4                   disabled

Server                         Server                             enabled: 3,628

repolist: 3,628

 

安装vb增强功能:

# cd

# yum -y install gcc kernel-devel

# ln -s /usr/src/kernels/2.6.32-431.el6.x86_64/ /usr/src/linux

 

设备-->安装增强功能

右键eject弹出光盘

 

  1. 确认root身份:

# id

  1. 硬件配置:

# df

 -h

# grep MemTotal /proc/meminfo

# grep SwapTotal /proc/meminfo

# vi /etc/fstab(永久修改)

tmpfs        /dev/shm          tmpfs        defaults,size=2G               0 0

# mount -o remount /dev/shm

临时修改

# mount -t tmpfs shmfs -o size=2g /dev/shm

 

# uname -m

# df -h

 

 

 

替代6 7 8 9步骤,(先把7最好单独做)

[root@node1 ~]# cd /media/OL6.4\ x86_64\ Disc\ 1\ 20130225/Packages/

[root@node1 Packages]# yum install oracle-rdbms-server-11gR2-preinstall-1.0-7.el6.x86_64.rpm

 

 

  1. rpm检查并安装:

# cat /etc/redhat-release

# uname -r

 

# rpm -qa | grep glibc

# yum install glibc

# yum install glibc.i686

 

binutils-2.20.51.0.2-5.11.el6 (x86_64)

compat-libcap1-1.10-1 (x86_64)

compat-libstdc++-33-3.2.3-69.el6 (x86_64)

compat-libstdc++-33-3.2.3-69.el6.i686

gcc-4.4.4-13.el6 (x86_64)

gcc-c++-4.4.4-13.el6 (x86_64)

glibc-2.12-1.7.el6 (i686)

glibc-2.12-1.7.el6 (x86_64)

glibc-devel-2.12-1.7.el6 (x86_64)

glibc-devel-2.12-1.7.el6.i686

ksh

libgcc-4.4.4-13.el6 (i686)

libgcc-4.4.4-13.el6 (x86_64)

libstdc++-4.4.4-13.el6 (x86_64)

libstdc++-4.4.4-13.el6.i686

libstdc++-devel-4.4.4-13.el6 (x86_64)

libstdc++-devel-4.4.4-13.el6.i686

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

make-3.81-19.el6

sysstat-9.0.4-11.el6 (x86_64)

  1. 创建用户:

# groupadd -g 1000 oinstall

# groupadd -g 1001 dba

# groupadd -g 1002 oper

# passwd oracle

  1. 修改内核参数:

# 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 = 1048576

# sysctl -p

  1. 修改资源限制:

# vi /etc/security/limits.conf

oracle          soft    nofile          1024

oracle          hard    nofile          65536

oracle          soft    nproc           2047

oracle          hard    nproc           16384

oracle          soft    stack           10240

oracle          hard    stack           32768

  1. 创建目录:

# mkdir -p /u01/app/oracle

# chown -R oracle:oinstall /u01

# chmod -R 775 /u01

  1. 修改概要文件:

# vi ~oracle/.bash_profile

export ORACLE_SID=orcl

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1

export ORACLE_HOSTNAME=node1.test.com

export ORACLE_UNQNAME=orcl

export PATH=$PATH:$ORACLE_HOME/bin

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib

export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

export NLS_LANG=american_america.AL32UTF8

export NLS_DATE_FORMAT=‘yyyy-mm-dd hh24:mi:ss‘

export EDITOR=vi

export LANG=C

  1. 使用hosts文件解析主机名:

# hostname

node1.test.com

# vi /etc/hosts

192.168.0.1          node1.test.com          node1

                                  虚拟机                            主机

# ping node1               ping:强制回显请求数据(用来检测网络通与不通或测试网络连接速度的)

# ping node1.test.com

 

  1. 解压缩安装包:

# cd /installation

# unzip p10404530_112030_Linux-x86-64_[12]of7.zip               【未用】

或者:

 

安装包所在目录共享给虚拟机后解压缩。命令如下:

#  mkdir /installation

#  mount -t vboxsf installation /installation/

# cd /installation/

# ls

p10404530_112030_Linux-x86-64_1of7.zip  p10404530_112030_Linux-x86-64_2of7.zip

#unzip p10404530_112030_Linux-x86-64_1of7.zip

#unzip p10404530_112030_Linux-x86-64_2of7.zip

[root@node1 installation]# ls

database                                p10404530_112030_Linux-x86-64_2of7.zip

p10404530_112030_Linux-x86-64_1of7.zip

 

 

  1. 图形界面安装:

# xhost +

# su - oracle

$ cd /database/

$ ./runInstaller

 

以root身份执行两个脚本

 

 

 

  1.  

创建监听和数据库:

图形界面下创建监听,oracle执行:

$ netca

$ lsnrctl status                          //查看状态

$ netstat -tlnp | grep 1521

图形界面创建db,oracle执行:

$ dbca

通用或事务处理,orcl/orcl选中样本方案,内存1200

Char

Var

Sys 登录

System系统用户操作员

Dbsnmp简单网络协议

sysman

 

  1. 测试:

sqlplus测试:

$ sqlplus sys/password@orcl as sysdba

$ sqlplus / as sysdba

SQL> show user

SQL> select count(*) from hr.employees;

SQL> exit

浏览器测试:

https://192.168.0.1:1158/em

sys/password  sysdba

 

安装rlwrap:

root身份安装

在windows将rlwrap安装包复制到installation下

检查挂载目录

#cd /installation

# yum install rlwrap-0.42-1.el6.x86_64.rpm

# vi ~oracle/.bashrc

alias sqlplus=‘rlwrap sqlplus‘

alias rman=‘rlwrap rman‘

 

# su - oracle

$ sqlplus / as sysdba

SQL> select  *  from hr.employees;

 

root身份安装

# yum install flash-plugin-11.2.202.508-release.x86_64.rpm

 

sqldeveloper测试:

root身份安装

# yum install jdk-8u51-linux-x64.rpm

# yum install sqldeveloper-4.1.1.19.59-1.noarch.rpm

 

# /usr/local/bin/sqldeveloper

输入jdk的路径 /usr/java/jdk1.8.0_51/

 

点左上角+号,创建新连接:

sys/password,连接类型:basic,角色:sysdba

192.168.0.1   端口1521   sid:orcl

测试,保存。

乱码变中文

 

  1. 添加启动脚本:

# vi /etc/oratab  把N改为Y

orcl:/u01/app/oracle/product/11.2.0/db_1:Y

 

# vi /etc/rc.d/init.d/oracle

 

#!/bin/bash

#chkconfig:35 99 01

case "$1" in

  start)

        echo -n "Starting Oracle Database & Listener:"

        su - oracle -c ‘dbstart $ORACLE_HOME‘ >/dev/null

        echo "[ ok ]"

 

        echo -n "Starting Oracle EM dbconsole:"

        su - oracle -c "emctl start dbconsole">/dev/null

        echo "[ ok ]"

 

        touch /var/lock/subsys/oracle

        ;;

  stop)

        echo -n "Shutting Down Oracle EM dbconsole:"

        su - oracle -c "emctl stop dbconsole">/dev/null

        echo "[ ok ]"

 

        echo -n "Shutting Down Oracle Database & Listener:"

        su - oracle -c ‘dbshut $ORACLE_HOME‘ >/dev/null

        echo "[ ok ]"

 

        rm -f /var/lock/subsys/oracle

        ;;

  *)

        echo "Usage: oracle {start|stop}"

        exit 1

esac

 

 

# chmod 755 /etc/rc.d/init.d/oracle

# chkconfig --add oracle

# chkconfig --list oracle

 

  1. 删除口令有效期:

# su - oracle

$ sqlplus / as sysdba

SQL> alter profile default limit PASSWORD_LIFE_TIME unlimited;

检查:

重启一次直接sqlplus / as sysdba

输入 select  *  from hr.employees;看结果

 

Oracle实验手册

标签:lan   shm   packages   limited   创建用户   .bashrc   关闭防火墙   library   touch   

原文地址:http://www.cnblogs.com/awdsjk/p/7241364.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!