centos7.3上安装oracle xe 11g

oracle -11g-xe是数据库是免费版本,支持标准版的大部分功能。oracle XE版本也称快捷版本。是个个人学习,熟悉oracle的简化版。

oracle XE做为免费的Oracle数据库版本,主要的限制是:

最大数据库大小是11GB

可使用的最大内存是1G

一个机器只能安装一个XE实例

XE只能使用单CPU

1.下载OracleXE的包
[root@oracle2 ~]# ls
anaconda-ks.cfg  initial-setup-ks.cfg  oracle-xe-11.2.0-1.0.x86_64.rpm.zip  公共  模板  视频  图片  文档  下载  音乐  桌面
[root@oracle2 ~]# unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip  ----解压
Archive:  oracle-xe-11.2.0-1.0.x86_64.rpm.zip
   creating: Disk1/
   creating: Disk1/upgrade/
  inflating: Disk1/upgrade/gen_inst.sql  
   creating: Disk1/response/
  inflating: Disk1/response/xe.rsp   
  inflating: Disk1/oracle-xe-11.2.0-1.0.x86_64.rpm 

2.安装依赖
 [root@oracle2 ~]# yum install libaio* -y
[root@oracle2 ~]# cd Disk1/
[root@oracle2 Disk1]# useradd oracle
[root@oracle2 Disk1]# groupadd dba
[root@oracle2 Disk1]# groupadd oinstall
[root@oracle2 Disk1]# useradd -m -g oinstall -G dba oracle
useradd:用户“oracle”已存在
[root@oracle2 Disk1]# grep dba /etc/group
dba:x:1002:
[root@oracle2 Disk1]# grep oinstall /etc/group
oinstall:x:1003:
[root@oracle2 Disk1]# id oracle
uid=1001(oracle) gid=1001(oracle) 组=1001(oracle)

[root@oracle2 Disk1]# dd if=/dev/zero of=/home/swap2 bs=1024 count=2512000
记录了2512000+0 的读入
记录了2512000+0 的写出
2572288000字节(2.6 GB)已复制,22.2486 秒,116 MB/秒
[root@oracle2 Disk1]# /sbin/mkswap  /home/swap2
正在设置交换空间版本 1,大小 = 2511996 KiB
无标签,UUID=100bb638-0c19-44cd-b191-78f02d8c5e81
[root@oracle2 Disk1]# /sbin/swapon /home/swap2
swapon: /home/swap2:不安全的权限 0644,建议使用 0600。

修改/etc/fstab文件

[root@oracle2 Disk1]# vim /etc/fstab   

/home/swap2  swap swap defaults 0 0
[root@oracle2 Disk1]# mount -a
[root@oracle2 Disk1]# free -m
              total        used        free      shared  buff/cache   available
Mem:            992          96          62           1         833         724
Swap:          4501           7        4493
[root@oracle2 Disk1]# vim /etc/profile

TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/xe; export ORACLE_HOME
ORACLE_SID=XE; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
TNS_ADMIN=$ORACLE_HOME/network/admin
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
if [ $USER = "oracle" ];then
if [ $SHELL = "/bin/ksh" ];then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
[root@oracle2 Disk1]# source /etc/profile

root@oracle2 Disk1]# echo $ORACLE_BASE

3.根据提示安装XE
 

[root@oracle2 Disk1]# rpm -i oracle-xe-11.2.0-1.0.x86_64.rpm

输入的四项内容是:

http访问时的端口
数据库的监听端口
SYS和SYSTEM用户的密码
是否开机启动(并没有开机启动,可能还有地方要设置)。
安装完成后:

会自动建立一个名为oracle的用户,家目录/u01/app/oracle。
会建立dba组,oracle用户属于这个组。
会自动生成一个数据库实例,名为XE。/u01/app/oracle/product/11.2.0/xe/dbs/spfileXE.ora

[root@oracle2 Disk1]# /etc/init.d/oracle-xe configure

Oracle Database 11g Express Edition Configuration
-------------------------------------------------
This will configure on-boot properties of Oracle Database 11g Express 
Edition.  The following questions will determine whether the database should 
be starting upon system boot, the ports it will use, and the passwords that 
will be used for database accounts.  Press <Enter> to accept the defaults. 
Ctrl-C will abort.

Specify the HTTP port that will be used for Oracle Application Express [8080]:8081

Specify a port that will be used for the database listener [1521]:1521

Specify a password to be used for database accounts.  Note that the same
password will be used for SYS and SYSTEM.  Oracle recommends the use of 
different passwords for each database account.  This can be done after 
initial configuration:
Confirm the password:

Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]:y

Starting Oracle Net Listener...Done

Configuring database...Done
Starting Oracle Database 11g Express Edition instance...Done
Installation completed successfully.


4.连接数据库
[root@oracle2 Disk1]# su oracle
[oracle@oracle2 Disk1]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.2.0 Production on Sun Aug 5 13:30:12 2018

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

SQL> conn sys/ as sysdba
Enter password: 
Connected.

5. 客户端配置TNS(把IP替换掉):

VM_XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.205.128)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)

猜你喜欢

转载自www.cnblogs.com/lavezhang/p/10443360.html