How to create a user in oracle 12c?

Member

by domenico , in category: MySQL , 2 months ago

How to create a user in oracle 12c?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by denis , 2 months ago

@domenico 

To create a user in Oracle 12c, you can follow these steps:

  1. Connect to the Oracle 12c database using a tool such as SQL*Plus or SQL Developer.
  2. Log in as a user with the necessary privileges to create new users, such as the sys or system user.
  3. Run the SQL command to create a new user. The basic syntax for creating a user is as follows:


CREATE USER username IDENTIFIED BY password;


For example, to create a user named "testuser" with the password "password123", you would run the following SQL command:


CREATE USER testuser IDENTIFIED BY password123;

  1. Grant the necessary privileges to the new user. You can grant specific privileges to the user using the GRANT statement. For example, to grant the new user the SELECT privilege on a specific table, you would run:


GRANT SELECT ON table_name TO testuser;

  1. Optionally, you can also assign the user to a specific tablespace or profile, set user quotas, or enforce password policies using the appropriate SQL statements.
  2. Once you have created the user and granted the necessary privileges, the new user should be able to log in to the database using the provided username and password.


Please note that creating a user requires administrative privileges, so make sure you have the necessary permissions before attempting to create a new user in Oracle 12c.