11 user management and database security.pdf

107
8/9/2019 11 User Management and Database Security.pdf http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 1/107 Revision no.: PPT/2K403/02 User Management and Database Security

Upload: repentchristian

Post on 01-Jun-2018

240 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 1/107

Revision no.: PPT/2K403/02

User Management and Database Security

Page 2: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 2/107

Revision no.: PPT/2K403/02

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

2

Oracle database security management

• Controlling access to data ( authorization )

• Authenticating users

• Ensuring data integrity

• Auditing user’s actions

• Managing enterprise security

Page 3: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 3/107

Revision no.: PPT/2K403/02

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

3

Managing Users

• Creating new database users

• Altering and dropping existing database users• Monitoring information about existing users

Page 4: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 4/107

Revision no.: PPT/2K403/02

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

4

Users and Security

• DBA defines users who

can access db

• Security domain

defines the settings

that apply to users

Accountlocking

Tablespacequotas

Temporarytablespace

Defaulttablespace

Roleprivileges

Resourcelimits

Securitydomain

Directprivileges

Authenticationmechanism

Page 5: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 5/107

Revision no.: PPT/2K403/02

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

5

Database Schema

• Schema: named collection of objects like tables, views,

procedures, etc.

• When a user is created a schema with same name is created

• Hence username and schema name used interchangeably

• Some of the objects a user can own

Page 6: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 6/107

Revision no.: PPT/2K403/02

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

6

Checklist for Creating Users(Developers not end users)

• Choose a username and authentication mechanism.

• Identify tablespaces in which the user needs to store objects.

• Decide on quotas for each tablespace.

• Assign default tablespace and temporary tablespace.

• Create a user.

• Grant privileges and roles to the user.

• If no default tablespace is assign to the user the System

tablespace becomes the default for that user.

Page 7: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 7/107

Revision no.: PPT/2K403/02

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

7

Creating a New User:Server Authentication

• Set the initial password:

• Expires at login forcing user to change password

CREATE USERCREATE USER anilanil

IDENTIFIED BYIDENTIFIED BY panilpanil

DEFAULT TABLESPACE data01DEFAULT TABLESPACE data01

TEMPORARY TABLESPACE tempTEMPORARY TABLESPACE temp

QUOTA 15m ON data01QUOTA 15m ON data01

PASSWORD EXPIRE;PASSWORD EXPIRE;

Page 8: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 8/107

Revision no.: PPT/2K403/02

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

8

Creating a New User: Operating SystemAuthentication

• Use OS_AUTHENT_PREFIX (in parameter file)

• Example: O/S User = user15

Remote LoginRemote Login

PossiblePossibleOS_AUTHENT_ OS_AUTHENT_ 

PREFIXPREFIX

OS_ 

empty string

“ “

OPS$

(default)

DatabaseDatabase

User User 

OS_USER15

USER15

OPS$USER15

(default)

No

No

 Yes

Page 9: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 9/107

Revision no.: PPT/2K403/02

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

9

Creating a New User: Operating SystemAuthentication (contd.)

• E.g., An OS user tikekarr;

• Use IDENTIFIED EXTERNALLY clause with create user 

• Also exists as a database user 

• Oracle will not validate

• To use sql*plus say

 – Sqlplus /

Page 10: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 10/107

Revision no.: PPT/2K403/02

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

10

Creating a New User: Guidelines

• Choose a standard password initially; use O/S authentication

sparingly.

• Use the EXPIRE keyword to force users to reset their

passwords.

• Always assign temporary tablespace.

• Restrict quotas to few users; use QUOTA UNLIMITED with

caution.

• Educate users:

 – To connect

 – To change password

R i i PPT/2K403/02

Page 11: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 11/107

Revision no.: PPT/2K403/02

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

11

Controlling Account Lockand Password

ALTER USER anil

IDENTIFIED BY hisgrandpaPASSWORD EXPIRE;

ALTER USER anil

IDENTIFIED BY hisgrandpaPASSWORD EXPIRE;

ALTER USER anil

IDENTIFIED BY hisgrandpa

ACCOUNT LOCK | UNLOCK;

ALTER USER anil

IDENTIFIED BY hisgrandpa

ACCOUNT LOCK | UNLOCK;

R i i PPT/2K403/02

Page 12: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 12/107

Revision no.: PPT/2K403/02

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

12

Changing User Quota on Tablespace

• To get a user out of system (fired/resigned):

 – Use password expiration

 – Lock account

 – Alter password

 – Change profile

 – Export/import user schema elsewhere

ALTER USER anil

QUOTA 0 ON data01;

ALTER USER anil

QUOTA 0 ON data01;

Revision no : PPT/2K403/02

Page 13: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 13/107

Revision no.: PPT/2K403/02

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

13

Dropping a User 

• Use the CASCADE clause if the schema contains objects.

• User currently connected cannot be dropped

DROP USER anil;DROP USER anil;

DROP USER anil CASCADE;DROP USER anil CASCADE;

Revision no : PPT/2K403/02

Page 14: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 14/107

Revision no.: PPT/2K403/02

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

14

Monitoring Users

DBA_USERS

USERNAME

USER_ID

CREATEDACCOUNT_STATUS

LOCK_DATE

EXPIRY_DATEDEFAULT_TABLESPACE

TEMPORARY_TABLESPACE

DBA_USERSDBA_USERS

USERNAME

USER_ID

CREATED

ACCOUNT_STATUS

LOCK_DATE

EXPIRY_DATE

DEFAULT_TABLESPACE

TEMPORARY_TABLESPACE

DBA_TS_QUOTAS

USERNAME

TABLESPACE_NAME

BYTESMAX_BYTES

BLOCKS

MAX_BLOCKS

DBA_TS_QUOTASDBA_TS_QUOTAS

USERNAME

TABLESPACE_NAME

BYTES

MAX_BYTES

BLOCKS

MAX_BLOCKS

Revision no : PPT/2K403/02

Page 15: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 15/107

Revision no.: PPT/2K403/02

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

15

Monitoring Users (contd.)

• Select tablespace_name, blocks, max_blocks, bytes,

max_bytes From dba_ts_quota Where username = ‘SCOTT’;

• -1 in MAX_BLOCKS or MAX_BYTES indicates unlimited quota

• Select username, account_status, temporary_tablespace From

dba_users;

• Lists all users, their account status and temp. ts

Revision no : PPT/2K403/02

Page 16: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 16/107

