Oracle wallet implements login to the database without entering the user name and password

Source: Internet
Author: User

Before Oracle 10 Gb, when we connect to the database in SHELL or JDBC, we need to enter the user name and password, and both are in plain text. Starting from 1OGR2, ORACLE provides the wallet tool to log on to the database without entering the user name and password, as shown below:

General situation: sqlplus scott/oracle @ htzdg

After using wallet: sqlplus/@ htzdg

Test environment:

Server: solaris 10, oracle 11gr2

Client: win 7, oracle11gr2

Configure the tnsnames. ora file on the login end and add the following lines

  1. HTZDG =
  2. (DESCRIPTION =
  3. (ADDRESS_LIST =
  4. (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.100.30) (PORT = 1521 ))
  5. )
  6. (CONNECT_DATA =
  7. (SERVER = DEDICATED)
  8. (SERVICE_NAME = htzdg)
  9. )
  10. )

Test whether Parsing is normal

  1. C: \ Users \ luoping> tnsping htzdg
  2.  
  3. TNS Ping UtilityFor32-BitWindows: Version 11.2.0.1.0-ProductionOn298-month-
  4. 21:40:40 2012
  5.  
  6. Copyright (c) 1997,201 0, Oracle.AllRights reserved.
  7.  
  8. Used parameter files:
  9. D: \ app \ luoping \ product \ 11.2.0 \ client_1 \ network \ admin \ sqlnet. ora
  10.  
  11.  
  12. Alias resolved using TNSNAMES Adapter
  13. Try to connect (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.1
  14. 68.100.30) (PORT = 1521) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = h
  15. Tzdg )))
  16. OK (40 ms)
  17.  
  18. C: \ Users \ luoping>

The following describes how to configure wallet.

1. Create a wallet
 
 
  1. D: \ app \ luoping \ product \ 11.2.0 \ client_1 \ BIN> mkstore-wrl D: \ app \ luoping \ product \ 11.2.0 \ client_1 \ pstore-Create 
  2. Oracle Secret Store Tool: Version 11.2.0.1.0-Production
  3. Copyright (c) 2004,200 9, Oracle and/or its subsidiaries. All rights reserved.
  4. Enter the password:
  5. Enter the password again:
  6. D: \ app \ luoping \ product \ 11.2.0 \ client_1 \ BIN> cd ../
  7. D: \ app \ luoping \ product \ 11.2.0 \ client_1> cd pstore
  8. D: \ app \ luoping \ product \ 11.2.0 \ client_1 \ pstore> dir
  9. The volume in drive D is DATA
  10. The serial number of the volume is the D60C-09BD
  11. D: \ app \ luoping \ product \ 11.2.0 \ client_1 \ pstore directory
  12. <DIR>.
  13. <DIR> ..
  14. 3,589 cwallet. sso
  15. 3,512 ewallet. p12
  16. 2 files in 7,101 bytes
  17. 2 directories, 368,717,893,632 available bytes

2. Start wallet and specify the wallet location

 
 
  1. D:\app\luoping\product\11.2.0\client_1\network\admin>more sqlnet.ora 
  2. # sqlnet.ora Network Configuration File: D:\app\luoping\product\11.2.0\client_1\ 
  3. network\admin\sqlnet.ora 
  4. # Generated by Oracle configuration tools. 
  5.  
  6. # This file is actually generated by netca. But if customers choose to 
  7. # install "Software Only", this file wont exist and without the native 
  8. # authentication, they will not be able to connect to the database on NT. 
  9.  
  10. SQLNET.AUTHENTICATION_SERVICES= (NTS) 
  11.  
  12. NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT) 
  13. WALLET_LOCATION=(SOURCE=(METHOD=FILE)(METHOD_DATA=(DIRECTORY=D:\app\luoping\product\11.2.0\client_1\pstore))) 
  14. SQLNET.WALLET_OVERRIDE=TRUE 

