首发:http://www.arppinging.com/wordpress/?p=90
chmod -R 755 /tmp/database/
创建oracle用户,并将oracle用户加入oinstall和dba组,后面安装的时候需要用到
[root@localhost ~]# groupadd oinstall
[root@localhost ~]# groupadd dba
[root@localhost ~]# useradd -g oinstall -G dba oracle
[root@localhost ~]# passwd oracle
Changing password for user oracle.
New password:
BAD PASSWORD: it is based on a dictionary word
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
[root@localhost ~]#
创建数据库安装目录u01
[root@localhost ~]# mkdir /home/u01
为数据库安装目录做一个软链接
[root@localhost ~]# ln -s /home/u01/ /u01
[root@localhost ~]# mkdir -p /u01/app/oracle
修改/u01目录的属主和属组信息
[root@localhost ~]# chown -R oracle:oinstall /u01/
修改u01的权限为755
[root@localhost ~]# chmod -R 755 /u01/
[root@localhost ~]# vim /home/oracle/.bash_profile
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.4/db_1
export ORACLE_SID=test
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$ORACLE_HOME/jdk/bin:$PATH
export LANG="en_US.UTF-8"
export NLS_LANG=american_AMERICA.UTF8
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"
验证一下有没有问题,没有输出,则代表没有问题
[root@localhost oracle]# source .bash_profile
[root@localhost oracle]#
1.挂载光驱
[root@localhost ~]# mount /dev/cdrom /mnt/
mount: block device /dev/sr0 is write-protected, mounting read-only
[root@localhost ~]#
2.修改yum文件
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
rhel-source.repo
[root@localhost yum.repos.d]# cp rhel-source.repo rhel-source.repo.bak
[root@localhost yum.repos.d]# vim rhel-source.repo
[rhel-source]
name=Red Hat Enterprise Linux $releasever - $basearch - Source
baseurl=file:///mnt/
enabled=1
gpgcheck=0
3.清除yum源,并重新生成
[root@localhost yum.repos.d]# yum claenall
[root@localhost yum.repos.d]# yum makecache
4.使用yum 安装软件
[root@localhost yum.repos.d]# yum install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers pdksh cvuqdisk libaio libaio-devel libgcc libgomp libstdc++ libstdc++-devel make numactl-devel sysstat unixODBC unixODBC-devel -y
1.打开图形化桌面的终端
[oracle@localhost ~]$ cd /tmp/database/
[oracle@localhost database]$ ./runInstaller
2.去掉选项卡中的勾
3.选择YES
4.选择第二个,安装数据库软件
5.选择安装单节点
6.选择安装语言,默认就好(貌似没有中文)
7.选择默认的企业版
8.默认路径,路径准备阶段已经创建,不是按照上面创建目录的这里需要修改
9.目录和组,默认即可
10.用户组,默认即可
11.安装前检查,选中Ignore All即可下一步
12.点击finish即可开始安装
13.安装中可能出现提示,直接点击ok即可
14.安装完成点击close关闭窗口
[oracle@localhost database]$ dbca
1.选择下一步
2.选择创建数据库
3.选择数据库模板,默认即可
4.设置SID,这个SID需要跟oracle用户的.bash_profile中的SID相同,上面我们设置的是test
5.取消最上面的勾,下一步
6.为oracle数据库的两个用户设置密码,下面的选项是两个用户的密码都使用...,当然,也可以一个用户设置一个密码。
7.下面的选项都选择下一步即可
8.点击完成
9.点击ok
10.点击exit完成安装
[oracle@localhost /]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 02-OCT-2018 11:51:04
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Starting /u01/app/oracle/product/11.2.4/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Log messages written to /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 02-OCT-2018 11:51:05
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Log File /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@localhost /]$
[oracle@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Tue Oct 2 11:53:31 2018
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> startup
ORA-01081: cannot start already-running ORACLE - shut it down first
SQL>
顺便查询一张表,又数据输出则代表没有问题。
SQL> select * from user_tables;
1.下载rlwrap软件
[root@localhost /]# wget http://mirrors.aliyun.com/epel/6/x86_64/Packages/r/rlwrap-0.42-1.el6.x86_64.rpm
2.安装
[root@localhost /]# rpm -ivh rlwrap-0.42-1.el6.x86_64.rpm
warning: rlwrap-0.42-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ########################################### [100%]
1:rlwrap ########################################### [100%]
[root@localhost /]#
3.修改配置文件
[oracle@localhost ~]$ vi .bash_profile
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
4.重新登陆或者切换一下即可
完。