In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Backup and Recovery [TOC] 1. What is Backup and Recovery?
Backup and recovery exist only one meaning is to protect the database (protect the data and itself), to prevent database damage or data loss due to equipment failure or human error. Even if lost data cannot be recovered, lost data can be reconstructed based on backup information. Backup and restore operations are also a form of data migration under certain requirements.
2. Classification of backups:
Backup can be divided into physical backup and logical backup according to different backup forms. Physical backup can be divided into cold backup and hot backup according to the state of database.
Physical backup: A physical backup is a way of copying physical files of a database to another location to preserve data files.
Cold backup: The primary requirement for this backup is that the database be backed up when it is shut down, also known as offline backup, because the database needs to be shut down so this method is less used in production environments. It is important to note that database consistency is required to close the database. This allows for complete backups, including data files, control files, and log files. Hot backup: As opposed to cold backup, backup can be performed while the database is started. In a production environment, backups of this state are often inconsistent with the actual data in the database because the data blocks just backed up are being modified. To ensure that backups are ultimately consistent, logs need to be used as a complement to recovery. Therefore, if you want to make a hot backup, the archive must be opened, so it takes up more space.
Logical backup: Logical backup is only for the data in the database and is completed through the database import and export tool. It is a complementary form of physical backup.
3. Backup level: full backup: full backup, for a table space or data file, etc., the table space or database data in a full backup. incremental backup: incremental backup, which needs to be performed on the basis of a full backup to backup changed data. It can be classified as differential incremental backups (changes since the last backup) and cumulative incremental backups (changes since the last full backup)
level 0-> full backup; level 1-> differential incremental backup level 1c-> cumulative incremental backup 4. full recovery and incomplete recovery: full recovery: backup files and log files can be used to restore database information to the latest state, possibly archive logs and online redo logs can be used to restore the system to the latest state before the crash. The database can be opened via alter database open. At this point, no transaction data is lost. Uncommitted transactions are rolled back. Incomplete recovery: Because a database data manipulation error occurred, you want to recover the database before the error occurred. The system log is incomplete. To open the database, alter database open resetlogs is required, and a full database backup is performed after startup. SCN: 5.1 Definition:
System Change Numbers (SCNs)&System Commit Numbers。System change number and system submission number. SCN is the timestamp of logic used internally in Oracle databases. SCN generation, the system generates a new SCN is converted according to the timestamp at that time, whenever it needs to generate a new SCN to redo records, the system will obtain the timestamp at that time and convert it into a number as SCN.
5.2 Features:
SCN itself is also a kind of time. It is a monotonic increasing sequence from the beginning of the library, and the maximum number can be increased by 32000 at one time. SCN numbers have an upper limit. When SCN numbers are used up, the database will not be able to run, but it will not be used up for hundreds of years. SCN is a very important mechanism, which plays an important role in data recovery, DG, RAC node synchronization and other functions.
5.3 SCN Type: Database Current SCN: SYS@proe> select current_scn from v $database; CURRENT_SCN--------- 2128297 Database checkpoint scn (system scn), this scn comes from the control file, used to identify the data update information of the current database, indicating the update behavior of the database. SYS@proe>select checkpoint_change#,current_scn from v$database;CHECKPOINT_CHANGE# CURRENT_SCN------------------ ----------- 2127934 2128360 Data file checkpoint SCN, derived from control files, identifies when each file is synchronized. SYS@proe>select file#,checkpoint_change# from v$datafile order by 1; FILE# CHECKPOINT_CHANGE#---------- ------------------ 1 2127934 2 2127934 3 2127934 4 2127934 5 2127934 6 2127934 7 17285687 rows selected. Datafile header checkpoint. SYS@proe>select file#,checkpoint_change# from v$datafile_header; FILE# CHECKPOINT_CHANGE#---------- ------------------ 1 2127934 2 2127934 3 2127934 4 2127934 5 2127934 6 2127934 7 17285687 rows selected.# If the header of the data file is 0, it means that the data file has been offline and the data file has not been read. Close SCN (End SCN) of the data file. SYS@proe>select file#,checkpoint_change#,last_change# from v$datafile; FILE# CHECKPOINT_CHANGE# LAST_CHANGE#---------- ------------------ ------------ 1 2127934 (null) 2 2127934 (null) 3 2127934 (null) 4 2127934 (null) 5 2127934 (null) 6 2127934 (null) 7 1728568 17285687 rows selected. Note: The file being run does not have last_change #, only readonly, offline will have it. The above two values are normal if they are the same after consistency is turned off. 6. SCN and TIME mutual conversion function scn to timestamp: SYS@proe> select scn_to_timestamp (2127934) from dual; SCN_TO_TIMESTAMP (2127934)--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------07.14.57.000000000 19934697. About restore and recoverrestore: restore, similar to the cp command in linux, copies a backup to a destination location. Recovery: After restore, it refers to using all redo log files to restore the database to the state before the crash, or using some redo log files to restore the database to a specified point in time.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.