password

Oracle: password function

Sunday, November 4th, 2007

Find the name of the current password function

SELECT * FROM DBA_PROFILES WHERE RESOURCE_NAME=’PASSWORD_VERIFY_FUNCTION’;

Change the password function for the profile:

ALTER PROFILE &profile. LIMIT PASSWORD_VERIFY_FUNCTION &function_name.;

Example of the password function:

CREATE OR REPLACE FUNCTION dummy_func
 (USERNAME VARCHAR2, PASSWORD VARCHAR2, OLD_PASSWORD VARCHAR2)
 RETURN BOOLEAN IS
 BEGIN
   IF NLS_LOWER(password) = NLS_LOWER(username) THEN
      raise_application_error(-20001, ‘Password is the same as the username’);
   END [...]

Setting password for Oracle listener in the script

Friday, March 3rd, 2006

Oracle listener control utility doesn’t allow to set the password non-interactively.
In this case the small Perl script, using Expect, could help.

#!/usr/bin/perl
use Expect;
my $exp = new Expect;
my $command = ‘lsnrctl’;
my $PROMPT=’LSNRCTL>’;

Read password in Unix shell

Thursday, February 2nd, 2006

print -n “Enter Your password:”
stty_orig=`stty -g`
trap “stty ${stty_orig}; exit” 1 2 3 15
stty -echo >&- 2>&-
read PASS
stty ${stty_orig} >&- 2>&-
trap 1 2 3 15
print

trap :catches interruptions. I.e. if the user presses Ctrl+C, the normal stty mode is set before stopping the program
stty -echo :switches off the display echo
>&- 2>&- :helps to [...]

Keep on coding