第十一天 安装Oracle数据库

解压缩2个安装包共享给虚拟机,命令如下:

 

# cd /installation

# unzip p10404530_112030_Linux-x86-64_[12]of7.zip

# mkdir /installation

# mount -t vboxsf installation /installation

cd /installation

 unzip p10404530_112030_Linux-x86-64_1of7.zip

 unzip p10404530_112030_Linux-x86-64_2of7.zip

  • 图形界面安装:

# xhost +   //所有用户都有权限去桌面

# su - oracle

$ cd /database/

$ ./runInstaller

只安装软件

以root身份执行两个脚本

  • 创建监听和数据库:

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

$ netca

$ lsnrctl status

$ netstat -tlnp | grep 1521

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

$ dbca

通用或事务处理,orcl 要选中样本权限 内存1200  数据库字符:UTF8

  • 测试:

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身份安装

# 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

 

root身份安装(不用执行)

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

 

sqldeveloper测试:

root身份安装

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

检查挂载目录

# cd /installation/

# 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

测试,保存。

 

  • 添加启动脚本:

以root身份

# 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

 

  • 删除口令有效期:

# su - oracle

$ sqlplus / as sysdba

SQL> alter profile default limit PASSWORD_LIFE_TIME unlimited;

  • 修改virtualbox的网络设置(可选):

全局设置添加hostonly网络,设置ip为:192.168.0.253,取消dhcp(linux only)

虚拟机网络改为hostonly

虚拟机中将网卡的ip改为静态,192.168.0.1

# vi /etc/sysconfig/network-scripts/ifcfg-eth0

BOOTPROTO=none

IPADDR=192.168.0.1

PREFIX=24

# ifdown eth0;ifup eth0

# vi /etc/hosts

192.168.0.1 node1.test.com node1

posted @ 2017-07-27 19:35  夜月色下  阅读(100)  评论(0编辑  收藏  举报