CentOS7下使用yum快速安裝配置oracle數據庫

CentOS7下使用yum快速安裝配置oracle數據庫

2017年10月10日 15:29:23 aladdin_sun 閱讀數:3146 標籤: 數據庫 centos oracle yum 更多
我的分類: oracle讀書筆記
 

CentOS7下使用yum快速安裝配置oracle數據庫

實驗環境

操做系統:CentOS Linux release 7.3.1611 (Core)

IP: 192.168.230.141
  • 1
  • 2
  • 3

原理

使用yum工具安裝oracle提供的preinstall包,它將自動執行一些與配置步驟:html

  • 自動下載並安裝 Oracle Grid Infrastructure 和 Oracle Database 11g 第 2 版 (11.2.0.3) 安裝過程所需的任何額外的軟件包和特定軟件版本,並經過 yum 或 up2date 功能處理軟件包依賴關係。
  • 建立用戶 oracle 和組 oinstall(針對 OraInventory)、dba(針對 OSDBA),供數據庫安裝期間使用。(出於安全目的,該用戶沒有默認口令,且不能遠程登陸)。要啓用遠程登陸,請使用 passwd 工具設置一個口令。)
  • 修改 /etc/sysctl.conf 中的內核參數以更改共享內存、信號、最大文件描述符數量等設置。
  • 設置 /etc/security/limits.conf 中的軟硬 shell 資源限制,如鎖定內存地址空間、打開的文件數量、進程數和核心文件大小。
  • 對於 x86_64 計算機,在內核中設置 numa=off。

如此可簡化不少配置步驟linux

配置yum的repo文件

進入yum配置文件夾,添加oracle的yum信息庫c++