3. Add the name, user, and password of the network service to be logged on to wallet.

 
 
  1. D: \ app \ luoping \ product \ 11.2.0 \ client_1 \ BIN> mkstore-wrl D: \ app \ luoping \ product \ 1
  2. 1.2.0 \ client_1 \ pstore-createCredential htzdg sys oracle
  3. Oracle Secret Store Tool: Version 11.2.0.1.0-Production
  4. Copyright (c) 2004,200 9, Oracle and/or its subsidiaries. All rights reserved.
  5.  
  6. Enter the Wallet password:
  7.  
  8. CreateCredential oracle. security. client. connect_string1

4. Check whether the test is successful.

 
 
  1. D: \ app \ luoping \ product \ 11.2.0 \ client_1 \ BIN> sqlplus/@ htzdgAsSysdba
  2.  
  3. SQL * Plus: Release 11.2.0.1.0 ProductionOnWednesday, September 16, August 29 17:48:27, 2012
  4.  
  5. Copyright (c) 1982,201 0, Oracle.AllRights reserved.
  6.  
  7.  
  8. Connect:
  9. OracleDatabase11g Enterprise Edition Release 11.2.0.1.0-64bit Production
  10. WithThe Partitioning, OLAP, Data MiningAnd RealApplication Testing options
  11.  
  12. SQL>

5. view the network service name configured in the wallet.

 
 
  1. D: \ app \ luoping \ product \ 11.2.0 \ client_1 \ BIN> mkstore-wrl d: \ app \ luoping \ product \ 1
  2. 1.2.0 \ client_1 \ pstore-listCredential
  3. Oracle Secret Store Tool: Version 11.2.0.1.0-Production
  4. Copyright (c) 2004,200 9, Oracle and/or its subsidiaries. All rights reserved.
  5.  
  6. Enter the Wallet password:
  7.  
  8. List credential (Index: Connect_string username)
  9. 1: htzdg sys

6. A network service name can correspond to only one user. If the number of users in the same database needs to be implemented through wallet in the same client, we need to create a network service name for each user.

The following is a test of a network service name. When two users are added, an error is returned.

 
 
  1. C: \ Users \ luoping> mkstore-wrl D: \ app \ luoping \ product \ 11.2.0 \ client_1 \ pstore-Re
  2. AteCredential htzdg scott oracle
  3. Oracle Secret Store Tool: Version 11.2.0.1.0-Production
  4. Copyright (c) 2004,200 9, Oracle and/or its subsidiaries. All rights reserved.
  5.  
  6. Enter the Wallet password:
  7.  
  8. CreateKey storage error in credential: oracle. security. pki. oraclesecretstore0000ti
  9. On: Credential already exists

