oracle怎么部署客户端,如何二进制部署oracle客户端?

1 前言

笔者需要一个Oracle客户端用于测试与服务器之间的连通性,于是此文产生。

2 最佳实践

2.1 系统环境

OS = CentOS 6.8 x86_64

IP Address = any

Host Name = any.cmdschool.org

2.2 基础配置

2.2.1 安装所需的工具包

yum install -y unzip

2.2.2 下载软件包

cd ~

wget https://download.oracle.com/otn/linux/instantclient/185000/instantclient-basic-linux.x64-18.5.0.0.0dbru.zip

wget https://download.oracle.com/otn/linux/instantclient/185000/instantclient-sqlplus-linux.x64-18.5.0.0.0dbru.zip

2.2.3 解压软件包

cd ~

unzip instantclient-basic-linux.x64-18.5.0.0.0dbru.zip

unzip instantclient-sqlplus-linux.x64-18.5.0.0.0dbru.zip

2.3 部署SQLPlus

2.3.1 创建目录结构

mkdir -p /usr/lib/oracle/18.5/client64/bin

mkdir -p /usr/lib/oracle/18.5/client64/lib

mkdir -p /usr/share/oracle/18.5/client64/doc/

2.3.2 部署软件包

cd ~/instantclient_18_5

mv adrci /usr/lib/oracle/18.5/client64/bin/

mv genezi /usr/lib/oracle/18.5/client64/bin/

mv uidrvci /usr/lib/oracle/18.5/client64/bin/mv

mv libclntsh.so.18.1 /usr/lib/oracle/18.5/client64/lib/

mv libclntsh.so /usr/lib/oracle/18.5/client64/lib/

mv libclntshcore.so.18.1 /usr/lib/oracle/18.5/client64/lib/

mv libipc1.so /usr/lib/oracle/18.5/client64/lib/

mv libmql1.so /usr/lib/oracle/18.5/client64/lib/

mv libnnz18.so /usr/lib/oracle/18.5/client64/lib/

mv libocci.so.18.1 /usr/lib/oracle/18.5/client64/lib/

mv libocci.so /usr/lib/oracle/18.5/client64/lib/

mv libociei.so /usr/lib/oracle/18.5/client64/lib/

mv libocijdbc18.so /usr/lib/oracle/18.5/client64/lib/

mv libons.so /usr/lib/oracle/18.5/client64/lib/

mv liboramysql18.so /usr/lib/oracle/18.5/client64/lib/

mv network /usr/lib/oracle/18.5/client64/lib/

mv ojdbc8.jar /usr/lib/oracle/18.5/client64/lib/

mv xstreams.jar /usr/lib/oracle/18.5/client64/lib/

mv ucp.jar /usr/lib/oracle/18.5/client64/lib/

mv BASIC_LICENSE /usr/share/oracle/18.5/client64/doc/

mv BASIC_README /usr/share/oracle/18.5/client64/doc/

mv sqlplus /usr/lib/oracle/18.5/client64/bin/

mv glogin.sql /usr/lib/oracle/18.5/client64/lib/

mv libsqlplus.so /usr/lib/oracle/18.5/client64/lib/

mv libsqlplusic.so /usr/lib/oracle/18.5/client64/lib/

mv SQLPLUS_LICENSE /usr/share/oracle/18.5/client64/doc/

mv SQLPLUS_README /usr/share/oracle/18.5/client64/doc/

2.3.3 配置环境变量

vim /etc/profile.d/oracle-lient.sh

加入如下定义,

export ORACLE_CLIENT_HOME=/usr/lib/oracle/18.5/client64

export LD_LIBRARY_PATH=${ORACLE_CLIENT_HOME}/lib:$LD_LIBRARY_PATH

export PATH=${ORACLE_CLIENT_HOME}/bin:$PATH

使用如下命令加载环境变量,

source /etc/profile

另外,亦可使用如下快速命令实现,

