Module 14-1 - Create and Manage Oracle Users
Module 14-1 - Create and Manage Oracle Users
Objectives
Users also have a privilege domain initially the user account has
NO privileges it is empty.
In order for a user to connect to Oracle, you must grant the user the
CREATE SESSION system privilege.
Each user has a schema for the storage of objects within the database
(see the figure below).
Two users can name objects identically because the objects are
referred to globally by using a combination of the username and
object name.
Scott has two tablespaces identified, one for DEFAULT storage of objects
and one for TEMPORARY objects.
ERROR:
ORA-28001: the account has expired
Changing password for SCOTT
Old password:
New password:
Retype new password:
Password changed
Database Authentication
Advantages:
o User accounts and all authentication are controlled by the
database. There is no reliance on anything outside of the
database.
o Oracle provides strong password management features to
enhance security when using database authentication.
o It is easier to administer when there are small user communities.
External Authentication
External Authentication requires the creation of user accounts that are
maintained by Oracle. Passwords are administered by an external service
such as the operating system or a network service (Oracle Networks
Network authentication through the network is covered in the course
This prefix is used at the operating system level when the user's
account username.
You can also use a NULL string (a set of empty double quotes: "" )
for the prefix so that the Oracle username exactly matches the
Operating System user name. This eliminates the need for any
prefix.
#init.ora parameter
OS_AUTHENT_PREFIX=OPS$
#create user command
CREATE USER OPS$Scott
IDENTIFIED EXTERNALLY
DEFAULT TABLESPACE users
TEMPORARY TABLESPACE temp
QUOTA UNLIMITED ON Users;
When Scott attempts to connect to the database, Oracle will check to see if
there is a database user named OPS$Scott and allow or deny the user
access as appropriate. Thus, to use SQLPlus to log on to the system,
the LINUX/UNIX user Scott enters the following command from the
operating system:
$ sqlplus /
Changes in the parameter take effect the next time the instance
starts and the database is mounted.
Global Authentication
Central authentication can be accomplished through the use of Oracle
Advanced Security software for a directory service.
Global Roles are defined in a database and known only to that database
and authorization for the roles is done through the directory service. The
roles can be used to provide access privileges
Most users don't need their own schemas this approach separates
users from databases.
The WITH ROLE clause specifies that Proxy_Server can active all
roles for the user Scott except the role named Inventory.
Default Tablespace
If one is not specified, the default tablespace for a user is the SYSTEM
tablespace not a good choice for a default tablespace. The standard
Changing a default tablespace does not affect the storage location of any
user schema objects that were created before the default tablespace
modification.
You can assign each user a tablespace quota for any tablespace (except a
temporary tablespace). Assigning a quota does the following things:
Oracle Database limits the amount of space that can be allocated for
storage of a user's objects within the specified tablespace to the
amount of the quota.
If the user has the privilege to create a schema object, then you must
assign a quota to allow the user to create objects.
Temporary Tablespace
The default Temporary Tablespace for a user is also the SYSTEM
tablespace.
Allowing this situation to exist for system users will guarantee that user
processing will cause contention with access to the data dictionary.
Generally a DBA will create a TEMP tablespace that will be shared by all
users for processing that requires sorting and joins.
Tablespace Quotas
Assigning a quota ensures that users with privileges to create objects can
create those objects in the tablespace.
tablespace so a quota must be set or else the Oracle user account cannot
be used to create any objects.
This is often done for senior systems analysts and programmers who
are authorized to create objects in a DATA tablespace.
If you change a quota and the new quota is smaller than the old one, then
the following rules apply:
For users who have already exceeded the new quota, new objects
cannot be created, and existing objects cannot be allocated more
space until the combined space of the user's objects is within the new
quota.
For users who have not exceeded the new quota, user objects can
be allocated additional space up to the new quota.
A DBA can revoke tablespace access by setting the user's quota to zero for
the tablespace through use of the ALTER USER command. This example
alters the user named SCOTT for the USERS tablespace.
Existing objects for the user will remain within the tablespace, but cannot
be allocated additional disk space.
To make any other use of the command, a user must have the ALTER
USER system privilege - something the DBA should not give to individual
users.
In order for a DBA to drop a user, the DBA must have the DROP
USER system privilege.
depend upon tables that the user created. In those cases, dropping a user
requires a lot of detailed investigation and careful deletion of objects.
If you want to deny access to the database, but do not want to drop the
user and the user's objects, you should revoke the CREATE SESSION
privilege for the user temporarily.
You cannot drop a user who is connected to the database - you must first
terminate the user's session with the ALTER SYSTEM KILL SESSION
command.
USERNAME
ACCOUNT_STATUS
DEFAULT_TABLESPACE
--------------- -------------------------------------OUTLN
OPEN
SYSTEM
USER350
OPEN
USERS
DBOCK
OPEN
DATA01
SYS
OPEN
SYSTEM
SYSTEM
OPEN
SYSTEM
USER349
EXPIRED
SYSTEM
SCOTT
EXPIRED
USERS
TSMSYS
SYSTEM
DIP
SYSTEM
DBSNMP
SYSAUX
ORACLE_OCM
SYSTEM
11 rows selected.
Site Licensing
One of the DBA's responsibilities is to ensure that the Oracle Server license
agreement is maintained.
A DBA can track and limit session access for users concurrently accessing
the database through use of the LICENSE_MAX_SESSIONS,
When the maximum limit is reached, Oracle enforces the limit by restricting
access to the database. Oracle also tracks the highest number of
concurrent sessions for each instance. This is termed the "high water
mark" and the information is written to the ALERT file.
LICENSE_MAX_SESSIONS = 80
LICENSE_SESSIONS_WARNING = 70
The usage limits can be changed while the database is running with the
ALTER SYSTEM command. This example alters the number of concurrent
sessions and the warning limit:
ALTER SYSTEM
SET LICENSE_MAX_SESSIONS = 100
LICENSE_SESSIONS_WARNING = 90;
If the new value is lower than the number of users currently logged on,
Oracle does not force any users off of the system, but enforces the new
limit for new users who attempt to connect.
LICENSE_MAX_USERS = 100
Attempting to create users after the limit is reached generates an error and
a message is written to the ALERT file. A DBA can change the maximum
named users limit with the ALTER SYSTEM command as shown here:
To view the current session limits, query the V$LICENSE data dictionary
view as shown in this SELECT statement.
SELECT sessions_max s_max,
sessions_warning s_warning,
sessions_current s_current,
sessions_highwater s_high,
users_max
FROM v$license;
S_MAX
----100
S_WARNING
--------80
End of Notes
S_CURRENT
--------65
S_HIGH
-----82
USERS_MAX
--------50