Creates a special security profile entry to identify a database user. That user can be granted roles, which in turn provide access to database objects.
1 – Environment
You can use the CREATE USER statement: o In interactive SQL o Embedded in host language programs o As part of a procedure in an SQL module or other compound statement o In dynamic SQL as a statement to be dynamically executed
2 – Format
(B)0[m[1;4mCREATE[m[1m [1;4mUSER[m[1m qqwqqq> <username> qqqq> [1;4mIDENTIFIED[m[1m [1;4mEXTERNALLY[m[1m qqwqqqqqk [m [1m mqqq> [1;4mPUBLIC[m[1m qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj x [m [1mlqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj [m [1mmqqqqqqqqqqqqqwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqwqqqqqqqqqqqqqqqqqqqq> [m [1m mqqq> create-user-opts qqqqqqqqqj [m (B)0[m[1mcreate-user-opts = [m [1m [m [1mqwq> [1;4mACCOUNT[m[1m qqwq>[1;4mLOCK[m[1m qqqwqqqqqqqqqqqqqqqqqqqqqwqq> [m [1m x mq>[1;4mUNLOCK[m[1m qj [m [1m x [m [1mtq> [1;4mCOMMENT[m[1m IS qwq> '<string>' qqwqqqqqqqqqqqqqu [m [1mx mqqqqqqq / <qqqqqj x [m [1m [m [1mtq> [1;4mNO[m[1m [1;4mPROFILE[m[1m qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu[m [1mmq> [1;4mPROFILE[m[1m <profile_name> qqqqqqqqqqqqqqqqqqqqj[m [1m [m
3 – Arguments
3.1 – ACCOUNT lock-option
Syntax options: ACCOUNT LOCK | ACCOUNT UNLOCK The ACCOUNT LOCK clause disables access to the database by the user for whom the CREATE USER statement is being applied. The ACCOUNT UNLOCK clause allows that user access to the database. The ACCOUNT UNLOCK clause is the default.
3.2 – COMMENT IS 'string'
Adds a comment about the user. SQL displays the text of the comment when it executes a SHOW USERS statement. Enclose the comment in single quotation marks (') and separate multiple lines in a comment with a slash mark (/).
3.3 – IDENTIFIED_EXTERNALLY
Indicates that the user will be authenticated through the operating system.
3.4 – PROFILE
Syntax options: PROFILE | NOPROFILE Identifies a new profile for assignment to the user. The specified profile name must be the name of an existing profile. NOPROFILE is the default behavior and indicates that no special restrictions are applied to this user.
3.5 – PUBLIC
Explicitly creates a PUBLIC security profile entry in the database.
3.6 – username
The name of the user to add to the database. This must match the name of an existing OpenVMS username.
4 – Examples
Example 1: Creating a New User and Locking Her Account SQL> CREATE USER munroy IDENTIFIED EXTERNALLY cont> ACCOUNT LOCK cont> COMMENT IS 'User munroy starts job on'/ cont> 'May 1, 2003. Unlock when she starts'; Example 2: Adding a profile to a user This example creates a new profile that defines the DEFAULT transaction and then assigns a profile while creating a new user. The next time the user attaches to the database the START DEFAULT TRANSACTION statement will use the defined profile instead of the standard READ ONLY default. SQL> create profile READ_COMMITTED cont> default transaction read write isolation level read committed wait 30; SQL> show profile READ_COMMITTED READ_COMMITTED Default transaction read write wait 30 Isolation level read committed SQL> create user JAIN identified externally profile READ_COMMITTED; SQL> show user JAIN; JAIN Identified externally Account is unlocked Profile: READ_COMMITTED No roles have been granted to this user