Home  >  Blog  >   Oracle DBA

How to Create Profiles and Password Management in Oracle DBA

Rating: 4.7
  
 
7395
  1. Share:

Create Profiles and Password Management - Table of Contents

Profiles

The PROFILE specifies the name of the profile to be created. Use profiles to limit the database resources available to a user for a single call or a single session.

Oracle database enforces resource limits in the following ways:

1. If a user exceeds the connect_time or idle_time session resource limit, then the database rolls back the current transaction and ends the session. When the user process next issues a call, the database returns an error.

2. If a user attempts to perform an operation that exceeds the limit for another session resource, then the database aborts the operation, rolls back the current statement, and immediately returns an error. The user can then commit or roll back the current transaction, and must then end the session.

3. If a user attempts to perform an operation that exceeds the limit for a single call, then the database aborts the operation, rolls back the current statement, and returns an error, leaving the current transaction intact.

Unlimited

When specified with a resource parameter, unlimited indicates that a user assigned this profile can use an unlimited amount of this resource. When specified with a password parameter, unlimited indicates that no limit has been set for the parameter.

Default

Specify default if you want to omit a limit for this resource in this profile. A user assigned this profile is subject to the limit for this resource specified in the default profile. The default profile initially defines unlimited resources. You can change those limits with the alter profile statement.

Any user who is not explicitly assigned a profile is subject to the limits defined in the default profile. Also, if the profile that is explicitly assigned to a user omits limits for some resources or specifies default for some limits, then the user is subject to the limits on those resources defined by the default profile.

If you want to enrich your career and become a professional in Oracle DBA, then enroll in "Oracle DBA Training". This course will help you to achieve excellence in this domain.

Resource Parameters

  1. Sessions_per_user: specify the number of concurrent sessions to which you want to limit the user.
  2. Cpu_per_session: specify the CPU time limit for a session, expressed in a hundredth of seconds.
  3. Cpu_per_call: specify the CPU time limit for a call (a parse, execute, or fetch), expressed in hundredths of seconds.
  4. Connect_time: specify the total elapsed time limit for a session, expressed in minutes.
  5. Idle_time: specify the permitted periods of continuous inactive time during a session, expressed in minutes. Long-running queries and other operations are not subject to this limit.
  6. Logical_reads_per_session: Specify the permitted number of data blocks read in a session, including blocks read from memory and disk.
  7. Logical_reads_per_call: Specify the permitted number of data blocks read for a call to process a SQL statement (a parse, execute, or fetch).
  8. Private_sga: specify the amount of private space a session can allocate in the shared pool of the system global area (SGA), expressed in bytes.
  9. Composite_limit: specify the total resource cost for a session, expressed in service units. Oracle database calculates the total service units as a weighted sum of cpu_per_session, connect_time, logical_reads_per_session, and private_sga.

MindMajix YouTube Channel

Password Parameters

Use the following clauses to set password parameters. Parameters that set the length of time are interpreted in a number of days. For testing purposes, you can specify the minutes (n/1440) or even seconds (n/86400).

1. Failed_login_attempts: Specify the number of failed attempts, to log in to the user account before the account is locked.

2. Password_life_time: Specify the number of days the same password can be used for authentication. If you also set a value for password_grace_time, the password expires if it is not changed within the grace period, and further connections are rejected. If you do not set a value for password_grace_time, its default of unlimited will cause the database to issue a warning but let the user continue to connect indefinitely.

3. Password_reuse_time and password_reuse_max: These two parameters must be set in conjunction with each other. Password_reuse_time specifies the number of days before which a password cannot be reused. Password_reuse_max specifies the number of password changes required before the current password can be reused. For this parameter to have any effect, you must specify an integer for both of them.

1. If you specify an integer for both of these parameters, then the user cannot reuse a password until the password has been changed the number of times specified for password_reuse_max during the number of days specified for password_reuse_time. For example, if you specify password_reuse_time to 30 and password_reuse_max to 10, then the user can reuse the password after 30 days if the password has already been changed 10 times.

2. If you specify an integer for either of these parameters and specify unlimited for the other, then the user can never reuse a password.

3. If you specify a default for either parameter, then the oracle database uses the value defined in the default. By default, all parameters are set to unlimited in the default profile. If you have not changed the default setting of unlimited in the default profile, then the database treats the value for that parameter as unlimited.

