当前位置:   article > 正文

CentOS7静默安装oracle_attempting to create directory perl5

attempting to create directory perl5

一.准备工作

 1. centos7服务器一台(自备)

 2. oracle安装包

      官方下载地址:http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html

      根据自己服务器的情况选择对应的安装包下载,以我的为例,是64位操作系统的。下载完成后,有两个压缩文件linux.x64_11gR2_database_1of2.zip 和 linux.x64_11gR2_database_2of2.zip

3.安装位置的选择

      oracle尽量安装在剩余空间充足的位置,因此首先要查看服务器硬盘情况,如下:

  1. [root@bogon ~]# df -h
  2. Filesystem Size Used Avail Use% Mounted on
  3. /dev/mapper/centos-root 50G 8.5G 42G 17% /
  4. devtmpfs 16G 0 16G 0% /dev
  5. tmpfs 16G 0 16G 0% /dev/shm
  6. tmpfs 16G 9.0M 16G 1% /run
  7. tmpfs 16G 0 16G 0% /sys/fs/cgroup
  8. /dev/sda1 1014M 180M 835M 18% /boot
  9. /dev/mapper/centos-home 142G 37M 142G 1% /home
  10. tmpfs 3.2G 40K 3.2G 1% /run/user/0
  11. /dev/sdb1 493G 825M 467G 1% /data

      对比后发现/data余量最大,因此决定将oracle安装在/data目录

4.上传安装包

      把下载下来的两个安装包通过xftp上传到/data目录(开始上传后继续执行后边的目录即可,无需等待上传完成)。

5.安装依赖包

      安装依赖包之前,建议将yum源修改为aliyun源,下载速度快些:

  1. [root@iz8vb8edqeyilgy4r9zci6z ~]# cd /etc
  2. [root@iz8vb8edqeyilgy4r9zci6z etc]# mv yum.repos.d yum.repos.d.bak
  3. [root@iz8vb8edqeyilgy4r9zci6z etc]# mkdir yum.repos.d
  4. [root@iz8vb8edqeyilgy4r9zci6z etc]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
  5. --2019-01-25 09:15:40-- http://mirrors.aliyun.com/repo/Centos-7.repo
  6. Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 101.37.183.142, 101.37.183.145, 101.37.183.169, ...
  7. Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|101.37.183.142|:80... connected.
  8. HTTP request sent, awaiting response... 200 OK
  9. Length: 2523 (2.5K) [application/octet-stream]
  10. Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’
  11. 100%[=========================================================================================================================================================>] 2,523 --.-K/s in 0s
  12. 2019-01-25 09:15:40 (289 MB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [2523/2523]
  13. [root@iz8vb8edqeyilgy4r9zci6z etc]# yum clean all
  14. Loaded plugins: fastestmirror
  15. Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
  16. Cleaning repos: base extras updates
  17. Cleaning up everything
  18. Cleaning up list of fastest mirrors
  19. [root@iz8vb8edqeyilgy4r9zci6z etc]# yum makecache
  20. Loaded plugins: fastestmirror
  21. base | 3.6 kB 00:00:00
  22. extras | 3.4 kB 00:00:00
  23. updates | 3.4 kB 00:00:00
  24. (1/12): base/7/x86_64/group_gz | 166 kB 00:00:00
  25. (2/12): base/7/x86_64/primary_db | 6.0 MB 00:00:00
  26. (3/12): base/7/x86_64/filelists_db | 7.1 MB 00:00:00
  27. (4/12): base/7/x86_64/other_db | 2.6 MB 00:00:00
  28. (5/12): extras/7/x86_64/prestodelta | 36 kB 00:00:00
  29. (6/12): extras/7/x86_64/filelists_db | 189 kB 00:00:00
  30. (7/12): extras/7/x86_64/primary_db | 156 kB 00:00:00
  31. (8/12): extras/7/x86_64/other_db | 107 kB 00:00:00
  32. (9/12): updates/7/x86_64/prestodelta | 190 kB 00:00:00
  33. (10/12): updates/7/x86_64/filelists_db | 1.4 MB 00:00:00
  34. (11/12): updates/7/x86_64/primary_db | 1.3 MB 00:00:00
  35. (12/12): updates/7/x86_64/other_db | 204 kB 00:00:00
  36. Determining fastest mirrors
  37. * base: mirrors.cloud.aliyuncs.com
  38. * extras: mirrors.cloud.aliyuncs.com
  39. * updates: mirrors.cloud.aliyuncs.com
  40. Metadata Cache Created

 修改成功后,安装如下依赖包:

yum -y install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel expat gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers libaio libaio-devel libgcc libstdc++ libstdc++-devel make pdksh sysstat unixODBC unixODBC-devel

安装完成后界面如下:

使用如下命令检查依赖是否安装完整:

rpm -q binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel expat gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers libaio libaio-devel libgcc libstdc++ libstdc++-devel make pdksh sysstat unixODBC unixODBC-devel | grep "not installed"

发现pdksh没有安装,如下图:

通过wget命令直接下载pdksh的rpm包,我下载到了/tmp/,然后安装

  1. [root@bogon ~]# wget -O /tmp/pdksh-5.2.14-37.el5_8.1.x86_64.rpm http://vault.centos.org/5.11/os/x86_64/CentOS/pdksh-5.2.14-37.el5_8.1.x86_64.rpm
  2. --2019-01-25 09:31:23-- http://vault.centos.org/5.11/os/x86_64/CentOS/pdksh-5.2.14-37.el5_8.1.x86_64.rpm
  3. Resolving vault.centos.org (vault.centos.org)... 208.100.23.71, 2607:f128:40:1600:225:90ff:fe00:bde6
  4. Connecting to vault.centos.org (vault.centos.org)|208.100.23.71|:80... connected.
  5. HTTP request sent, awaiting response... 302 Found
  6. Location: http://120.52.51.16/vault.centos.org/5.11/os/x86_64/CentOS/pdksh-5.2.14-37.el5_8.1.x86_64.rpm [following]
  7. --2019-01-25 09:31:24-- http://120.52.51.16/vault.centos.org/5.11/os/x86_64/CentOS/pdksh-5.2.14-37.el5_8.1.x86_64.rpm
  8. Connecting to 120.52.51.16:80... connected.
  9. HTTP request sent, awaiting response... 200 OK
  10. Length: 210877 (206K) [application/x-rpm]
  11. Saving to: ‘/tmp/pdksh-5.2.14-37.el5_8.1.x86_64.rpm’
  12. 100%[=========================================================================================================================================================>] 210,877 --.-K/s in 0.03s
  13. 2019-01-25 09:31:24 (7.63 MB/s) - ‘/tmp/pdksh-5.2.14-37.el5_8.1.x86_64.rpm’ saved [210877/210877]
  14. [root@bogon ~]# cd /tmp/
  15. [root@bogon tmp]# rpm -ivh pdksh-5.2.14-37.el5_8.1.x86_64.rpm
  16. warning: pdksh-5.2.14-37.el5_8.1.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID e8562897: NOKEY
  17. Preparing... ################################# [100%]
  18. Updating / installing...
  19. 1:pdksh-5.2.14-37.el5_8.1 ################################# [100%]

再次检查依赖包是否安装完整

rpm -q binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel expat gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers libaio libaio-devel libgcc libstdc++ libstdc++-devel make pdksh sysstat unixODBC unixODBC-devel | grep "not installed"

 发现所有依赖都已经安装完毕,至此依赖包安装完成

6.添加oracle用户组和用户

      设置密码时pssswd oracle后直接输密码回车即可。

  1. [root@bogon tmp]# groupadd oinstall
  2. [root@bogon tmp]# groupadd dba
  3. [root@bogon tmp]# useradd -g oinstall -G dba oracle -d /home/oracle
  4. [root@bogon tmp]# passwd oracle
  5. Changing password for user oracle.
  6. New password:
  7. BAD PASSWORD: The password is shorter than 8 characters
  8. Retype new password:
  9. passwd: all authentication tokens updated successfully.
  10. [root@bogon tmp]# id oracle
  11. uid=1001(oracle) gid=1001(oinstall) groups=1001(oinstall),1002(dba)

7.配置hostname

  1. [root@bogon tmp]# vim /etc/hosts
  2. # 编辑状态添加如下内容
  3. 192.168.14.107 oracle
  4. [root@bogon tmp]# ping -c 2 oracle
  5. PING oracle (192.168.14.107) 56(84) bytes of data.
  6. 64 bytes from oracle (192.168.14.107): icmp_seq=1 ttl=64 time=0.049 ms
  7. 64 bytes from oracle (192.168.14.107): icmp_seq=2 ttl=64 time=0.032 ms
  8. --- oracle ping statistics ---
  9. 2 packets transmitted, 2 received, 0% packet loss, time 999ms
  10. rtt min/avg/max/mdev = 0.032/0.040/0.049/0.010 ms

8.优化OS内核参数

      kernel.shmmax 参数设置为物理内存的一半

  1. [root@bogon tmp]# vim /etc/sysctl.conf
  2. # 编辑状态输入如下内容/或修改对应的值
  3. fs.aio-max-nr=1048576
  4. fs.file-max=6815744
  5. kernel.shmall=2097152
  6. kernel.shmmni=4096
  7. kernel.shmmax = 8589934592
  8. kernel.sem=250 32000 100 128
  9. net.ipv4.ip_local_port_range=9000 65500
  10. net.core.rmem_default=262144
  11. net.core.rmem_max=4194304
  12. net.core.wmem_default=262144
  13. net.core.wmem_max=1048586
  14. [root@bogon tmp]# sysctl -p
  15. fs.aio-max-nr = 1048576
  16. fs.file-max = 6815744
  17. kernel.shmall = 2097152
  18. kernel.shmmni = 4096
  19. kernel.shmmax = 8589934592
  20. kernel.sem = 250 32000 100 128
  21. net.ipv4.ip_local_port_range = 9000 65500
  22. net.core.rmem_default = 262144
  23. net.core.rmem_max = 4194304
  24. net.core.wmem_default = 262144
  25. net.core.wmem_max = 1048586

9.创建oracle安装目录

  1. [root@bogon data]# mkdir -p /data/oracle/oracle/product/11.2.0
  2. [root@bogon data]# mkdir /data/oracle/oracle/oradata
  3. [root@bogon data]# mkdir /data/oracle/oracle/inventory
  4. [root@bogon data]# mkdir /data/oracle/oracle/fast_recovery_area
  5. # 修改文件夹从属
  6. [root@bogon data]# chown -R oracle:oinstall /data/oracle/oracle/
  7. # 修改权限
  8. [root@bogon data]# chmod -R 775 /data/oracle/oracle/

10.配置oracle用户环境变量

  1. [root@bogon data]# su - oracle
  2. Attempting to create directory /home/oracle/perl5
  3. [oracle@bogon ~]$ vim .bash_profile
  4. # 进入编辑状态后添加如下代码
  5. umask 022
  6. export ORACLE_HOSTNAME=oracle
  7. export ORACLE_BASE=/data/oracle/oracle
  8. export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/
  9. export ORACLE_SID=ORCL
  10. export PATH=.:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$ORACLE_HOME/jdk/bin:$PATH
  11. export LC_ALL="en_US"
  12. export LANG="en_US"
  13. export NLS_LANG="AMERICAN_AMERICA.ZHS16GBK"
  14. export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"
  15. [oracle@bogon ~]$ source .bash_profile

此步完成建议重启一下服务器,如果未重启,进行下边操作的时候先切换回root用户 

11.解压oracle压缩文件,进行安装前的配置

  1. [root@bogon data]# cd /data
  2. [root@bogon data]# unzip linux.x64_11gR2_database_1of2.zip -d /data/oracle/
  3. [root@bogon data]# unzip linux.x64_11gR2_database_2of2.zip -d /data/oracle/
  4. # 解压完成后进行安装前的配置
  5. [root@bogon data]# mkdir /data/oracle/etc
  6. [root@bogon data]# cp /data/oracle/database/response/* /data/oracle/etc/
  7. [root@bogon data]# vim /data/oracle/etc/db_install.rsp
  8. # 进入编辑状态修改如下项的值
  9. oracle.install.option=INSTALL_DB_SWONLY
  10. DECLINE_SECURITY_UPDATES=true
  11. UNIX_GROUP_NAME=oinstall
  12. INVENTORY_LOCATION=/data/oracle/oracle/inventory
  13. SELECTED_LANGUAGES=en,zh_CN
  14. ORACLE_HOSTNAME=oracle
  15. ORACLE_HOME=/data/oracle/oracle/product/11.2.0
  16. ORACLE_BASE=/data/oracle/oracle
  17. oracle.install.db.InstallEdition=EE
  18. oracle.install.db.isCustomInstall=true
  19. oracle.install.db.DBA_GROUP=dba
  20. oracle.install.db.OPER_GROUP=dba

二.安装

1.执行静默安装

  1. su - oracle
  2. cd /data/oracle/database
  3. # 可以看见database文件夹下有三个模板其中dbca.rsp是用来创建数据库的。db_install.rsp是用来安装Oracle软件的。netca.rsp是用来创建监听器的
  4. ./runInstaller -silent -ignorePrereq -responseFile /data/oracle/etc/db_install.rsp

      正常会进入如下过程: 

      最下边一行为日志文件的位置,安装过程中可以通过tail -f xxx.log查看当前日志,当前情况如下
      tail -f /data/oracle/oracle/inventory/logs/installActions2019-01-25_10-41-53AM.log

      安装成功后情况如下:

      

按照上边提示的内容进行操作:

1.打开一个新的shell窗口

2. 登录root账号

3.执行脚本(脚本位置在红框前两行有标注)

4.回到当前窗口按回车

  1. [root@bogon ~]# sh /data/oracle/oracle/inventory/orainstRoot.sh
  2. Changing permissions of /data/oracle/oracle/inventory.
  3. Adding read,write permissions for group.
  4. Removing read,write,execute permissions for world.
  5. Changing groupname of /data/oracle/oracle/inventory to oinstall.
  6. The execution of the script is complete.
  7. [root@bogon ~]# sh /data/oracle/oracle/product/11.2.0/root.sh
  8. Check /data/oracle/oracle/product/11.2.0/install/root_bogon_2019-01-25_10-51-48.log for the output of root script

2.配置静默监听 

      在另外一个窗口用root执行那两个脚本后,之前oracle的窗口需要关掉重新开,否则监听配置不成功

  1. [root@bogon ~]# su - oracle
  2. Last login: Fri Jan 25 10:40:23 CST 2019 on pts/0
  3. [oracle@bogon ~]$ netca /silent /responsefile /data/oracle/etc/netca.rsp
  4. Parsing command line arguments:
  5. Parameter "silent" = true
  6. Parameter "responsefile" = /data/oracle/etc/netca.rsp
  7. Done parsing command line arguments.
  8. Oracle Net Services Configuration:
  9. Profile configuration complete.
  10. Listener "LISTENER" already exists.
  11. Oracle Net Services configuration successful. The exit code is 0

3.静默创建数据库 

  注:修改配置文件为root用户,静默建库为oracle用户

  1. [root@bogon ~]# vim /data/oracle/etc/dbca.rsp
  2. # 修改如下配置
  3. GDBNAME = "orcl"
  4. SID = "orcl"
  5. SYSPASSWORD = "oracle"
  6. SYSTEMPASSWORD = "oracle"
  7. SYSMANPASSWORD = "oracle"
  8. DBSNMPPASSWORD = "oracle"
  9. DATAFILEDESTINATION =/data/oracle/oracle/oradata
  10. RECOVERYAREADESTINATION=/data/oracle/oracle/fast_recovery_area
  11. CHARACTERSET = "AL32UTF8"
  12. TOTALMEMORY = "1638"

      修改完成后执行静默建库 GDBNAME为ORCL

[oracle@bogon etc]$ dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbName ORCL -sysPassword oracle -systemPassword oracle

4.查看监听状态

  1. [oracle@iz8vb8edqeyilgy4r9zci6z ~]$ lsnrctl status
  2. LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 25-JAN-2019 16:28:33
  3. Copyright (c) 1991, 2009, Oracle. All rights reserved.
  4. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
  5. STATUS of the LISTENER
  6. ------------------------
  7. Alias LISTENER
  8. Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
  9. Start Date 26-DEC-2018 23:40:53
  10. Uptime 29 days 16 hr. 47 min. 40 sec
  11. Trace Level off
  12. Security ON: Local OS Authentication
  13. SNMP OFF
  14. Listener Parameter File /data/oracle/oracle/product/11.2.0/network/admin/listener.ora
  15. Listener Log File /data/oracle/oracle/diag/tnslsnr/iz8vb8edqeyilgy4r9zci6z/listener/alert/log.xml
  16. Listening Endpoints Summary...
  17. (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  18. (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=iz8vb8edqeyilgy4r9zci6z)(PORT=1521)))
  19. Services Summary...
  20. Service "ORCL" has 1 instance(s).
  21. Instance "ORCL", status READY, has 1 handler(s) for this service...
  22. Service "orclXDB" has 1 instance(s).
  23. Instance "ORCL", status READY, has 1 handler(s) for this service...
  24. The command completed successfully