[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo    CentOS-Vault.repo
CentOS-CR.repo    CentOS-fasttrack.repo  CentOS-Sources.repo
[root@localhost yum.repos.d]# rm public-yum-ol7.repo 
rm: remove regular file ‘public-yum-ol7.repo’? y
[root@localhost yum.repos.d]# wget http://public-yum.oracle.com/public-yum-ol7.repo
--2017-10-09 19:26:42--  http://public-yum.oracle.com/public-yum-ol7.repo
Resolving public-yum.oracle.com (public-yum.oracle.com)... 23.49.60.35, 173.222.148.42
Connecting to public-yum.oracle.com (public-yum.oracle.com)|23.49.60.35|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6947 (6.8K) [text/plain]
Saving to: ‘public-yum-ol7.repo’

100%[=========================================================================================>] 6,947       --.-K/s   in 0s      

2017-10-09 19:26:44 (354 MB/s) - ‘public-yum-ol7.repo’ saved [6947/6947]

[root@localhost yum.repos.d]# ls
CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo    CentOS-Vault.repo
CentOS-CR.repo    CentOS-fasttrack.repo  CentOS-Sources.repo  public-yum-ol7.repo
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21

使用yum安裝oracle預安裝文件,這裏咱們選擇11g的版本爲實驗對象sql

[root@localhost yum.repos.d]# yum install oracle
oracleasm-support.x86_64                        oracle-logos.noarch
oracle-database-server-12cR2-preinstall.x86_64  oracle-rdbms-server-11gR2-preinstall.x86_64
oraclelinux-release.x86_64                      oracle-rdbms-server-12cR1-preinstall.x86_64
[root@localhost yum.repos.d]# yum install oracle-rdbms-server-11gR2-preinstall.x86_64 
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package oracle-rdbms-server-11gR2-preinstall.x86_64 0:1.0-5.el7 will be installed
--> Processing Dependency: gcc-c++ for package: oracle-rdbms-server-11gR2-preinstall-1.0-5.el7.x86_64
--> Processing Dependency: kernel-uek for package: oracle-rdbms-server-11gR2-preinstall-1.0-5.el7.x86_64
--> Processing Dependency: compat-libcap1 for package: oracle-rdbms-server-11gR2-preinstall-1.0-5.el7.x86_64
--> Processing Dependency: ksh for package: oracle-rdbms-server-11gR2-preinstall-1.0-5.el7.x86_64
--> Processing Dependency: libaio-devel for package: oracle-rdbms-server-11gR2-preinstall-1.0-5.el7.x86_64
--> Processing Dependency: compat-libstdc++-33 for package: oracle-rdbms-server-11gR2-preinstall-1.0-5.el7.x86_64
--> Processing Dependency: libstdc++-devel for package: oracle-rdbms-server-11gR2-preinstall-1.0-5.el7.x86_64
--> Running transaction check
---> Package compat-libcap1.x86_64 0:1.10-7.el7 will be installed
---> Package compat-libstdc++-33.x86_64 0:3.2.3-72.el7 will be installed
---> Package gcc-c++.x86_64 0:4.8.5-16.el7 will be installed
---> Package kernel-container.x86_64 0:3.10.0-0.0.0.2.el7 will be installed
---> Package ksh.x86_64 0:20120801-34.el7 will be installed
---> Package libaio-devel.x86_64 0:0.3.109-13.el7 will be installed
---> Package libstdc++-devel.x86_64 0:4.8.5-16.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===================================================================================================================================
 Package                                          Arch               Version                          Repository              Size
===================================================================================================================================
Installing:
 oracle-rdbms-server-11gR2-preinstall             x86_64             1.0-5.el7                        ol7_latest              21 k
Installing for dependencies:
 compat-libcap1                                   x86_64             1.10-7.el7                       base                    19 k
 compat-libstdc++-33                              x86_64             3.2.3-72.el7                     base                   191 k
 gcc-c++                                          x86_64             4.8.5-16.el7                     base                   7.2 M
 kernel-container                                 x86_64             3.10.0-0.0.0.2.el7               ol7_latest             2.6 k
 ksh                                              x86_64             20120801-34.el7                  base                   883 k
 libaio-devel                                     x86_64             0.3.109-13.el7                   base                    13 k
 libstdc++-devel                                  x86_64             4.8.5-16.el7                     base                   1.5 M

Transaction Summary
===================================================================================================================================
Install  1 Package (+7 Dependent packages)

Total download size: 9.8 M
Installed size: 29 M
Is this ok [y/d/N]: y
Downloading packages:
(1/8): compat-libcap1-1.10-7.el7.x86_64.rpm                                                                 |  19 kB  00:00:00     
(2/8): compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm                                                          | 191 kB  00:00:00     
(3/8): ksh-20120801-34.el7.x86_64.rpm                                                                       | 883 kB  00:00:00     
(4/8): libaio-devel-0.3.109-13.el7.x86_64.rpm                                                               |  13 kB  00:00:00     
(5/8): libstdc++-devel-4.8.5-16.el7.x86_64.rpm                                                              | 1.5 MB  00:00:00     
warning: /var/cache/yum/x86_64/7/ol7_latest/packages/kernel-container-3.10.0-0.0.0.2.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Public key for kernel-container-3.10.0-0.0.0.2.el7.x86_64.rpm is not installed
(6/8): kernel-container-3.10.0-0.0.0.2.el7.x86_64.rpm                                                       | 2.6 kB  00:00:00     
(7/8): oracle-rdbms-server-11gR2-preinstall-1.0-5.el7.x86_64.rpm                                            |  21 kB  00:00:01     
(8/8): gcc-c++-4.8.5-16.el7.x86_64.rpm                                                                      | 7.2 MB  00:00:01     
-----------------------------------------------------------------------------------------------------------------------------------
Total                                                                                              6.1 MB/s | 9.8 MB  00:00:01     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle


GPG key retrieval failed: [Errno 14] curl#37 - "Couldn't open file /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle"
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70

直接使用yum安裝會報錯:Couldn’t open file /etc/pki/rpm-gpg/RPM-GPG-KEY-oracleshell

經查,這是因爲我使用的不是oracle Linux致使,強制跳過gpg檢查便可:數據庫

[root@localhost yum.repos.d]# yum install oracle-rdbms-server-11gR2-preinstall.x86_64 --nogpgcheck
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package oracle-rdbms-server-11gR2-preinstall.x86_64 0:1.0-5.el7 will be installed
--> Processing Dependency: gcc-c++ for package: oracle-rdbms-server-11gR2-preinstall-1.0-5.el7.x86_64
--> Processing Dependency: kernel-uek for package: oracle-rdbms-server-11gR2-preinstall-1.0-5.el7.x86_64
--> Processing Dependency: compat-libcap1 for package: oracle-rdbms-server-11gR2-preinstall-1.0-5.el7.x86_64
--> Processing Dependency: ksh for package: oracle-rdbms-server-11gR2-preinstall-1.0-5.el7.x86_64
--> Processing Dependency: libaio-devel for package: oracle-rdbms-server-11gR2-preinstall-1.0-5.el7.x86_64
--> Processing Dependency: compat-libstdc++-33 for package: oracle-rdbms-server-11gR2-preinstall-1.0-5.el7.x86_64
--> Processing Dependency: libstdc++-devel for package: oracle-rdbms-server-11gR2-preinstall-1.0-5.el7.x86_64
--> Running transaction check
---> Package compat-libcap1.x86_64 0:1.10-7.el7 will be installed
---> Package compat-libstdc++-33.x86_64 0:3.2.3-72.el7 will be installed
---> Package gcc-c++.x86_64 0:4.8.5-16.el7 will be installed
---> Package kernel-container.x86_64 0:3.10.0-0.0.0.2.el7 will be installed
---> Package ksh.x86_64 0:20120801-34.el7 will be installed
---> Package libaio-devel.x86_64 0:0.3.109-13.el7 will be installed
---> Package libstdc++-devel.x86_64 0:4.8.5-16.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===================================================================================================================================
 Package                                          Arch               Version                          Repository              Size
===================================================================================================================================
Installing:
 oracle-rdbms-server-11gR2-preinstall             x86_64             1.0-5.el7                        ol7_latest              21 k
Installing for dependencies:
 compat-libcap1                                   x86_64             1.10-7.el7                       base                    19 k
 compat-libstdc++-33                              x86_64             3.2.3-72.el7                     base                   191 k
 gcc-c++                                          x86_64             4.8.5-16.el7                     base                   7.2 M
 kernel-container                                 x86_64             3.10.0-0.0.0.2.el7               ol7_latest             2.6 k
 ksh                                              x86_64             20120801-34.el7                  base                   883 k
 libaio-devel                                     x86_64             0.3.109-13.el7                   base                    13 k
 libstdc++-devel                                  x86_64             4.8.5-16.el7                     base                   1.5 M

Transaction Summary
===================================================================================================================================
Install  1 Package (+7 Dependent packages)

Total size: 9.8 M
Installed size: 29 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libstdc++-devel-4.8.5-16.el7.x86_64                                                                             1/8 
  Installing : gcc-c++-4.8.5-16.el7.x86_64                                                                                     2/8 
  Installing : ksh-20120801-34.el7.x86_64                                                                                      3/8 
  Installing : libaio-devel-0.3.109-13.el7.x86_64                                                                              4/8 
  Installing : kernel-container-3.10.0-0.0.0.2.el7.x86_64                                                                      5/8 
  Installing : compat-libcap1-1.10-7.el7.x86_64                                                                                6/8 
  Installing : compat-libstdc++-33-3.2.3-72.el7.x86_64                                                                         7/8 
  Installing : oracle-rdbms-server-11gR2-preinstall-1.0-5.el7.x86_64                                                           8/8 
  Verifying  : oracle-rdbms-server-11gR2-preinstall-1.0-5.el7.x86_64                                                           1/8 
  Verifying  : gcc-c++-4.8.5-16.el7.x86_64                                                                                     2/8 
  Verifying  : libstdc++-devel-4.8.5-16.el7.x86_64                                                                             3/8 
  Verifying  : compat-libstdc++-33-3.2.3-72.el7.x86_64                                                                         4/8 
  Verifying  : compat-libcap1-1.10-7.el7.x86_64                                                                                5/8 
  Verifying  : kernel-container-3.10.0-0.0.0.2.el7.x86_64                                                                      6/8 
  Verifying  : libaio-devel-0.3.109-13.el7.x86_64                                                                              7/8 
  Verifying  : ksh-20120801-34.el7.x86_64                                                                                      8/8 

Installed:
  oracle-rdbms-server-11gR2-preinstall.x86_64 0:1.0-5.el7                                                                          

Dependency Installed:
  compat-libcap1.x86_64 0:1.10-7.el7             compat-libstdc++-33.x86_64 0:3.2.3-72.el7   gcc-c++.x86_64 0:4.8.5-16.el7         
  kernel-container.x86_64 0:3.10.0-0.0.0.2.el7   ksh.x86_64 0:20120801-34.el7                libaio-devel.x86_64 0:0.3.109-13.el7  
  libstdc++-devel.x86_64 0:4.8.5-16.el7         

Complete!
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80

如此,便完成了oracle的預配置,查看日誌文件,瞭解到底作了什麼操做:vim

[root@localhost yum.repos.d]# vim /var/log/oracle-rdbms-server-11gR2-preinstall/results/orakernel.log 

Adding group oinstall with gid 54321
Adding group dba
Adding user oracle with user id 54321, initial login group oinstall, supplementary group dba and  home directory /home/oracle
Changing ownership of /home/oracle to oracle:oinstall
Please set password for oracle user
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba)
Creating oracle user passed