Revision no.: PPT/2K403/02

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

16

Exercise III Managing Users

Revision no : PPT/2K403/02

Page 17: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 17/107

Revision no.: PPT/2K403/02

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

17

Profiles

• Are named sets of resource and

password limits

• Are assigned to users bythe CREATE/ALTER USER

command

• Can be enabled or disabled• Can relate to the DEFAULT

profile

• Can limit system resources onsession or call level

Accountlocking

Tablespacequotas

Temporarytablespace

Defaulttablespace

Roleprivileges

Resourcelimits

Securitydomain

Directprivileges

Authenticationmechanism

Revision no.: PPT/2K403/02

Page 18: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 18/107

Revision no.: PPT/2K403/02

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

18

Managing Resources with Profiles

1. Create profiles.

2. Assign profiles to the user.

3. Enable resource limits.

Revision no.: PPT/2K403/02

Page 19: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 19/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

19

Creating a Profile: Resource Limit

CREATE PROFILE developer_prof LIMITSESSIONS_PER_USER 2

CPU_PER_SESSION 10000

IDLE_TIME 60CONNECT_TIME 480;

CREATE PROFILE developer_prof LIMITSESSIONS_PER_USER 2

CPU_PER_SESSION 10000

IDLE_TIME 60

CONNECT_TIME 480;

Revision no.: PPT/2K403/02

Page 20: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 20/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

20

ResourceResource

CPU_PER_SESSION

SESSIONS_PER_USER

CONNECT_TIME

IDLE_TIME

LOGICAL_READS_PER

 _SESSIONPRIVATE_SGA

DescriptionDescription

Total CPU time measured inhundredths of seconds

Number of concurrent sessionsallowed for each username

Elapsed connect time measured

in minutesPeriods of inactive timemeasured in minutes

Number of data blocks (physical

and logical reads)Private space in the SGAmeasured in bytes (for MTSonly)

Setting Resource Limits at Session Level

Revision no.: PPT/2K403/02

Page 21: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 21/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

21

Setting Resources at Call Level

ResourceResource

CPU_PER_CALL

LOGICAL_READS_PER _CALL

DescriptionDescription

CPU time per call in hundredths

of seconds

Number of data blocks

Revision no.: PPT/2K403/02

Page 22: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 22/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

22

Resource Parameter 

• Composite_limit

 – A composite limit is a sum of several of the resource parameters,measured in service units.

 – These resources are weighted by their importance.

 – Oracle takes into account four parameters to compute a weightedcomposite_limit:

• Cpu_per_session

• Connect_time

• Logical_reads_per_session

• Private_sga.

 –  You can set a weight for these four parameter by using the alter 

resource cost statement.

Revision no.: PPT/2K403/02

Page 23: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 23/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

23

Assigning Profiles to a User 

CREATE USER user3 IDENTIFIED BY user3

DEFAULT TABLESPACE data01

TEMPORARY TABLESPACE temp

QUOTA unlimited ON data01

PROFILE developer_prof;

CREATE USER user3 IDENTIFIED BY user3

DEFAULT TABLESPACE data01

TEMPORARY TABLESPACE temp

QUOTA unlimited ON data01

PROFILE developer_prof;

ALTER USER scott

PROFILE developer_prof;

ALTER USER scott

PROFILE developer_prof;

Revision no.: PPT/2K403/02

Page 24: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 24/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

24

Enabling Resource Limits

• Set the initialization parameter RESOURCE_LIMIT to TRUE

 – or

• Enforce the resource limits by enabling the parameter with theALTER SYSTEM command

ALTER SYSTEM SET RESOURCE_LIMIT=TRUE;ALTER SYSTEM SET RESOURCE_LIMIT=TRUE;

Revision no.: PPT/2K403/02

Page 25: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 25/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

25

Altering a Profile

ALTER PROFILE default LIMIT

SESSIONS_PER_USER 5CPU_PER_CALL 3600

IDLE_TIME 30;

ALTER PROFILE default LIMIT

SESSIONS_PER_USER 5CPU_PER_CALL 3600

IDLE_TIME 30;

Revision no.: PPT/2K403/02

Page 26: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 26/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

26

Dropping a Profile

DROP PROFILE developer_prof;DROP PROFILE developer_prof;

DROP PROFILE developer_prof CASCADE;DROP PROFILE developer_prof CASCADE;

Revision no.: PPT/2K403/02

Page 27: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 27/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

27

Viewing Resource Limits

DBA_USERSDBA_USERS

- profile

- username

DBA_PROFILESDBA_PROFILES

- profile

- resource_name- resource_type

(KERNEL)- limit

Revision no.: PPT/2K403/02

Page 28: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 28/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

28

Password Management

User User 

PasswordPassword

expirationexpiration

and agingand aging

PasswordPassword

verificationverification

PasswordPassword

historyhistory

AccountAccount

lockinglocking

Setting upSetting up

profilesprofiles

Revision no.: PPT/2K403/02

Page 29: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 29/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

29

Enabling Password Management

• Set up password management by using profiles and assigning

them to users.

• Lock, unlock, and expire accounts using the CREATE USER or

ALTER USER command.

• Password limits are always enforced, even if

RESOURCE_LIMIT for an instance is set to FALSE.

Revision no.: PPT/2K403/02

Page 30: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 30/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

30

Creating a Profile: Password Settings

CREATE PROFILE grace_5 LIMIT

FAILED_LOGIN_ATTEMPTS 3

PASSWORD_LIFE_TIME 30

PASSWORD_REUSE_TIME 30

PASSWORD_VERIFY_FUNCTION verify_function

PASSWORD_GRACE_TIME 5;

CREATE PROFILE grace_5 LIMIT

FAILED_LOGIN_ATTEMPTS 3

PASSWORD_LIFE_TIME 30

PASSWORD_REUSE_TIME 30

PASSWORD_VERIFY_FUNCTION verify_function

PASSWORD_GRACE_TIME 5;

Revision no.: PPT/2K403/02

Page 31: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 31/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

31

Password Settings

Parameter Parameter 

FAILED_LOGIN_ATTEMPTS

PASSWORD_LOCK_TIME

PASSWORD_LIFE_TIME

PASSWORD_GRACE_TIME

DescriptionDescription

Number of failed login attempts

before lockout of the account

Number of days for which the

account remains locked upon

password expirationLifetime of the password in days

after which the password expires

Grace period in days for changing

the password after the first

