Sunday, January 4, 2015

Oracle - Wallet

Oracle Wallet  Tips
===============

-- IF  ENCRYPTION_WALLET_LOCATION is defined in the sqlnet.ora then all database will use that location

-- IF ENCRYPTION_WALLET_LOCATION is NOT defined then Wallet will be at $ORACLE_BASE/DB_UNIQUE_NAME/wallet

   in my case /apps/oracle/admin/TESTDB/wallet

-- Following statement will show you the wallet file location , it is reading from sqlnet.ora ow Default loc
   select * gv$encryption_wallet_location

-- you must restart the database after changing wallet location to see the change in v$encryption_wallet_location

-- Before you create wallet using SQL+ ,create Directory and any sub dir such as /TESTDB/wallet

-- Now Create the wallet (Make sure you have Oracle_SID set)

   export ORACLE_SID=TESTDB
   sqlplus / as stsdba
   SQL> alter system set encryption key identified by "WallertPassword";
   this will create one file called ewallet.p12  in /apps/oracle/admin/TESTDB/wallet  ( in my case)

-- Now put the above wallet in auto-login mode  ( create cwallet.sso)

   Set to auto open local wallet
  
   As oracle: cd $ORACLE_HOME/bin
 
   make sure you are giving the correct wallet location and the Wallet Password you used to create the wallet
  
   ./orapki wallet create -wallet /apps/oracle/admin/TESTDB/wallet -auto_login

-- open wallet command

   ALTER SYSTEM SET ENCRYPTION WALLET OPEN IDENTIFIED BY "WallertPassword";

-- Close Wallet Command

   ALTER SYSTEM SET ENCRYPTION WALLET CLOSE IDENTIFIED BY "WallertPassword";

-- In RAC Make sure you copy the file from one node to other Nodes

==========
Example how to create a Excrypted Tablespace
==========

CREATE SMALLFILE TABLESPACE "TS_ENCRYPT_01"  DATAFILE '+DG_DATA'
SIZE 5M AUTOEXTEND ON NEXT 1M MAXSIZE UNLIMITED LOGGING
EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT
AUTO DEFAULT
STORAGE ( ENCRYPT )
ENCRYPTION USING 'AES256';