Saving a copy of the initial sysctl.conf
Verifying  kernel parameters as per Oracle recommendations...
Adding fs.file-max = 6815744
Adding kernel.sem = 250 32000 100 128
Adding kernel.shmmni = 4096
Adding kernel.shmall = 1073741824
Adding kernel.shmmax = 4398046511104
Adding kernel.panic_on_oops = 1
Adding net.core.rmem_default = 262144
Adding net.core.rmem_max = 4194304
Adding net.core.wmem_default = 262144
Adding net.core.wmem_max = 1048576
Adding net.ipv4.conf.all.rp_filter = 2
Adding net.ipv4.conf.default.rp_filter = 2
Adding fs.aio-max-nr = 1048576
Adding net.ipv4.ip_local_port_range = 9000 65500
Setting kernel parameters as per oracle recommendations...
Altered file /etc/sysctl.conf
Saved a copy of the current file in /etc/sysctl.d/99-oracle-rdbms-server-11gR2-preinstall-sysctl.conf
Check /etc/sysctl.d for backups
Verifying & setting of kernel parameters passed

Setting user limits using /etc/security/limits.conf

Verifying oracle user OS limits as per Oracle recommendations...
Adding oracle soft nofile  1024
Adding oracle hard nofile  65536
Adding oracle soft nproc  16384
Adding oracle hard nproc  16384
Adding oracle soft stack  10240
Adding oracle hard stack  32768
Adding oracle hard memlock  134217728
Adding oracle soft memlock  134217728
Setting oracle user OS limits as per Oracle recommendations...
Altered file /etc/security/limits.conf
Original file backed up at /var/log/oracle-rdbms-server-11gR2-preinstall/backup/Oct-09-2017-18-53-12
Verifying & setting of user limits passed