successful login after the password

has expired

Revision no.: PPT/2K403/02

Page 32: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 32/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

32

Password Settings (contd.)

Parameter Parameter 

PASSWORD_REUSE_TIME

PASSWORD_REUSE_MAX

PASSWORD_VERIFY_FUNCTION

DescriptionDescription

Number of days before a password can

be reused

Maximum number of times a password

can be reused

PL/SQL function that makes a

password complexity check before a

password is assigned

Revision no.: PPT/2K403/02

Page 33: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 33/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

33

User- Provided Password Function

• Function must be created in the SYS schema and must havethe following specification:

function_name(

userid_parameter IN VARCHAR2(30),

password_parameter IN VARCHAR2(30),

old_password_parameter IN VARCHAR2(30))

RETURN BOOLEAN

function_name(

userid_parameter IN VARCHAR2(30),

password_parameter IN VARCHAR2(30),

old_password_parameter IN VARCHAR2(30))

RETURN BOOLEAN

Revision no.: PPT/2K403/02

Password Verification Function

Page 34: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 34/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

34

Password Verification FunctionVERIFY_FUNCTION

• Minimum length is four characters

• Password should not be equal to username

• Password should have at least one alpha, one

numeric, and one special character 

• Password should differ from the previous

password by at least

three letters PasswordPasswordverificationverification

Revision no.: PPT/2K403/02

Page 35: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 35/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

35

Viewing Password Information

• DBA_USERS

 – profile

 – username

 – account_status

 – lock_date

 – expiry_date

• DBA_PROFILES – profile

 – resource_name

 – resource_type (PASSWORD)

 – limit

Revision no.: PPT/2K403/02

Resource Management Problem for

Page 36: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 36/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

36

Resource Management Problem forProduction Database

• Batch job’s are taking up most of the available resources,which is hurting other, more critical jobs that need to run at thesame time.

• Excessive loads at peak times are causing critical processesto run for an unacceptably long period of time.

•  You schedule large jobs and really can’t predict when theymight be launched.

• Some users are using an excessive amount of CPU, causingyou to kill their session abruptly.

• Some users are using a very high degree of parallelism in theiroperations, which is hurting the performance of the system as

a whole.•  You want to prioritize jobs according to some scheme, but you

can’t do so using operating system resources.

Revision no.: PPT/2K403/02

With Oracle's Database Resource Manager a

Page 37: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 37/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

37

With Oracle s Database Resource Manager, adatabase administrator can:

• Guarantee certain users a minimum amount of processingresources regardless of the load on the system and thenumber of users

• Distribute available processing resources by allocatingpercentages of CPU time to different users and applications.

 – In a data warehouse, a higher percentage may be given to ROLAP(relational on-line analytical processing) applications than to

batch jobs.

• Limit the degree of parallelism of any operation performed bymembers of a group of users

• Create an active session pool. – This pool consists of a specified maximum number of user

sessions allowed to be concurrently active within a group ofusers.

Revision no.: PPT/2K403/02

With Oracle's Database Resource Manager a

Page 38: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 38/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

38

With Oracle s Database Resource Manager, adatabase administrator can: (contd.)

• Allow automatic switching of users from one group to anothergroup based on administrator-defined criteria. – If a member of a particular group of users creates a session that

runs for longer than a specified amount of time, that session canbe automatically switched to another group of users with differentresource requirements.

• Prevent the execution of operations that are estimated to runfor a longer time than a predefined limit

• Create an undo pool. – This pool consists of the amount of undo space that can be

consumed in by a group of users.

• Configure an instance to use a particular method of allocatingresources. –  You can dynamically change the method, for example, from a

daytime setup to a nighttime setup, without having to shut downand restart the instance.

Revision no.: PPT/2K403/02

Page 39: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 39/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

39

Database Resource Manager Overview

• Resources are allocated to users according to a resource planspecified by the database administrator.

• The following terms are used in specifying a resource plan:

• A resource plan – specifies how the resources are to be distributed among various

users (resource consumer groups).

• Resource consumer groups

 – allow the administrator to group user sessions together byresource requirements. Resource consumer groups are differentfrom user roles; one database user can have different sessionsassigned to different resource consumer groups.

• Resource allocation methods – determine what policy to use when allocating for any particularresource. Resource allocation methods are used by resourceplans and resource consumer groups.

Revision no.: PPT/2K403/02

Page 40: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 40/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

40

Database Resource Manager Overview (contd.)

• Resource plan directives

 – are a means of assigning consumer groups to particular plans

and partitioning resources among consumer groups by specifyingparameters for each resource allocation method.

• The Database Resource Manager also allows for creation of

plans within plans, called subplans.

• Subplans allow further subdivision of resources among

different users of an application.

• Levels provide a mechanism to specify distribution of unused

resources among available users. Up to eight levels of

resource allocation can be specified.

Revision no.: PPT/2K403/02

Page 41: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 41/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

41

Using the Database Resource Manager 

• A DBA can manage the Database Resource Manager through

executing procedures in the Oracle-supplied

DBMS_RESOURCE_MANAGER package.

• Sequence of actions need to take to start using the Database

Resource Manager 

 – Create a pending area.

 – Create a consumer group.

 – Create a resource plan.

 – Create a plan directive. – Validate the pending area.

 – Submit the pending area.

Revision no.: PPT/2K403/02

Page 42: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 42/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

42

Creating a Pending Area

• Before you can modify an old plan or create a new plan, youneed to activate or create a pending area using the DatabaseResource Manager package.

• All resource plans created will be stored in the data dictionary.

SQL> execute dbms_resource_manager.create_pending_area;

PL/SQL procedure successfully completed.

SQL> execute dbms_resource_manager.create_pending_area;

PL/SQL procedure successfully completed.

SQL> execute dbms_resource_manager.clear_pending_area;

PL/SQL procedure successfully completed.

SQL> execute dbms_resource_manager.clear_pending_area;

PL/SQL procedure successfully completed.

Revision no.: PPT/2K403/02

Page 43: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 43/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

43

Creating Consumer Groups

• Once the pending area is active, create the consumer groupsto which users are allocated.

•  You can assign users initially to one group, and you can later

switch them to other groups if necessary.

SQL> execute dbms_resource_manager.create_pending_area;

PL/SQL procedure successfully completed.

SQL> execute dbms_resource_manager.create_consumer_group(consumer_group => ‘local’,comment => ‘local councils’);

