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

To generate a PDF using JavaScript in Oracle APEX from a collection

  To generate a PDF using JavaScript in Oracle APEX from a collection, you can follow these steps: 1. Create a button or link on your APEX p...