To create a user, use the CREATE USER statement. There are lots of options for this one statement, so you will want to consult the documentation for more information. To create a basic user, issue the following:
CREATE USER myuser IDENTIFIED BY mypassword DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp;You can substitute values for the lowercase words above. This newly created user does not have any privileges. You may want to let them connect to the database and create database objects. To do that, you can grant the CONNECT and RESOURCE roles to that user with the following command:
GRANT connect,resource TO myuser;If you want the user to be "all powerful", then grant the DBA role as well:
GRANT dba TO myuser;
For More Information
- Dozens more answers to tough Oracle questions from Brian Peasland are available.
- The Best Oracle Web Links: tips, tutorials, scripts, and more.
- Have an Oracle or SQL tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize. Submit your tip today!
- Ask your technical Oracle and SQL questions -- or help out your peers by answering them -- in our live discussion forums.
- Ask the Experts yourself: Our SQL, database design, Oracle, SQL Server, DB2, metadata, object-oriented and data warehousing gurus are waiting to answer your toughest questions.
This was first published in June 2002