oracle wallet使用与维护
2015年05月26日 17:58:55 SilenceRiver 阅读数:1614
oracle wallet使用与维护---oracle无密码登录
分类: Oracle Management2012-07-24 19:54 3111人阅读 评论(1) 收藏 举报
oraclestringoracle11g数据库listjdbc
author:skate
time:2012/07/24

oracle wallet使用与维护

从Oracle10gR2开始, 通过使用Oracle Wallet达到任意用户不使用密码登录数据库(非操作系统认证方式),这对于用脚本登录数据库进行操作来说是非常有用的;尤其对于企业安全要求很高,不希望用户名和密码明文存在配置文件中,而且对于密码的维护是极为方便的,比如我把wallet放在指定路径下,当修改密码时,只需统一覆盖wallet即可,对于有大量应用服务器尤为方便。

在客户端创建一个wallet

用法:
E:\app\Administrator\product\11.2.0\dbhome_1\BIN>mkstore --help
Oracle Secret Store Tool: 版本 11.2.0.1.0 - Production
版权所有 (c) 2004, 2009, Oracle 和/或其子公司。保留所有权利。
未指定 Wallet 的位置。
mkstore [-wrl wrl] [-create] [-createSSO] [-createLSSO] [-createALO] [-delete] [
-deleteSSO] [-list] [-createEntry alias secret] [-viewEntry alias] [-modifyEntry
alias secret] [-deleteEntry alias] [-createCredential connect_string username p
assword] [-listCredential] [-modifyCredential connect_string username password]
[-deleteCredential connect_string] [-help] [-nologo]
E:\app\Administrator\product\11.2.0\dbhome_1\BIN>

1. 创建wallet
语法: mkstore -wrl <wallet_location> -create
eg:
E:\app\Administrator\product\11.2.0\dbhome_1\BIN>mkstore -wrl e:\temp\wallet -create
Oracle Secret Store Tool: 版本 11.2.0.1.0 - Production
版权所有 (c) 2004, 2009, Oracle 和/或其子公司。保留所有权利。
输入口令:(输入wallet的密码,要设置的复杂些,否则失败)
再次输入口令:(输入wallet的密码)
E:\app\Administrator\product\11.2.0\dbhome_1\BIN>

查看创建wallet
e:\temp\wallet>dir
驱动器 E 中的卷是 data
卷的序列号是 DCEE-F1D9
e:\temp\wallet 的目录
2012/07/24 17:19 <DIR> .
2012/07/24 17:19 <DIR> ..
2012/07/24 17:19 3,589 cwallet.sso
2012/07/24 17:19 3,512 ewallet.p12
2 个文件 7,101 字节
2 个目录 212,962,336,768 可用字节
e:\temp\wallet>

2.创建客户端连接服务端的网络连接串,每个连接串对应一个数据库用户
skate_192.168.1.9 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.9)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = skate)
)
)

3.把登入数据库的用户认证信息添加到wallet中
E:\app\Administrator\product\11.2.0\dbhome_1\BIN>mkstore -wrl e:\temp\wallet -createCredential skate_192.168.1.9 skate skatepwd
Oracle Secret Store Tool: 版本 11.2.0.1.0 - Production
版权所有 (c) 2004, 2009, Oracle 和/或其子公司。保留所有权利。
输入 Wallet 口令:
Create credential oracle.security.client.connect_string1

4.在客户端的sqlnet.ora文件里,编辑参数“WALLET_LOCATION ”
WALLET_LOCATION=(SOURCE=(METHOD=FILE)(METHOD_DATA=(DIRECTORY=e:\temp\wallet)))
SQLNET.WALLET_OVERRIDE = TRUE

5.测试在客户端无需密码连接数据库测试

E:\app\Administrator\product\11.2.0\dbhome_1\BIN>sqlplus /@skate_192.168.1.9
SQL*Plus: Release 11.2.0.1.0 Production on 星期二 7月 24 17:59:21 2012
Copyright (c) 1982, 2010, Oracle. All rights reserved.
连接到:
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> show user;
USER 为 "SKATE"
SQL>

