Results 1 to 5 of 5

Thread: How to "create user" in batch mode

  1. #1
    Join Date
    Jan 2004
    Location
    Missouri
    Posts
    10

    Question How to "create user" in batch mode

    I was asked to find out how to create multiple users in batch mode. Can someone tell me how to do it?

    Our system uses sqlplus with Oracle 9i.

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    create a script to create users and run from command line using sqlplus.

    sqlplus user/password@sidname @createscript

  3. #3
    Join Date
    Jan 2004
    Location
    Missouri
    Posts
    10
    Thank you for replying.

    Can a sql file(.sql) read from file? Also is it capable of loops?

    I have a list of username and password in a text file, and I want to create account from this data. Do I have to write SQL statement for each account?

  4. #4
    Join Date
    Mar 2003
    Posts
    468
    you won't be able to loop with standard SQL.
    couple ways you might want to think about doing this.
    1. you could create a procedure that would read an external table of users to create and then loop through the users and create the accounts.

    2. you could create a shell script that could loop through the list and call sql/plus that would execute the command to create the user.

  5. #5
    Join Date
    Jan 2004
    Location
    Missouri
    Posts
    10
    Thank you very much.

    I could not figure out how to execute SQL commands from a shell script.

    I ended up writing a C program that will write a SQL statement list into a text file. And from Sqlplus, executed the list. It wasn't too difficult, but I believe there must be better way to do this.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •