Monday, February 22, 2021

How to create random password in oracle database

SQL> set serveroutput on

SQL> DECLARE

  2    l_passwd VARCHAR2(40);

  3  BEGIN

  4    l_passwd := DBMS_RANDOM.string('a',10) || DBMS_RANDOM.string('x',10) || '1#';

  5    -- Remove CONTAINER=ALL for non-CDB environments

  6    DBMS_OUTPUT.PUT_LINE(l_passwd);

  7    --EXECUTE IMMEDIATE 'ALTER USER anonymous IDENTIFIED BY ' || l_passwd || ' ACCOUNT UNLOCK CONTAINER=ALL';

  8  END;

  9  /

nqhZxILnruA2JHHR0BOL1#


PL/SQL procedure successfully completed.


SQL> ed

Wrote file afiedt.buf


  1  DECLARE

  2    l_passwd VARCHAR2(40);

  3  BEGIN

  4    l_passwd := DBMS_RANDOM.string('a',5) || DBMS_RANDOM.string('x',5) || '1#';

  5    -- Remove CONTAINER=ALL for non-CDB environments

  6    DBMS_OUTPUT.PUT_LINE(l_passwd);

  7    --EXECUTE IMMEDIATE 'ALTER USER anonymous IDENTIFIED BY ' || l_passwd || ' ACCOUNT UNLOCK CONTAINER=ALL';

  8* END;

SQL> /

aulAuPBYEG1#


PL/SQL procedure successfully completed.


SQL> /

oUBLDJWQIK1#


PL/SQL procedure successfully completed.


No comments:

Post a Comment

How to install and configure Oracle Apex 24.1 with ORDS 22, Tomcat 9 and Jasper Report 7 on Oracle Linux 8.10

#########################Install Oracle  APEX 24.1################################ ----------------------------------------------------...