How to create a  procedure to  change randomly passwords

Hello,
I am trying to create a procedure to change randomly passwords for all users in a database. I need this after the database cloning. I have too many users to alter in a manual way...
Is there any option to create a procedure which will fetch all users in a database and alter them by a random password?
I was not able to find any clue.
Could you help me?
Thanks

Welcome to the forum.
change randomly passwords for all users in a database.All users? Including SYS/SYSTEM? I hope not...
But you could 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 from http://www.oracle.com/pls/db102/homepage or http://www.oracle.com/pls/db112/homepage)
DBMS_RANDOM.STRING 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'll have to fill in the where-clause yourself/
I also commented out the dynamic alter user statement, since I'm not sure if you really want to reset the pwd's for all users.
Also, instead of using dbms_output.put_line to check the new passwords, you could insert them in a table or spool the output to a file.

Similar Messages

  • How to create a javabean that generate random password?

    May i know how to create a javabean that can generate random password?
    that include character and string
    and length of 10.

    i created a class file for my java bean
    package autogenerate;
    import java.util.*;
    public class GeneratePwId
    private int MemId;
    private String Passwd;
    public GeneratePwId(){}
    public String getPasswd()
    return this.Passwd;
    public void setPasswd()
    char[] letters = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
    'J', 'K', 'L', 'M', 'N', 'P', 'R', 'T',
    'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c',
    'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k',
    'm', 'n', 'p', 'q', 'r', 's', 't', 'u',
    'v', 'w', 'x', 'y', 'z', '0', '1', '2',
    '3', '4', '5', '6', '7', '8', '9' } ;
    String pwd = "" ;
    while( pwd.length() < 10 )
    pwd += letters[ (int)( Math.random() * letters.length ) ] ;
    this.Passwd = pwd;
    i successfully compile my java file. and try to test it by writing a jsp file.
    here is my jsp code
    <html>
    <head>
    <title>
    Try retrieving password
    </title>
    </head>
    <body>
    <jsp:useBean class"autogenerate.GeneratePwId" id="bean0" scope="page"/>
    <%=bean0.getPasswd()%>
    </body>
    </html>
    but i encounter this error
    org.apache.jasper.compiler.ParseException: /jsp/GetPasswd.jsp(7,18) Attribute class has no value
    anyone can teach me how to solve this problem?
    thanks a alot!

  • How to create a procedure in oracle to write the data into file

    Hi All,
    I am just wondered on how to create a procedure which will do following tasks:
    1. Concat the field names
    2. Union all the particular fields
    3. Convert the date field into IST
    4. Prepare the statement
    5. write the data into a file
    Basically what I am trying to achieve is to convert one mysql proc to oracle. MySQL Proc is as follows:
    DELIMITER $$
    USE `jioworld`$$
    DROP PROCEDURE IF EXISTS `usersReport`$$
    CREATE DEFINER=`root`@`%` PROCEDURE `usersReport`(IN pathFile VARCHAR(255),IN startDate TIMESTAMP,IN endDate TIMESTAMP )
    BEGIN
    SET @a= CONCAT("(SELECT 'User ID','Account ID','Gender','Birthdate','Account Registered On') UNION ALL (SELECT IFNULL(a.riluid,''),IFNULL(a.rilaccountid,''),IFNULL(a.gender,''),IFNULL(a.birthdate,''),IFNULL(CONVERT_TZ(a.creationDate,'+0:00','+5:30'),'') INTO OUTFILE '",pathFile,"' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\n' FROM account_ a where a.creationDate>='",startDate,"' and a.creationdate <='",endDate,"')");
    PREPARE stmt FROM @a;
    EXECUTE stmt;
    DEALLOCATE PREPARE stmt ;
    END$$
    DELIMITER ;
    Regards,
    Vishal G

    1. Concat the field names
    Double Pipe (||) is the concatenation operator in Oracle. There is also a function CONCAT for this purpose
    2. Union all the particular fields
    Not sure what do you mean by UNION ALL particular fields? UNION ALL is a set operation applied on two different result sets that have the same projection.
    3. Convert the date field into IST
    SQL> select systimestamp "Default Time"
      2       , systimestamp at time zone 'Asia/Calcutta' "IST Time"
      3    from dual;
    Default Time                                       IST Time
    05-05-15 03:14:52.346099 AM -04:00                 05-05-15 12:44:52.346099 PM ASIA/CALCUTTA
    4. Prepare the statement
    What do you mean by prepare the statement?
    5. write the data into a file
    You can use the API UTL_FILE to write to a file.

  • How to create  a procedure to send a mail if the Database is down?

    Hi,
    I have created the below procedure to send a mail if the count is less than 1300. It scheduled daily @ 15 30 hrs. Its fine.
    CREATE OR REPLACE procedure SCOTT.hrsmail
    is
    v_count number;
    begin
    Select count(*) into v_count from emp;
    if v_count < 1300
    then
    UTL_MAIL.send(sender => '[email protected]',
    recipients => '[email protected]',
    cc => '[email protected]',
    bcc => '[email protected]',
    subject => 'Testing the UTL_MAIL Package',
    message => 'If you get this, UTL_MAIL package
    else
    null; --what you want to do here
    end if ;
    end;
    Sometime the Database is down, so the job is not running.
    How to create a procedure to send a mail if the database is down?
    Pls help me. Its highly appreciated.
    Thanks
    Nihar

    nihar wrote:
    How to create a procedure to send a mail if the database is down?And what if the database is up, but the network down? Or the database up and mail server down? Or mail server undergoing maintenance?
    There are loads of "+What if's+" - and in that respect, playing "+What if database is down..+" in this case does not make any sense. You do not use the database to monitor its own up/down status. You do not rely just on SMTP as notification protocol that the database is down.
    The correct approach would be using something like SNMP as the monitoring protocol. A monitoring system that can process SNMP and perform some basic root cause analysis (e.g. network to the database server down, database server status unknown). And this system supporting notification methods like SMTP, SMS and so on.

  • How to create a procedure function with a return value of ref cursor?

    Can anybody provide a sample about how to create a procedure function with a return value of REF CURSOR?
    I heard if I can create a function to return a ref cursor, I can use VB to read its recordset.
    Thanks a lot.

    http://osi.oracle.com/~tkyte/ResultSets/index.html

  • How to create stored procedures automatically when creating new company

    I need to create a method in our add-on Business One application that will create stored procedures at the time we install the add-on (when the new company is created).  Where would I store the SQL scripts, and what SAP Business One commands do I need to use to build the stored procedures into the new company database? Can someone give me an example of how to do this?  We are coding in C#, but an example in visual basic would also be helpful if no one out there in forum land uses C#   
    Thanks,
    Nancy Walk
    [email protected]

    Hi Nancy!
    Of course are there people here that use C#
    To solve your problem, create a routine in your add-on that checks at startup if the stored procedures are present. If they are not, create them. You can use the DI-API, or just add them directly to your database.
    <i>Note: SAP does not like it when you play around directly in the SAP databases, and does not supply support for databases that are changed manually. You'd better use the DI-API...</i>
    Hope it helps...
    Grtz, Rowdy

  • How to create stored procedures and use those in Crystal reports

    Hi All,
    Can anyone explain me how to create a stored procedure and use that stored procedure in Crystal reports. As I have few doubts in this process, It would be great if you can explain me with a small stored proc example.
    Thanks in advance.

    Hello,
    There is a document explainining how to use Oracle stored proc with Crystal reports.
    Check at:
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/1084c536-711e-2b10-e48a-924a60745253
    It is for older version but it should work and you can refer to it to get general idea how to start with it. It has a sample oracle stored proc and how to connect it from Crystal Reports.

  • HOW TO CREATE STORED PROCEDURE IN DATA INTEGRATOR

    Hi to every one,
    Can any one help in giving me a solution for creating stored procedure in Data Integrator.
    I m new to this field

    Hi nath,
    Firstly are you using MYSQL or Oracle as the database,if its oracle database then follow this
    http://obiee101.blogspot.com/2008/01/obiee-using-oracle-stored-procedure-to.html
    http://oraclebizint.wordpress.com/2008/02/20/oracle-bi-ee-101332-executing-stored-proceduresfunctions-before-reports-before-report-triggers-and-global-temporary-tables/
    EXEC [DATABASE_NAME].[SCHEMA_NAME].[PROCEDURE_NAME][DATABASE_NAME] --> is the database name your creating your procedure
    [SCHEMA_NAME]-->is the user with which your creating
    [PROCEDURE_NAME] --> the name given to procedure
    You dont know how to get those run this SQL in TOAD and see select sys_context('userenv','db_name'), sys_context('userenv','session_user') from dual
    (OR) open you connection pool properties window in RPD,you will get the DB name and the user name as the schema name
    hope answered your question.
    CHeers,
    KK

  • How to create stored procedure directely in RPD

    Hi Gurus,
    I am trying to create stored procedure directly in physical table in rpd level in OBIEE.for this one i have gone through below website.
    http://obiee101.blogspot.com/2011/01/obiee-using-mssql-stored-procedure-as.html
    in that blog they mentioned to write some query which is...........
    EXEC [DATABASE_NAME].[SCHEMA_NAME].[PROCEDURE_NAME]
    in above query i am not getting what is DATABASE_NAME,SCHEMA_NAME,PROCEDURE_NAME
    can any one elobrate this one

    Hi nath,
    Firstly are you using MYSQL or Oracle as the database,if its oracle database then follow this
    http://obiee101.blogspot.com/2008/01/obiee-using-oracle-stored-procedure-to.html
    http://oraclebizint.wordpress.com/2008/02/20/oracle-bi-ee-101332-executing-stored-proceduresfunctions-before-reports-before-report-triggers-and-global-temporary-tables/
    EXEC [DATABASE_NAME].[SCHEMA_NAME].[PROCEDURE_NAME][DATABASE_NAME] --> is the database name your creating your procedure
    [SCHEMA_NAME]-->is the user with which your creating
    [PROCEDURE_NAME] --> the name given to procedure
    You dont know how to get those run this SQL in TOAD and see select sys_context('userenv','db_name'), sys_context('userenv','session_user') from dual
    (OR) open you connection pool properties window in RPD,you will get the DB name and the user name as the schema name
    hope answered your question.
    CHeers,
    KK

  • How to create several procedures from several script files?

    Hello,
    I have several procedures for SAP HANA. Every procedure is stored in a script file. I can only use SAP HANA Studio.  How can I easily  run all script files to create all procedures on a schema? Can somebody help me?
    Best regards,
    Y.Hu

    Hi Fernando,
    Thank you very much for you explanation.
    My scripts contain native sql statements for creation stored procedures “CREATE PROCEDURE … AS BEGIN … END”. They are not objects for or from Content/package. The procedures should be created direct in a project schema.
    The option with hdbsql command line is not possible because I may not use hdbsql (unfortunately not allowed for me).
    The option all scripts into a big file is a possible option for me. The big file has only 1600 lines. But there is a  strange problem with the text “FOR” in script (please see the thread http://scn.sap.com/thread/3728741 ). Unfortunately SAP HANA Studio cannot run my big script. 
    I hope there is a solution or workaround for this problem.
    Best regards,
    Y.Hu

  • How to create approval procedure when saved as draft?

    How can I create an approval procedure where the document is saved as draft?
    Specifically, returns saved as draft where document total is greater than $3,000 need approval.
    Thanks

    Hi,
         Approval Procedures cant be used in draft mode. Approval Procedure itself acts as document in draft. It wont do inventory postings & financial postings as well. Just create approval procedure with your requirement & try.
    I am looking forward your reply,
    Regards,
    Maheswaran.

  • How to create the request for change of selection text into other language.

    Hi,
    In my object requirement is that when login through Japanese language,  then on selection screen selection text should appear in Japanese language. For that I have maintained the text in Japanese language the program where we define the selection text there from translation I have maintained the text in Japanese but while maintain the text it didn't ask me for REQUEST, because of that I am not able to transport the changes to next system, so I want know how to create the request for this case.
    Thanks

    Hello Chetan,
    You could goto the selection screen texts by goto-> selection texts,
    Then you could again goto -> Translation
    or
    Other-> Translation(Not sure )
    Then double click on the Program you should be able to see the Texts that need translation, now change something save and come back and try to activate, now it should propose for a new Transport Request.
    Either create a new transaport request or give one that you have given for the program.
    Hope the issue is resolved.

  • How to create a procedure using program unit

    Hai All
    Ii have created a procedure like this
    PROCEDURE Duty_calc
    IS
    procedure w_Time
    is
    begin
    update dail_att set wtime= (select lpad((to_number(to_char(outtime,'hh24mi')-to_char(intime,'hh24mi'))),4,0) from dail_att where attend_date=f_date);
    end w_time;
    begin
    if wtime >0830 then
    update dail_att set etime= (select lpad(wtime-0830) from dail_att where attend_date=f_date);
    else
         null;
    end if;
    duty_calc;
    end duty_calc;
    And i have declare in the program unit as Duty_calc and while i am executing my procedure i had an error
    is it must i need to declare a my inner procedure in my program unit
    Regards
    Srikkanth.M

    the same question you asked 2 month ago and same mistake you are doing
    - Procedure name can only be one.
    - Count proper BEGIN ENDs
    PROCEDURE Duty_calc
    IS
    BEGIN
    begin
    update dail_att set wtime= (select lpad((to_number(to_char(outtime,'hh24mi')-to_char(intime,'hh24mi'))),4,0) from dail_att where attend_date=f_date);
    end;
    begin
      if wtime >0830 then
      update dail_att set etime= (select lpad(wtime-0830) from dail_att where attend_date=f_date);
    else
      null;
    end if;
    end;
    END;

  • How to lock a user by using random password?

    hello,
    i need to lock a user from a target system by pushing in random passwords for the accounts. i am successfully able to create an adapter that can generate a random string, but the place where i am stuck is that where to use it as i just need to lock the user and not delete it. if the corresponding manager approves the suspension then the account needs to be deleted else again the account needs to be enabled.
    Please help!
    Thanks!

    ok... sorry...
    so what i did is that i have created a resource that has to be provisioned to the user if the user is to be terminated, in which the manager will mention the user to be terminated and the reason.
    now OIM has to lock the user till the reason that has been given by the manager is deemed valid by the second level manager.
    so for that i have a approval and a process form and processes associsted with them. but the problem is that i need to lock the user using the "Entity Adapter" so i need to do so only in the "Data Object Manager" and thus the problem starts as i dont know where to map the adapter that generates the random password so as to lock the user.
    please, if you find anything confusing here, go thru the discussion in the whole of the thread.
    Thanks!

  • How to create a LOGIN Form & LOGIN ID & PASSWORD for END USERS

    hi,
    i have just created a Database and Forms & Reports using developer 6i.
    now i want to deleiver that Database to end users, but i dont know that how to create a LOGIN Form for the end users and also i want to assign each user a Login ID & Password.
    Plz help me to solve out this problem.

    1. Create the user accounts on the database CREATE USER ... IDENTIFIED BY...
    2. Grant CONNECT Role to the Users
    3. in the main form (the one which is being called initially at runtime) in the ON-LOGON-Trigger create a CALL_FORM() to the Login Form
    4. The Login Form will be called; build a Block with username, password and a Button
    5. In the Button call the LOGON Built-In
    6. Control will be passed to the initially called form again
    I also noticed a thread in here explaining this in more detail...
    Message was edited by:
    user434854

Maybe you are looking for

  • Macbook Pro won't print the first page of any file in any application.

    Problem: My Mid-2009 Macbook Pro won't print the first page in Microsoft Word, Sibelius 6, or in Adobe Reader. My printer is an old Canon MP480 that's worked for almost 2 years perfectly. As well, the "print to pdf" function results in the same error

  • Build project error 1046

    Hi all, I have a problem when I tried to include automation library in to my project. In project property compiler i put some compiler aguments -include-libraries "${flexlib}/libs/automation/automation.swc" when I try to rebuild my project I got erro

  • Bootable tape/dvd/cd/network backup

    I usually work with AIX based systems that has a feature called mksysb. It lets me make a on the fly system backup while system is in full production, to a tape, CD, disk, DVD of file. The backup contains: the OS, boot information, kernel adjustments

  • No Video when using the "Send To Soundtrack Pro Audio File" Command

    Hello FCP Users, After reading and rereading the FCP and STP manuals and scouring the boards; I still can not figure out how to view my video clip while I'm editing/sweetening audio in STP. I have even used the DVD tutorial in an attempt to figure it

  • I was 'tipped' an Iphone 5 and it has a passcode....

    It's an AT&T 32 gig 4g Iphone 5.  There is a passcode on it. My friend thinks its an international one. I was trying to use square on my iphone 4 to get paid for the cab ride using his credit card and to turn my phone on I had to really hammer down o