How to use multiple Oracle Wallets
February 1, 2025
by Benthic SoftwareAbout Oracle wallets
In an earlier blog post we described how to create and use Oracle wallets with our products. If you use the Oracle Cloud web site to generate your wallet, the download will include sample versions of sqlnet.ora and tnsnames.ora. The sample sqlnet.ora file includes the wallet location setting. The tnsnames.ora contains sample connect configurations for the databse. These versions work great if all your database connections use that one wallet or databse, but handling multiple connections with different wallets requires a bit more thought.
Using a single wallet
If you only have a single Oracle Wallet, then you can use the generated configuration files "as is" just by putting them in the default client configuration directory (generally %oracle_home%\network\admin) or the location specified by your TNS_ADMIN environment or registry setting. Make sure to double check the wall_location setting as it comes configured to a default location. Note that our products have a command-line override setting for TNS_ADMIN. In general, we recommend using a TNS_ADMIN setting as it can avoid issues of the Oracle client finding a different tnsnames.ora file than desired.
# Benthic Note: sqlnet.ora wallet location will be the default for all connections using this home.
WALLET_LOCATION = (
SOURCE =
(METHOD = file)
(METHOD_DATA = (DIRECTORY="C:\DbClients\Oracle\DefaultWallet"))
)
SSL_SERVER_DN_MATCH=yes
Sample sqlnet.ora with default wallet location
Using multiple wallets with multiple configuration files
One way to use multiple wallets is to use separate Oracle Homes or TNS_ADMIN settings and keep separate sqlnet.ora and tnsnames.ora files. This utilizes separate sqlnet.ora files that can contain different settings including the wallet location. Our product's command-line override (/t) for this makes it easy to do, but managing multiple configuration files can quickly become unmanageable and fortunately there's a better way to handle things.
Using multiple wallets with one set of configuration files
Fortunately, you can specify your wallet location in the tnanames.ora file for each individual database alias (officially called net service names) in the tnsnames.ora file. The key for this is named "WALLET_LOCATION" in newer Oracle clients and "MY_WALLET_DIRECTORY" for older ones (Note that MY_WALLET_DIRECTORY has been deprecated for newer clients but still works as of 23ai.) Here's an example of two tnsnames.ora entries that point to two different Oracle wallets:
# Two entries in tnsnames.ora that each use a separate wallet. benthicOne = (description= (address=(protocol=tcps)(port=1522)(host=yourhost.oraclecloud.com)) (connect_data=(service_name=yourdbOne.adb.oraclecloud.com)) (security=(WALLET_LOCATION="C:\DbClients\Oracle\WalletOne")(ssl_server_dn_match=yes))) benthicTwo = (description= (address=(protocol=tcps)(port=1522)(host=yourhost.oraclecloud.com)) (connect_data=(service_name=yourdbTwo.adb.oraclecloud.com)) (security=(WALLET_LOCATION="C:\DbClients\Oracle\WalletTwo")(ssl_server_dn_match=yes)))
Sample tnsnames.ora showing two entries using two separate wallets
Using Oracle's Easy Connect Plus syntax to avoid using configuration files at all
Oracle introduced an extended syntax for the older Easy Connect (or EZConnect) feature that adds the ability to set various connection options including the wallet location.
# Sample net service name that sets wallet location. To use enter the service name in the login window's "database" field.
tcps://yourhost:1522/yourdb?wallet_location="C:\DbClients\Oracle\Wallet1"
Sample tnsnames.ora entry which sets a wallet location
Note that not all client applications handle this syntax. Golden fully supports it, but GoldSqall doesn't support it as of build 202, but it should be supported in a future build.
Conclusion
Oracle gives a lot of different options for handling Oracle Client connections and configuration files. Hopefully we've touched on some of the more useful options dealing with wallet files. Our products Golden and GoldSqall are great tools for writing SQL queries and scripts and work great with Oracle wallets or any other Oracle client settings.
This website uses cookies to enhance your browsing experience and analyze our website traffic and performance. By using this website, you agree to our use of cookies. Learn more about our Cookie Policy in our Privacy Statement.