Create a new user in oracle database 12c
Here are the steps to create a new user in an Oracle database 12c:
Using SQLPlus
- Open a SQLPlus session by running the command
sqlplus
and logging in as the system administrator (e.g.,sys
orsystem
). - Create a new user by running the following command:
CREATE USER <username> IDENTIFIED BY <password>;
Replace
<username>
with the desired username and<password>
with the desired password.
For example:
CREATE USER myuser IDENTIFIED BY mypassword;
- Grant the user the necessary privileges by running the following command:
GRANT <privilege> TO <username>;
Replace
<privilege>
with the desired privilege (e.g.,CREATE SESSION
,CREATE TABLE
, etc.) and<username>
with the username you created.
For example:
GRANT CREATE SESSION TO myuser;
- Commit the changes by running the following command:
COMMIT;
Using Oracle Enterprise Manager
- Log in to Oracle Enterprise Manager (EM) by navigating to the URL
http://<your_database_host>:<port>/em
(e.g.,http://localhost:5500/em
). - Click on the "Security" tab and then click on "Users" in the left-hand menu.
- Click on the "Create User" button.
- Enter the desired username and password, and select the desired privileges (e.g.,
CREATE SESSION
,CREATE TABLE
, etc.). - Click on the "Create" button to create the user.
- Click on the "Commit" button to commit the changes.
Using Oracle SQL Developer
- Open Oracle SQL Developer and connect to your database.
- Click on the "Tools" menu and select "User" > "Create User".
- Enter the desired username and password, and select the desired privileges (e.g.,
CREATE SESSION
,CREATE TABLE
, etc.). - Click on the "Create" button to create the user.
- Click on the "Commit" button to commit the changes.
Note: Make sure to replace <username>
and <password>
with the desired values, and <privilege>
with the desired privilege. Also, ensure that the username and password are strong and follow the recommended password policies.