虚拟机Linux下Oracle11g客户端安装

Linux 专栏收录该内容
17 篇文章 0 订阅

服务器:Windows Server 2008

Oracle数据库版本:Oracle11g

本机系统:Winows 7专业版

虚拟机:VMware Workstation

虚拟机系统:CentOs-6.2

 

step0: 软件下载

网址:http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html

分别下载三个文件:

1instantclient-basic-linux.x64-11.2.0.4.0.zip (60,704,657 bytes) (cksum - 41267059)

2instantclient-sqlplus-linux.x64-11.2.0.4.0.zip (834,491 bytes) (cksum - 2262912957)

3instantclient-sdk-linux.x64-11.2.0.4.0.zip (643,089 bytes) (cksum - 3927039586)

或者

1oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm (59,865,008 bytes) (cksum - 526022028)

2oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.rpm (828,333 bytes) (cksum - 955935608)

3oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm (610,222 bytes) (cksum - 2481040260)

 

step1: 创建3个客户端安装目录

[root@localhost ~]# mkdir -p /opt/oracle/lib

[root@localhost ~]# mkdir -p /opt/oracle/sdk

[root@localhost ~]# mkdir -p /opt/oracle/network/admin

注:创建三个客户端的安装目录,这三个目录可以自定义,但配置环境变量时,需要一致

 

step2: 文件解压

[root@localhost Downloads]# unzip instantclient-sqlplus-linux.x64-11.2.0.3.0.zip

[root@localhost Downloads]# unzip instantclient-sqlplus-linux.x64-11.2.0.3.0.zip

(注1:这两个文件都会默认的解压到同一个目录instantclient_11_2下面。)

[root@localhost Downloads]# cp -Rf instantclient_11_2/* /opt/oracle/lib/  #将目录下的所有文件拷贝到/opt/oracle/lib/

 

[root@localhost Downloads]# unzip instantclient-sdk-linux.x64-11.2.0.3.0

(注2:这个文件也会默认的解压到同一个目录instantclient_11_2下面,且解压后的文件都在sdk目录下。)

[root@localhost instantclient_11_2]# cp -Rf sdk/*  /opt/oracle/sdk/  #将目录下的所有文件拷贝到/opt/oracle/sdk/

 

step3: 配置环境变量

 [root@localhost Downloads]vim /etc/profile  #注意,这是针对所有用户的环境变量,如果你想局限某用户,只能配置用户的配置文件了。

末尾加入:

export ORACLE_HOME=/opt/oracle

      export LD_LIBRARY_PATH=/opt/oracle/lib

保存并退出。然后,

[root@localhost tmp]# source /etc/profile         #使配置文件立刻生效

[root@localhost tmp]# echo $ORACLE_HOME      #查看一下配置的环境变量是否成功

 /opt/oracle  

 

step4: 配置监听器和网络环境

因为本地没有安装oracle 数据库,所以需要从安装oracle 数据库的目录取三个文件过来。一般位于Oracle数据库服务端,路径位于:

*:\app\Administrator\product\11.2.0\dbhome_1\NETWORK\ADMIN

三个文件名分别为:listener.orasqlnet.oratnsnames.ora

将其放置在:/opt/oracle/network/admin

[root@localhost admin]# pwd

/opt/oracle/network/admin

[root@localhost admin]# ls

  listener.ora  sqlnet.ora  tnsnames.ora       //就这三个文件,放到这个目录下

 

 

step5: 修改step4中的三个文件

原文件格式如下:

[root@localhost admin]#vim listener.ora  ###########  原文件A

# listener.ora Network Configuration File: E:\app\Administrator\product\11.2.0\dbhome_1\network\admin\listener.ora

# Generated by Oracle configuration tools.

 

SID_LIST_LISTENER =

  (SID_LIST =

    (SID_DESC =

      (SID_NAME = CLRExtProc)

      (ORACLE_HOME = E:\app\Administrator\product\11.2.0\dbhome_1)  

      (PROGRAM = extproc)

      (ENVS = "EXTPROC_DLLS=ONLY:E:\app\Administrator\product\11.2.0\dbhome_1\bin\oraclr11.dll")

    )

  )

 