7. After the password is changed, manually update the corresponding password in the wallet. Otherwise, an error is reported.

 
 
  1. D: \ app \ luoping \ product \ 11.2.0 \ client_1 \ BIN> sqlplus/@ htzdgAsSysdba
  2.  
  3. SQL * Plus: Release 11.2.0.1.0 ProductionOnWednesday, September 16, August 29 17:45:56, 2012
  4.  
  5. Copyright (c) 1982,201 0, Oracle.AllRights reserved.
  6.  
  7.  
  8. Connect:
  9. OracleDatabase11g Enterprise Edition Release 11.2.0.1.0-64bit Production
  10. WithThe Partitioning, OLAP, Data MiningAnd RealApplication Testing options
  11.  
  12. SQL>
  13. SQL>Alter UserSys identifiedByHtz;
  14.  
  15. The user has changed.
  16.  
  17. SQL> exit
  18. From OracleDatabase11g Enterprise Edition Release 11.2.0.1.0-64bit Production
  19. WithThe Partitioning, OLAP, Data MiningAnd RealApplication Testing options disconnected
  20. Open
  21.  
  22. D: \ app \ luoping \ product \ 11.2.0 \ client_1 \ BIN> sqlplus/@ htzdgAsSysdba
  23.  
  24. SQL * Plus: Release 11.2.0.1.0 ProductionOnWednesday, September 16, August 29 17:46:25, 2012
  25.  
  26. Copyright (c) 1982,201 0, Oracle.AllRights reserved.
  27.  
  28. ERROR:
  29. ORA-01017: invalid username/Password; Logon denied
  30.  
  31.  
  32. Enter the User Name:
  33.  
  34. D: \ app \ luoping \ product \ 11.2.0 \ client_1 \ BIN> mkstore-wrl D: \ app \ luoping \ product \ 1
  35. 1.2.0 \ client_1 \ pstore-modifyCredential htzdg sys
  36. Oracle Secret Store Tool: Version 11.2.0.1.0-Production
  37. Copyright (c) 2004,200 9, Oracle and/or its subsidiaries. All rights reserved.
  38.  
  39. Your key/password is missing from the command line
  40. Enter your key/password:
  41.  
  42. Enter your key/password again:
  43.  
  44. Enter the Wallet password:
  45.  
  46. ModifyCredential
  47. Modify1
  48.  
  49. D: \ app \ luoping \ product \ 11.2.0 \ client_1 \ BIN>
  50.  
  51. D: \ app \ luoping \ product \ 11.2.0 \ client_1 \ BIN> mkstore-wrl D: \ app \ luoping \ product \ 1
  52. 1.2.0 \ client_1 \ pstore-modifyCredential htzdg sys
  53. Oracle Secret Store Tool: Version 11.2.0.1.0-Production
  54. Copyright (c) 2004,200 9, Oracle and/or its subsidiaries. All rights reserved.
  55.  
  56. Your key/password is missing from the command line
  57. Enter your key/password:
  58.  
  59. Enter your key/password again:
  60.  
  61. Enter the Wallet password:
  62.  
  63. ModifyCredential
  64. Modify1
  65.  
  66. D: \ app \ luoping \ product \ 11.2.0 \ client_1 \ BIN>
  67. D: \ app \ luoping \ product \ 11.2.0 \ client_1 \ BIN> sqlplus/@ htzdgAsSysdba
  68.  
  69. SQL * Plus: Release 11.2.0.1.0 ProductionOnWednesday, September 16, August 29 17:48:27, 2012
  70.  
  71. Copyright (c) 1982,201 0, Oracle.AllRights reserved.
  72.  
  73.  
  74. Connect:
  75. OracleDatabase11g Enterprise Edition Release 11.2.0.1.0-64bit Production
  76. WithThe Partitioning, OLAP, Data MiningAnd RealApplication Testing options
  77.  
  78. SQL>

8. manually delete records in the wallet

 
 
  1. D: \ app \ luoping \ product \ 11.2.0 \ client_1 \ BIN> mkstore-wrl d: \ app \ luoping \ product \ 1
  2. 1.2.0 \ client_1 \ pstore-deleteCredential htzdg
  3. Oracle Secret Store Tool: Version 11.2.0.1.0-Production
  4. Copyright (c) 2004,200 9, Oracle and/or its subsidiaries. All rights reserved.
  5.  
  6. Enter the Wallet password:
  7.  
  8. DeleteCredential
  9. Delete1

9. mkstore Command help manual

 
 
  1. D: \ app \ luoping \ product \ 11.2.0 \ client_1 \ BIN> mkstore
  2. Oracle Secret Store Tool: Version 11.2.0.1.0-Production
  3. Copyright (c) 2004,200 9, Oracle and/or its subsidiaries. All rights reserved.
  4.  
  5. Mkstore [-wrl] [-Create] [-CreateSSO] [-createLSSO] [-createALO] [-Delete] [
  6. -DeleteSSO] [-list] [-createEntry alias secret] [-viewEntry alias] [-modifyEntry
  7. Alias secret] [-deleteEntry alias] [-createCredential connect_string username p
  8. Assword] [-listCredential] [-modifyCredential connect_string usernamePassword]
  9. [-DeleteCredential connect_string] [-help] [-nologo]

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.