PL/SQL procedure successfully completed.

SQL> execute dbms_resource_manager.create_consumer_group

(consumer_group => ‘regional’,comment => ‘regional’);

PL/SQL procedure successfully completed.

SQL> execute dbms_resource_manager.create_consumer_group

(consumer_group => ‘national’,comment => ‘national office’);

PL/SQL procedure successfully completed.

SQL> execute dbms_resource_manager.create_pending_area;

PL/SQL procedure successfully completed.

SQL> execute dbms_resource_manager.create_consumer_group

(consumer_group => ‘local’,comment => ‘local councils’);

PL/SQL procedure successfully completed.

SQL> execute dbms_resource_manager.create_consumer_group

(consumer_group => ‘regional’,comment => ‘regional’);

PL/SQL procedure successfully completed.SQL> execute dbms_resource_manager.create_consumer_group

(consumer_group => ‘national’,comment => ‘national office’);

PL/SQL procedure successfully completed.

Revision no.: PPT/2K403/02

Page 44: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 44/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

44

Checking what groups exist in your database

• Use DBA_RSRC_CONSUMER_GROUPS view for informationrelating to what groups currently exist in your database.

SQL> SELECT consumer_group, status FROM

dba_rscr_consumer_groups;

SQL> SELECT consumer_group, status FROM

dba_rscr_consumer_groups;

Revision no.: PPT/2K403/02

Page 45: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 45/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

45

Default groups in Oracle Database

• Other_groups

 – This isn’t really a group, because you can’t assign users to it.

 – When a resource plan is active, other_groups is the catchall term

for all sessions that don’t belong to this active resource plan.• Default_consumer_groups

 – If you don’t assign users to any group, they will, by default,become members of the default group.

• Sys_group and low_group

 – These are part of the default system_plan that exists in everydatabase.

 – Oracle supplies three plans for each database

• SYSTEM_PLAN : Plan to give system sessions priority.

• INTERNAL_QUIESCE : Plan to internally quiesce system.

• INTERNAL_PLAN : Plan to give system sessions priority

Revision no.: PPT/2K403/02

Page 46: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 46/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

46

Validate & submit pending area

• Once you create the groups, you can then validate yourpending area.

• Once the changes are accepted as being correct, you can

submit the changes through the Database Resource Manager.

SQL> execute dbms_resource_manager.validate_pending_area;

PL/SQL procedure successfully completed.SQL> execute dbms_resource_manager.submit_pending_area;

PL/SQL procedure successfully completed.

SQL> select consumer_group, status from

dba_rsrc_consumer_groups;

SQL> execute dbms_resource_manager.validate_pending_area;

PL/SQL procedure successfully completed.

SQL> execute dbms_resource_manager.submit_pending_area;

PL/SQL procedure successfully completed.

SQL> select consumer_group, status from

dba_rsrc_consumer_groups;

Revision no.: PPT/2K403/02

Page 47: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 47/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

47

Assigning users to consumer groups

• First grant the users privileges to switch their groups usingdbms_resource_manager_pr ivs.grant_switch_consumer_group 

procedure.

• Use dbms_resource_manager_privs.set_ini t ia l_consumer_group 

procedure to switch.

SQL> execute dbms_resource_manager_privs.grant_switch_ 

consumer_group ('anil','local',TRUE);PL/SQL procedure successfully completed.

SQL> execute dbms_resource_manager.set_inital_ 

consumer_group('anil','local');

PL/SQL procedure successfully completed.

SQL> execute dbms_resource_manager_privs.grant_switch_ 

consumer_group ('anil','local',TRUE);PL/SQL procedure successfully completed.

SQL> execute dbms_resource_manager.set_inital_ 

consumer_group('anil','local');

PL/SQL procedure successfully completed.

Verify Consumer Group Membership of Users

SQL> select username, initial_rsrc_consumer_group from dba_users;

Verify Consumer Group Membership of Users

SQL> select username, initial_rsrc_consumer_group from dba_users;

Revision no.: PPT/2K403/02

Page 48: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 48/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

48

Create Resource Plans and Plan Directives

• Creating Resource Plans

 – Resource plans enable you to set limits on resource use byspecifying limits on four variables: CPU, active session pool,

degree of parallelism, and the order in which queued sessions willexecute.

 – Currently, for all four parameters, only the default levels andmethods provided by Oracle can be used.

SQL> execute dbms_resource_manager.create_pending_area;

PL/SQL procedure successfully completed.

SQL> execute dbms_resource_manager.create_plan ( plan =>

‘membership_plan’, comment => ‘New Membership

Recruitment’);

PL/SQL procedure successfully completed.

SQL> execute dbms_resource_manager.create_pending_area;

PL/SQL procedure successfully completed.

SQL> execute dbms_resource_manager.create_plan ( plan =>

‘membership_plan’, comment => ‘New Membership

Recruitment’);

PL/SQL procedure successfully completed.

Revision no.: PPT/2K403/02

Page 49: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 49/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

49

Create Resource Plans and Plan Directives (contd.)

• Creating a Plan Directive

 – The plan directive assigns 70 percent of the available CPU at the

first level to the local group and the rest, 30 percent, to theregional group.

 – It allocates 100 percent of the CPU at the second level to the

national group.

 – In addition to the preceding three groups, you need to add a plan

directive for the default other_groups for the Database Resource

Manager to accept your plan directives.

• If you don’t include a resource directive for other_groups,Oracle won’t let you use your directives for the other groups if 

the plan directives is for a primary or top plan.

Revision no.: PPT/2K403/02

Page 50: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 50/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

50

Create Resource Plans and Plan Directives (contd.)

SQL> execute dbms_resource_manager.create_plan_directive

(plan => ‘membership_plan’, GROUP_OR_SUBPLAN =>

‘local’, COMMENT => ‘LOCAL GROUP’, CPU_P1 => 70);

SQL> execute dbms_resource_manager.create_plan_directive

(plan => ‘membership_plan’, GROUP_OR_SUBPLAN =>

‘REGIONAL’, COMMENT => ‘regional group’, CPU_P1 => 30);

SQL> execute dbms_resource_manager.create_plan_directive

(plan => ‘membership_plan’, GROUP_OR_SUBPLAN =>

‘national’, COMMENT => ‘NATIONAL GROUP’, CPU_P2 => 100);

SQL> execute dbms_resource_manager.create_plan_directive

(plan => 'membership_plan', GROUP_OR_SUBPLAN =>

'OTHER_GROUPS', comment => 'Default plan',CPU_P3 => 100);

SQL> execute dbms_resource_manager.create_plan_directive

(plan => ‘membership_plan’, GROUP_OR_SUBPLAN =>

‘local’, COMMENT => ‘LOCAL GROUP’, CPU_P1 => 70);

SQL> execute dbms_resource_manager.create_plan_directive

(plan => ‘membership_plan’, GROUP_OR_SUBPLAN =>

‘REGIONAL’, COMMENT => ‘regional group’, CPU_P1 => 30);

SQL> execute dbms_resource_manager.create_plan_directive

(plan => ‘membership_plan’, GROUP_OR_SUBPLAN =>

‘national’, COMMENT => ‘NATIONAL GROUP’, CPU_P2 => 100);

SQL> execute dbms_resource_manager.create_plan_directive

(plan => 'membership_plan', GROUP_OR_SUBPLAN =>

'OTHER_GROUPS', comment => 'Default plan',CPU_P3 => 100);

Revision no.: PPT/2K403/02

Page 51: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 51/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

51

Create Resource Plans and Plan Directives (contd.)

•  You can now validate and submit your new top-level plan,membership_plan.

• Determining the status of the Resource Plans from

dba_rsrc_plan_directives

SQL> execute dbms_resource_manager.validate_pending_area;

PL/SQL procedure successfully completed.SQL> execute dbms_resource_manager.submit_pending_area;

PL/SQL procedure successfully completed.

SQL> select plan, group_or_subplan, cpu_p1, cpu_p2,cpu_p3, status

from dba_rsrc_plan_directives;

SQL> execute dbms_resource_manager.validate_pending_area;

PL/SQL procedure successfully completed.SQL> execute dbms_resource_manager.submit_pending_area;

PL/SQL procedure successfully completed.

SQL> select plan, group_or_subplan, cpu_p1, cpu_p2,cpu_p3, status

from dba_rsrc_plan_directives;

Revision no.: PPT/2K403/02

Page 52: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 52/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

52

Enabling the Database Resource Manager 

• Oracle will not automatically enforce the resource plans.

• Explicitly activate the Database Resource Manager, either byspecifying the initialization parameter resource_manager_plan

in the init.ora file or by using the alter system command.

• Query V$RSRC_CONSUMER_GROUP to see what resourceusage among the consumers groups looks like.

SQL> alter system set resource_manager_plan=MEMBERSHIP_PLAN;System altered.

SQL select * from v$rsrc_plan;

SQL> select name, active_sessions, cpu_wait_time,consumed_cpu_time,

current_undo_consumption from v$rsrc_consumer_group;

SQL> alter system set resource_manager_plan=MEMBERSHIP_PLAN;System altered.

SQL select * from v$rsrc_plan;

SQL> select name, active_sessions, cpu_wait_time,consumed_cpu_time,

current_undo_consumption from v$rsrc_consumer_group;

Revision no.: PPT/2K403/02

Page 53: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 53/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

53

Managing Privileges

• Two types of privileges:

 – SYSTEM: enables users to perform particular actions in the

database

• create, alter, drop, etc.

 – OBJECT: enables users to access and manipulate a specific

object

• select, update, insert, exec, etc.

Revision no.: PPT/2K403/02

Page 54: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 54/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

54

System Privileges

• There are about 126 system privileges.

• The ANY-keyword in the privileges signifies that users have

the privilege in every schema.

• The GRANT command adds a privilege to a user or a group of

users.

• The REVOKE command deletes the privileges.

• Users with ANY privilege can access data dictionary tables

Revision no.: PPT/2K403/02

Page 55: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 55/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

55

System Privileges: Examples

CategoryCategory ExamplesExamples

INDEX CREATE ANY INDEX, ALTER ANY INDEXDROP ANY INDEX

TABLE CREATE TABLE (includes dropping privilege, create index)CREATE ANY TABLE, ALTER ANY TABLEDROP ANY TABLE (need this for truncating)SELECT ANY TABLE, UPDATE ANY TABLEDELETE ANY TABLE

SESSION CREATE SESSION (need this to do anything)ALTER SESSIONRESTRICTED SESSION(when db in restricted mode)

TABLESPACE CREATE TABLESPACEALTER TABLESPACEDROP TABLESPACEUNLIMITED TABLESPACE

Revision no.: PPT/2K403/02

Page 56: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 56/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

56

Granting System Privileges

GRANT CREATE SESSION, CREATE TABLE TO user1;GRANT CREATE SESSION, CREATE TABLE TO user1;

GRANT CREATE SESSION TO scott

WITH ADMIN OPTION; (enables scott to grant the privilege

or role to other users or roles)

GRANT CREATE SESSION TO scott

WITH ADMIN OPTION; (enables scott to grant the privilege

or role to other users or roles)

Revision no.: PPT/2K403/02

Page 57: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 57/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

57

SYSDBA and SYSOPER Privileges

CategoryCategory ExamplesExamples

SYSOPER STARTUPSHUTDOWN

ALTER DATABASE OPEN | MOUNTALTER DATABASE BACKUP CONTROLFILEALTER TABLESPACE BEGIN/END BACKUPRECOVER DATABASE,ALTER DATABASE ARCHIVELOG

RESTRICTED SESSION

SYSDBA SYSOPER privileges WITH ADMIN OPTIONCREATE DATABASE

RECOVER DATABASE UNTIL

(any operation on db or objects in db)

user SYSTEM not as powerful as SYS

Revision no.: PPT/2K403/02

Page 58: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 58/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

58

SYSDBA and SYSOPER Privileges (contd.)

• User SYS:

 – Owner of data dictionary, can make changes

 – Granted SYSOPER and SYSDBA roles

 – Can start and shutdown database

• User STSTEM:

 – Not granted SYSOPER and SYSDBA roles

 – Cannot start/shutdown database

 – Cannot modify data dictionary

 – Safer to be SYSTEM than SYS

Revision no.: PPT/2K403/02

Page 59: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 59/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

59

Password File Authentication

• Create the password file and set theREMOTE_LOGIN_PASSWORDFILEparameter.

• Set REMOTE_LOGIN_ PASSWORD_FILE=EXCLUSIVE.

• Grant SYSOPER and SYSDBAprivileges to users.

• Query V$PWFILE_USERS to verify thepassword file members.

Revision no.: PPT/2K403/02

