centos7.3上安裝oracle xe 11g

卡卡西村長發表於2019-02-27

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)
)
)

相關文章