Online database backup
Once the database runs in Archivelog mode, it can be backed up when it is open and available to the user. This feature allows the continuous operation of the database to be archived and to ensure its recoverability. Online hot backup should be scheduled for the minimum user activity time period.
Online hot backup consists of three processes, that is, table-space backup of data files, backup archive redo log files, and backup control files.
1. Backing up data files by table space
This process can be divided into four steps, that is, the query table space includes which data files, set the table space for backup status, backup table space data files, restore the table space to the normal state.
(1) What data files are included in the query table space
Execute command Select Tablespace_name,file_name from Dba_data_files to get all the data files in the system and the tablespace in which they belong.
(2) Set table space to backup state
Execute command ALTER TABLESPACE TABLESPACE_NAME begin backup to set table space Tablespace_name to backup state.
(3) Data files for the backup table space
Perform the operating system's file backup command to back up the data files in the tablespace.
(4) Restore the tablespace to its normal state
The Execute command ALTER TABLESPACE Tablespace_name end Backup restores the tablespace tablespace_name to its normal state.
2. Backup Archive Redo log file
This process can be divided into three steps, that is, to suspend the archive process arch, backup archive redo log files.
(1) Suspend the archive process arch
Execute Command archive log stop suspend archive process arch.
(2) record the list of archived log files in the target directory
You can query the V$log dynamic dictionary view. If the log is fully archived, the V$log archived column will contain a 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 archived log file, you can successfully back up files in the archive redo log target directory with all the numbers below 2334. If you attempt to back up 2335, you can make a successful backup at the operating system level, but since this file is not fully archived, the backup may be written in half and therefore cannot be useful during the recovery operation.
(3) Restart the archive process arch
Execute Command archive log start to launch the archive process arch.
(4) Backup archive redo log file
Perform the operating system file backup command Backup archive redo log file.
(5) Delete archived log files that have been backed up from the archive target directory
3. Backing up control files
Execute command ALTER DATABASE backup Controlfile to Destinantion/control.bak for online backup control files. You can also execute ALTER DATABASE backup Controlfile to trace writes the command for create Controlfile to the trace file in the database
How to open a database after an online hot backup failure
Because the table space is still in hot backup state.
Simulation Phenomena and Solutions:
First set the database to archive mode
code is as follows |
copy code |
C:>SVRMGRL Svrmgrl>connect Internal svrmgrl>alter tablespace table space name begin backup; -The table space hot standby mode shuts down the database forcibly, causing errors Svrmgrl>shutdown abort Svrmgrl>startup Mount -Empty This table The data file between is set to end backup mode Svrmgrl>alter database datafile ' table space data file name '; -or perform tablespace media recovery svrmgrl>recover tablespace table space name; Svrmgrl>alter database open; |