Page 60: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 60/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

60

Displaying System Privileges

• Select * from dba_sys_privs;

• Select * from session_privs; (current session)

DBA_SYS_PRIVSDBA_SYS_PRIVS

•• GRANTEEGRANTEE

•• PRIVILEGEPRIVILEGE

•• ADMIN OPTIONADMIN OPTION

SESSION_PRIVSSESSION_PRIVS

•• PRIVILEGEPRIVILEGE

Database LevelDatabase Level Session LevelSession Level

Revision no.: PPT/2K403/02

Page 61: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 61/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

61

System Privilege Restrictions

• O7_DICTIONARY_ACCESSIBILITY = TRUE

 – Reverts to Oracle7 behavior 

 – Removes the restrictions on system privileges with the ANY

keyword

 – Defaults to TRUE

Revision no.: PPT/2K403/02

Page 62: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 62/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

62

Revoking System Privileges

REVOKE CREATE TABLE FROM user1;(can REVOKE privileges granted with GRANT command)

REVOKE CREATE TABLE FROM user1;(can REVOKE privileges granted with GRANT command)

REVOKE CREATE SESSION FROM scott;REVOKE CREATE SESSION FROM scott;

Revision no.: PPT/2K403/02

Revoking System Privileges

Page 63: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 63/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

63

Using WITH ADMIN OPTION

USER 1 SCOTT

DBA

GRANT

REVOKE(doesn’t

cascade)

USER 1 SCOTT

DBA

Revision no.: PPT/2K403/02

Revoking System PrivilegesO O

Page 64: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 64/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

64

Using WITH ADMIN OPTION (contd.)

RESULTRESULT

DBA USER 1 SCOTT

Revision no.: PPT/2K403/02

Obj t P i il

Page 65: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 65/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

65

Object Privileges

ObjectObject privpriv.. TableTable ViewView SequenceSequence ProcedureProcedure

ALTER  

DELETE 

EXECUTE  

INDEX 

INSERT  

REFERENCES

SELECT

UPDATE  

Page 66: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 66/107

Revision no.: PPT/2K403/02

Di l i Obj t P i il

Page 67: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 67/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

67

Displaying Object Privileges

DBA_TAB_PRIVSDBA_TAB_PRIVS DBA_COL_PRIVSDBA_COL_PRIVS

GRANTEEOWNERTABLE_NAME

GRANTORPRIVILEGEGRANTABLE

GRANTEEOWNERTABLE_NAME

COLUMN_NAMEGRANTORPRIVILEGEGRANTABLE

Object privilegesObject privileges Col specific privilegesCol specific privileges

Revision no.: PPT/2K403/02

R ki Obj t P i il

Page 68: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 68/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

68

Revoking Object Privileges

• Select * from dba_tab_privs where grantee = ‘SCOTT’;

• Select * from dba_col_privs;

REVOKE execute ON dbms_pipe FROM scott;REVOKE execute ON dbms_pipe FROM scott;

Revision no.: PPT/2K403/02

Revoking Object PrivilegesU i WITH GRANT OPTION

Page 69: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 69/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

69

Using WITH GRANT OPTION

GRANTGRANT

REVOKEREVOKE

SCOTT

SCOTT

USER 1

USER 1

USER 2

USER 2

Revision no.: PPT/2K403/02

Revoking Object PrivilegesU i WITH GRANT OPTION

Page 70: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 70/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

70

Using WITH GRANT OPTION (contd.)

RESULTRESULT

SCOTT USER 1 USER 2

Summary: revoking object privileges will cascadeSummary: revoking object privileges will cascade

Revision no.: PPT/2K403/02

R l

Page 71: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 71/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

71

Roles

• Role: named groups of related privileges

 – Granted/revoked with same commands as for privileges

 – Maybe granted to user or role (except itself)

 – Can consist of object and system privileges

 – May be enabled/disabled

 – Can require password to enable

 – Not owned by anyone

Revision no.: PPT/2K403/02

Roles

Page 72: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 72/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

72

Roles (contd.)

AA AAAA

UsersUsers

PrivilegesPrivileges

RolesRoles

UPDATE ONEMP

INSERT ONEMP

SELECT ONEMP

CREATETABLE

CREATESESSION

HR_CLERKHR_MGR

Revision no.: PPT/2K403/02

Benefits of Roles

Page 73: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 73/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

73

Benefits of Roles

• Reduced granting of privileges

• Dynamic privilege management

• Selective availability of privileges

• Granted through the OS

• No cascading revokes

• Improved performance

Revision no.: PPT/2K403/02

Creating Roles

Page 74: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 74/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

74

Creating Roles

CREATE ROLE sales_clerk;CREATE ROLE sales_clerk;

CREATE ROLE hr_clerk

IDENTIFIED BY bonus;

CREATE ROLE hr_clerk

IDENTIFIED BY bonus;

CREATE ROLE hr_manager IDENTIFIED EXTERNALLY;CREATE ROLE hr_manager IDENTIFIED EXTERNALLY;

Revision no.: PPT/2K403/02

Using Predefined Roles

Page 75: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 75/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

75

Using Predefined Roles

Role NameRole Name DescriptionDescription

CONNECT These two roles are provided

RESOURCE for backward compatibility.DBA All system privileges WITH

ADMIN OPTION

EXP_FULL_DATABASE Privileges to export the DB

IMP_FULL_DATABASE Privileges to import the DB

DELETE_CATALOG_ROLE DELETE privileges onDD tables

EXECUTE_CATALOG_ROLE EXECUTE privilege onDD packages

SELECT_CATALOG_ROLE SELECT privilege on DD tables

Revision no.: PPT/2K403/02

Modifying Roles

Page 76: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 76/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

76

Modifying Roles

ALTER ROLE hr_clerk

IDENTIFIED EXTERNALLY;

ALTER ROLE hr_clerk

IDENTIFIED EXTERNALLY;

ALTER ROLE hr_manager NOT IDENTIFIED;ALTER ROLE hr_manager NOT IDENTIFIED;

ALTER ROLE sales_clerk

IDENTIFIED BY commission;

ALTER ROLE sales_clerk

IDENTIFIED BY commission;

Revision no.: PPT/2K403/02

Assigning Roles

Page 77: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 77/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

77

Assigning Roles

GRANT hr_clerk,

TO hr_manager;

GRANT hr_clerk,

TO hr_manager;

