Detailed Explanation of oracle Online Database Backup

  • 2021-09-11 21:46:14
  • OfStack

Although the database system runs slowly in many cases, it is obvious that the cost of the loss of database data is self-evident. Therefore, DBA is the minimum requirement to improve the performance of the system at least while ensuring that the data is not lost
Online database backup
The 1-denier database runs in archivelog mode, and can be backed up when it is open and available to users. This 1 feature allows continuously running databases to be archived and can ensure their recovery. Online hot backup should be scheduled for the time period with the least user activity.
Online hot backup includes three processes, namely, backing up data files one by one, backing up archive redo log files and backing up control files.
1. Back up data files on a table space-by-table basis
This process can be divided into four steps, namely, looking up which data files are included in the tablespace, setting the tablespace to backup state, backing up the data files in the tablespace, and restoring the tablespace to normal state.
(1) What data files are included in the query table space
Execute the commands select tablespace_name, file_name from dba_data_files to obtain all the data files in the system and the tablespace to which they belong.
(2) Set tablespace to backup state
Execute the command alter tablespace tablespace_name begin backup to set the tablespace tablespace_name to a backup state.
(3) Back up the data files in the tablespace
Execute the File Backup command of the operating system to back up the data files of the tablespace.
(4) Restore the table space to its normal state
Execute the command alter tablespace tablespace_name end backup to restore the tablespace tablespace_name to its normal state.
2. Back up the archive redo log file
This process can be divided into three steps, namely, pausing the archive process ARCH and backing up the archive redo log file.
(1) Pause the archiving process ARCH
Execute the command archive log stop to suspend the archiving process ARCH.
(2) Record the list of archived log files in the archive destination directory
You can query the V $LOG dynamic dictionary view. If the log is fully archived, the archived column of V $LOG will contain the YES value. You can select the highest archive log (using the sequence # column) from V $LOG and use it as the basis for the backup file manifest. For example, if V $LOG indicates that sequence # 2334 is the last log file to be archived, you can successfully back up all files with sequence numbers below 2334 in the archive redo log destination directory. If you try to back up 2335, you can successfully back it up at the operating system level, but since the file is not fully archived, this backup may only be written to 1.5%, so it may not be useful during the recovery operation.
(3) Restart the archiving process ARCH
Execute the command archive log start to start the archiving process ARCH.
(4) Back up the archive redo log file
Execute the File Backup command of the operating system to back up the archive remake log file.
(5) Delete the backed-up archive log files from the archive destination directory
3. Back up control files
Execute the command alter database backup controlfile to destinantion/control. bak to back up the control files online. You can also execute alter database backup controlfile to trace to write the command of create controlfile to the trace file of the database

How to open a database after online hot backup fails
Because the tablespace is still in a hot backup state.
  
Simulation Phenomena and Solutions;
  
Set the database to archive mode first

 
C:>svrmgrl
svrmgrl>connect internal
svrmgrl>alter tablespace  Tablespace name  begin backup;
-- Forcibly close the database before the hot standby mode of tablespace ends, causing an error 
svrmgrl>shutdown abort
svrmgrl>startup mount
-- Set the data file of this tablespace to when the database is not open end backup Mode 
svrmgrl>alter database datafile ' Data file name of tablespace ' end backup;
-- Or perform tablespace media recovery 
svrmgrl>recover tablespace  Tablespace name ;
svrmgrl>alter database open; 


Related articles: