Database Blog

Unlocking the Power of Table Partitioning in Oracle Databases 

Unlocking the Power of Table Partitioning in Oracle Databases  Managing large datasets efficiently is a key challenge for database administrators (DBAs). One solution to this problem is table partitioning, a feature in Oracle databases that allows large tables to be divided into smaller, more manageable segments called partitions. In this post, we’ll explore the concept, benefits, and implementation of table partitioning, along with practical SQL examples. What is Table Partitioning?  Table partitioning involves splitting a large table into smaller, independent pieces, each known as a partition. These partitions can have distinct storage characteristics, but the SQL used to access the data remains unchanged. This means that while the data storage mechanism is different, users can interact with partitioned tables just like regular tables. Advantages of Table Partitioning  Improved Data Availability: – If one partition becomes unavailable due to a media failure, other partitions remain accessible. For example, if the ‘EMP’ table has three partitions (A, B, C) and partition A encounters an issue, partitions B and C can still serve user requests. Reduced Contention: – By storing partitions in separate tablespaces and placing each tablespace on a different disk drive, multiple users can access the table simultaneously without contention. For instance, User A can select data from Partition 1, while User B inserts data into Partition 2 without interference. Enhanced Query Performance: – Partition Pruning optimizes query execution. Oracle automatically identifies the relevant partition based on the query condition, significantly reducing the search scope. Efficient Backups: – DBAs can back up individual partitions instead of the entire table, making the backup process faster and more manageable. Simplified Data Management: – Partitioning makes handling large datasets easier. For example, in a data warehouse, weekly data can be loaded into a fresh partition. Retrieving data for a specific week then becomes as simple as querying that partition.   Types of Table Partitioning  Range Partitioning: – Divides data based on a range of values in a specified column (e.g., salary ranges). List Partitioning: – Segregates data based on a predefined list of values (e.g., state codes). Hash Partitioning: – Distributes data evenly across partitions using a hash function, ensuring balanced storage and performance. How to Implement Table Partitioning  Here are practical examples of table partitioning in Oracle databases: Creating a Table with Range Partitions: CREATE TABLE EMP1 (    EMPNO NUMBER(4),    ENAME VARCHAR2(10),    SAL   NUMBER(7,2),   HIREDATE DATE) PARTITION BY RANGE (SAL) (  PARTITION P1 VALUES LESS THAN (1000),    PARTITION P2 VALUES LESS THAN (2000),   PARTITION P3 VALUES LESS THAN (3000),   PARTITION P4 VALUES LESS THAN (5000)); Inserting Data into Partitions: INSERT INTO EMP1 PARTITION (P1) VALUES (1001, ‘ALLEN’, 800, ’01-JAN-2005′); INSERT INTO EMP1 VALUES (1002, ‘JAMES’, 4500, ’01-JAN-2005′);…

Read More

Speeding Up SQL Server Operations with Instant File Initialization (IFI)

In SQL Server environments, routine administrative operations such as database restores, data file growth, and the addition of new data files can become increasingly time-consuming as databases grow in size…

Read More

Step-by-Step Guide: Configure Debezium with PostgreSQL 17 and Apache Kafka

Prerequisites  PostgreSQL 17 installed and running. • Java 11 or later installed. • Apache Kafka and Kafka Connect. • Debezium PostgreSQL connector JAR placed in Kafka Connect plugin path. • A PostgreSQL…

Read More

Index Usage & Missing Index Checks in Oracle

A Practical Guide for Oracle DBAs Indexes play a critical role in Oracle database performance. While well-designed indexes can dramatically improve query response time, unused or missing indexes can just…

Read More

Oracle Audit Trail Queries

A Practical Guide for DBAs Auditing helps Oracle DBAs track who did what, when, and from where. Whether for security reviews, compliance, or incident investigations, having ready-to-use audit queries saves…

Read More

Resolving PRCR-1079 / CRS-5076 Due to DB_UNIQUE_NAME Mismatch in Oracle RAC 

Error  While starting an Oracle RAC database using srvctl, the startup failed with:  PRCR-1079: Failed to start resource ora.RACDB.db  CRS-5076: Startup of database resource ‘ora.RACDB.db’ is failing because  DB_UNIQUE_NAME ‘RAC_DB’ is not expected  Description …

Read More

How to Enable Active Data Guard on a Physical Standby 

Description: –  Active Data Guard allows a physical standby database to be opened in READ ONLY mode while redo apply continues in the background. This enables the standby database to be used for reporting and…

Read More

How to Perform Password-Based Encrypted RMAN Tablespace Backup & Restore

  Overview  This blog explains how to secure an Oracle 19c tablespace using RMAN password-based encryption and demonstrates a complete backup, restore, and recovery cycle. It covers verifying tablespaces and datafiles, taking an encrypted RMAN backup…

Read More

Oracle 19c Table Shrink Space

Shrinking a table in an Oracle database is used to reclaim unused space and optimize storage. As data is inserted, updated, and deleted over time, tables can become fragmented and retain empty blocks, leading to wasted…

Read More

Query to get the output for object privileges, roles, system privileges with details

Please use the below query to get the output.   set echo on; SELECT COUNT(*) AS object_priv_count FROM dba_tab_privs WHERE grantee = ‘A’; set echo on; SELECT COUNT(*) AS role_grant_count…

Read More