Tablespace in BEGIN BACKUP mode
Job details
Name: |
Tablespace in BEGIN BACKUP mode |
Platform: |
Oracle |
Category: |
Availability |
Description: |
Checks if any of the tablespaces are in ‘BEGIN BACKUP‘ mode (caused by DDL ‘alter tablespace |
Long description: |
Checks if any of the tablespaces are in ‘BEGIN BACKUP‘ mode (caused by DDL ‘alter tablespace |
Version: |
1.21 |
Default schedule: |
10 10,15 * * |
Requires engine install: |
Yes |
Compatibility tag: |
.[type=‘instance’ & databasetype=‘oracle’]/.[hasengine=‘YES’] |
Parameters
Name |
Default value |
Description |
time threshold |
24 |
A maximum number of hours a tablespace can be in BEGIN BACKUP mode before an alert can be sent by the procedure. |
return status |
2 |
Return status value (ALARM – 2, WARNING – 1, or OK – 0) when tablespace is in BEGIN BACKUP mode for a period of time controlled by the parameter “time threshold”. |
history threshold |
7 |
The number of days to keep statistics for in dbwatch history table. |
Job Summary
- Purpose: The primary purpose of this job is to monitor and identify Oracle tablespaces that are in BEGIN BACKUP mode. It checks using the DDL “alter tablespace [ts_name] begin backup” command.
- Why: This job is essential for ensuring that backups do not run indefinitely or longer than expected, which can affect database performance and availability. Extended backup modes can lock the tablespace, preventing other transactions from completing, which could lead to application errors or slowdowns.
- Manual checking: You can manually check tablespaces in BEGIN BACKUP mode by using the following SQL commands:
SELECT df.name "File name", bf.status "Status", bf.change# "Change#", bf.time "Date"
FROM v$datafile df, v$backup bf
WHERE df.file# = bf.file# AND bf.status = 'ACTIVE'
ORDER BY 4 DESC;
Implementation Details
- The job involves a stored procedure ‘ts_begin_backup_mode’ that checks the v$datafile and v$backup views to find active backups.
- A history table ‘ts_begin_backup_mode_histr’ logs entries each time a tablespace is checked for active backup status, helping in tracking and audit processes.
- Historical data past a preconfigured threshold is deleted to maintain table size and performance.
Dependencies
- This job depends on two objects:
- ‘ts_begin_backup_mode’
- ‘ts_begin_backup_mode_histr’, which contains logs from the v$backup view.
Monitoring Thresholds and Alerts
- Time Threshold: The job alerts if tablespaces have been in BEGIN BACKUP mode for more than the configured threshold hours.
- Return Status: Generates different status codes based on duration the tablespace remains in BEGIN BACKUP mode.
Report Generation
- A report template included in the job provides detailed presentations of:
- Database files in BEGIN BACKUP mode.
- Historical tracking of tablespaces that have been placed in BEGIN BACKUP mode.
- These reports help in quick assessment and review of the tablespaces’ status, assisting in prompt and informed decision-making.
Conclusion
Given the functions and mechanisms involved in this job, it is clear that the monitoring of tablespaces in BEGIN BACKUP mode is crucial for maintaining the health and performance of an Oracle database. The ability to alert and log these events helps database administrators manage backups effectively and avoid prolonged locks or resource issues.