Team Fly 

Page 113

Create a User

When you create a user, you can either use the create user syntax or the OEM, which is an easier approach. In order to create a user, you will need to decide the following things:

Image The default tablespace where segments created by this user will be placed unless a tablespace name is used in the DDL to override this.

Image Whether to expire the password so that the user needs to change it the first time they log in to Oracle.

Image A temporary tablespace to store internal data used by Oracle while queries are running. Sort operations make use of the temporary tablespace if there is not enough room in the SGA to perform the sort operation.

Image Whether to employ user quotas on tablespaces, which put a limit on the amount of space that a user's objects can take up in that tablespace.

Image The authentication type, which allows you to specify whether you want Oracle to force the user to specify a password when they log in, or you can trust the operating system to do this for you.

Image The initial password that the user will log in with. The user must change this during the first log in if you chose to expire the password in advance of the user's first logon.

Image Privileges to grant to the user. These can be direct privileges or roles. We will discuss them in the next section.

Image A profile for the user, which can be employed to manage the user's session by limiting resources that sessions can use, and that help implement corporate password policies. We will also see this in the next section.

Image Whether to lock or unlock the user.

The OEM console in Figure 3-9 shows the options available to you to create and edit a user. For each user, there are eight separate tabs that allow you to easily enter a user's information. You can see the SQL that will be generated by selecting the Show Sql button at the bottom of the panel. Another great option allows you to model a user and create another user like one that already exists. To do this, click the user that you want to model, select Object from the top of the panel, and then select the Create Like option.

Here is a sample CREATE USER statement:

CREATE USER ''NEWUSER" PROFILE "DEFAULT" IDENTIFIED BY "newpassword"
PASSWORD EXPIRE DEFAULT TABLESPACE "USERS" TEMPORARY TABLESPACE "TEMP"
QUOTA UNLIMITED ON TEMP QUOTA UNLIMITED ON USERS
ACCOUNT UNLOCK;
GRANT "CONNECT" TO "NEWUSER";
Team Fly 
0132