linux单独安装oracle客户端及exp/imp工具配置
1.下载安装包
下载链接
https://www.oracle.com/technetwork/database/database-technologies/instant-client/downloads/index.html
instantclient-basic-linux.x64-12.2.0.1.0.zip instantclient-jdbc-linux.x64-12.2.0.1.0.zip instantclient-odbc-linux.x64-12.2.0.1.0-2.zip instantclient-sdk-linux.x64-12.2.0.1.0.zip instantclient-sqlplus-linux.x64-12.2.0.1.0.zip instantclient-tools-linux.x64-12.2.0.1.0.zip
2.安装
在当前目录下解压缩zip包得到:
instantclient_12_2
3.创建数据库连接文件(可选)
[root@localhost oracle]# cd instantclient_12_2
[root@localhost instantclient_12_2]# mkdir -p network/admin
并在 admin 目录下创建 tnsnames.ora 文件:
ORCL = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = orcl) ) )
4.配置环境变量
这里配置 root 用户环境变量: ~/.bashrc
export ORACLE_HOME=/opt/oracle/instantclient_12_2 export PATH=$ORACLE_HOME:$PATH export TNS_ADMIN=$ORACLE_HOME/network/admin export LD_LIBRARY_PATH=$ORACLE_HOME:$LD_LIBRARY_PATH export NLS_LANG='american_america.AL32UTF8'
配置完毕后,进行刷新环境变量,进行生效
source ~/.bashrc
5.测试
[root@localhost instantclient_12_2]# sqlplus /nolog 6 SQL*Plus: Release 12.2.0.1.0 Production on Fri Nov 9 15:45:04 2018 Copyright (c) 1982, 2016, Oracle. All rights reserved. SQL>
出现上面的结果说明测试成功。
6.数据库导入导出
exp username/password@//host:1521/orclpdb1 file=/opt/oracle/daochu.dmp owner=username imp username/password@//host:1521/orclpdb1 file=/opt/oracle/daochu.dmp