Saving a copy of /etc/default/grub file in /etc/default/grub-initial.orabackup
Saving a copy of /etc/default/grub in /var/log/oracle-rdbms-server-11gR2-preinstall/backup/Oct-09-2017-18-53-12...
Verifying kernel boot parameters as per Oracle recommendations...
old boot params: "crashkernel=auto rhgb quiet"
new boot params: "crashkernel=auto rhgb quiet numa=off"

old boot params: "crashkernel=auto rhgb quiet numa=off"
new boot params: "crashkernel=auto rhgb quiet numa=off transparent_hugepage=never"

Setting kernel boot parameters as per Oracle recommendations...
G_DIR=/boot/grub2
Default kernel is ->  3.10.0-693.2.2.el7.x86_64
Default saved_entry is -> CentOS Linux (3.10.0-693.2.2.el7.x86_64) 7 (Core)
Default saved_entry_line is ->  linux16 /vmlinuz-3.10.0-693.2.2.el7.x86_64
Saving a copy of grubenv... in /var/log/oracle-rdbms-server-11gR2-preinstall/backup/Oct-09-2017-18-53-12
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-693.2.2.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-693.2.2.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-514.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-514.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-358841bb4583417589c4aa102424e4fc
Found initrd image: /boot/initramfs-0-rescue-358841bb4583417589c4aa102424e4fc.img
done
The saved kernel 3.10.0-693.2.2.el7.x86_64 is now at position - 0
Boot parameters will be effected on next reboot
Altered file /etc/default/grub
Copy of the changed file is in - /etc/default/grub-oracle-rdbms-server-11gR2-preinstall.orabackup
Copy of the original file is in - /var/log/oracle-rdbms-server-11gR2-preinstall/backup/Oct-09-2017-18-53-12
Verifying & setting of boot parameters passed

Trying to add NOZEROCONF parameter...
Taking a backup of existing file to /etc/sysconfig/network.orabackup
Successfully added parameter NOZEROCONF to /etc/sysconfig/network
Setting /etc/sysconfig/network parameters passed

Disabling Transparent Hugepages.
Refer Oracle Note:1557478.1

Disabling defrag.
Refer Oracle Note:1557478.1

Taking a backup of old config files under /var/log/oracle-rdbms-server-11gR2-preinstall/backup/Oct-09-2017-18-53-12
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90

修改oracle用戶的密碼:centos

[root@localhost yum.repos.d]# passwd oracle
Changing password for user oracle.
New password: 
BAD PASSWORD: The password is shorter than 8 characters
Retype new password: 
passwd: all authentication tokens updated successfully.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

