0% found this document useful (0 votes)
52 views

Oracle Dba Notes

Uploaded by

Arjoo
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views

Oracle Dba Notes

Uploaded by

Arjoo
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Qu.5 Classify the backup scheduling strategies in detail in oracle DBA?

Ans. In Oracle Database Administration (DBA), backup scheduling is a critical task to ensure
data availability, integrity, and recoverability. Backup strategies can be classified based on
various criteria, including frequency, type of backup, and the method used. Here is a detailed
classification of backup scheduling strategies:

1. Based on Frequency

a. Full Backup:

 Description: A complete copy of the entire database.


 Frequency: Typically done weekly or monthly, depending on the size of the database
and the acceptable recovery time objective (RTO).
 Pros: Simplifies restore process since it's a single comprehensive copy.
 Cons: Time-consuming and resource-intensive.

b. Incremental Backup:

 Description: Copies only the data that has changed since the last backup.
 Types:
o Cumulative Incremental (Level 1): Backs up all changes since the last full
backup.
o Differential Incremental (Level 0): Backs up all changes since the last
incremental backup.
 Frequency: Typically done daily.
 Pros: Faster and less resource-intensive than full backups.
 Cons: Restoration can be more complex and time-consuming, as it may require
applying multiple incremental backups.

c. Differential Backup:

 Description: Similar to cumulative incremental, but backs up all changes since the
last full backup.
 Frequency: Typically done daily or multiple times per day.
 Pros: Faster than full backups and simplifies restore compared to incremental
backups.
 Cons: As the time since the last full backup increases, the size of differential backups
can grow significantly.

2. Based on Type

a. Physical Backup:

 Description: Backs up the physical files used by the database (e.g., datafiles, control
files, redo log files).
 Types:
o Cold Backup: Performed when the database is shut down.
o Hot Backup: Performed while the database is running and accessible to users.
 Pros: Ensures a point-in-time snapshot of the database.
 Cons: Cold backups require downtime; hot backups require careful coordination to
ensure data consistency.

b. Logical Backup:

 Description: Backs up the logical data within the database (e.g., schemas, tables,
views).
 Tools: Export/Import utilities (exp, imp), Data Pump (expdp, impdp).
 Pros: Useful for individual object recovery and data migration.
 Cons: Does not include physical structure or system-specific data.

3. Based on Method

a. Manual Backup:

 Description: Initiated manually by the DBA using scripts or commands.


 Pros: Full control over the backup process.
 Cons: Prone to human error and requires constant monitoring and intervention.

b. Automated Backup:

 Description: Scheduled and managed automatically using backup management tools


(e.g., Oracle RMAN, Enterprise Manager).
 Tools: Oracle Recovery Manager (RMAN), Oracle Enterprise Manager (OEM).
 Pros: Reduces the risk of human error, provides regular and consistent backups, and
can be easily integrated with other management tasks.
 Cons: Initial setup can be complex; requires monitoring to ensure automated
processes are functioning correctly.

Qu. 2 Explain the process of installing and Managing Oracle?

Ans. Installing and managing an Oracle Database involves several steps and considerations to
ensure a smooth and efficient setup. Here is a detailed guide on the process:

1. Pre-Installation Steps

a. System Requirements:

 Hardware: Ensure your system meets the minimum hardware requirements (CPU,
memory, disk space).
 Software: Verify that your operating system is supported by the Oracle version you
plan to install.
 Dependencies: Install necessary libraries and packages required by Oracle.

b. Prepare the Environment:

 User Account: Create an Oracle user account with appropriate permissions.


 Directories: Create directories for Oracle software and database files.
 Environment Variables: Set environment variables such as ORACLE_HOME,
ORACLE_SID, and PATH.

c. Download Oracle Software:

 Download the appropriate Oracle Database software from the Oracle Technology
Network (OTN) or Oracle Software Delivery Cloud.

2. Installation Process

a. Run the Oracle Universal Installer (OUI):

 Start OUI: Launch the installer (runInstaller on Unix/Linux or setup.exe on


Windows).
 Configuration Options:
o Select installation type (e.g., Enterprise Edition, Standard Edition).
o Choose the installation location (ORACLE_BASE and ORACLE_HOME).
o Configure the database options (e.g., character set, memory allocation).
 Install Software: Follow the prompts to install the Oracle binaries.