6.如何管理wallet
6.1 查看wallet里的连接认证信息
E:\app\Administrator\product\11.2.0\dbhome_1\BIN>mkstore -wrl e:\temp\wallet -listCredential
Oracle Secret Store Tool: 版本 11.2.0.1.0 - Production
版权所有 (c) 2004, 2009, Oracle 和/或其子公司。保留所有权利。
输入 Wallet 口令:
List credential (index: connect_string username)
1: skate_192.168.1.9 skate

6.2 添加一个新的认证信息到wallet里,在wallet是以连接串为唯一标识的
E:\app\Administrator\product\11.2.0\dbhome_1\BIN>mkstore -wrl e:\temp\wallet -createCredential test_skate_s_192.168.1.9 skate skatepwd
Oracle Secret Store Tool: 版本 11.2.0.1.0 - Production
版权所有 (c) 2004, 2009, Oracle 和/或其子公司。保留所有权利。
输入 Wallet 口令:
Create credential oracle.security.client.connect_string2

查看已经添加用户认证信息
E:\app\Administrator\product\11.2.0\dbhome_1\BIN>mkstore -wrl e:\temp\wallet -listCredential
Oracle Secret Store Tool: 版本 11.2.0.1.0 - Production
版权所有 (c) 2004, 2009, Oracle 和/或其子公司。保留所有权利。
输入 Wallet 口令:
List credential (index: connect_string username)
2: test_skate_s_192.168.1.9 skate
1: skate_192.168.1.9 skate

6.3 编辑wallet里的用户密码
E:\app\Administrator\product\11.2.0\dbhome_1\BIN>mkstore -wrl e:\temp\wallet -modifyCredential test_skate_s_192.168.1.9 skate skatepwd1
Oracle Secret Store Tool: 版本 11.2.0.1.0 - Production
版权所有 (c) 2004, 2009, Oracle 和/或其子公司。保留所有权利。
输入 Wallet 口令:
Modify credential
Modify 2
E:\app\Administrator\product\11.2.0\dbhome_1\BIN>

6.4 删除wallet的用户认证信息
E:\app\Administrator\product\11.2.0\dbhome_1\BIN>mkstore -wrl e:\temp\wallet -listCredential
Oracle Secret Store Tool: 版本 11.2.0.1.0 - Production
版权所有 (c) 2004, 2009, Oracle 和/或其子公司。保留所有权利。
输入 Wallet 口令:
List credential (index: connect_string username)
2: test_skate_s_192.168.1.9 skate
1: skate_192.168.1.9 skate
E:\app\Administrator\product\11.2.0\dbhome_1\BIN>mkstore -wrl e:\temp\wallet -deleteCredential test_prodb_s_192.168.1.9
Oracle Secret Store Tool: 版本 11.2.0.1.0 - Production
版权所有 (c) 2004, 2009, Oracle 和/或其子公司。保留所有权利。
输入 Wallet 口令:
Delete credential
Delete 2
E:\app\Administrator\product\11.2.0\dbhome_1\BIN>mkstore -wrl e:\temp\wallet -listCredential
Oracle Secret Store Tool: 版本 11.2.0.1.0 - Production
版权所有 (c) 2004, 2009, Oracle 和/或其子公司。保留所有权利。
输入 Wallet 口令:
List credential (index: connect_string username)
1: skate_192.168.1.9 skate
E:\app\Administrator\product\11.2.0\dbhome_1\BIN>

7.查看wallet里的详细认证信息
E:\app\Administrator\product\11.2.0\dbhome_1\BIN>mkstore -wrl e:\temp\wallet -list
Oracle Secret Store Tool: 版本 11.2.0.1.0 - Production
版权所有 (c) 2004, 2009, Oracle 和/或其子公司。保留所有权利。
输入 Wallet 口令:
Oracle 密钥存储条目:
oracle.security.client.connect_string1
oracle.security.client.password1
oracle.security.client.username1