GRANT sales_clerk TO scott;GRANT sales_clerk TO scott;

GRANT hr_manager TO scott

WITH ADMIN OPTION;

GRANT hr_manager TO scott

WITH ADMIN OPTION;

Revision no.: PPT/2K403/02

Assigning Privileges to Roles

Page 78: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 78/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

78

Assigning Privileges to Roles

GRANT create table, create any index TO hr_clerk;GRANT create table, create any index TO hr_clerk;

GRANT create_session TO hr_manager;GRANT create_session TO hr_manager;

Revision no.: PPT/2K403/02

Enabling and Disabling Roles

Page 79: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 79/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

79

Enabling and Disabling Roles

• Disable a role to temporarily revoke the role from a user.

• Enable a role to temporarily grant it.

• The SET ROLE command enables and

disables roles.

• Default roles are enabled for a user at login.

• A password may be required to enable a role.

Revision no.: PPT/2K403/02

Enabling and Disabling Roles:Examples

Page 80: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 80/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

80

Examples

SET ROLE hr_clerk;SET ROLE hr_clerk;SET ROLE sales_clerk IDENTIFIED BY

commission;

SET ROLE sales_clerk IDENTIFIED BY

commission;

SET ROLE ALL EXCEPT sales_clerk;SET ROLE ALL EXCEPT sales_clerk;

SET ROLE NONE;SET ROLE NONE;

Enable: this is howEnable: this is how

users would activateusers would activate

their roletheir role

Disable all roles for currentDisable all roles for current

sessionsession

Revision no.: PPT/2K403/02

Removing Roles from Users

Page 81: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 81/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

81

Removing Roles from Users

REVOKE hr_manager FROM PUBLIC;REVOKE hr_manager FROM PUBLIC;

REVOKE sales_clerk FROM scott;REVOKE sales_clerk FROM scott;

Revision no.: PPT/2K403/02

Removing Roles

Page 82: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 82/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

82

Removing Roles

DROP ROLE hr_manager;DROP ROLE hr_manager;

Revision no.: PPT/2K403/02

Guidelines for Creating Roles

Page 83: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 83/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

83

Guidelines for Creating Roles

BENEFITS PAYROLL

HR_MANAGERHR_CLERK PAY_CLERKUser User rolesroles

ApplicationApplicationrolesroles

ApplicationApplicationprivilegesprivileges

UsersUsers

Payroll privilegesBenefits privileges

Revision no.: PPT/2K403/02

Guidelines for using Passwords and DefaultRoles

Page 84: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 84/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

84

Roles

PAY_CLERK PAY_CLERK_RO

Default rolePassword protectednon-default

Select privilegesInsert, update, delete

and select privileges

Revision no.: PPT/2K403/02

PUBLIC

Page 85: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 85/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

85

PUBLIC

• The PUBLIC User Group and Roles

 – To give a certain privilege or role to all the users in the database,

simple grant this privilege/role to the user group PUBLIC, which

exists in every database by default.

• Using Secure Application Roles

 – Secure application roles in Oracle9i are roles that are

implemented through a package.

Revision no.: PPT/2K403/02

Displaying Role Information

Page 86: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 86/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

86

Displaying Role Information

Role ViewRole View DescriptionDescription

DBA_ROLES All roles which exist in the database

DBA_ROLE_PRIVS Roles granted to users and rolesROLE_ROLE_PRIVS Roles which are granted to roles

DBA_SYS_PRIVS System privileges granted to usersand roles

ROLE_SYS_PRIVS System privileges granted to roles

ROLE_TAB_PRIVS Table privileges granted to roles

SESSION_ROLES Roles which the user currently hasenabled.

Select role, password_required fromSelect role, password_required from dba_rolesdba_roles;;

Revision no.: PPT/2K403/02

Exercise IV Managing user roles & privileges

Page 87: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 87/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

87

Exercise IV Managing user roles & privileges

Revision no.: PPT/2K403/02

Fine-grained Data Security

Page 88: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 88/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

88

Fine grained Data Security

• Oracle9i database provides a lower level security of data usingfine-grained data security techniques.

•  You can allow all users to access a central table such as

payroll table, but transparent to the users you can institutesecurity policies that limit access of an individual user to onlythose rows in a table.

• Oracle uses two main concepts to enforce fine-grained

security within database:

 – An application context.

 – A fine-grained access control policy.

• Oracle uses the term Virtual Private Database to refer to theimplementation of the fine-grained access control policiesthrough application contexts.

Revision no.: PPT/2K403/02

Auditing Categories

Page 89: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 89/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

89

Auditing Categories

• Auditing privileged operations

 – Always audited

 – Startup, shutdown, and SYSDBA or SYSOPER connections

• Database auditing

 – Enabled by DBA

 – Cannot record column values

• Value-based or application auditing

 – Implemented through code

 – Can record column values

 – Used to track changes to tables

Revision no.: PPT/2K403/02

System-level Triggers

Page 90: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 90/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

90

System level Triggers

• Database start-up triggers :

 – These triggers are used to execute code that you want to executeimmediately after database start-up.

• Logon triggers: – Provide you with information regarding the logon times of a user,

along with details about the user’s session.

• Logoff triggers:

 – Similar to the logon triggers, but they execute right before theuser’s session logs off.

• DDL triggers:

 – To capture all database object changes with these triggers.• Server error triggers:

 – Capture all major PL/SQL code errors into a special table.

Revision no.: PPT/2K403/02

Value-Based Auditing:An Example

Page 91: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 91/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

91

CREATE TRIGGER scott.auditemployee

AFTER INSERT OR DELETE OR UPDATE

ON scott.emp

FOR EACH ROW

BEGIN

INSERT INTO scott.audit_employee

VALUES ( :OLD.empno, :OLD.name,…,

:NEW.empno, :NEW.name,…,

USER, SYSDATE);END;

CREATE TRIGGER scott.auditemployee

AFTER INSERT OR DELETE OR UPDATE

ON scott.emp

FOR EACH ROW

BEGIN

INSERT INTO scott.audit_employeeVALUES ( :OLD.empno, :OLD.name,…,

:NEW.empno, :NEW.name,…,

USER, SYSDATE);END;

An Example

Revision no.: PPT/2K403/02

Database Auditing

Page 92: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 92/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

92

Database Auditing

DBA

Audit trail

Audit options

Other tables

Parameter file

Enable DB auditing

Specifyaudit options

Database

Execute command

Generateaudit trail

