I often need to create a handful of Oracle user schemas for test builds. I generally use the following two commands in sqlplus:
This works fine, but I would really like to make my life easier and combine the 6 or so user creation statements into a .sql file and just run the script in sqlplus. I naively constructed a script in the following way:
sqlplus complains aboout the first 'CREATE USER' statement, saying that it is an invalid way to begin a command. Indeed, 'CREATE' is not one of the acceptable statements it lists in the error message. I tried Googling around, but could not find quite what I'm looking for.
What is the correct syntax for creating users and granting permissions in an equivalent way to my two sqlplus commands in an Oracle .sql script? I am using Oracle 10.2 Express Edition.
Thanks in advance!
Code:
CREATE USER username IDENTIFIED BY password DEFAULT TABLESPACE users;
GRANT connect, resource TO username;
This works fine, but I would really like to make my life easier and combine the 6 or so user creation statements into a .sql file and just run the script in sqlplus. I naively constructed a script in the following way:
Code:
begin
CREATE USER ...
GRANT ...
CREATE USER ...
GRANT ...
...
end;
/
sqlplus complains aboout the first 'CREATE USER' statement, saying that it is an invalid way to begin a command. Indeed, 'CREATE' is not one of the acceptable statements it lists in the error message. I tried Googling around, but could not find quite what I'm looking for.
What is the correct syntax for creating users and granting permissions in an equivalent way to my two sqlplus commands in an Oracle .sql script? I am using Oracle 10.2 Express Edition.
Thanks in advance!