5.启动数据库

需要先将/usr/local/oracle/admin/test/pfile/init.ora.1014201721194复制修改名称放到/usr/local/oracle/product/11.2.0/dbs/initORCL.ora

  1. [oracle@iz8vb8edqeyilgy4r9zci6z ~]$ sqlplus / as sysdba
  2. SQL*Plus: Release 11.2.0.1.0 Production on Fri Jan 25 16:30:40 2019
  3. Copyright (c) 1982, 2009, Oracle. All rights reserved.
  4. Connected to an idle instance.
  5. SQL> startup
  6. ORACLE instance started.
  7. Total System Global Area 3273641984 bytes
  8. Fixed Size 2217792 bytes
  9. Variable Size 1795164352 bytes
  10. Database Buffers 1459617792 bytes
  11. Redo Buffers 16642048 bytes
  12. Database mounted.
  13. Database opened.

      在此步骤经常遇到的问题:

      ORA-00845: MEMORY_TARGET not supported on this system 参考https://blog.csdn.net/sunny05296/article/details/56495599

      ORA-01102  cannot mount database in EXCLUSIVE mode  参考  https://blog.csdn.net/lzwgood/article/details/26368323

6.开端口号 

  1. [oracle@iz8vb8edqeyilgy4r9zci6z ~]$ firewall-cmd --zone=public --add-port=1521/tcp --permanent
  2. [oracle@iz8vb8edqeyilgy4r9zci6z ~]$ firewall-cmd --reload

7.修改charset 

    参考https://blog.csdn.net/yixia/article/details/4029822

 

本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号