安裝oracle數據庫

新建目錄OraDB11g並將下載好的oracle安裝包放入其中安全

[root@localhost yum.repos.d]# mkdir -p /home/OraDB11g
[root@localhost yum.repos.d]# cd /home/OraDB11g/
[root@localhost OraDB11g]#  unzip p13390677_112040_Linux-x86-64_1of7.zip
[root@localhost OraDB11g]#  unzip p13390677_112040_Linux-x86-64_2of7.zip
  • 1
  • 2
  • 3
  • 4

切換至oracle用戶,執行安裝命令bash

[root@localhost database]# su - oracle
Last login: Mon Oct  9 18:55:10 PDT 2017 on pts/1
[oracle@localhost ~]$ cd /home/OraDB11g/database/

[oracle@localhost database]$ ./runInstaller 
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 120 MB.   Actual 26804 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 3968 MB    Passed
Checking monitor: must be configured to display at least 256 colors
    >>> Could not execute auto check for display colors using command /usr/bin/xdpyinfo. Check if the DISPLAY variable is set.    Failed <<<<

Some requirement checks failed. You must fulfill these requirements before

continuing with the installation,

Continue? (y/n) [n] y


>>> Ignoring required pre-requisite failures. Continuing...
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2017-10-09_08-23-40PM. Please wait ...
DISPLAY not set. Please set the DISPLAY and try again.
Depending on the Unix Shell, you can use one of the following commands as examples to set the DISPLAY environment variable:
- For csh:              % setenv DISPLAY 192.168.1.128:0.0
- For sh, ksh and bash:     $ DISPLAY=192.168.1.128:0.0; export DISPLAY
Use the following command to see what shell is being used:
    echo $SHELL
Use the following command to view the current DISPLAY environment variable setting:
    echo $DISPLAY
- Make sure that client users are authorized to connect to the X Server.
To enable client users to access the X Server, open an xterm, dtterm or xconsole as the user that started the session and type the following command:
% xhost +
To test that the DISPLAY environment variable is set correctly, run a X11 based program that comes with the native operating system such as 'xclock':
    % <full path to xclock.. see below>
If you are not able to run xclock successfully, please refer to your PC-X Server or OS vendor for further assistance.
Typical path for xclock: /usr/X11R6/bin/xclock
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36

執行失敗並報錯DISPLAY not set. Please set the DISPLAY and try again.

這是因爲未配置圖形顯示
根據提示進行處理:

[oracle@localhost database]$ echo $SHELL
/bin/bash
[oracle@localhost database]$ echo $DISPLAY
  • 1
  • 2
  • 3
  • 4

此時確認本操做系統使用的是bash,因此使用第二種配置方式

[oracle@localhost database]$ DISPLAY=192.168.1.128:0.0; export DISPLAY
[oracle@localhost database]$ xhost +
xhost:  unable to open display "192.168.1.128:0.0"
  • 1
  • 2
  • 3

發現依然沒法使用
重置DISPLAY配置:

[oracle@localhost database]$ DISPLAY=192.168.1.128:0.0; export DISPLAY
[oracle@localhost database]$ export DISPLAY=:0
[oracle@localhost database]$ xhost +
access control disabled, clients can connect from any host
[oracle@localhost database]$ xhost + 192.168.230.141
192.168.230.141 being added to access control list
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

配置成功,開始正式安裝oracle

[oracle@localhost database]$ ./runInstaller 
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 120 MB.   Actual 25950 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 3968 MB    Passed
Checking monitor: must be configured to display at least 256 colors.    Actual 16777216    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2017-10-09_08-36-12PM. Please wait ...
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

彈出安裝界面:
將接受oracle支持項取消,下一步

這裏寫圖片描述

選擇跳過軟件自動更新服務,下一步

這裏寫圖片描述

選擇建立一個數據庫系統,下一步

這裏寫圖片描述

選擇桌面系統(我只是實驗環境,不是爲了搭建服務器環境),下一步

這裏寫圖片描述

配置默認數據庫實例,並設置密碼(我使用的是簡單密碼,因此會有警告),下一步

這裏寫圖片描述

選擇數據庫用戶分組,這裏使用默認的oinstall組,下一步

這裏寫圖片描述

自動檢測數據庫安裝環境

這裏寫圖片描述

這裏我檢測出來缺乏2個包:

  • elfutils-libelf-devel-0.97
  • pdksh-5.2.14

