linux安装oracle12C客户端(适用于18C和19C)

安装过程目录

  • linux6及以上版本安装oracle 12C过程(适用于18C和19C)
    • 安装前环境准备
    • 安装过程
    • 复制客户端到其他服务器

linux6及以上版本安装oracle 12C过程(适用于18C和19C)

部门开发和测试的两台web环境在刀片机上运行了将近11年,之前使用配p2v迁移软件迁移到vmvare的虚拟机上中途报错,报错内容为 an error occurred during the conversion: ‘keeponebootentry: there is matching kernel modules for kernel /boot/xen,gz-2.6.18-8.el5’,查资料为vmvare虚拟环境不支持xen的内核。没有办法只能重新搭建环境,顺便装版本高一点的操作系统和软件。

  1. 操作系统安装时间
gztvtest/root>fdisk -l

Disk /dev/cciss/c0d0: 146.7 GB, 146778685440 bytes
255 heads, 63 sectors/track, 17844 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

           Device Boot      Start         End      Blocks   Id  System
/dev/cciss/c0d0p1   *           1         637     5116671   83  Linux
/dev/cciss/c0d0p2             638        1912    10241437+  83  Linux
/dev/cciss/c0d0p3            1913        2549     5116702+  83  Linux
/dev/cciss/c0d0p4            2550       17844   122857087+   5  Extended
/dev/cciss/c0d0p5            2550        3059     4096543+  82  Linux swap / Solaris
/dev/cciss/c0d0p6            3060       15804   102374181   8e  Linux LVM
/dev/cciss/c0d0p7           15805       16314     4096543+  83  Linux
/dev/cciss/c0d0p8           16315       16824     4096543+  83  Linux
/dev/cciss/c0d0p9           16825       17334     4096543+  83  Linux
/dev/cciss/c0d0p10          17335       17844     4096543+  83  Linux
gztvtest/root> tune2fs -l /dev/cciss/c0d0p1 | grep create
Filesystem created:       Thu Jul 24 02:29:56 2008

系统是2008年7月安装的,到现在为止已经11年。果然很老了,机房刀片机能跑这么久也是佩服(散热,噪音,耗电也是这种老机器的特点)

  1. P2V虚拟机迁移报错
    报错内容为 an error occurred during the conversion: ‘keeponebootentry: there is matching kernel modules for kernel /boot/xen,gz-2.6.18-8.el5’,
    linux安装oracle12C客户端(适用于18C和19C)_第1张图片
    报错内容

安装前环境准备

  1. 操作系统:redhat 6.5
  2. 客户端软件:
    instantclient-basic-linux.x64-12.2.0.1.0.zip
    instantclient-tools-linux.x64-12.2.0.1.0.zip
    instantclient-sqlplus-linux.x64-12.2.0.1.0.zip
    instantclient-sdk-linux.x64-12.2.0.1.0.zip
    instantclient-odbc-linux.x64-12.2.0.1.0-2.zip
    instantclient-jdbc-linux.x64-12.2.0.1.0.zip
    instantclient-basiclite-linux.x64-12.2.0.1.0.zip
    下载地址:Instant Client for Linux x86-64 (64-bit)

安装过程

  1. 下载安装包
    官网地址有.zip安装包和rpm安装包,这里下载的是.zip压缩安装包,整个过程也是用解压的方式安装的。
    linux安装oracle12C客户端(适用于18C和19C)_第2张图片
    官网选择安装的包

    我这里选择把全部包都下载下来了,以免有些功能到时候不支持。
  2. 配置主机名和IP的映射
