Snippet Name: USERS: Creating Users
Description: Use the CREATE USER statement to create and configure a database user, which is an account through which you can log in to the database, and to establish the means by which Oracle Database permits access by the user.
You can enable a user to connect to the database through a proxy application or application server.
When you create a user with the CREATE USER statement, the user's privilege domain is empty. To log on to Oracle Database, a user must have the CREATE SESSION system privilege. Because of this, after creating a user you should grant the user at least the CREATE SESSION system privilege.
Also see: » USER: connection information
» USER: User Information 2
» USER idle time
» USER Information
» USER active connected users
» USER memory use
» USER: Connected Users
» USER: drop user
» USER: misc queries and commands
» USER system authentication
» USER lock account
» USER password expiration
» USER profile
» USER tablespace quota
» USER temp tablespace
» USER tablespace
» USER password
» USERS: view specific user info
» USERS: view currently connected users
» USERS: view all active users
» USERS: Drop users
» USERS: Lock and Unlock accounts
» USERS: Proxy Users
» USERS: Grant tablespace access
» USERS: Alter a user
» USERS: CREATE USER w/ authentication
» CREATE USER
» Drop User example
» Create User example
» Create User
Comment: (none)
Language: PL/SQL
Highlight Mode: PLSQL
Last Modified: March 09th, 2009
|
CREATE USER <user_name>
IDENTIFIED BY <password>
-- for example:
CREATE USER mike
IDENTIFIED BY abc123;
-- create a user with a password containing spaces,
-- punctuation characters or other special chars
CREATE USER <user_name>
IDENTIFIED BY "<password>"
-- for example:
CREATE USER mike
IDENTIFIED BY "my $pecial p#ssword";
-- create a user with access to a default tablespace
CREATE USER <user_name>
IDENTIFIED BY <password>
DEFAULT TABLESPACE <tablespace_name>;
-- for example:
CREATE USER mike
IDENTIFIED BY abc123
DEFAULT TABLESPACE sales_dept;
-- create a user with access to a temporary tablespace
CREATE USER <user_name>
IDENTIFIED BY <password>
TEMPORARY TABLESPACE <temporary_tablespace_name>;
-- for example:
CREATE USER mike
IDENTIFIED BY abc123
DEFAULT TABLE sales_dept
TEMPORARY TABLESPACE scratchpad;
/*
Restrictions on Temporary Tablespace
The tablespace must be a temporary tablespace and must
have a standard block size.
The tablespace cannot be an undo tablespace or a tablespace
with automatic segment-space management.
*/
-- create user account and expire a the password
CREATE USER <user_name>
IDENTIFIED BY <password>
DEFAULT TABLESPACE <tablespace_name>
TEMPORARY TABLESPACE <temp_tablespace_name>
QUOTA <quota_amount> ON <tablespace_name>
PROFILE <profile_name>
PASSWORD EXPIRE;
-- for example:
CREATE USER mike
IDENTIFIED BY abc123
DEFAULT TABLESPACE sales_dept
TEMPORARY TABLESPACE scratchpad
PASSWORD EXPIRE;
|