Lesson 10 | Monitoring an open database backup |
Objective | Explain how to Check the State of an Open Database Backup. |
Connect to the Oracle database using SQL*Plus or any other SQL client with a user that has the necessary privileges (e.g., SYSDBA
).
sqlplus / as sysdba
V$BACKUP
View:
The V$BACKUP
view contains information about the backup status of each datafile. The STATUS
column indicates whether a datafile is currently being backed up.
SELECT file#, status, change#, time FROM v$backup;
file#
: The file number of the datafile.status
: The backup status of the datafile.
ACTIVE
indicates that the datafile is currently being backed up.NOT ACTIVE
indicates that the datafile is not being backed up.change#
: The system change number (SCN) at which the backup started.time
: The time when the backup started.V$DATAFILE
View:
The V$DATAFILE
view provides additional information about the datafiles, such as their names and current status.
SELECT file#, name, status FROM v$datafile;
file#
: The file number of the datafile.name
: The name of the datafile.status
: The current status of the datafile (e.g., ONLINE
, OFFLINE
, etc.).You can join the V$BACKUP
and V$DATAFILE
views to get a comprehensive view of the backup status along with the datafile names.
SELECT b.file#, d.name, b.status, b.change#, b.time FROM v$backup b JOIN v$datafile d ON b.file# = d.file#;
FILE# NAME STATUS CHANGE# TIME ------ -------------------------------- ---------- -------- --------- 1 /u01/oradata/ORCL/system01.dbf ACTIVE 1234567 2023-10-01 12:00:00 2 /u01/oradata/ORCL/sysaux01.dbf NOT ACTIVE 0 3 /u01/oradata/ORCL/undotbs01.dbf NOT ACTIVE 0 4 /u01/oradata/ORCL/users01.dbf ACTIVE 1234568 2023-10-01 12:05:00
ACTIVE
status).NOT ACTIVE
status).V$BACKUP
view is particularly useful during hot backups (open database backups) to monitor which datafiles are currently in backup mode.V$BACKUP
view will not show any active backups since the database is not open.SQL> desc V$backup Name Null? Type ------------------------------- -------- ---- FILE# NUMBER STATUS VARCHAR2(18) CHANGE# NUMBER TIME DATE
SQL> select * from V$backup; FILE# STATUS CHANGE# TIME ---------- ------------------ ---------- --------- 1 NOT ACTIVE 0 2 NOT ACTIVE 0 3 NOT ACTIVE 0 4 NOT ACTIVE 0 5 NOT ACTIVE 0 6 NOT ACTIVE 0 7 NOT ACTIVE 0 8 NOT ACTIVE 0 9 NOT ACTIVE 0 10 NOT ACTIVE 0 11 NOT ACTIVE 0 FILE# STATUS CHANGE# TIME ---------- ------------------ ---------- --------- 12 ACTIVE 130521 14-JAN-2020 12 rows selected.
ALTER TABLESPACE BEGIN BACKUP;
SQL> desc V$datafile_header Name Null? Type ------------------------------- -------- ---- FILE# NUMBER STATUS VARCHAR2(7) ERROR VARCHAR2(18) FORMAT NUMBER RECOVER VARCHAR2(3) FUZZY VARCHAR2(3) CREATION_CHANGE# NUMBER CREATION_TIME DATE TABLESPACE_NAME VARCHAR2(30) TS# NUMBER RFILE# NUMBER RESETLOGS_CHANGE# NUMBER RESETLOGS_TIME DATE CHECKPOINT_CHANGE# NUMBER CHECKPOINT_TIME DATE CHECKPOINT_COUNT NUMBER BYTES NUMBER BLOCKS NUMBER
SQL> select name, status, fuzzy from V$datafile_header; NAME STATUS FUZZY --------------------------------------------- ------- ----- /u02/oradata/DVL1/system_DVL1_01.dbf ONLINE /u02/oradata/DVL1/rbs_DVL1_01.dbf ONLINE /u02/oradata/DVL1/temp_DVL1_01.dbf ONLINE /u02/oradata/DVL1/tools_DVL1_01.dbf ONLINE /u02/oradata/DVL1/users_DVL1_01.dbf ONLINE /u02/oradata/DVL1/des_tab_DVL1.dbf ONLINE /u03/oradata/DVL1/des_idx_DVL1.dbf ONLINE /u02/oradata/DVL1/des_rbs_DVL1.dbf ONLINE /u02/oradata/DVL1/synchro_dvl1.dbf ONLINE /u02/oradata/DVL1/olant_dvl1.dbf ONLINE /u02/oradata/DVL1/celeris_dvl1.dbf ONLINE /u02/oradata/DVL1/isd_002_proj_dvl1.dbf ONLINE YES 12 rows selected.
ALTER TABLESPACE BEGIN BACKUP;
ALTER TABLESPACE END BACKUP
command is issued.
The next lesson examines the backup implications of logging and nologging modes.