E:\app\Administrator\product\11.2.0\dbhome_1\BIN>mkstore -wrl e:\temp\wallet -viewEntry oracle.security.client.connect_string1
Oracle Secret Store Tool: 版本 11.2.0.1.0 - Production
版权所有 (c) 2004, 2009, Oracle 和/或其子公司。保留所有权利。
输入 Wallet 口令:
oracle.security.client.connect_string1 = skate_192.168.1.9
E:\app\Administrator\product\11.2.0\dbhome_1\BIN>mkstore -wrl e:\temp\wallet -viewEntry oracle.security.client.password1
Oracle Secret Store Tool: 版本 11.2.0.1.0 - Production
版权所有 (c) 2004, 2009, Oracle 和/或其子公司。保留所有权利。
输入 Wallet 口令:
oracle.security.client.password1 = skatepwd
E:\app\Administrator\product\11.2.0\dbhome_1\BIN>mkstore -wrl e:\temp\wallet -viewEntry oracle.security.client.username1
Oracle Secret Store Tool: 版本 11.2.0.1.0 - Production
版权所有 (c) 2004, 2009, Oracle 和/或其子公司。保留所有权利。
输入 Wallet 口令:
oracle.security.client.username1 = skate
E:\app\Administrator\product\11.2.0\dbhome_1\BIN>

8.更改wallet里用户认证信息的内容
8.1 更改密码
E:\app\Administrator\product\11.2.0\dbhome_1\BIN>mkstore -wrl e:\temp\wallet -modifyEntry oracle.security.client.password1 skatepwd1
Oracle Secret Store Tool: 版本 11.2.0.1.0 - Production
版权所有 (c) 2004, 2009, Oracle 和/或其子公司。保留所有权利。
输入 Wallet 口令:

8.2 更改密码
E:\app\Administrator\product\11.2.0\dbhome_1\BIN>mkstore -wrl e:\temp\wallet -modifyEntry oracle.security.client.username1 skate1
Oracle Secret Store Tool: 版本 11.2.0.1.0 - Production
版权所有 (c) 2004, 2009, Oracle 和/或其子公司。保留所有权利。
输入 Wallet 口令:

E:\app\Administrator\product\11.2.0\dbhome_1\BIN>

和6.3步骤里(-modifyCredential)的区别是,这里不仅仅改密码,连接串和密码都可以改

我们这里是本地创建wallet,从本地客户端可以登录,那从其他地方可以吗?
A.
在win7+oracle11g客户端上创建的wallet,无密码访问linux+oracle10g服务服务端没有问题,但是把wallet复制到linux+oracle10g的服务端,再无密码登录是报错“ORA-12534: TNS:operation not supported”,需要用如下命令编辑一下,就可以无密码登录了。虽然语句没有改任何内容。
[oracle@localhost ~]$ mkstore -wrl /tmp/wallet1 -createCredential skate_192.168.1.9 skate skatepwd1

B. 在linux+oracle10g服务端上创建的wallet,无密码访问linux+oracle10g服务服务端没有问题,把wallet复制到win7+oracle11g客户端,无密码登录也没问题。

猜测可能是版本问题。

在客户端使用wallet无密码登录的步骤:

1.创建wallet(tnsname.ora里面的连接串,sqlnet.ora文件内容都要复制到客户端)
2.把wallet复制到客户端指定路径(注意文件权限和属主)
3.修改客户端的tnsname.ora文件里连接服务器的连接串为创建时的连接串,在sqlnet.ora文件里添加如下内容:
WALLET_LOCATION=(SOURCE=(METHOD=FILE)(METHOD_DATA=(DIRECTORY=e:\temp\wallet)))
SQLNET.WALLET_OVERRIDE = TRUE
4.在sqlplus无密码等里测试
sqlplus /@skate_192.168.1.9

在jdbc里连接数据库密码形式如下:
public static Connection getConnection() throws SQLException {
DriverManager.registerDriver(new OracleDriver());
Connection conn = DriverManager
.getConnection("jdbc:oracle:oci:/@tnskate");
conn.setAutoCommit(false);
return conn;
}

参考: [ID 340559.1] [ID 741810.1]

转载于:https://www.cnblogs.com/buffercache/p/10789764.html

