Você está na página 1de 20

15 Managing Users

Copyright © Oracle Corporation, 2002. All rights reserved.


Objectives

After completing this lesson, you should be able to do


the following:
• Create new database users
• Alter and drop existing database users
• Monitor information about existing users
• Obtain user information

15-2 Copyright © Oracle Corporation, 2002. All rights reserved.


Users and Security

Account Default
locking tablespace

Authentication Temporary
mechanism tablespace
Security
domain
Role Tablespace
privileges quotas

Direct Resource
privileges limits

15-3 Copyright © Oracle Corporation, 2002. All rights reserved.


15-4 Copyright © Oracle Corporation, 2002. All rights reserved.
Database Schema

• Schema Objects
A schema is a named
collection of objects. Tables
Triggers
• A user is created, and a
Constraints
corresponding schema
is created. Indexes
Views
• A user can be
associated with only Sequences
one schema. Stored program units
Synonyms
• Username and schema
are often used User-defined data types
interchangeably. Database links

15-5 Copyright © Oracle Corporation, 2002. All rights reserved.


Checklist for Creating Users

• Identify tablespaces in which the user must store


objects.
• Decide on quotas for each tablespace.
• Assign a default tablespace and temporary
tablespace.
• Create a user.
• Grant privileges and roles to the user.

15-6 Copyright © Oracle Corporation, 2002. All rights reserved.


Creating a New User:
Database Authentication

Set the initial password:

CREATE USER aaron


IDENTIFIED BY soccer
DEFAULT TABLESPACE data
TEMPORARY TABLESPACE temp
QUOTA 15M ON data
QUOTA 10M ON users
PASSWORD EXPIRE;

15-7 Copyright © Oracle Corporation, 2002. All rights reserved.


15-8 Copyright © Oracle Corporation, 2002. All rights reserved.
15-9 Copyright © Oracle Corporation, 2002. All rights reserved.
Creating a New User:
Operating System Authentication

• The OS_AUTHENT_PREFIX initialization parameter


specifies the format of the usernames.
• It defaults to OPS$.
CREATE USER aaron
IDENTIFIED EXTERNALLY
DEFAULT TABLESPACE USERS
TEMPORARY TABLESPACE temp
QUOTA 15m ON data;

15-10 Copyright © Oracle Corporation, 2002. All rights reserved.


15-11 Copyright © Oracle Corporation, 2002. All rights reserved.
Changing User Quota on Tablespaces

• A user’s tablespace quotas can be modified for any


of the following situations:
– Tables owned by a user exhibit unanticipated growth.
– An application is enhanced and requires additional
tables or indexes.
– Objects are reorganized and placed in different
tablespaces.
• To modify a user’s tablespace quota, enter the
following:

ALTER USER aaron


QUOTA 0 ON USERS;

15-12 Copyright © Oracle Corporation, 2002. All rights reserved.


15-13 Copyright © Oracle Corporation, 2002. All rights reserved.
Dropping a User

• Use the DROP command to remove a user.


DROP USER aaron;

• Use the CASCADE clause to drop all objects in the


schema if the schema contains objects.
DROP USER aaron CASCADE;

• Users who are currently connected to the Oracle


server cannot be dropped.

15-14 Copyright © Oracle Corporation, 2002. All rights reserved.


15-15 Copyright © Oracle Corporation, 2002. All rights reserved.
Obtaining User Information

Information about users can be obtained by querying


the following views:
• DBA_USERS
• DBA_TS_QUOTAS

15-16 Copyright © Oracle Corporation, 2002. All rights reserved.


Summary

In this lesson, you should have learned how to:


• Create users by specifying the appropriate
password mechanism
• Control usage of space by users
• Obtain user information

15-17 Copyright © Oracle Corporation, 2002. All rights reserved.


Practice 15 Overview

This practice covers the following topics:


• Creating users
• Displaying data dictionary information about users
• Removing user quotas

15-18 Copyright © Oracle Corporation, 2002. All rights reserved.


15-19 Copyright © Oracle Corporation, 2002. All rights reserved.
15-20 Copyright © Oracle Corporation, 2002. All rights reserved.

Você também pode gostar