echo 'export ORACLE_CLIENT_HOME=/usr/lib/oracle/18.5/client64' > /etc/profile.d/oracle-lient.sh

echo 'export LD_LIBRARY_PATH=${ORACLE_CLIENT_HOME}/lib:$LD_LIBRARY_PATH' >> /etc/profile.d/oracle-lient.sh

echo 'export PATH=${ORACLE_CLIENT_HOME}/bin:$PATH' >> /etc/profile.d/oracle-lient.sh

source /etc/profile

环境变量“LD_LIBRARY_PATH”用于声明库文件的路径,否则运行命令行将会收到如下提示,

sqlplus: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory

2.3.4 测试命令行运行

sqlplus -V

可见如下提示,

SQL*Plus: Release 18.0.0.0.0 - Production

Version 18.5.0.0.0

2.3.5 获取使用帮助

sqlplus -h

可见如下提示,

SQL*Plus: Release 18.0.0.0.0 - Production

Version 18.5.0.0.0

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

Use SQL*Plus to execute SQL, PL/SQL and SQL*Plus statements.

Usage 1: sqlplus -H | -V

-H Displays the SQL*Plus version and the

usage help.

-V Displays the SQL*Plus version.

Usage 2: sqlplus [ [] [{logon | /nolog}] [] ]

is: [-AC] [-C ] [-F] [-L] [-M ""] [-NOLOGINTIME]

[-R ] [-S]

-AC Enable Application Continuity.

-C Sets the compatibility of affected commands to the

version specified by . The version has

the form "x.y[.z]". For example, -C 10.2.0

-F This option improves performance in general. It changes

the default values settings.

See SQL*Plus User's Guide for the detailed settings.

-L Attempts to log on just once, instead of

reprompting on error.

-M "" Sets automatic HTML or CSV markup of output. The options

have the form:

{HTML html_options|CSV csv_options}

See SQL*Plus User's Guide for detailed HTML and CSV options.

-NOLOGINTIME Don't display Last Successful Login Time.

-R Sets restricted mode to disable SQL*Plus commands

that interact with the file system. The level can

be 1, 2 or 3. The most restrictive is -R 3 which

disables all user commands interacting with the

file system.

-S Sets silent mode which suppresses the display of

the SQL*Plus banner, prompts, and echoing of

commands.

is: {[/][@] | / }

[AS {SYSDBA | SYSOPER | SYSASM | SYSBACKUP | SYSDG

| SYSKM | SYSRAC}] [EDITION=value]

Specifies the database account username, password and connect

identifier for the database connection. Without a connect

identifier, SQL*Plus connects to the default database.

The AS SYSDBA, AS SYSOPER, AS SYSASM, AS SYSBACKUP, AS SYSDG,

AS SYSKM and AS SYSRAC options are database administration privileges.

can be in the form of Net Service Name

or Easy Connect.

@[ | [//]Host[:Port]/]

is a simple name for a service that resolves

to a connect descriptor.

Example: Connect to database using Net Service Name and the

database net service name is ORCL.

sqlplus myusername/mypassword@ORCL

Host specifies the host name or IP address of the database

server computer.

Port specifies the listening port on the database server.

specifies the service name of the database you

want to access.

Example: Connect to database using Easy Connect and the

Service name is ORCL.

sqlplus myusername/mypassword@Host/ORCL

The /NOLOG option starts SQL*Plus without connecting to a

database.

The EDITION specifies the value for Session Edition.

is: @|[.] [ ...]

Runs the specified SQL*Plus script from a web server (URL) or the

local file system (filename.ext) with specified parameters that

will be assigned to substitution variables in the script.

When SQL*Plus starts, and after CONNECT commands, the site profile

(e.g. $ORACLE_HOME/sqlplus/admin/glogin.sql) and the user profile

(e.g. login.sql in the working directory) are run. The files may

contain SQL*Plus commands.

Refer to the SQL*Plus User's Guide and Reference for more information.

参阅资料

===================

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值