一、Oracle介绍
1、Oracle简介
Oracle Database,又名Oracle RDBMS,或简称Oracle。是甲骨文公司的一款关系数据库管理系统。它是在数据库领域一直处于领先地位的产品。可以说Oracle数据库系统是目前世界上流行的关系数据库管理系统,系统可移植性好、使用方便、功能强,适用于各类大、中、小、微机环境。它是一种高效率、可靠性好的 适应高吞吐量的数据库解决方案。但是其作为一个闭源的数据库(需要进行收费),不能进行二次开发,因此互联网的公司使用并不是很多。
2、Oracle特点
(1)完整的数据管理功能
- 数据的大量性
- 数据的保存的持久性
- 数据的共享性
- 数据的可靠性
(2)完备关系的产品
- 信息准则—关系型DBMS的所有信息都应在逻辑上用一种方法,即表中的值显式地表示
- 保证访问的准则
- 视图更新准则—只要形成视图的表中的数据变化了,相应的视图中的数据同时变化
- 数据物理性和逻辑性独立准则
(3)分布式处理功能
ORACLE数据库自第5版起就提供了分布式处理能力,到第7版就有比较完善的分布式数据库功能了,一个ORACLE分布式数据库由oraclerdbms、sqlNet、SQLCONNECT和其他非ORACLE的关系型产品构成。
(4)用ORACLE能轻松的实现数据仓库的操作。
二、实验环境
1、下载地址
软件包链接:https://pan.baidu.com/s/1r9o5MISdzRNocZG2XW5ZbQ 密码: u4hf
官网下载地址:http://www.oracle.com/technetwork/cn/database/enterprise-edition/downloads/index.html
2、安装环境
操作系统:Red Hat Enterprise Linux Server release 6.5 (Santiago)
[root@server1 ~]# hostname
server1
[root@server1 ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
10.10.10.1 server1
二、Oracle安装
1、Oracle用户环境要求
[root@server1 ~]# useradd oracle
[root@server1 ~]# echo '1' |passwd --stdin oracle
[root@server1 ~]# mkdir -p /data/oracle ###创建基本组
[root@server1 ~]# chown -R oracle.oracle /data/oracle/
[root@server1 ~]# chmod -R 755 /data/oracle/
[root@server1 ~]# mkdir /data/tmp ##创建安装临时文件夹
2、Oracle用户的环境配置
[root@server1 ~]# vim /home/oracle/.bash_profile
PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export PATH
export ORACLE_BASE=/data/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2/db_1
export ORACLE_SID=orcl
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
3、Oracle用户资源限制
[root@server1 ~]# vim /etc/pam.d/login ###加入2行
session required /lib/security/pam_limits.so
session required pam_limits.so
[root@server1 ~]# vim /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
4、Oracle安装过程(拷贝软件包到/mnt下)
[root@server1 mnt]# unzip p13390677_112040_Linux-x86-64_1of7.zip
[root@server1 mnt]# unzip p13390677_112040_Linux-x86-64_2of7.zip
[root@server1 mnt]# xhost +
### 用oracle直接进行登陆,否则可能会报错
[oracle@server1 ~]$ cd /mnt/database/
[oracle@server1 database]$ ./runInstaller
5、图形设置
6、安装所需要的Packages
(1)yum安装
[root@server1 mnt]# yum install -y libaio-devel elfutils-libelf-devel gcc-c++ libstdc++-devel compat-libstdc++ pdksh
可以发现所需要的2个安装包并没有存在,可以自我进行下载,地址:http://www.rpmfind.net/linux/rpm2html/search.php?query=pdksh&submit=Search+…&system=&arch=
(2)接在来安装发现报错:
[root@server1 mnt]# yum install -y compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm pdksh-5.2.14-32.mga4.x86_64.rpm
Error: Package: pdksh-5.2.14-32.mga4.x86_64 (/pdksh-5.2.14-32.mga4.x86_64)
Requires: libc.so.6(GLIBC_2.14)(64bit)
Error: Package: compat-libstdc++-33-3.2.3-72.el7.x86_64 (/compat-libstdc++-33-3.2.3-72.el7.x86_64)
Requires: libc.so.6(GLIBC_2.14)(64bit)
(3)安装glibc
下载地址:http://ftp.gnu.org/gnu/glibc/
<1> 编译安装
[root@server1 mnt]# tar xf glibc-2.14.tar.gz
[root@server1 mnt]# cd glibc-2.14
[root@server1 glibc-2.14]# ./configure --prefix=/opt/glibc-2.14
<2> 报错:
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
configure: error: you must configure in a separate build directory ###需要建立一个build目录
<3> 解决方法:
[root@server1 glibc-2.14]# mkdir build
[root@server1 glibc-2.14]# cd build/
[root@server1 build]# ../configure --prefix=/opt/glibc-2.14
[root@server1 build]# make && make install
[root@server1 build]# cp /etc/ld.so.c* /opt/glibc-2.14/etc/
cp: overwrite `/opt/glibc-2.14/etc/ld.so.cache'? y
cp: omitting directory `/etc/ld.so.conf.d'
[root@server1 build]# ln -s /opt/glibc-2.14/lib/libc-2.14.so /lib64/libc.so.6
ln: creating symbolic link `/lib64/libc.so.6': File exists
[root@server1 build]# rm -f /lib64/libc.so.6
[root@server1 build]# ln -s /opt/glibc-2.14/lib/libc-2.14.so /lib64/libc.so.6
[root@server1 mnt]# strings /lib64/libc.so.6 | grep GLIBC ###如果出现2.14版本则安装成功
再次重新安装即可!!!
7、下面用root执行2条shell
[root@server1 ~]# /data/oracle/oraInventory/orainstRoot.sh
Changing permissions of /data/oracle/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /data/oracle/oraInventory to oracle.
The execution of the script is complete.
[root@server1 ~]# /data/oracle/product/11.2/db_1/root.sh
Performing root user operation for Oracle 11g
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /data/oracle/product/11.2/db_1
Enter the full pathname of the local bin directory: [/usr/local/bin]:
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...
Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Finished product-specific root actions.
8、测试
[oracle@server1 ~]$ sqlplus / as sysdba ###超级管理员(sysdba)登陆
SQL*Plus: Release 11.2.0.4.0 Production on Mon Jul 2 01:50:05 2018
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL>
Oracle的基础安装便完成了!!!