[root@web1 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

10.16.19.2  web1 
  1. 创建oracle用户并改密码
[root@web1 ~]# useradd oracle
[root@web1 ~]# passwd oracle
Changing password for user oracle.
New password: oracle
BAD PASSWORD: it is based on a dictionary word
BAD PASSWORD: is too simple
Retype new password: oracle
passwd: all authentication tokens updated successfully.

这里创建用户可以按照特定要求创建,比如UID,相关组等。

  1. 上传软件并修改目录的用户属性
sftp> lcd d:/
sftp> cd /oracle/
sftp> put  instantclient-basic-linux.x64-12.2.0.1.0.zip 
sftp> put  instantclient-sqlplus-linux.x64-12.2.0.1.0.zip 
sftp> put  instantclient-basiclite-linux.x64-12.2.0.1.0.zip 
sftp> put  instantclient-jdbc-linux.x64-12.2.0.1.0.zip 
sftp> put  instantclient-odbc-linux.x64-12.2.0.1.0-2.zip 
sftp> put  instantclient-tools-linux.x64-12.2.0.1.0.zip 
[root@web1 ~]# chown oracle:oracle -R /oracle/
  1. 切换到oracle用户然后解压
[root@web1 ~]# su - oracle
[root@web1 ~]# cd /oracle 
[root@web1 oracle]# unzip instantclient-basic-linux.x64-12.2.0.1.0.zip 
[root@web1 oracle]# unzip instantclient-sqlplus-linux.x64-12.2.0.1.0.zip 
[root@web1 oracle]# unzip instantclient-basiclite-linux.x64-12.2.0.1.0.zip 
[root@web1 oracle]# unzip instantclient-jdbc-linux.x64-12.2.0.1.0.zip 
[root@web1 oracle]# unzip instantclient-odbc-linux.x64-12.2.0.1.0-2.zip 
[root@web1 oracle]# unzip instantclient-tools-linux.x64-12.2.0.1.0.zip 

注意:
这里需要先解压instantclient-basic-linux.x64-12.2.0.1.0.zip基础包

  1. 配置tns
[oracle@web1 instantclient_12_2]$ pwd
/oracle/instantclient_12_2
[oracle@web1 instantclient_12_2]$ mkdir -p network/admin
[oracle@web1 ~]$ cd /oracle/instantclient_12_2/
[oracle@web1 instantclient_12_2]$ cd network/admin/
[oracle@web1 admin]$ vi tnsnames.ora 
gdvassp =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.16.9.69)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SID = gdvassp)
      (SERVER = DEDICATED)
    )
  )
  1. 设置环境变量
[oracle@web1 ~]$ cd
[oracle@web1 ~]$ pwd
/home/oracle
[oracle@web1 ~]$ cat .bash_profile 
# .bash_profile

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

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export ORACLE_BASE=/oracle
export ORACLE_HOME=/oracle/instantclient_12_2
export LD_LIBRARY_PATH=$ORACLE_HOM/lib
export  LD_LIBRARY_PATH=$ORACLE_HOME:$LD_LIBRARY_PATH
export TNS_ADMIN=$ORACLE_HOME/network/admin
export NLS_LANG=american_america.zhs16gbk
export PATH=$ORACLE_HOME:$PATH:
[oracle@web1 ~]$ source  .bash_profile 
  1. 测试数据库连接
[oracle@web1 ~]$ sqlplus scott/scott@gdvassp    

SQL*Plus: Release 12.2.0.1.0 Production on Wed Aug 21 16:25:53 2019

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


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

SQL>

到这里能正常连接测试开发数据库,表示客户端安装成功了。

复制客户端到其他服务器

如果想安装下一台可以把这个安装路径打成一个压缩包,然后上传到其他机器解压配置下环境变量后也可以直接用这个客户端。