Review auditinformation

Server process

User 

Revision no.: PPT/2K403/02

Enabling Database Auditing

Page 93: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 93/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

93

Enabling Database Auditing

AUDIT_TRAIL Parameter 

file

InstanceNONE

No trail

AUD$table

DB

OS audit

trailOS

OS

DBA

Revision no.: PPT/2K403/02

Enabling Auditing Options

Page 94: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 94/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

94

ab g ud t g Opt o s

• Statement auditing

• Privilege auditing

• Schema object auditing

AUDIT select any table

BY scott BY ACCESS;

AUDIT select any table

BY scott BY ACCESS;

AUDIT user;AUDIT user;

AUDIT LOCK ON scott.emp

BY ACCESS WHENEVER SUCCESSFUL;

AUDIT LOCK ON scott.emp

BY ACCESS WHENEVER SUCCESSFUL;

Revision no.: PPT/2K403/02

Auditing Schema Objects

Page 95: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 95/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

95

g j

ObjectObject

OptionOption

 ALTER

 AUDIT

COMMENT

DELETE

EXECUTE

GRANTINDEX

INSERT

LOCK

READ

RENAME

SELECT

UPDATE

TableTable

X

X

X

X

XX

X

X

X

X

X

ViewView

X

X

X

X

X

X

X

X

X

SeqSeq--

uenceuence

X

X

X

X

SnapSnap--

shotshot

X

X

X

X

XX

X

X

X

X

X

StoredStored

ProPro--

gramgram

X

X

X

X

Revision no.: PPT/2K403/02

Viewing Auditing Options

Page 96: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 96/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

96

Data Dictionary ViewData Dictionary View

ALL_DEF_AUDIT_OPTS

DBA_STMT_AUDIT_OPTS

DBA_PRIV_AUDIT_OPTS

DBA_OBJ_AUDIT_OPTS

DescriptionDescription

Default audit options

Statement auditing options

Privilege auditing options

Schema object auditing

options

g g p

Revision no.: PPT/2K403/02

Disabling Auditing Options

Page 97: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 97/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

97

NOAUDIT create table BY scott;NOAUDIT create table BY scott;

g g p

NOAUDIT LOCK ON emp;NOAUDIT LOCK ON emp;

NOAUDIT user WHENEVER SUCCESSFUL;NOAUDIT user WHENEVER SUCCESSFUL;

Revision no.: PPT/2K403/02

The Audit Trail

Page 98: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 98/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

98

• Stores the records generated by statement, privilege, and

object auditing

• The audit records are stored in the SYS.AUD$ data dictionarytable or in the OS audit trail

• Each record in the audit trail includes:

 – The user who executed the statement

 – The command issued (action code)

 – Any system or object privilege used

 – The objects referenced in the statement

 – The date and time the statement was issued

Revision no.: PPT/2K403/02

Oracle Default Auditing

Page 99: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 99/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

99

g

• When you don’t specify any type of logging, by default Oracle

will log three types of database actions under all

circumstances.

• The auditing actions and the audit records are written to the

default $ORACLE_HOME/rdbms/audit directory.

 – Connections as SYSOPER or SYSDBA.

 – Database start-up

 – Database shutdown

Revision no.: PPT/2K403/02

Viewing Auditing Results

Page 100: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 100/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

100

g g

Audit Trail ViewAudit Trail View

DBA_AUDIT_TRAIL

DBA_AUDIT_EXISTS

DBA_AUDIT_OBJECT

DBA_AUDIT_SESSION

DBA_AUDIT_STATEMENT

DescriptionDescription

All audit trail entries

Records for AUDIT EXISTS/NOT

EXISTS

Records concerning schemaobjects

All connect and disconnect entries

Statement auditing records

Revision no.: PPT/2K403/02

Auditing Guidelines

Page 101: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 101/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

101

g

• Focus auditing

 – Object auditing, where possible

 – Only specific users

 – By session

 – Successful or unsuccessful

• Maintain the audit trail

 – Monitor the growth of the audit trail

 – Protect the audit trail from unauthorized access

 – Cleaning OS audit files

Revision no.: PPT/2K403/02

The Password File

Page 102: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 102/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

102

• Use orapwd to create the password file.

• The remote_login_passwordfile initialization parameter.

• None

 – No password file is used. – This is the default, and it permits only operating system-

authenticated users to perform DBA task.

• Shared

 – Creates a shared password file with a single user: SYS. – Any user who wants to perform privileged tasks has to log in as

SYS.

• Exclusive

 – Uses a password file. – Any user can be granted the SYSDBA and SYSOPER privileges,

and when the user SYS does so, the user is automatically addedto the password file.

Revision no.: PPT/2K403/02

Encrypted Passwords

Page 103: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 103/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

103

• By default, Oracle user passwords aren’t encrypted, which

leaves them vulnerable to unauthorized usage.

• ora_encrypt_login=true (client)

• dblink_encrypt_login=true (server)

• Oracle will always encrypt a password when it’s sending it

across a network.

Revision no.: PPT/2K403/02

Authentication Methods

Page 104: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 104/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

104

• External Authentication

• Proxy Authentication

• Centralized User Authorization using LDAP

Revision no.: PPT/2K403/02

Database Security Do’s Don’ts

Page 105: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 105/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

105

• User Accounts default lock except SYS and SYSTEM.

• Passwords, don’t hard-code

• Operating System Authentication

• Audit your Database

• Grant Privileges Appropriately.

• Set appropriate Permissions.

• Safeguard the Network and the Listener.

• Keep Up-to-Date for latest news about new security

vulnerabilities and the patches to overcome them..

• Use Oracle’s Advanced Security Feature.

• Take Care of Application Security.

Revision no.: PPT/2K403/02

Exercise V Auditing the database Usage

Page 106: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 106/107

 © CMS INSTITUTE, 2004. All rights reserved. No part of this material may be reproduced, stored or emailed without the prior permission of Programme Director, CMS Institute

106

Revision no.: PPT/2K403/02

Page 107: 11 User Management and Database Security.pdf

8/9/2019 11 User Management and Database Security.pdf

http://slidepdf.com/reader/full/11-user-management-and-database-securitypdf 107/107

107

Design & Published by:CMS Institute, Design & Development Centre, CMS House, Plot No. 91, Street No.7,

MIDC, Marol, Andheri (E), Mumbai –400093, Tel: 91-22-28216511, 28329198

Email: [email protected]