Need to create a user  from procedure

Hi to all,
I need to create a user from oracle stored procedure. i am able to create a proceure successfully, when i am executing the procedure i cant able to successfully run it. it is throwing insufficient privileges. i tried to run the procedure from system user also.
The below one is the procedure.
create or replace procedure sp_createsuser(username varchar2)
as
begin
execute immediate 'create user ' || username || ' identified by ' || username;
end;
the code is parsed successfully and created without any errors
when trying to executing it throwing error as insufficient privileges
the user is dba privileged and tried this procedure to execute from the system user also, getting the same output.
I need to know whether it is possible to create user from a procedure, package or a trigger.
Thanks in advance.

Hi,
I guess the message is pretty clear !! you lack privilege.
SQL> conn imx/imx
Connected.
SQL>
SQL> create user testproc identified by testproc;
create user testproc identified by testproc
ERROR at line 1:
ORA-01031: insufficient privileges
SQL> create or replace procedure sp_createsuser(username varchar2)
  2  as
  3  begin
  4  execute immediate 'create user ' || username || ' identified by ' || username;
  5  end;
  6  /
Procedure created.
SQL> exec sp_createsuser('testproc');
BEGIN sp_createsuser('testproc'); END;
ERROR at line 1:
ORA-01031: insufficient privileges
ORA-06512: at "IMX.SP_CREATESUSER", line 4
ORA-06512: at line 1
SQL> conn sys/******* as sysdba
Connected.
SQL> grant create user to imx;
Grant succeeded.
SQL> conn imx/imx
Connected.
SQL> exec sp_createsuser('testproc');
PL/SQL procedure successfully completed.
SQL> conn sys/syssys as sysdba
Connected.
SQL> select username from dba_users where username like 'TESTP%';
USERNAME
TESTPROC
SQL>Regards

Similar Messages

  • Create new user from EM

    Hi,
    I need to create a user who can only access to OEM and run a job: the job execute a stored procedure that reads and writes to the oracle tables.
    The user must have the least set of privileges possible.
    How can I do? What privileges do I set?

    Sara C. wrote:
    I must create a user in OEM who can ONLY:
    1) access to EM
    2) to create and run a job, or to view and run a job created by user SYS. The job run a stored procedure
    the user can not:
    1) access the Oracle schema and view the contents of store procedures, such as packages and are defined.Also I didn't get the need of such user, AFAIK I don't think that's possible. From EM, the users who are created are considered as teh admins of the EM. Why you want to make such user? If a job is made by Sys, why not log in as Sys and monitor it as well ?
    Aman....

  • Error message in creating EBP users from existing SU01 users

    I am getting the following error messages when i try to create EBP users from existing SU01 users using users_gen: Error during creation of user: User not created or error(s) occurred during user creation. ``Central person`` already exists for user (BBPU_MESSAGES 042). Pls what does it mean and how do i solve this?

    Babalola-
    The message is indicating that the user you are attempting to create was previously created in the EBP system.
    First I would try to correct the user via users_gen using the "check users" option.  This may repair the user, but if the user has lost the association to the org then you will need to take some manual steps to re-establish the links for the user in the org details.
    If this doesn't correct it, then use transaction PP01 to correct/verify the following relationships for the user.  Start with the org unit and work your way down looking for the broken link/s.
    Here are the required relationships for the objects:
    ORG UNIT:
    Relationship     Object
    B 003          Position(of user)
    POSITION:
    Relationship     Object
    A 003          Org Unit
    A 008          Central Person (of user)
    A 008          User
    CENTRAL PERSON:
    Relationship     Object
    B 008          Position
    B 207          Business Partner
    B 208          User
    USER:
    NONE
    BUSINESS PARTNER:
    NONE
    Hope this helps you.
    b

  • I need to prevent unauthorized users from accessing the application pages

    Hi^^,
    I have created an application in jsp and servlets. It has several pages like manager, supervisor accountant. I need to prevent unauthorised users from accessing these pages. In other words I need to implement a filter. Anyone who types a url other than that of the login page needs to be blocked. However I am not able to conceptualize the code that is going to be inside the doFilter() method. Please help
    Sincerely,
    Prashant

    Hi^^,
    I admit that there were some mistakes in the previous posting. I have corrected the mistakes and now there is going to be no compile time error. However when i put in the login id and the password it is redirecting me to the login page. I think that the front end jsp is directing the control to the controller servlet. But as "YOU" have pointed out in your previous post,
    "by default requestDispatcher.forward(...) does not pass through the filter change. If the user requests the login page from their browser however, then they will still get the error message, which may not be appropriate."
    I feel we need to somehow make the code pass through the requestDispatcher.forward(...) method of the servlet.
    I am again posting the corrected code.
    package com;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class SecurityFilter implements Filter
      public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws   ServletException, IOException
      HttpServletRequest req = (HttpServletRequest)request;
      HttpServletResponse res = (HttpServletResponse)response;
      String X = req.getRequestURI();
      if(X.equals(http://localhost:8080/MyProject/LoginPage.jsp))
         //writing code for passing through the filter
         final class MyGenericFilter implements javax.servlet.Filter
          public FilterConfig filterConfig;
          public void doFilter( final ServletRequest request, final ServletResponse response, FilterChain chain) throws java.io.IOExeption, javax.servlet.ServletException
          chain.doFilter(request,response);
          public void init(final FilterConfig filterConfig)
          this.filterConfig = filterConfig;
          public void destroy()
    else
       HttpSession session = req.getSession();
       String username = (String)session.getAttribute("username");
       if(null==username)
         request.setAttribute("Error","Session has ended. Please login");
         RequestDispatcher rd = request.getRequestDispatcher("Login.jsp");
         rd.forward(request,response);
         chain.doFilter(request,response);
        else
         RequestDispatcher rd = request.getRequestDispatcher("X");
         rd.forward(request,response);
    public void init(final FilterConfig filterConfig)throws ServletException
          public void destroy()
      Edited by: pksingh79 on Aug 12, 2008 5:23 AM

  • HT1752 I have forgotten my admin password and need to create another user

    I have forgotten my admin password and need to create another user. Have no disks to boot from!!

    You need an installer disc in order to reset an admin password. I don't know if the following will work on your system, but give it a try:
    You can also reset the password by printing out (or writing down) and carefully following these steps.
    First, find the short name of the admin user on the machine. The easiest way of doing this is by looking at what their directory is called in the Users folder.
    Now, start up the computer while holding down Cmd-S. It should boot into a command line. (If it doesn't, you may need to reset the firmware password, which is detailed elsewhere.)
    Type these exact lines:
    mount -uw /
    ifconfig lo0 up
    cd /var/db/netinfo
    netinfod -s local
    Now you'll need that short name. (You did write it down, didn't you?) Type "passwd", a space, and the short name of the admin. For example, if the admin was - rather prosaically - called "admin", you'd type "passwd admin".
    The computer will now prompt you to change the password for "admin" (or whatever the short name was). Go ahead and type a new password.
    Now, type:
    sync
    reboot
    and the machine will reboot. The admin password should now be changed.

  • I need to create a PDF from InDesign that people can edit in Reader or Acrobat

    I need to create a PDF from InDesign that people can edit (for example, change a name from "John" to "Johnny") from either Adobe Reader or Adobe Acrobat. I have already looked at forms, but they do not keep your font colors, faces, and sizes and just make everything that is selected as a text form Black, 12pt, Times New Roman.
    Can anyone here help me?

    Vincent,
    If you use Acrobat pro, generate your .pdf file and then save it as (french version):
    ... so that anyone using Acrobat Reader (or Pro, of course) can modify the .pdf file (with limitations), add comments, ...
    If you want to try to "protect" your .pdf file, you can try with this (in the "Préférences" menu (french version)):

  • Create an user from the existing user.

    Hi All,
    Recently i have created one user from the existing user in a different server.
    Oracle version :10.2.0.1.0
    I have granted the similar roles same as in production.
    In Production:
    SQL> select granted_role,grantee from dba_role_privs where grantee in ('TRADELOANS');
    GRANTED_ROLE                   GRANTEE
    RESOURCE                       TRADELOANS
    CONNECT                        TRADELOANS
    In Test:
    SQL> select granted_role,grantee from dba_role_privs where grantee in ('TRADELOANS');
    GRANTED_ROLE                   GRANTEE
    RESOURCE                       TRADELOANS
    CONNECT                        TRADELOANS
    But the user complained that he is getting error like 'user lacks CREATE SESSSION privilege'. He also says he is able to connect to production but for the test he is getting that error
    Can anybody let me know where i have done the mistake?
    Regards
    Arun

    arundba wrote:
    Hi Kamran,
    I listed the roles given to the user in my first post. I have granted connect and resource role to the user.
    and it is same in production also. But the thing is why he is able to connect to production and not for test?
    Regards
    ArunSee the following demonstration:
    SQL> create user t identified by t;
    User created.
    SQL> connect t/t
    ERROR:
    ORA-01045: user T lacks CREATE SESSION privilege; logon denied
    Warning: You are no longer connected to ORACLE.
    SQL> conn / as sysdba
    Connected.
    SQL> grant connect to t;
    Grant succeeded.
    SQL> conn t/t
    Connected.
    SQL>

  • Need to create a user who will run the logminer what rights should be given

    I Need to create a user who will run the logminer what specific rights should be given in order to run the logminer and query the logminer views. Cant give the sysdba privilages.
    Any help in this regard will be really appericiated.
    Thanks

    I have given the following privilages
    GRANT CREATE SESSION TO NEW_USER;
    GRANT SELECT ANY TABLE TO NEW_USER;
    GRANT EXECUTE ON DBMS_LOGMNR TO NEW_USER;
    GRANT EXECUTE ON SYS.DBMS_LOGMNR_D TO NEW_USER;
    GRANT SELECT ON V_$SESSION TO NEW_USER;
    GRANT SELECT ON V_$ARCHIVED_LOG TO NEW_USER;
    GRANT SELECT ON V_$LOG TO NEW_USER;
    GRANT SELECT ON V_$LOGFILE TO NEW_USER;
    GRANT SELECT ON V_$LOGMNR_CONTENTS TO NEW_USER;
    but when i try to add the logfile it gives me the following error
    ERROR at line 1:
    ORA-06550: line 1, column 85:
    PLS-00201: identifier 'DBMS_LOGMNR.NEW' must be declared
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    What additional rights can i gave to run this
    Thanks

  • Creating FBA user from the timer job

    Hi,
    I'm trying to create FBA users from the timer job,
    The code to it:
    MembershipCreateStatus createStatus;
    MembershipUser user = Membership.CreateUser(strUserID, strPassword, strEmail, "Test Question", "Test Answer", true, out createStatus);
    switch (createStatus)
    case MembershipCreateStatus.Success:
    //SendMail
    break;
    case MembershipCreateStatus.DuplicateEmail:
    //Log in to the error file
    break;
    But it throws the error:
    Unable to connect to SQL Server database in the timer job
    Regards,
    Sachin

    timer job has its own app.config, which is completely separate from the web.config
    plus, this is a terrible idea.
    Scott Brickey
    MCTS, MCPD, MCITP
    www.sbrickey.com
    Strategic Data Systems - for all your SharePoint needs

  • Need to create new users in Office 365 with custom attributes from a csv file

    I am exporting users from an active directory environment and then deleting them from AD. They are Alumni and will no longer be in AD.
    I have a csv file with the following fields that I need to use to create new Alumni email boxes in Office 365 for. I need the CustomAttributes because my Dynamic Distribution Groups use them. I am fairly new to PowerShell and have been unable to get this
    to work. I suspect I may have to split it into two parts, but am not sure how to proceed. Any assistance would be appreciated. I was directed here from the Office 365 community.
    Import-Csv -Path c:\CSVfiles\CreateAlumni.csv | ForEach-Object {
       New-MsolUser -FirstName $_.FirstName -LastName $_.LastName
       -UserPrincipalName $_.UserPrincipalName
       -DisplayName "$($_.FirstName) $($_.LastName)"
       -Password $_.Password
       -CustomAttribute1 $_.CustomAttribute1
       -CustomAttribute3 $_.CustomAttribute3
       -CustomAttribute10 $_.CustomAttribute10
       -CustomAttribute11 $_.CustomAttribute11
       -CustomAttribute12 $_.CustomAttribute12
       -LicenseAssignment 'domaincom:EXCHANGESTANDARD_ALUMNI'
       -UsageLocation US

    Ok, it wasn't stopping after 2 iterations. What I was seeing was 2 failures. The first was the Get-Mailbox command and the second was when it tried to assign attributes. For some reason it is not looping when it fails. It just goes on and tries to assign
    the Custom Attributes. I added writes in to tell me what was happening.
    ### Check if mailbox is provisioned yet
    Write-Host "Checking if mailbox is provisioned yet..." -foregroundcolor yellow
    $found = $false
    $count = 0
    Do {
    try {
    Get-Mailbox -Identity $_.UserName -ErrorAction Stop
    $found = $true
    Write-Output 'Mailbox found. Details:'
    Get-Mailbox -Identity $_.UserName
    } catch {
    Write-Output 'Sleeping'
    $count++
    Start-Sleep -Seconds 5
    If ($count -ge 12) {
    Write-Output 'Mailbox not found. Quitting.'
    $found = $true
    } Until ($found)
    Write-Host "Adding Custom Attributes to User" -foregroundcolor yellow
    Set-Mailbox -Identity $_.UserName -CustomAttribute1 $_.CustomAttribute1 -CustomAttribute3 $_.CustomAttribute3 -CustomAttribute10 $_.CustomAttribute10 -CustomAttribute11 $_.CustomAttribute11 -CustomAttribute12 $_.CustomAttribute12
    Write-Output "User has been Provisioned in Office 365!" -foregroundcolor yellow
    Checking if mailbox is provisioned yet...
    The operation couldn't be performed because object 'Joe.Cool2003' couldn't be found on 'CO1PR07A002DC01.NAMPR07A002.prod.outlook.com'.
        + CategoryInfo         
    : NotSpecified: (:) [Get-Mailbox], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : [Server=CO1PR07MB125,RequestId=e1aabda1-01e4-4f68-984e-e20be0975242,TimeStamp=5/22/2014 4:23:59 AM] [FailureCategory=Cmdlet-ManagementObj
       ectNotFoundException] 2788FB48,Microsoft.Exchange.Management.RecipientTasks.GetMailbox
        + PSComputerName        : pod51038psh.outlook.com
    Mailbox found. Details:
    The operation couldn't be performed because object 'Joe.Cool2003' couldn't be found on 'CO1PR07A002DC01.NAMPR07A002.prod.outlook.com'.
        + CategoryInfo         
    : NotSpecified: (:) [Get-Mailbox], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : [Server=CO1PR07MB125,RequestId=16a8a2bc-333a-455c-8504-e0b99c44c334,TimeStamp=5/22/2014 4:24:00 AM] [FailureCategory=Cmdlet-ManagementObj
       ectNotFoundException] 2788FB48,Microsoft.Exchange.Management.RecipientTasks.GetMailbox
        + PSComputerName       
    : pod51038psh.outlook.com
    Adding Custom Attributes to User
    The operation couldn't be performed because object 'Joe.Cool2003' couldn't be found on 'CO1PR07A002DC01.NAMPR07A002.prod.outlook.com'.
        + CategoryInfo         
    : NotSpecified: (:) [Set-Mailbox], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : [Server=CO1PR07MB125,RequestId=8319d220-b9dd-492f-8182-5083cf56e58b,TimeStamp=5/22/2014 4:24:00 AM] [FailureCategory=Cmdlet-ManagementObj
       ectNotFoundException] C7844A24,Microsoft.Exchange.Management.RecipientTasks.SetMailbox
        + PSComputerName       
    : pod51038psh.outlook.com
    User has been Provisioned in Office 365!
    Of course the user has been provisioned, but the CustomAttributes have not been assigned. :(

  • Need to create sale order from the flat file & mail has to be sent

    Hi Experts,
              I have a requirement to create a sale order from a flat file and once the oder is created, mail has to be sent to customer as well as to internal user with the order details. I want to know how this process can be implemented and what adapters are needed to execute this.
    it would be very helpful, if i get an step-by-step procedure.
    Points assured for any helpful answers.
    Thanks in Advance
    Jai

    HI Jai,
    You need to create two interfaces as file will be sending the Sales oreder details that you need to capture in IDOC or RFC and then have to trigger to create the sales order. For this Standard BAPIs are also available.
    These RFC or BAPIs will response with Sales order details that you need to divert to Mail adapter with the use of BPM and also have to go for Async to Sync bridge.
    File -
    >XI (BPM) ---> BAPI/RFC  (Request)
    MailAdapter <- XI (BPM) <--- BAPI/RFC (Response)
    For this refer below links for step by step
    /people/arpit.seth/blog/2005/06/27/rfc-scenario-using-bpm--starter-kit - File to RFC
    https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/1685 [original link is broken] [original link is broken] [original link is broken] - File to Mail
    /people/krishna.moorthyp/blog/2005/06/09/walkthrough-with-bpm - Walk through BPM
    /people/siva.maranani/blog/2005/05/22/schedule-your-bpm - Schedule BPM
    /people/sriram.vasudevan3/blog/2005/01/11/demonstrating-use-of-synchronous-asynchronous-bridge-to-integrate-synchronous-and-asynchronous-systems-using-ccbpm-in-sap-xi - Use of Synch - Asynch bridge in ccBPM
    https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/1403 [original link is broken] [original link is broken] [original link is broken] - Use of Synch - Asynch bridge in ccBPM
    If you will use IDOC then In IDOC inbound processing you need to trigger for Sales order creation and then have to send the Sales Order generated IDOC as an Outbound to Mail Adapter
    Flat file -
    > XI ---> IDOC
    IDOC -
    > XI ---> Mail
    This will be bit easy scenario to develope as compare to using BAPI with BPM
    /people/ravikumar.allampallam/blog/2005/06/24/convert-any-flat-file-to-any-idoc-java-mapping - Any flat file to any Idoc
    configuring IDOC-XI-Mail scenario using following web-log:
    /people/michal.krawczyk2/blog/2005/03/07/mail-adapter-xi--how-to-implement-dynamic-mail-address
    /people/sravya.talanki2/blog/2005/08/18/triggering-e-mails-to-shared-folders-of-sap-is-u - Triggering Email from folder
    Thanks
    Swarup

  • Create new users from an excel spread sheet

    Hi Everyone.
    I am very new to SAP and I have only done the ABAP programming course last month.
    To make mme become familiar with ABAP - I was given a task of creating users from an Excel spread sheet - This will be used later on when we implement the new SAP system and decommision the legacy system.
    I am just wondering If anyone has created such program - I would appreciated If I can have a copy So I can learn how it is done -
    At the moment, I was thinking of using BAPI_USER_CREATE1 and BAPI_TRANSACTION_COMIT to create users and optimise the creation call. Is there any thing else that I should be aware of ? I'd be appreciated if someone drop me some ideas - Thanks in Advance

    Hi Samantak.
    Thanks for your quick response.
    Since posting the question, I discovered that within  'BAPI_USER_CREATE1'  sub-call statements - comit is already done. Now my questions are:
    1) Do I still need 'BAPI_TRANSACTION_COMIT' to optimise the CREATE new newusers call ?  Apparently, yes.......I am curious for the reason 'why' since comitting is already done.
    2) I did an interactive call of the 'BAPI_USER_CREATE1'  - a user id was actually created in the system.  Now, my second question is.. Is there a way of calling 'BAPI_USER_CREATE1'  without comitting the data (i.e. create user record on file)..
    I want to call this whout comitting because I want to sort out the number of 'good' records from the supplied data list - and presenting the success percentage to the users before comitting the data.
    Thanks

  • Need to create a user policy form

    Can anyone help?
    I need to create a policy form in Dreamweaver CS4 that a user needs to accept, or not, before proceeding further to another page in my site? After they accept the form the functionality needs to take the individual to another page where they are able to make charitable contributions using credit cards that would be sent directly to the organizations bank. They are trying to avoid using PayPal.
    This is my first time using this concept and I'm getting lost.
    Thanks
    Swany

    Unfortunately it's not perfect. With the other recommendation a user could simply go to the URL without viewing the policy page and thus not accepting the terms. For instance in the example anyone could just go to http://google.com without accepting the terms. Just view source code and see where GoTo URL directs upon accept. Also because there is no server side restriction to the page then the page is crawled by search engines so someone searching for your page online may go to your form page without first being redirected to the policy page.
    With server side restriction the page is not crawled by search engines so the page will not come up in search results and users could not simply visit the URL because it would restrict access and redirect to the "login" AKA policy page first. Server side authentication is always the best method.
    If you'd still like to go about doing it the recommended way let me know and I can walk you through the process. Basically just create a MySQL database table for the users username and password then user Dreamweaver Server behaviors to create the restrict access page and login page. It's pretty straight-forward to use the server behaviors in Dreamweaver once the database is setup. I walked someone through how to setup a database with GoDaddy recently and it's a similar process with other hosts.
    If the other imperfect method that can be worked around works for you then that's great!

  • Need to refresh materialized view from procedure and pl/sql block

    Hi,
    I need to refresh materialized view (complete refresh)from procedure and pl/sql block .can some one help.
    MV name:MV_DGN_TEST_SESSION
    Thanks,
    Rajasekhar

    dbms_mview.REFRESH ('MV_DGN_TEST_SESSION', 'C');Regards,
    Mahesh Kaila
    Edited by: user4211491 on Dec 1, 2009 10:41 PM

  • Need to create infor record from one plant to other

    Hi All,
    We have a requirement where we need to create a info record in plant 120.
    we already have the info records in the plant 130 and need to merge them in plant 120 even.
    So requirement is to get the infor records from plant 130 and create in plant 120.
    We have batch input programs ZRM06IBI0 ( create purch info record ) by which we can create the info record with available sequential file. this sequential file will be created by program RM06IBIE  ( Create sequetial file for Purch info record ).
    The problem here to use this things is that it creates a session for each record which will result in lacs of session created. which is not advaisable.
    another option is to use BDC. but because of performance issues we need to skip it out and find any other method or function modules which can get the inforecords info from the database for plant 130 and create the same in plant 120.
    Please help me in this regard.
    Helpfull answers will be rewarded.
    BR,
    Ravi

    Try:
    INSERT INTO fnd_lobs
               (fnd_lob_id,
                file_data
        VALUES (1, -- or whatever the identifying value is
                (SELECT blob_type_column
                   FROM xxxx
                  WHERE xxxx_id = 1 -- or whatever the identifying value is
    ;If this doesn't work, then please list the table create statements for each table.

Maybe you are looking for

  • How can i connect between WS−G5484 1000BASE−SX and GLC-LH-SMD ?

    Dear experts, My customer has 6509 A-side and B-side core switches and need to migrate only 6509 B-side to Nexus. I have some question below. 1. Customer's 6509A-side has multiple WS−G5484 1000BASE−SX and WS−G5486 1000BASE−LX links and it is connecte

  • LSMW by BI  : Unable to specify file in step 7; logical Path not assigned

    Hi, I'm trying to uplaod HR DATA using object 0555 and method 0000 for Program RPDUSTD00 using LSMW Batch Input Method. In step 7 when i specify file which tab delimited text file at front end pc(at my pc) let say  c:\test.txt and save I got error me

  • ASO to ASO Partitioning not working in 11.1.1.3

    Hi All, We are to create a transparent partition using EAS between 2 ASO cubes. When we use member relation functions such as @IDESCENDANTS on the dimension name, the partition validates successfully however no data comes across in the target databas

  • IMPORT itab FROM MEMORY ID - doubt

    Hello all, In my program I am using the statement like given below. IMPORT  ITAB_TDR       FROM MEMORY ID 'PPI'.  I am getting Sy-subrc = 4.  The reason might be either Unable to import data objects or The ABAP memory was probably empty or The conten

  • ITunes sync disables EAS sync

    I have user that just updated iTunes to the latest version. Now whenever he syncs with his laptop, his EAS will stop syncing. He can go back in and setup the account again and it will work until he syncs. Then it stops.