[root@web1 oracle]#  tar -zcvf instantclient_12_2.tar.gz instantclient_12_2
instantclient_12_2/
instantclient_12_2/sqlplus
instantclient_12_2/genezi
instantclient_12_2/SQLPLUS_README
instantclient_12_2/libclntsh.so.12.1
instantclient_12_2/libnnz12.so
instantclient_12_2/network/
instantclient_12_2/network/admin/
instantclient_12_2/network/admin/tnsnames.ora
instantclient_12_2/ODBC_IC_Readme_Unix.html
instantclient_12_2/orai18n-mapping.jar
instantclient_12_2/libocijdbc12.so
instantclient_12_2/glogin.sql
instantclient_12_2/libheteroxa12.so
instantclient_12_2/libocci.so.12.1
instantclient_12_2/impdp
instantclient_12_2/libipc1.so
instantclient_12_2/liboramysql12.so
instantclient_12_2/libsqora.so.12.1
instantclient_12_2/BASIC_LITE_README
instantclient_12_2/libociei.so
instantclient_12_2/exp
instantclient_12_2/TOOLS_README
instantclient_12_2/libmql1.so
instantclient_12_2/adrci
instantclient_12_2/libsqlplus.so
instantclient_12_2/imp
instantclient_12_2/JDBC_README
instantclient_12_2/help/
instantclient_12_2/help/us/
instantclient_12_2/help/us/toc.htm
instantclient_12_2/help/us/img/
instantclient_12_2/help/us/img/odbcmodel.gif
instantclient_12_2/help/us/img/setup_work.gif
instantclient_12_2/help/us/img/odbcdrvarch.gif
instantclient_12_2/help/us/img/setup_ssmig.gif
instantclient_12_2/help/us/img/setup_app.gif
instantclient_12_2/help/us/img/setup_ora.gif
instantclient_12_2/help/us/sqora.htm
instantclient_12_2/help/us/blafdoc.css
instantclient_12_2/help/us/map.xml
instantclient_12_2/help/us/img_text/
instantclient_12_2/help/us/img_text/setup_work.htm
instantclient_12_2/help/us/img_text/setup_app.htm
instantclient_12_2/help/us/img_text/odbcdrvarch.htm
instantclient_12_2/help/us/img_text/setup_ssmig.htm
instantclient_12_2/help/us/img_text/odbcmodel.htm
instantclient_12_2/help/us/img_text/setup_ora.htm
instantclient_12_2/help/us/cpyr.htm
instantclient_12_2/help/us/oracle.gif
instantclient_12_2/help/us/META-INF/
instantclient_12_2/help/us/META-INF/MANIFEST.MF
instantclient_12_2/help/ja/
instantclient_12_2/help/ja/toc.htm
instantclient_12_2/help/ja/img/
instantclient_12_2/help/ja/img/odbcmodel.gif
instantclient_12_2/help/ja/img/setup_work.gif
instantclient_12_2/help/ja/img/odbcdrvarch.gif
instantclient_12_2/help/ja/img/setup_ssmig.gif
instantclient_12_2/help/ja/img/setup_app.gif
instantclient_12_2/help/ja/img/setup_ora.gif
instantclient_12_2/help/ja/sqora.htm
instantclient_12_2/help/ja/blafdoc.css
instantclient_12_2/help/ja/map.xml
instantclient_12_2/help/ja/img_text/
instantclient_12_2/help/ja/img_text/setup_work.htm
instantclient_12_2/help/ja/img_text/setup_app.htm
instantclient_12_2/help/ja/img_text/odbcdrvarch.htm
instantclient_12_2/help/ja/img_text/setup_ssmig.htm
instantclient_12_2/help/ja/img_text/odbcmodel.htm
instantclient_12_2/help/ja/img_text/setup_ora.htm
instantclient_12_2/help/ja/cpyr.htm
instantclient_12_2/help/ja/oracle.gif
instantclient_12_2/help/ja/META-INF/
instantclient_12_2/help/ja/META-INF/MANIFEST.MF
instantclient_12_2/libsqlplusic.so
instantclient_12_2/BASIC_README
instantclient_12_2/libons.so
instantclient_12_2/odbc_update_ini.sh
instantclient_12_2/expdp
instantclient_12_2/wrc
instantclient_12_2/xstreams.jar
instantclient_12_2/libclntshcore.so.12.1
instantclient_12_2/ojdbc8.jar
instantclient_12_2/uidrvci
instantclient_12_2/libnfsodm12.so
instantclient_12_2/orai18n.jar
instantclient_12_2/sqlldr

[root@web1 oracle]# ll
total 175812
drwxrwxr-x. 4 oracle oracle     4096 Aug 21 15:53 instantclient_12_2
-rw-r--r--. 1 root   root   73191540 Aug 22 10:28 instantclient_12_2.tar.gz
上传到其他服务解压后配置下环境变量就可以直接用了

你可能感兴趣的:(linux,oracle)