How to create a procedure to change random passwords

Hello


I am trying to create a procedure to change randomly the passwords for all users in a database. I need this after the cloning of the database. I have too many users to change manually...

Y at - it option to create a procedure that will extract all users in a database and edit a random password?


I wasn't able to find any clue.

Could you help me?

Thank you

Welcome to the forum.

change randomly the passwords for all users in a database.

All users? Including SYS/SYSTEM? I hope not...

But you can use DBMS_RANDOM. STRING and ALL_USERS and dynamic SQL.

http://download.Oracle.com/docs/CD/B19306_01/AppDev.102/b14258/d_random.htm#sthref4675
http://download.Oracle.com/docs/CD/B19306_01/server.102/b14237/statviews_2114.htm#REFRN20302
http://download.Oracle.com/docs/CD/B19306_01/AppDev.102/b14261/dynamic.htm#LNPLS01101

(easy to find when you do a quick search for http://www.oracle.com/pls/db102/homepage or http://www.oracle.com/pls/db112/homepage)

DBMS_RANDOM. CHAIN can give you a random password easily:

select dbms_random.string('x', 10)
from   dual
connect by level <= 10;

Zo, you could do something like:

begin
  for rec in ( select t.username
               ,      dbms_random.string('x', 10) new_pass
               from   all_users t
              -- where  t.username not in (...)
              -- or
              -- where  t.username in (...)
             )
  loop
    --execute immediate ' alter user '||rec.username||' identified by '||rec.new_pass;
    dbms_output.put_line ('New password for user '||rec.username||' = '||rec.new_pass);
  end loop;
end;
/

You will have to fill in the where clause.
I also commented on the dynamic modify the statement of the user, since I don't know if you really want to reset the DDT for all users.
Also, rather than use dbms_output.put_line to verify the new password, you can insert them into a table or spool the output to a file.

Tags: Database

Similar Questions

  • How to create a procedure using unit program

    Hai All

    II have created a procedure like this

    PROCEDURE Duty_calc
    IS
    procedure w_Time
    is
    Start
    Update dail_att set wtime = (select lpad ((to_number (to_char(outtime,'hh24mi')-to_char(intime,'hh24mi'))), 4: 0) in the dail_att where attend_date = f_date);
    end w_time;

    Start
    If wtime > 0830 then
    Update etime set dail_att = (select lpad(wtime-0830) from the dail_att where attend_date = f_date);
    on the other
    null;
    end if;
    duty_calc;
    end duty_calc;


    And I declare in unity of programs such as Duty_calc and whereas I will carry out my procedure I got an error

    What must I declare a my procedure internal in my program unit


    Concerning

    Srikkanth.M

    Just write the name of the procedure simple no need to CALL

    my_Proc;

  • How can I unlock my mobile, changed the password now, it's say that he will not. Tried various combinations.

    I have an Acer laptop with Windows Vista Premium.I changed my password now it won't let me log on, repeat the password wrong the previous password, I tried but still no joy.

    Hello

    This is the information from microsoft on you assist on passwords

    http://support.Microsoft.com/kb/940765

    except that we cannot help you

    read this microsoft's policy NOT to provide assistance to crack passwords:

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_vista-security/keeping-passwords-secure-Microsoft-policy-on/a5839e41-b80e-48c9-9d46-414bc8a8d9d4

  • How to create a procedure for REF CURSOR output with any WHERE clause?

    I have a requirement like this: I have a huge question that need to reuse in my code over 10 times. This SQL has about 50 lines. Here for these 10 odd times sometimes changes in WHERE clause (columns are the same). So I can't create a view as SQL is not static.

    I thought to write a procedure with a para of WHERE_CLAUSE entry. I pulled out a refcursor sys by adding where clause. But I can't do it because you cannot add a clause like this where clause.

    i.e.
    PROCEDURE dynamyic_query (p_where_clause IN VARCHAR2, p_out_query OUT SYS_REFCURSOR ) IS
    BEGIN
    
      OPEN p_out_query FOR SELECT ......... FROM table WHERE || ' ' || p_where_clause;
    
    END;
    The foregoing gives an error.

    How to handle such a situation? Any help would be greatly appreciated.

    Hello

    Channa wrote:
    ... However, when I change the procedure like this:

    PROCEDURE FORMS_TEXT_DYN_SQL_TEST(p_where_cluase IN VARCHAR2, p_out_cursor OUT SYS_REFCURSOR) IS
    v_stmt VARCHAR2(1000);
    BEGIN
    v_stmt := 'SELECT tname FROM tab_test WHERE tname LIKE ''%ABS_V4%'' AND :y';
    
    OPEN p_out_cursor FOR v_stmt using p_where_cluase;
    
    END;
    

    And run this block of code:

    declare
    v_tname varchar2(200);
    out_cursor sys_refcursor;
    begin
    forms_text_dyn_sql_test(' 1 = 1 ', out_cursor );
    LOOP
    fetch out_cursor INTO v_tname;
    exit when out_cursor%NOTFOUND;
    DBMS_OUTPUT.PUT_LINE(v_tname);
    END LOOP;
    end;
    /
    

    I get the error:

    [1]: (Error): ORA-00920: invalid relational operator ORA-06512: at "ABS.FORMS_TEXT_DYN_SQL_TEST", line 6 ORA-06512: at line 5
    

    Looks like you can only set column_name =: z, column_name =: values of type y. You can not it seems to replace it with no WHERE CLAUSE?

    A bind variable, such as: it, represents a single value.
    If: is the VARCHAR2 '1 = 1', then

    SELECT tname FROM tab_test WHERE tname LIKE '%ABS_V4%' AND :y
    

    takes the value

    SELECT tname FROM tab_test WHERE tname LIKE '%ABS_V4%' AND '1 = 1'
    

    I think you want something like this:

    CREATE OR REPLACE PROCEDURE FORMS_TEXT_DYN_SQL_TEST
    (     p_where_clause      IN      VARCHAR2
    ,      p_out_cursor      OUT      SYS_REFCURSOR
    ) IS
      v_stmt VARCHAR2(1000);
    BEGIN
      v_stmt := 'SELECT ename FROM scott.emp WHERE ename LIKE ''%A%'' AND '
              || p_where_clause;
    
      OPEN p_out_cursor FOR v_stmt;
    
    END;
    /
    show errors
    
    SET  SERVEROUTPUT  ON
    
    declare
      v_tname varchar2(200);
      out_cursor sys_refcursor;
    begin
      forms_text_dyn_sql_test(' 1 = 1 ', out_cursor );
      LOOP
        fetch out_cursor INTO v_tname;
        exit when out_cursor%NOTFOUND;
        DBMS_OUTPUT.PUT_LINE(v_tname);
      END LOOP;
    end;
    / 
    

    Output:

    ALLEN
    WARD
    MARTIN
    BLAKE
    CLARK
    ADAMS
    JAMES
    
  • How to create a brush that changes brightness on pen pressure?

    I want to have a brush that changes brightness on pen pressure.

    I have essentially the same problem as this person 7 years ago: Re: draw under dark work (I'm even using the same tablet )

    There is a way to define a brush opacity on pen pressure, the problem is that it works well in a continuous race. If I start another shot, he adds the darkness at the previous race. Not what I want. The color should be only rgb, rgba not.

    Then, there is a way to define a ' background/forground color' brush on pressure of the pen, which is good for the cool effects and works pretty much exactly what I want if I set the background color of white, except that the light replaced darkness within a single shot. That means when I let go of the Tablet, a white dot appears where I let go.

    In this thread, he writes did he use to do this: "merge layers > layer > Set current to darken layer > Exchange swatches > fill > Exchange color chart." I noticed that in photoshop today cc 2015, when you make a new layer, there is an option to set the blending mode and fill with a neutral color for the blend mode. I don't know how to make the actions, so it would be nice if someone tells me how to do this action.

    To get into the Action:

    Window-> Actions

    Create a new set, and then create a new Action and start recording the steps

  • How to create a variable &lt; sql:setDataSource &gt; database password

    Hello

    I hope someone can enlighten me on that.

    I am trying to create a jsp page that uses JSTL to access the database. Regulations in my company requires me to use the password for the encrypted database.

    Here is an excerpt of my codes. The error I get is the password = "${decryptedPassword}" never work. However, it can print the password correctly from "System.out.println ("password is"+ decryptedPassword);" How can I pass the variable 'decryptedPassword' in the password?

    Thank you very much!

    Steve

    < %
    System.setProperty ("oracle.net.tns_admin", "C: / NEW PC BACKUP/oracle/product/10.2.0/client_1/NETWORK/ADMIN");
    System.setProperty ("oracle.net.tns_admin", "/ usr/local/oracle/10.2.0.3/network/admin");
    String decryptedPassword = "";

    Logger.info ("PLANNER_REPORT_EDOW_PSWD_ENCRYPT_KEY = <" + keyAlias + ">");
    Logger.info ("PLANNER_REPORT_EDOW_PSWD_KEY_STORE = <" + keyStoreFile + ">");

    FStore FileBasedKeyStore = new FileBasedKeyStore ("/ usr/local/scripts/keystorefile/key.dat", null);
    If (fStore == null) System.out.println ("keystore is null");
    Key = fStore.getKey ("cities") (Key);
    If (key == null) System.out.println ("key is null");
    decryptedPassword = new String (CryptoUtil.decryptFromBase64 ("OIC/n5asIP6CDR01WwvXtw is", key));
    System.out.println ("password is" + decryptedPassword);
    % >

    < sql:setDataSource var = 'snapshot' driver = "oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@cngd" user = "citosapp" password = "${decryptedPassword}" / > "

    A variable in the Java code is not available as magically as a variable JSTL. You will need to add it to the requestScope for example (request.addParameter ()).

    Your confusion is proof enough that it is a very bad idea to put the Java code in your JSP pages. It leads to unreadable code. You should learn how to combine JSPs & servlets to separate the logic of the other Java and JSP code model.

  • How to create a graph in time real LabVIEW 6.1?

    I am new to programming in LabVIEW (6.1). I wonder to create a LabVIEW interface that can operate the multimeter Keithley 6487, allowing us to apply a voltage and nth measures. With the measures that we have create a chart (V curve i) I find the XY graph, but it only allows to send all the measures at the same time (indexing) to generate the graph and not whenever we take the action so the graph build inn in real-time. I need to know how to create a chart or change the XY graph, so I can generate the i - V curve with each step we take in real time. Whenever we take the action and not once the program ends. Thanks in advance.

    You must place the graphic inside the loop and the use of shift registers to accumulate the X and Y in the form of tables. I do not have 6.1 right now in the process of execution, but it would basically look like this:

    Note that the above is for demonstration (the code is in fact a greedy loop). You can consider putting Scripture on file inside the loop. In this way, if the program crashes, you will not lose your data.

    WARNING: Using table build as indicated above will result in continued growth of memory. If your program is running for a long time, this can become a problem. One thing you may need to watch must have a limit on the size of the array. I know there is an example of "Table of XY" comes with LabVIEW, and I'm sure that this is with 6.1. You should take a look at this example, which implements a fixed buffer for the data in the chart size. You should be able to use the VI "graphic buffer XY"directly in your code. "

  • Procedure to change the CLI password for user directors

    Hello

    I have Cisco context directory Agent 1.0.0.011 installed by another Member of the team and I want to reset password admin CLI. Tracking how do to reset passwrod (DCO of admin password reset application) but I always connect with the old password.

    Can anyone provide some documents what would be the correct procedure to change/reset password for the user admin CLI? It's password during the original installation is complete.

    Thank you

    The command you typed: application ACD reset admin password changes the password for the application of cda admin only.  This is the admin of WebGUI.

    To change the password for the CLI, try the following command:

    Enter the Configuration mode.

    Run the username password plain | hash role admin | user command

    For example: username, password admin hash Cisco123 admin role

    The words in bold are provided by you.

    Please rate useful messages and mark this question as answered if, in fact, does that answer your question.  Otherwise, feel free to post additional questions.

    Charles Moreton

  • How to change the password apps on multiple instance nodes.

    We have multi installation of node Oracle Applications R12 (PRODUCTION) have 1 database server and 2 application servers.

    database and simultaneous manager on the database server while web services and forms are on the two application servers. So I need to change apps password scheme. How could I do?

    I changed the password apps on single node successfully. But I need to do this on the Multi node instance too.
    Please suggest.

    Thank you and best regards,
    Manish

    Hello

    Not necessarily, just run it on application-level nodes.

    Kind regards
    Hussein

  • Allow the user to change the password on the login page.

    Hello

    How to allow the user to change the password on the login page?

    Thank you

    Gargi

    Elodie:

    The appeal of the procedure should be as below

    apex_util.CHANGE_CURRENT_USER_PW('hello');
    

    CITY

  • Definition of attributes based on the change of password

    Hello

    I have a requirement where if the administrator changes the password of a user to the IOM, I need set a particular attribute in the directory server, but if the user changes his password, I need to delete it. Could someone please tell me how can I capture that has changed the password and then set this attribute in the DS?

    Thank you
    PETREA

    It will give the details of the profile for the user that triggered the change of password.

    Ideally, you should plug the API code in the task where you try to define attributes in the DS.

  • How can I create a shortcut to "change user" on the desktop using rundll32.exe in Vista Home Premium?

    I am trying to create the shortcut to "change user" using rundll32.exewithout to create the shortcut to "lock", only to pass the user. I already know that I have to right click on an empty space on the desktop, press New\Shortcut and type%windir%\System32\rundll32.exe user32.dll,but not after the comma. Type so I can only create the shortcut to "change user" and not the shortcut to 'lock '? (This means that I don't want this: %windir%\System32\rundll32.exe user32.dll, LockWorkStation, with LockWorkStation after him.)

    Unfortunately, it can be done in your version of Vista (or so they say, hang on a moment.)  I found the article according to that cllaims to do in Vista Basic and Vista Home Premium in addint a file and shows a set of procedures.  As it is a 3rd party file, do so at your own risk. http://www.vistarevisited.com/2008/08/02/create-a-desktop-shortcut-to-switch-users-in-vista/.  NOTE: This is not how you suggested higher, but if it works who cares?

    In case you don't want to consider the solution above, you have refused, here is the procedure (how to do it in other versions of Vista):http://www.vistax64.com/tutorials/136969-switch-user-desktop-shortcut.html.

    I hope this helps.

    Good luck!

    Lorien - MCSA/MCSE/network + / has + - if this post solves your problem, please click the 'Mark as answer' or 'Useful' button at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • How to create temporary tables in stored procedures.

    Hello

    I am new to oracle, I have a requirement where I need to run a query in a loop for different values of where condition. Here, I need to record the results of the query on each iteration. After the end of the loop, I need to send the results to the front end. I did a lot of research for the concept of the temporary table in oracle, but I found myself unresolved except headaches. Everyone is showing how to create temporary tables in general but not in stored procedure.

    Bad, I need the concept of temporary tables, or is there an alternative way to store temporary results. My procedure looks like this.

    create or replace
    procedure uspMatchCode (parWord varchar2, p_recorderSet to types.cursor_type)
    as
    smallint parCnt;
    Start
    parcnt: = 0;
    Select count (1) in parCnt of...;
    If parcnt > 0 then
    Open for P_recorderSet
    Select field1, field2, field3,... of table1, table2, table2 where < < condition > >
    on the other
    -Here, I want to create a temporary table and store the result for the loop shape into the temporary table.
    CREATE TEMPORARY TABLE global my_temp_table (NUMBER of Column1, Column2) ON COMMIT DELETE ROWS.
    FOR parCnt in 0.3
    loop
    INSERT into my_temp_table select Field1, Field2, field3,... from table1, table2, table2 where < < condition > >
    end loop;
    Open for P_recorderSet
    Select * from < < temporary table > >
    end if;
    end;

    Any help would be great to check me on the problem.

    Thank you
    Kiran.

    This is a change to the query Kiss has posted:

    with data_text like)
    Select regexp_substr (' sales financing marketing ',' [^] +', 1, level ") val
    of tconnect by level<= length('sales="" finance="" marketing')-="" length(replace('sales="" finance="" marketing','="">
    )
    Select * from t, data_text, where t.colname like '% "| data_text. Val |' %'

    This will help you. Please change the column names and the name of the table as a result

  • How to create a boot Veristand procedure?

    I want to create a procedure on the first execution of the workspace. I also need procedures without alarms. How do I do this in Veristand?

    JY

    Thank you

  • I am told that the icons change randomly - why? and how to fix it?

    I just see Wndows Live summary of the problems identified and fixed. Only 'Unfixed' is 'icons change randomly. How can I fix it?

    See if any of these items helps your problem:

    '' The icons change incorrectly in Windows. ''
      <>http://support.Microsoft.com/kb/2396571 >

    '' The icons randomly change to different icons. ''
      <>http://support.Microsoft.com/kb/132668 >

    HTH,
    JW

Maybe you are looking for