b. Create a Database:

 DBCA (Database Configuration Assistant): Use DBCA to create a new database.


o Select database creation mode (typical or advanced).
o Configure database settings (e.g., SID, administrative passwords, storage
options).
o Optionally configure automated backups and sample schemas.

3. Post-Installation Steps

a. Verify Installation:

 Check Services: Ensure that Oracle services (e.g., Oracle Listener, database instance)
are running.
 Connectivity: Test connectivity using tools like SQL*Plus or Oracle SQL Developer.

b. Configure Listener:

 Listener.ora: Configure the Oracle Net listener (listener.ora).


 Start Listener: Use lsnrctl start to start the listener.
 Verify Listener: Check listener status with lsnrctl status.

4. Managing Oracle Database

a. Database Startup and Shutdown:

 Startup: Use SQL*Plus to start the database (startup command).


 Shutdown: Use SQL*Plus to shut down the database gracefully (shutdown
immediate command).
b. Backup and Recovery:

 RMAN (Recovery Manager): Use RMAN for backup and recovery operations.
o Full Backup: backup database;
o Incremental Backup: backup incremental level 1 database;
o Restore and Recover: restore database; recover database;
 Data Pump: Use Data Pump utilities (expdp and impdp) for logical backups and data
migration.

c. Monitoring and Tuning:

 AWR (Automatic Workload Repository): Collect and analyze performance data.


 ADDM (Automatic Database Diagnostic Monitor): Identify and diagnose
performance issues.
 Enterprise Manager: Use Oracle Enterprise Manager (OEM) for comprehensive
monitoring and management.

d. User and Security Management:

 User Accounts: Create and manage database users.


o CREATE USER username IDENTIFIED BY password;
o GRANT CONNECT, RESOURCE TO username;
 Roles and Privileges: Assign roles and privileges to users.
o CREATE ROLE role_name;
o GRANT privilege TO role_name;
 Auditing: Enable and configure auditing to track user activities.

e. Patch Management:

 OPatch: Use the OPatch utility to apply patches.


o opatch apply
 PSU and CPU: Regularly apply Patch Set Updates (PSUs) and Critical Patch
Updates (CPUs) to maintain security and stability.

f. Storage Management:

 Tablespaces: Create and manage tablespaces.


o CREATE TABLESPACE tablespace_name DATAFILE 'datafile_path' SIZE
size;
 Datafiles: Add or resize datafiles as needed.
o ALTER DATABASE DATAFILE 'datafile_path' RESIZE new_size;

5. Advanced Administration

a. Data Guard:

 Setup: Configure Data Guard for disaster recovery.


 Switchover/Failover: Manage switchover and failover operations.

b. RAC (Real Application Clusters):


 Installation: Install and configure Oracle RAC for high availability.
 Management: Use Clusterware and Grid Infrastructure for managing RAC nodes.

c. ASM (Automatic Storage Management):

 Setup: Configure ASM for efficient storage management.


 Disk Groups: Create and manage ASM disk groups.

Qu 3. What are the key features & benefits of Automatic Storage Management?

Ans. Key Features of Automatic Storage Management

1. Simplified Storage Management:

 Disk Group Management: ASM manages groups of disks as a single unit, known as
a disk group, simplifying the configuration and management of storage.
 File Management: Automatically manages database file placement and naming
within disk groups.

2. Dynamic Reconfiguration:

 Disk Addition/Removal: Disks can be added or removed from disk groups without
downtime, allowing for flexible and scalable storage management.
 Rebalancing: Automatically redistributes data across disks when disks are added or
removed, maintaining performance and availability.

3. Integrated Database Tools:

 Oracle Enterprise Manager (OEM): ASM integrates with OEM for easy
monitoring and management of storage.
 RMAN Integration: Works seamlessly with Oracle Recovery Manager (RMAN) for
backup and recovery operations.

4. ASM Flex and ASM Flex Clusters:

 ASM Flex: Allows for flexible and isolated management of databases within the
same disk group.
 Flex Clusters: Supports larger cluster configurations and provides enhanced high
availability.

5. Scalability and Performance:

 Scalable Storage: ASM can manage very large storage configurations efficiently.
 I/O Optimization: Optimizes I/O performance through intelligent data placement and