LISTENER =

  (DESCRIPTION_LIST =

    (DESCRIPTION =

      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))

      (ADDRESS = (PROTOCOL = TCP)(HOST = WIN-V1FEBFA7UA0)(PORT = 1521))

    )

  )

 

ADR_BASE_LISTENER = E:\app\Administrator

[root@localhost admin]#vim sqlnet.ora         ###########  原文件B

# sqlnet.ora Network Configuration File: E:\app\Administrator\product\11.2.0\dbhome_1\network\admin\sqlnet.ora

# Generated by Oracle configuration tools.

 

# This file is actually generated by netca. But if customers choose to

# install "Software Only", this file wont exist and without the native

# authentication, they will not be able to connect to the database on NT.

 

SQLNET.AUTHENTICATION_SERVICES= (NTS)

 

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

 

[root@localhost admin]#vim tnsnames.ora          ###########  原文件C

# tnsnames.ora Network Configuration File: E:\app\Administrator\product\11.2.0\dbhome_1\NETWORK\ADMIN\tnsnames.ora

# Generated by Oracle configuration tools.

 

ORCL =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.194.224.110)(PORT = 1521))

    )

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = orcl)

    )

  )

 

修改后的文件如下:

[root@localhost admin]#vim listener.ora     ###########  原文件A

# listener.ora Network Configuration File: E:\app\Administrator\product\11.2.0\dbhome_1\network\admin\listener.ora

# Generated by Oracle configuration tools.

 

SID_LIST_LISTENER =

  (SID_LIST =

    (SID_DESC =

      (SID_NAME = CLRExtProc)

      (ORACLE_HOME = \opt\oracle)    ## 改动1:改为了刚才配置的$ORACLE_HOME

      (PROGRAM = extproc)

    )                               ## 改动2:删除的无关部分

  )

 

LISTENER =

  (DESCRIPTION_LIST =

    (DESCRIPTION =

      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))

      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.194.224.110)(PORT = 1521))

     #10.194.224.110  IP地址, 端口号:1521

 

    )

  )                                    ## 改动3:删除的无关部分

 

 

[root@localhost admin]#vim sqlnet.ora         ###########  原文件B(无需改动)

# sqlnet.ora Network Configuration File: E:\app\Administrator\product\11.2.0\dbhome_1\network\admin\sqlnet.ora

# Generated by Oracle configuration tools.

 

# This file is actually generated by netca. But if customers choose to

# install "Software Only", this file wont exist and without the native

# authentication, they will not be able to connect to the database on NT.

 

SQLNET.AUTHENTICATION_SERVICES= (NTS)

 

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

 

[root@localhost admin]#vim tnsnames.ora          ###########  原文件C

# tnsnames.ora Network Configuration File: E:\app\Administrator\product\11.2.0\dbhome_1\NETWORK\ADMIN\tnsnames.ora

# Generated by Oracle configuration tools.

 

ORCL =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.194.224.110)(PORT = 1521))

 // 注释:10.194.224.110  IP地址, 端口号:1521

    )

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = orcl)

    )

  )

                                   ## 改动4:以下语句到末尾,语句为新增。

EXTPROC_CONNECTION_DATA =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))

    )

    (CONNECT_DATA =

      (SID = PLSExtProc)

      (PRESENTATION = RO)

    )

  )

 

step6:测试。

 [root@localhost lib]# ./sqlplus

 

SQL*Plus: Release 11.2.0.3.0 Production on Mon Dec 21 00:47:49 2015

 

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

 

Enter user-name: yuanmin

Enter password:

 

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

With the Partitioning, Oracle Label Security, OLAP, Data Mining,

Oracle Database Vault and Real Application Testing options……

调用成功!

  • 1
    点赞
  • 1
    评论
  • 2
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

©️2021 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值