Create a new user oracle 12i
Here are the steps to create a new user in Oracle 12c:
Step 1: Connect to the database as a user with sufficient privileges
You can use the sys
user or another user with the CREATE USER
privilege to create a new user. For example:
sqlplus sys as sysdba
Step 2: Create a new user
Use the following command to create a new user:
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;
Step 3: Grant privileges to the new user
You can grant various privileges to the new user depending on their role and responsibilities. For example, to grant the CREATE SESSION
privilege, use the following command:
GRANT CREATE SESSION TO myuser;
To grant the CREATE TABLE
privilege, use the following command:
GRANT CREATE TABLE TO myuser;
Step 4: Create a default tablespace for the new user
You can create a default tablespace for the new user using the following command:
ALTER USER myuser DEFAULT TABLESPACE <tablespace_name>;
Replace <tablespace_name>
with the name of the tablespace you want to use as the default tablespace for the new user. For example:
ALTER USER myuser DEFAULT TABLESPACE users;
Step 5: Create a profile for the new user
You can create a profile for the new user using the following command:
CREATE PROFILE <profile_name> LIMIT PASSWORD_LIFE 90;
Replace <profile_name>
with the name of the profile you want to create. For example:
CREATE PROFILE myprofile LIMIT PASSWORD_LIFE 90;
Step 6: Assign the profile to the new user
You can assign the profile to the new user using the following command:
ALTER USER myuser PROFILE myprofile;
That's it! You have now created a new user in Oracle 12c.
Here is the complete script:
CREATE USER myuser IDENTIFIED BY mypassword;
GRANT CREATE SESSION TO myuser;
GRANT CREATE TABLE TO myuser;
ALTER USER myuser DEFAULT TABLESPACE users;
CREATE PROFILE myprofile LIMIT PASSWORD_LIFE 90;
ALTER USER myuser PROFILE myprofile;
Note: You can modify the script to suit your specific requirements.