striping.

Benefits of Automatic Storage Management

1. Simplified Administration:
 Reduces the complexity of storage management by automating many tasks, such as file
placement and disk management.
 Minimizes the need for manual intervention, reducing the risk of human errors.

2. Improved Performance:

 Enhances database performance through striping, which distributes I/O load evenly across
all disks.
 Optimizes read and write operations, leading to better overall system performance.

3. High Availability and Reliability:

 Ensures data availability and reliability through built-in mirroring and automatic failure
handling.
 Provides robust protection against disk failures, minimizing downtime and data loss.

4. Flexible and Scalable Storage:

 Allows dynamic adjustment of storage resources without requiring database downtime.


 Easily scales to accommodate growing storage needs by adding new disks to disk groups.

5. Cost-Effective Storage Management:

 Reduces administrative overhead and operational costs associated with managing storage.
 Efficiently utilizes available storage resources, potentially lowering storage hardware costs.

Qu 4. Elaborate on Undo Data and Redo Data administering techniques monitoring &
administrating.

Ans. Undo data and redo data are critical components in Oracle Database that ensure data
integrity and support various functionalities such as transaction rollback, read consistency,
and recovery operations. Effective monitoring and administration of these components are
essential for database performance and reliability. Here’s an in-depth look at undo data and
redo data, including techniques for monitoring and administering them:

Undo Data

Purpose:

 Transaction Rollback: Enables the database to roll back incomplete transactions, restoring
the data to its previous state.
 Read Consistency: Ensures that queries see a consistent snapshot of the data as of the query
start time, even if changes are being made concurrently.
 Flashback Features: Supports Oracle's Flashback Query, Flashback Table, and Flashback
Database features, allowing users to view or revert to previous data states.

Storage:

 Undo data is stored in undo tablespaces. Each transaction generates undo records, which
are stored in these tablespaces.
Monitoring Undo Data:

1. Undo Tablespace Usage:


o Monitor the usage and size of the undo tablespace to ensure it is not overfilled.
o SQL Query:

sql
Copy code
SELECT tablespace_name, SUM(bytes)/1024/1024 AS MB
FROM dba_data_files
WHERE tablespace_name = 'UNDOTBS1'
GROUP BY tablespace_name;

2. Active and Expired Undo:


o Check the status of undo extents (active, expired, unexpired) to understand space
utilization.
o SQL Query:

sql
Copy code
SELECT status, SUM(bytes)/1024/1024 AS MB
FROM dba_undo_extents
GROUP BY status;

3. Transaction Activity:
o Monitor the number of active transactions and the amount of undo data they
generate.
o SQL Query:

sql
Copy code
SELECT s.sid, s.username, t.used_ublk, t.used_urec
FROM v$transaction t, v$session s
WHERE t.ses_addr = s.saddr;

Administering Undo Data:

1. Undo Retention:
o Set an appropriate undo retention period to balance between ensuring read
consistency and efficient space usage.
o SQL Command:

sql
Copy code
ALTER SYSTEM SET undo_retention = 900;

2. Sizing Undo Tablespace:


o Adjust the size of the undo tablespace based on the transaction volume and undo
retention needs.
o SQL Command:

sql
Copy code
ALTER DATABASE DATAFILE 'path_to_undo_datafile' RESIZE
new_size;

3. Automatic Undo Management:


o Use automatic undo management to let Oracle handle undo tablespace allocation
and retention.
o SQL Command:

sql
Copy code
ALTER SYSTEM SET undo_management = 'AUTO';
ALTER SYSTEM SET undo_tablespace = 'UNDOTBS1';

Redo Data

Purpose:

 Data Recovery: Ensures data can be recovered in case of a system failure by recording all
changes made to the database.
 Synchronization: Helps in synchronizing standby databases in Oracle Data Guard setups.

Storage:

 Redo data is stored in redo log files. Each database has a set of redo log groups, each
containing one or more redo log members.

Monitoring Redo Data:

1. Redo Log File Status:


o Monitor the status and usage of redo log files to ensure they are switching properly.
o SQL Query:

sql
Copy code
SELECT group#, status, bytes/1024/1024 AS MB
FROM v$log;

