Connecting to database,expdp without supplying username/password
Configuring client to use external password Store
Saving password in a plain text file is a security risk and SOC will not accept using clear text password in scripts. This can be solved by using external password stores. Utilities like sqlplus,expdp,etc can pass db connection string to connect to database.
There are four steps to achieve this
Create a TNS entry
Add necessary entries in sqlnet.ora
Create wallet
Add/Create credential
Create a tns entry (this is going to be used while connecting to the database )
tnsnames.ora
exp_bkp=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = hol)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PDB_TST)
)
)
2 Modify sqlnet.ora
WALLET_LOCATION =
(SOURCE = (METHOD = FILE)
(METHOD_DATA =
(DIRECTORY = /home/oracle/19_hm_2/wallet)))
SQLNET.WALLET_OVERRIDE = TRUE
SSL_CLIENT_AUTHENTICATION = FALSE
3 Create wallet
Create a directory for wallet
mkdir /home/oracle/19_hm_2/wallet
mkstore -wrl /home/oracle/19_hm_2/wallet -create
Keep the wallet password safe(it's required to manage wallet)
Use -listCredential to list existing credentials in the wallet
mkstore -wrl /home/oracle/19_hm_2/wallet -listCredential
4. Add credential with the same name as previously created tns alias
mkstore -wrl /home/oracle/19_hm_2/wallet -createCredential exp_bkp system <password>
Now @exp_bkp can be used in connection(this will connect as system user)
This way db_connect_string(ie: exp_bkp) can be used for any user
Connect to the database
sqlplus /@exp_bkp
Now expdp can be run using connection aliases. This will eliminate need to save password in the script or parameter file
expdp /@exp_bkp schema=HR
Configuring a Client to Use the External Password Store
Comments
Post a Comment