博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ubuntu14.0安装 oracle instant client(oracle 12c)
阅读量:5244 次
发布时间:2019-06-14

本文共 4735 字,大约阅读时间需要 15 分钟。

安装环境

本文介绍在14.04系统(X64)上安装 Instant Client,安装版本为11.2.0.4.0(读者需要按照自己安装版本修改相应的)

安装RPM文件

  • 在Oracle官网地址  下载以下RPM文件:

oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpmoracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpmoracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.rpm
  • 使用alien转换PRM文件到DEB文件并安装(sudo apt-get install alien)

  • 安装alien后,执行下面的命令安装Oracle:

sudo alien -i oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpmsudo alien -i oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpmsudo alien -i oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.rpm

配置Oracle环境

  • 安装以下步骤新增tnsnames.ora文件:

cd /usr/lib/oracle/11.2/client64sudo mkdir -p network/adminsudo vi tnsnames.ora
  • 填写如下内容,或者直接从oracle端将相同目录下的这个文件拷贝过来。

# tnsnames.ora Network Configuration FileORCL =  (DESCRIPTION =    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.100.126.174)(PORT = 1521))    (CONNECT_DATA =      (SERVER = DEDICATED)      (SERVICE_NAME = orclpdb)    )  )
  • 链接Oracle的库文件到Oracle目录:

sudo ln -s /usr/include/oracle/11.2/client64 /usr/lib/oracle/11.2/client64/include

配置环境变量

在登录用户的profile中增加以下内容:

export ORACLE_HOME=/usr/lib/oracle/11.2/client64export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/libexport TNS_ADMIN=$ORACLE_HOME/network/adminexport PATH=$PATH:$ORACLE_HOME/binexport NLS_LANG="AMERICAN_AMERICA.UTF8"
 上面的内容是从https://blog.csdn.net/hanzengyi/article/details/70849091 复制过来的,需要注意的是ORCL是登录时@后面的名字,而orclpdb是在oracle服务端上通过 select name,pdb from v$services; 查到的pdb对应的name,切记。 下面是我查出来的结果,找到ORCLPDB 对应的NAME,即orclpdb,这个就相当于zbudcdb_stdby。
NAME                 PDB-------------------- --------------------orclXDB                CDB$ROOTorcl                   CDB$ROOTSYS$BACKGROUND         CDB$ROOTSYS$USERS              CDB$ROOTorclpdb                ORCLPDB
 
注意:查看服务端的监听状态会有以下信息:
[oracle@localhost admin]$ lsnrctl statusLSNRCTL for Linux: Version 12.2.0.1.0 - Production on 19-APR-2018 03:56:10Copyright (c) 1991, 2016, Oracle.  All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))STATUS of the LISTENER------------------------Alias                     LISTENERVersion                   TNSLSNR for Linux: Version 12.2.0.1.0 - ProductionStart Date                19-APR-2018 02:42:15Uptime                    0 days 1 hr. 13 min. 55 secTrace Level               offSecurity                  ON: Local OS AuthenticationSNMP                      OFFListener Parameter File   /orcl/app/oracle/product/12.1.0/db_1/network/admin/listener.oraListener Log File         /orcl/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xmlListening Endpoints Summary...  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=localhost)(PORT=5500))(Security=(my_wallet_directory=/orcl/app/oracle/admin/orcl/xdb_wallet))(Presentation=HTTP)(Session=RAW))Services Summary...Service "6a02d18fca293032e055000000000001" has 1 instance(s).  Instance "orcl", status READY, has 1 handler(s) for this service...Service "orcl" has 1 instance(s).  Instance "orcl", status READY, has 1 handler(s) for this service...Service "orclXDB" has 1 instance(s).  Instance "orcl", status READY, has 1 handler(s) for this service...Service "orclpdb" has 1 instance(s).  Instance "orcl", status READY, has 1 handler(s) for this service...The command completed successfully

有:Service "orclpdb" has 1 instance(s). Instance "orcl", status READY, has 1 handler(s) for this service...,证明监听启动正常。

另外附上远程登录用户的创建过程。 一 先将容器切换成pdb,详见https://blog.csdn.net/hanzengyi/article/details/70849091
1 查看系统中的容器:   select con_id,dbid,NAME,OPEN_MODE from v$pdbs;2 先打开pdb容器:   alter pluggable database orclpdb open;3再查看容器,pdb应该是READ,WRITE:   select con_id,dbid,NAME,OPEN_MODE from v$pdbs;4切换容器:   alter session set container=orclpdb;5查看当前使用的容器   select sys_context ('USERENV', 'CON_NAME') from dual;
 

二 创建表空间

create tablespace test_space datafile '/usr/local/yrm/oracle_data/test_space.dbf' size 50M autoextend on next 50m maxsize 2048m extent management local;create temporary tablespace test_space_temptempfile '/usr/local/yrm/oracle_data/test_space_temp.dbf'size 32mautoextend on next 32m maxsize 1024mextent management local;
 

三 创建用于远程登陆的用户

create user test_user identified by 123456 default tablespace test_spacetemporary tablespace test_space_temp;grant connect,resource to test_user;grant dba to test_user;alter user test_user account unlock identified by 123456;

四 在oracle主机上启动监听及服务

#su - oracle #切换到 oracle 用户且切换到它的环境$lsnrctl status #查看监听及数据库状态$lsnrctl start #启动监听$sqlplus / as sysdba #以 DBA 身份进入 sqlplus#登陆之后启动服务:startup,shutdown为停止服务。

五 测试远程登陆 sqlplus test_user/123456@ORCl。

  成功!

oracle的安装与远程登陆太瘠薄难呢,濒临崩溃~ ,欢迎留言探讨。

转载于:https://www.cnblogs.com/airduce/p/8875443.html

你可能感兴趣的文章
php提交表单校验例子
查看>>
man查看帮助命令
查看>>
【SVM】libsvm-python
查看>>
mysql 修改已存在的表增加ID属性为auto_increment自动增长
查看>>
sgu 109 Magic of David Copperfield II
查看>>
C++循环单链表删除连续相邻重复值
查看>>
IIS 7.5 + PHP-5.6.3 + mysql-5.6.21.1(转载)
查看>>
渣渣小本求职复习之路每天一博客系列——Java基础(3)
查看>>
C#调用WIN32 的API函数--USER32.DLL
查看>>
ListView下拉刷新实现
查看>>
Jmeter接口压力测试,Java.net.BindException: Address already in use: connect
查看>>
【7集iCore3基础视频】7-4 iCore3连接示意图
查看>>
ASP.NET使网页弹出窗口不再困难
查看>>
Leetcode Balanced Binary Tree
查看>>
Day1:Spring-IoC、DI
查看>>
Leetcode 92. Reverse Linked List II
查看>>
TensorFlow2-维度变换
查看>>
Redux源码分析之createStore
查看>>
POJ 2060 最小路径覆盖
查看>>
label标签作用
查看>>