Secure password in Scripts using Wallet feature of Oracle

Secure password in Scripts using Wallet feature of Oracle

1. Configure the Wallet and set the password for wallet:

Mkstore –wrl "wallet location" -create

Example:

Mkstore  -wrl E:\oracle\wallet –create

C:\Windows\System32>mkstore -wrl E:\oracle\wallet -create
Oracle Secret Store Tool : Version 11.2.0.4.0 - Production
Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
Enter password:
Enter password again:

 2. Secure the password of user which you want to use in script in wallet.

mkstore –wrl "wallet location" -createCredential

db_connection_string is an entry on your tnsnames.ora or any service name to connect to the desired database.
 
Example:

mkstore –wrl     E:\oracle\wallet  -createCredential  prod   username   password

Note:prod is an entry on your tnsnames.ora file

C:\Windows\System32>mkstore -wrl E:\oracle\wallet -createCredential prod sys
Oracle Secret Store Tool : Version 11.2.0.4.0 - Production
Copyright (c) 2004, 2013, 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

 3. Adding the following lines in sqlnet.ora for mentioned the location of wallet.

SQLNET.WALLET_OVERRIDE = TRUE
WALLET_LOCATION =
(SOURCE=
(METHOD= FILE)
(METHOD_DATA = (DIRECTORY=E:\oracle\wallet)
))

 4. You can list the credential you set in wallet.

Mkstore –wrl E:\oracle\wallet -listcredential

Example:

C:\Windows\System32>mkstore -wrl E:\oracle\wallet -listCredential
Oracle Secret Store Tool : Version 11.2.0.4.0 - Production
Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
Enter wallet password:   l
List credential (index: connect_string username)
1: prod sys

5. Delete the added credential from the wallet

Mkstore –wrl "wallet location" –deleteCredential

Example:

mkstore -wrl E:\oracle\wallet -deleteCredential prod

C:\Windows\System32>mkstore -wrl E:\oracle\wallet -deleteCredential prod
Oracle Secret Store Tool : Version 11.2.0.4.0 - Production
Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
Enter wallet password:
Delete credential
Delete 1

 6. Delete the wallet created for use

mkstore -wrl “wallet location”  -delete

Example

mkstore -wrl E:\oracle\wallet –delete

C:\Windows\System32>mkstore -wrl E:\oracle\wallet -delete
Oracle Secret Store Tool : Version 11.2.0.4.0 - Production
Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
Enter wallet password:

 7. Check wallet is deleted or not

mkstore -wrl E:\oracle\wallet –list
Use the wallet user in scripts as follows
Sqlplus /@prod

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.