Thursday, August 11, 2022

Using ADB wallet to hide your sqlplus and sqlldr password

 Using the following:

  • Autonomous Database (ADB) 19c
  • Oracle database client 21c on an OCI VM running OL 8
Here are the steps:

  • Download the ADB wallet from the OCI console and unzip to a empty directory
  • Modify the sqlnet.ora file
    • Add the following line “SQLNET.WALLET_OVERRIDE=TRUE”
    • Modify the WALLET_LOCATION line, change DIRECTORY="?/network/admin” to point to your new unzip directory. ,  i.e.   DIRECTORY="/home/oracle/Wallet_gfships”
  • create a credential to the Wallet for your db user.    
    • mkstore -wrl /home/oracle/Wallet_gfships -createCredential gfships_high admin  youradminpassword          (Or use your db user account)    this command will ask for the wallet password which is the same password you used to download the wallet from the OCI console.
  • set TNS_ADMIN to this wallet directory
  • verify connectivity with tnsping
Below are examples using SQLPLUS and SQLLDR with and without the password

SQLPLUS Example:

[oracle@linux-jump-server ~]$ sqlplus admin/yourpassword@gfships_high

SQL*Plus: Release 21.0.0.0.0 - Production on Mon Aug 1 02:23:36 2022
Version 21.3.0.0.0

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

Last Successful login time: Mon Aug 01 2022 02:21:59 +00:00

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.16.0.1.0

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.16.0.1.0
[oracle@linux-jump-server ~]$ sqlplus /@gfships_high

SQL*Plus: Release 21.0.0.0.0 - Production on Mon Aug 1 02:23:51 2022
Version 21.3.0.0.0

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

Last Successful login time: Mon Aug 01 2022 02:23:37 +00:00

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.16.0.1.0

SQL> show user
USER is "ADMIN"
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.16.0.1.0
[oracle@linux-jump-server ~]$


SQLLDR Example:

[oracle@linux-jump-server ~]$ sqlldr admin/yourpassword@gfships_high control=emp.ctl

SQL*Loader: Release 21.0.0.0.0 - Production on Mon Aug 1 02:29:02 2022
Version 21.3.0.0.0

Copyright (c) 1982, 2021, Oracle and/or its affiliates.  All rights reserved.

Path used:      Conventional
Commit point reached - logical record count 6

Table EMPLOYEE:
  6 Rows successfully loaded.

Check the log file:
  emp.log
for more information about the load.
[oracle@linux-jump-server ~]$ sqlldr /@gfships_high control=emp.ctl

SQL*Loader: Release 21.0.0.0.0 - Production on Mon Aug 1 02:29:24 2022
Version 21.3.0.0.0

Copyright (c) 1982, 2021, Oracle and/or its affiliates.  All rights reserved.

Path used:      Conventional
Commit point reached - logical record count 6

Table EMPLOYEE:
  6 Rows successfully loaded.

Check the log file:
  emp.log
for more information about the load.
[oracle@linux-jump-server ~]$ cat emp.ctl
load data
 infile '/home/oracle/emp.txt'
 append into table employee
 fields terminated by ","
 ( id, name, dept, salary )
[oracle@linux-jump-server ~]$

No comments:

Post a Comment