oracle wallet使用与维护相关推荐

  1. oracle wallet java_oracle wallet实践及常用维护操作

    Wallet作用 从Oracle 10g R2开始, 通过使用Oracle Wallet达到任意用户不使用密码登录数据库(非操作系统认证方式), 这对在shell中要使用用户密码登录数据库进行操作的脚 ...

  2. oracle wallet java_Oracle Wallet初探

    初探 1.什么是Wallet A datastructure used to store and manage security credentials for an individualentity ...

  3. oracle文件夹cwallet,Oracle Wallet

    Oracle Wallet是用来加密解密的,前两天做的项目中用到了这个技术,现把一些用到的东西总结一下. 原文如下: Our application does a web service call ( ...

  4. oracle 监听加密 tcps,通过oracle wallet配置listener tcps加密

    一 配置客户端和服务端的wallet 2端配置方法一致,相互添加证书 orapki wallet create -wallet "/u01/oracle/wallet" -pwd ...

  5. oracle rac维护命令,2015年oracle rac日常基本维护命令.doc

    Oracle RAC 资料收集 http://www.D 数据库吧 oracle rac日常基本维护命令2 Oracle RAC性能调整12 详解Oracle RAC入门和提高27 ORACLE RA ...

  6. Oracle分区表之创建维护分区表索引的详细步骤

    墨墨导读:本文来自墨天轮用户投稿,详细描述Oracle分区表之创建维护分区表索引的步骤. 分区索引分为本地(local index)索引和全局索引(global index).局部索引比全局索引容易管 ...

  7. oracle wallet,Oracle Wallet的使用

    从Oracle10gR2开始, 通过使用Oracle Wallet达到任意用户不使用密码登录数据库(非操作系统认证方式), 这对在shell中要使用用户密码登录数据库进行操作的脚本来说是非常有用的, ...

  8. oracle wallet java_oracle Wallet的使用

    oracle Wallet的使用(即内部加密技术TDE(Transparent Data Encryption )) 1. TDE是Oracle10gR2中推出的一个新功能,使用时要保证Oracle版 ...

  9. oracle wallet java_使用Oracle客户端wallet实现匿名登录

    我们无论是通过Oracle客户端的各种工具.还是应用系统链接数据库,链接用户名和密码都是不可缺少的验证环节.这些敏感信息的保存方式其实一直是一个比较纠结的问题,最常用的方法就是通过硬编码或者配置文件保 ...

最新文章

  1. go微服务框架-gomicro试用
  2. You must supply a resourceID for a TextView
  3. 操作系统【四】分页存储管理
  4. 31Exchange Server 2010跨站点部署-搬迁Exchange服务器到分支机构
  5. The Geometry has no Z values 解决办法
  6. svn提交代码失败提示清理(清理失败并且报错信息乱码解决办法)
  7. java apns ssl错误_无法使用Javapns/Javaapns SSL握手失败发送推送通知
  8. 万人拆盲盒,比特小鹿“2周年庆”云托管新团掀高潮
  9. 计算机专业实践报告立题依据,开题报告立题依据 .doc
  10. Drupal项目实战-公司订餐系统
  11. Gym - 101964E -Fishermen(二分+差分求前缀和)
  12. 项目Beta冲刺(4/7)(追光的人)(2019.5.26)
  13. 【转】浅谈半导体工艺变革
  14. 第四十六章 SQL函数 DAY
  15. 全国大学生“高教杯”成图大赛——如何绘制锥度斜度
  16. 程序员薪水最高的25家公司
  17. 启动两个80线的速腾雷达
  18. Servernbsp;Tomcatnbsp;v7.0amp;nbs…
  19. 操作体验极度舒适的多功能软件卸载工具 - iObit Uninstaller PRO
  20. 高性能MySQL(3th)(第一章 MySQL概述) —— 04 InnoDB和MyISAM

热门文章

  1. 第7章第27节:三图排版:三张图片交错对齐排列 [PowerPoint精美幻灯片实战教程]
  2. 工控液晶屏开机白屏怎么回事,开机白屏解决方法?
  3. android安装并启用新输入法
  4. MiKTeX手动更新宏包超详细,东北大学编译原理第三次作业
  5. Java操作Excel基础--POI之HSSF
  6. 什么是大小端?如何确定大小端?
  7. Java学生签到考勤请假系统源码
  8. Final SwfPlayer下载后在安卓12上玩宇宙的刻度2
  9. LeetCode:838. 推多米诺————中等
  10. 2017年问题汇总-待整理