Oracle Database SQL Certified Associate
1 Introduction to SQL
1-1 Overview of SQL
1-2 History of SQL
1-3 SQL Standards
2 SQL Data Types
2-1 Numeric Data Types
2-2 Character Data Types
2-3 Date and Time Data Types
2-4 Large Object (LOB) Data Types
2-5 Miscellaneous Data Types
3 Creating and Managing Tables
3-1 Creating Tables
3-2 Modifying Tables
3-3 Dropping Tables
3-4 Table Constraints
3-5 Temporary Tables
4 Data Manipulation Language (DML)
4-1 Inserting Data
4-2 Updating Data
4-3 Deleting Data
4-4 Selecting Data
4-5 Using Subqueries
5 Data Control Language (DCL)
5-1 Granting Privileges
5-2 Revoking Privileges
6 Data Definition Language (DDL)
6-1 Creating Tables
6-2 Altering Tables
6-3 Dropping Tables
6-4 Creating Indexes
6-5 Dropping Indexes
6-6 Creating Views
6-7 Dropping Views
7 SQL Functions
7-1 Single-Row Functions
7-2 Aggregate Functions
7-3 Group Functions
7-4 Analytical Functions
8 Joins and Subqueries
8-1 Inner Joins
8-2 Outer Joins
8-3 Self-Joins
8-4 Cross Joins
8-5 Subqueries
9 Set Operators
9-1 UNION
9-2 UNION ALL
9-3 INTERSECT
9-4 MINUS
10 Grouping and Aggregation
10-1 GROUP BY Clause
10-2 HAVING Clause
10-3 ROLLUP and CUBE
10-4 GROUPING SETS
11 Transactions and Concurrency
11-1 Transaction Control Statements
11-2 Locking and Concurrency
11-3 Isolation Levels
12 Oracle SQL Developer
12-1 Overview of Oracle SQL Developer
12-2 Using SQL Worksheet
12-3 Managing Connections
12-4 Running Scripts
13 Advanced SQL Topics
13-1 Recursive Queries
13-2 Model Clause
13-3 PIVOT and UNPIVOT
13-4 Flashback Query
14 Performance Tuning
14-1 Query Optimization
14-2 Indexing Strategies
14-3 Analyzing Query Performance
15 Security and Auditing
15-1 User Management
15-2 Role Management
15-3 Auditing SQL Statements
16 Backup and Recovery
16-1 Backup Strategies
16-2 Recovery Strategies
16-3 Using RMAN
17 Oracle Database Architecture
17-1 Overview of Oracle Database Architecture
17-2 Memory Structures
17-3 Process Structures
17-4 Storage Structures
18 PLSQL Basics
18-1 Introduction to PLSQL
18-2 PLSQL Block Structure
18-3 Variables and Data Types
18-4 Control Structures
18-5 Exception Handling
19 Oracle SQL Certification Exam Preparation
19-1 Exam Objectives
19-2 Sample Questions
19-3 Practice Tests
19-4 Exam Tips
User Management in Oracle SQL

User Management in Oracle SQL

Key Concepts

User Management in Oracle SQL involves creating, modifying, and deleting database users, as well as managing their privileges and roles. Understanding the following key concepts is essential for effective user management:

1. Creating Users

Creating users involves defining a new user with a username and password. This user can then be granted access to the database and assigned roles and privileges.

Example:

Creating a new user named JohnDoe with the password password123:

CREATE USER JohnDoe IDENTIFIED BY password123;

2. Modifying Users

Modifying users involves changing their attributes, such as their password, default tablespace, or temporary tablespace. This is useful for updating user information or resetting passwords.

Example:

Changing the password for the user JohnDoe to newpassword456:

ALTER USER JohnDoe IDENTIFIED BY newpassword456;

3. Deleting Users

Deleting users involves removing a user from the database. This action also removes all objects owned by the user and revokes all privileges granted to the user.

Example:

Deleting the user JohnDoe:

DROP USER JohnDoe CASCADE;

4. Granting Privileges

Granting privileges allows users to perform specific actions on database objects. Privileges can be granted on individual objects or globally.

Example:

Granting the SELECT privilege on the Employees table to the user JohnDoe:

GRANT SELECT ON Employees TO JohnDoe;

5. Revoking Privileges

Revoking privileges removes the ability of a user to perform specific actions on database objects. This is useful for restricting access or updating permissions.

Example:

Revoking the SELECT privilege on the Employees table from the user JohnDoe:

REVOKE SELECT ON Employees FROM JohnDoe;

6. Creating Roles

Roles are collections of privileges that can be granted to users. Creating roles allows for easier management of permissions by grouping related privileges together.

Example:

Creating a role named HR_Role with the SELECT and INSERT privileges on the Employees table:

CREATE ROLE HR_Role; GRANT SELECT, INSERT ON Employees TO HR_Role;

7. Granting Roles

Granting roles to users allows them to inherit all the privileges associated with the role. This simplifies the process of assigning multiple privileges to a user.

Example:

Granting the HR_Role to the user JohnDoe:

GRANT HR_Role TO JohnDoe;

8. Revoking Roles

Revoking roles removes the privileges associated with the role from the user. This is useful for updating user permissions or restricting access.

Example:

Revoking the HR_Role from the user JohnDoe:

REVOKE HR_Role FROM JohnDoe;

9. Default and Temporary Tablespaces

Default and temporary tablespaces define where user data and temporary data are stored. Setting these tablespaces ensures that users have appropriate storage locations.

Example:

Setting the default tablespace to USERS and the temporary tablespace to TEMP for the user JohnDoe:

ALTER USER JohnDoe DEFAULT TABLESPACE USERS TEMPORARY TABLESPACE TEMP;

10. Profile Management

Profiles define resource limits and password policies for users. Creating and assigning profiles helps in managing user resources and ensuring secure password practices.

Example:

Creating a profile named UserProfile with a password expiration policy and assigning it to the user JohnDoe:

CREATE PROFILE UserProfile LIMIT PASSWORD_LIFE_TIME 90; ALTER USER JohnDoe PROFILE UserProfile;

11. System Privileges

System privileges allow users to perform actions at the database level, such as creating tables or granting privileges. These privileges are essential for administrative tasks.

Example:

Granting the CREATE TABLE system privilege to the user JohnDoe:

GRANT CREATE TABLE TO JohnDoe;

12. Object Privileges

Object privileges allow users to perform actions on specific database objects, such as tables or views. These privileges are essential for interacting with specific data.

Example:

Granting the UPDATE object privilege on the Employees table to the user JohnDoe:

GRANT UPDATE ON Employees TO JohnDoe;

13. Public and Private Synonyms

Synonyms provide alternative names for database objects. Public synonyms are accessible to all users, while private synonyms are accessible only to the user who created them.

Example:

Creating a public synonym named Emp for the Employees table:

CREATE PUBLIC SYNONYM Emp FOR Employees;

14. User Quotas

User quotas define the amount of space a user can use in a tablespace. Setting quotas helps in managing storage resources and preventing overuse.

Example:

Setting a quota of 100 MB on the USERS tablespace for the user JohnDoe:

ALTER USER JohnDoe QUOTA 100M ON USERS;

15. Auditing User Actions

Auditing user actions involves tracking and logging user activities in the database. This is useful for security and compliance purposes.

Example:

Enabling auditing for all actions performed by the user JohnDoe:

AUDIT ALL BY JohnDoe;