2. Redo Log Switches:


o Track the frequency of redo log switches to understand the workload and identify
any bottlenecks.
o SQL Query:

sql
Copy code
SELECT COUNT(*) AS switches, TRUNC(first_time) AS date
FROM v$log_history
GROUP BY TRUNC(first_time);

3. Redo Log Waits:


o Monitor for log file sync and log file parallel write waits to detect performance issues
related to redo logging.
o SQL Query:
sql
Copy code
SELECT event, total_waits, time_waited
FROM v$system_event
WHERE event LIKE 'log file%';

Administering Redo Data:

1. Redo Log Size:


o Ensure redo log files are appropriately sized to balance between log switch
frequency and storage usage.
o SQL Command:

sql
Copy code
ALTER DATABASE ADD LOGFILE GROUP group_number
('path_to_redo_log_file') SIZE size_in_MB;

2. Redo Log Groups and Members:


o Add or drop redo log groups and members to enhance redundancy and
performance.
o SQL Commands:

sql
Copy code
ALTER DATABASE ADD LOGFILE GROUP new_group_number
('path_to_redo_log_file') SIZE size_in_MB;
ALTER DATABASE DROP LOGFILE GROUP group_number;

3. ARCHIVELOG Mode:
o Enable ARCHIVELOG mode to archive redo log files, essential for point-in-time
recovery.
o SQL Commands:

sql
Copy code
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
ALTER DATABASE ARCHIVELOG;
ALTER DATABASE OPEN;

4. Redo Log Retention:


o Manage the retention and deletion of archived redo logs to ensure they do not
consume excessive disk space.
o Use RMAN to automate the deletion of obsolete archived logs:

sql
Copy code
RMAN> DELETE ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-7';

Qu 6. Explain Control and Redo log files? How its related to database.
Ans. Control files and redo log files are critical components of an Oracle database. They play
vital roles in ensuring data integrity, managing database operations, and enabling recovery in
case of failures. Here’s a detailed explanation of each:

Control Files

Definition:

 Control files are binary files that record the physical structure of the database. They are
essential for the database to start and operate correctly.

Contents:

 Database Name and Timestamp: Uniquely identifies the database.


 Datafile Locations: Lists the names and locations of all datafiles and their states.
 Redo Log File Locations: Lists the names and locations of all redo log files.
 Tablespace Information: Information about the database's tablespaces.
 Checkpoint Information: Information about the last checkpoint, which is used to ensure
data consistency.
 Backup Information: Records information about RMAN backups.
 Log Sequence Numbers: Sequence numbers of redo log files.
 Archived Log Information: Information about archived redo logs.

Role in the Database:

 Startup and Shutdown: The control file is read at startup and is crucial for the database to
function. Without a valid control file, the database cannot be mounted or opened.
 Database Recovery: Contains necessary information for recovering the database in case of
failure.
 Data Integrity: Ensures that all parts of the database are consistent and coordinated.

Administration:

 Multiplexing: It is recommended to maintain multiple copies of the control file on different


disks to prevent data loss due to corruption or hardware failure.
o Configuration example:

sql
Copy code
CONTROL_FILES = ('/u01/oracle/oradata/DBNAME/control01.ctl',
'/u02/oracle/oradata/DBNAME/control02.ctl')

Redo Log Files

Definition:

 Redo log files record all changes made to the database. They are used to protect data in case
of a failure and to ensure data integrity.

Contents:
 Redo Entries: Each redo entry contains information about a change made to the database,
such as data modifications, structural changes, and transaction control statements.

Role in the Database:

 Data Recovery: Redo logs are crucial for recovering the database to a consistent state after a
failure. Oracle uses redo logs to replay changes made to the database.
 Transaction Management: Redo logs ensure that transactions are properly committed or
rolled back.
 Synchronization: Used in replication and standby database configurations to synchronize
data.

Administration:

 Log Groups and Members: Redo logs are organized into groups, with each group containing
one or more members (copies). Groups provide redundancy, ensuring that the loss of one
member does not lead to data loss.
o Configuration example:

sql
Copy code
LOG_GROUPS = ( ('/u01/oracle/oradata/DBNAME/redo01.log'),
('/u02/oracle/oradata/DBNAME/redo02.log') )

You might also like