打包elfutils-libelf-devel

[root@localhost yum.repos.d]# yum install elfutils-libelf-devel
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package elfutils-libelf-devel.x86_64 0:0.168-8.el7 will be installed
--> Processing Dependency: pkgconfig(zlib) for package: elfutils-libelf-devel-0.168-8.el7.x86_64
--> Running transaction check
---> Package zlib-devel.x86_64 0:1.2.7-17.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===================================================================================================================================
 Package                                  Arch                      Version                          Repository               Size
===================================================================================================================================
Installing:
 elfutils-libelf-devel                    x86_64                    0.168-8.el7                      base                     37 k
Installing for dependencies:
 zlib-devel                               x86_64                    1.2.7-17.el7                     base                     50 k

Transaction Summary
===================================================================================================================================
Install  1 Package (+1 Dependent package)

Total download size: 87 k
Installed size: 163 k
Is this ok [y/d/N]: y
Downloading packages:
(1/2): zlib-devel-1.2.7-17.el7.x86_64.rpm                                                                   |  50 kB  00:00:00     
(2/2): elfutils-libelf-devel-0.168-8.el7.x86_64.rpm                                                         |  37 kB  00:00:00     
-----------------------------------------------------------------------------------------------------------------------------------
Total                                                                                              295 kB/s |  87 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : zlib-devel-1.2.7-17.el7.x86_64                                                                                  1/2 
  Installing : elfutils-libelf-devel-0.168-8.el7.x86_64                                                                        2/2 
  Verifying  : zlib-devel-1.2.7-17.el7.x86_64                                                                                  1/2 
  Verifying  : elfutils-libelf-devel-0.168-8.el7.x86_64                                                                        2/2 

Installed:
  elfutils-libelf-devel.x86_64 0:0.168-8.el7                                                                                       

Dependency Installed:
  zlib-devel.x86_64 0:1.2.7-17.el7                                                                                                 

Complete!

[root@localhost yum.repos.d]# yum install pdksh
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
No package pdksh available.
Error: Nothing to do
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61

發現elfutils-libelf-devel包成功打上,可是pdksh包沒法找到。
我去centos的官網上搜索也沒找到這個包。後察知這個pdksh包早已棄用,被ksh包代替。只要系統中包含了ksh包就能夠忽略這個警告

檢查ksh是否存在:

[root@localhost yum.repos.d]# yum install ksh
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Package ksh-20120801-34.el7.x86_64 already installed and latest version
Nothing to do
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

點選check again,如今只剩一個警告了,選擇忽略所有,下一步

這裏寫圖片描述

觀看生成的簡報,確認配置無誤後,下一步

這裏寫圖片描述

彈出信息,確認默認實例的配置狀況以及em鏈接方式,下一步

這裏寫圖片描述

此時彈出提示,須要打開新的窗口按指示執行sh語句

這裏寫圖片描述

[root@localhost ~]# /home/oracle/app/oraInventory/orainstRoot.sh
Changing permissions of /home/oracle/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /home/oracle/app/oraInventory to oinstall.
The execution of the script is complete.
[root@localhost ~]# /home/oracle/app/oracle/product/11.2.0/dbhome_1/root.sh 
Performing root user operation for Oracle 11g 

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /home/oracle/app/oracle/product/11.2.0/dbhome_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.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26

完成後點擊ok,開始正式安裝,完成後畫面以下圖,關閉窗口

這裏寫圖片描述

配置環境變量

切換至oracle配置環境變量

[root@localhost ~]# su - oracle
Last login: Mon Oct  9 23:18:12 PDT 2017 on pts/3
[oracle@localhost ~]$ ls -a
.  ..  app  .bash_history  .bash_logout  .bash_profile  .bashrc  .cache  .config  .kshrc  .mozilla
[oracle@localhost ~]$ vim .bash_profile 

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH


export ORACLE_SID=orcl
export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_1
export PATH=$ORACLE_HOME/bin:$PATH


[oracle@localhost ~]$ source .bash_profile
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26

驗證

使用oracle自帶的交互工具鏈接數據庫

[oracle@localhost ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon Oct 9 23:26:45 2017

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select status from v$instance;

STATUS
------------
OPEN
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16

參考如何簡化 Oracle Linux 6 上的 Oracle Database 11g 安裝
參考Oracle 公共 yum 信息庫
參考Oracle 數據庫11g文檔

相關文章
相關標籤/搜索