Thursday, August 15, 2013

Oracle Database connection using Oracle Wallet


Oracle Wallet protects your oracle database user credential by password, it means, Oracle wallet creates a secured credential store, and sqlplus reads the credentials from the store to connect to specified database.

To use it, you need Oracle database client.


In $ORACLE_HOME/bin, mkstore can be found. If you prefer to GUI, type owm from unix console.

user: root
DB User: SCOTT
SID: TEST


1. Create .sqlnet.ora in /root with below entries

SQLNET.WALLET_OVERRIDE=TRUE
WALLET_LOCATION=(SOURCE=(METHOD=FILE)(METHOD_DATA=(DIRECTORY=/root)))
 
2. Create Oracle Wallet in /root
# mkstore -create -wrl /root
Oracle Secret Store Tool : Version 11.2.0.1.0 - Production
Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved.

Enter password:

Enter password again:

3. Add credentials
Syntax:  mkstore -wrl /root -createCredential <ORACLE_SID> scott

# mkstore -wrl /root -createCredential TEST scott
Oracle Secret Store Tool : Version 11.2.0.1.0 - Production
Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved.

Your secret/Password is missing in the command line
Enter your secret/Password:

Re-enter your secret/Password:

Enter wallet password:

Create credential oracle.security.client.connect_string1
4. Verify the setting

# sqlplus /@TEST

SQL*Plus: Release 11.2.0.1.0 Production on Thu Aug 15 11:56:51 2013

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> show user
USER is "SCOTT"
SQL>

Other usefull commands to help you troubleshoot

# mkstore -wrl /root -list
# mkstore -wrl /root -viewEntry oracle.security.client.connect_string1
# mkstore -wrl /root -viewEntry oracle.security.client.username1
# mkstore -wrl /root -viewEntry oracle.security.client.password1

Reference: http://docs.oracle.com/cd/B28359_01/network.111/b28530/asowalet.htm




No comments:

Post a Comment