4. If you set both of these parameters to unlimited, then the database ignores both of them.

4. Password_lock_time: Specify the number of days. Then an account will be locked after the specified number of consecutive failed login attempts.

5. Password_grace_time: Specify the number of days after the grace period begins during which a warning is issued and login is allowed. If the password is not changed during the grace period, the password expires.

6. Password_verify_function: The password_verify_function clause lets a pl/sql password complexity verification script be passed as an argument to the create profile statement. Oracle database provides a default script, but you can create your own routine or use third-party software instead.

  • For function, specify the name of the password complexity verification routine.
  • Specify null to indicate that no password verification is performed.

If you specify expr for any of the password parameters, the expression can be of any form except the scalar subquery expression.

Creating a Profile: Example

Use the CREATE PROFILE statement to create a profile, which is a set of limits on database resources. If you assign the profile to a user, then that user cannot exceed these limits.

The following statement creates the profile new_profile:

Sql>create profile new_profile   limit password_reuse_max 10   password_reuse_time 30;

Setting Profile Resource Limits: Example

The following statement creates the profile app_user:

Sql>create profile app_user limit
Sessions_per_user              unlimited
Cpu_per_session                 unlimited
Cpu_per_call                         3000
Connect_time                        45
Logical_reads_per_session  default
Logical_reads_per_call         1000
Private_sga                              15k
Composite_limit                    5000000

If you assign the app_user profile to a user, the user is subject to the following limits in subsequent sessions:

1. The user can have any number of concurrent sessions.

2. In a single session, the user can consume an unlimited amount of CPU time.

3. A single call made by the user cannot consume more than 30 seconds of CPU time.

4. A single session cannot last for more than 45 minutes.

5. In a single session, the number of data blocks read from memory and disk is subject to the limit specified in the default profile.

6. A single call made by the user cannot read more than 1000 data blocks from memory and disk.

7. A single session cannot allocate more than 15 kilobytes of memory in the sga.

8. In a single session, the total resource cost cannot exceed 5 million service units. The formula for calculating the total resource cost is specified by the alter resource cost

Since the app_user profile omits a limit for idle_time and for password limits, the user is subject to the limits on these resources specified in the default profile.

Learn Oracle DBA Interview Questions and Answers that help you grab high-paying jobs

Setting Profile Password Limits: Example

The following statement creates the app_user2 profile with password limits values set:

Sql>create profile app_user2 limit  failed_login_attempts 5 password_life_time 60
   password_reuse_time 60   password_reuse_max 5

Password_verify_function verify_function password_lock_time 1/24   password_grace_time 10;

Alter Profile

Use the ALTER PROFILE statement to add, modify, or remove a resource limit or a password management parameter in a profile.

Changes made to a profile with an ALTER PROFILE statement affect users, only in their subsequent sessions, not in their current sessions.

The following statement is used for altering the existing profiles.

Sql>alter profile limit failed_login_attempts 3;

Assigning Profiles

Profiles can only be assigned to system users if the profile has first been created. Each system user is assigned with only one profile at a time. When a profile is assigned to a system user who already has a profile, the new profile replaces the old one – the current session, if one taking place, is not affected, but subsequent sessions are affected. Also, you cannot assign a profile to a role or another profile.

Create                            user                          uwclass
identified                      by                             “n0way!”
default                  tablespace                       uwdata
temporary            tablespace                        temp
quota                              0                on              system
quota                             0                 on              sysaux
quota                    unlimited        on            uwdata
quota                         10m             on              indx_sml
profile app_user2 ;
Drop profiles:
Drop profile without users:

Example

Drop profile app_user2;
Drop profile with users:

Example

Drop profile app_user2 cascade;

Explore Oracle DBA Sample Resumes! Download & Edit, Get Noticed by Top Employers!
Join our newsletter
inbox

Stay updated with our newsletter, packed with Tutorials, Interview Questions, How-to's, Tips & Tricks, Latest Trends & Updates, and more ➤ Straight to your inbox!

Course Schedule
NameDates
Oracle DBA TrainingMar 30 to Apr 14View Details
Oracle DBA TrainingApr 02 to Apr 17View Details
Oracle DBA TrainingApr 06 to Apr 21View Details
Oracle DBA TrainingApr 09 to Apr 24View Details
Last updated: 03 Apr 2023
About Author

 

Technical Content Writer

read more
Recommended Courses

1 / 15