You can use an Oracle Wallet to mount the file system using dbfs_client
without having to enter a password. Using a wallet allows you to do the mount in the background in a more secure manner than reading the password from a text file. The wallet also makes it easier to use dbfs_client
for file system tasks.
Create an Oracle Wallet
Create a directory for the wallet.
[oracle@ora1 ~]$ mkdir -p $HOME/oracle/wallet
Create an auto-login wallet. You will be prompted to enter a password for the wallet.
[oracle@ora1 ~]$ mkstore -wrl $HOME/oracle/wallet -create Oracle Secret Store Tool : Version 11.2.0.1.0 - Production Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved. Enter password: Enter password again: [oracle@ora1 ~]$
Add the credentials to the wallet
[oracle@ora1 oracle]$ mkstore -wrl $HOME/oracle/wallet -createCredential orcl oradbfs password Oracle Secret Store Tool : Version 11.2.0.1.0 - Production Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved. Enter wallet password: Create credential oracle.security.client.connect_string1 [oracle@ora1 oracle]$
Add the wallet location and the SQLNET.WALLET_OVERRIDE parameter to the clients sqlnet.ora file.
WALLET_LOCATION = (SOURCE=(METHOD=FILE)(METHOD_DATA=(DIRECTORY=$HOME/oracle/wallet))) SQLNET.WALLET_OVERRIDE=TRUE
Now that the wallet is created with the credentials added for the oradbfs user let try a simple test using SQL*Plus. To use the wallet use the /@
[oracle@ora1 oracle]$ sqlplus /@orcl SQL*Plus: Release 11.2.0.1.0 Production on Fri Apr 16 13:27:36 2010 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL>
Using /@orcl
we were logged directly into the database without entering a username or password.
Using the wallet we can now mount the file system in the background.
[oracle@ora1 oracle]$ nohup dbfs_client -o wallet /@orcl /u01/app/oracle/dbfs nohup: appending output to `nohup.out' [oracle@ora1 oracle]$ df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 18G 15G 1.8G 90% / tmpfs 1014M 528M 486M 53% /dev/shm /dev/sdb1 40G 677M 37G 2% /u03 dbfs 5.3M 144K 5.2M 3% /u01/app/oracle/dbfs [oracle@ora1 oracle]$