Oracle Online Database Backup

Source: Internet
Author: User

Although the database system is running slowly in many cases, it is obvious that the cost of the latter is self-evident for the loss of database data. Therefore, it is the minimum requirement for DBA to improve the system performance at least when data is not lost.
Online Database Backup
Once the database runs in archivelog mode, it can be backed up when it is enabled and available to users. This feature allows continuous databases to be archived and recoverable. Online hot backup should be performed during the minimum period of user activity.
Online Hot Backup includes three processes: backing up data files one by one in a tablespace, backing up archived redo log files, and backing up control files.
1. Backup data files one by one in a tablespace
This process can be divided into four steps: querying which data files are included in the table space, setting the tablespace as a backup state, backing up the data files in the tablespace, and restoring the tablespace to a normal state.
(1) query which data files are included in the table space
Run 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 the tablespace to the backup state.
Run alter tablespace tablespace_name begin backup to set tablespace_name to the backup status.
(3) back up the data files in the tablespace
Run the file backup command of the operating system to back up the data files in the tablespace.
(4) restore the tablespace to normal
Run alter tablespace tablespace_name end backup to restore the tablespace tablespace_name to normal.
2. Backup archiving and redo log files
This process can be divided into three steps: suspending the archive process ARCH and backing up the archived and redo log files.
(1) suspend the archive process ARCH
Run the command archive log stop to pause the archive process ARCH.
(2) record the list of archived log files in the archive target directory
You can query the V $ LOG dynamic dictionary view. If the LOG is fully archived, the archived column of the V $ LOG contains 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 list. For example, if V $ LOG indicates that sequence #2334 is the last archived LOG file, you can back up all files whose serial numbers are less than 2334 in the target directory of the archived redo LOG. If you try to back up 2335, you can back up the backup at the operating system level. However, since the file is not fully archived, this backup may only be written in half, so it cannot be used during the recovery operation.
(3) restart the archive process ARCH
Run the archive log start command to start the archive process ARCH.
(4) backup archiving and redo log files
Execute the file backup command of the operating system to back up and archive the duplicate log file.
(5) Delete the archived log files that have been backed up from the archive target directory
3. Backup Control File
Run alter database backup controlfile to destinantion/control. bak to back up the control file online. You can also run alter database backup controlfile to trace to write the create controlfile command to the trace file of the database.

How to open the database after an online hot backup failure
Because the tablespace is still in the Hot Backup state.
  
Simulated phenomena and solutions:
  
First, set the database to archive mode.
Copy codeThe Code is as follows:
C:> svrmgrl
Svrmgrl> connect internal
Svrmgrl> alter tablespace name begin backup;
-- The tablespace hot standby mode forcibly closes the database before it ends, causing an error.
Svrmgrl> shutdown abort
Svrmgrl> startup mount
-- Sets the data file of the tablespace to end backup mode when the database is not opened.
Svrmgrl> alter database datafile 'table space data file name' end backup;
-- Or execute tablespace media recovery
Svrmgrl> recover tablespace name;
Svrmgrl> alter database open;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.