In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
1 Overview of backup recovery
The data in the DM7 database is stored in the physical data file of the database, and the data file is managed in the way of pages, clusters and segments, and the data page is the smallest data storage unit. Any operation on the DM7 database, in the final analysis, is a read and write operation to a data file page.
For information about these structures, please refer to:
Description of logical structure of DM7 Dameng Database
Https://www.cndba.cn/dave/article/3568
The essence of DM7 backup is to copy valid data pages from the database file and save them to the backup set, where the valid data pages include the description page of the data file and the data page assigned to be used. In the process of backup, if the database system continues to run, not all database operations during this period will be immediately reflected in the data file, but will first be written to the archive log in the form of a log. Therefore, in order to ensure that the user can restore the data to the state at the end of the backup through the backup set, it is necessary to save the archive logs generated during the backup to the backup set.
Restore and restore is the reverse process of backup. Restore is the process of rewriting valid data pages in the backup set to the target data file. Recovery refers to restoring the database state to the state at the end of the backup by redoing the archive log, or to a specified point in time and a specified LSN. After the recovery, there may be active transactions in the database that are in an uncommitted state, and these active transactions are automatically rolled back by the DM7 database server when the database system starts for the first time after the restore.
There are two types of backup and restore of DM database: physical backup restore and logical backup restore.
Physical backup restore is the backup and restore of the operating system physical files of the database, such as data files, control files, log files, etc. For example, backup and restore using the RMAN tool.
Logical backup restore is the backup and restore of database logical components such as tables, views, and database objects such as stored procedures. For example, backup and restore using dexp and dimp.
2 tablespace and data file
The table space of DM7 database is a logical concept, and its main purpose is to facilitate the management of the database. All the objects of the database are logically stored in a table space, while physically stored in the data files of the table space to which they belong. A tablespace consists of one or more data files.
Data file is the most important file type in the database, and it is the place where the real data is stored. The data file in DM7 has a .dbf extension, which is divided into two categories: the data file generated by default by the system and the data file created by the user.
When you create a DM7 database, the system automatically creates five tablespaces: SYSTEM tablespace, ROLL tablespace, MAIN tablespace, TEMP tablespace and HMAIN tablespace. DM7 automatically generates default data files for these automatically created tablespaces: SYSTEM.DBF, ROLL.DBF, MAIN.DBF, and TEMP.DBF,HMAIN tablespaces have no default data files.
You can also refer to the description of tablespaces:
Description of logical structure of DM7 Dameng Database
Https://www.cndba.cn/dave/article/3568
Note: physical backup and restore of DM7 is not supported:
TEMP tablespace.
HUGE tablespaces, or database backups and restores, do not include HMAIN and user-created HUGE tablespaces; nor does it support tablespace backups and restores of HMAIN and user-created HUGE tablespaces. DM7 provides HUGE backup and restore system functions to support online backup and restore of HUGE tables.
For instructions on HUGE tablespaces, please refer to my blog:
DM7 Dameng database column storage table HUGE table management instructions
Https://www.cndba.cn/dave/article/3583
3 redo log
The redo log, also known as the REDO log, records all physical page changes, including operation type, table space number, file number, page number, intra-page offset, actual data, and so on. DML operations such as INSERT, DELETE, UPDATE and DDL operations such as CREATE TABLE in the database are transformed into modifications to some data files and some data pages. Therefore, when a system failure restarts, you can restore the database to the state it was in at the time of the failure by redoing the REDO log.
By default, the DM7 database contains two log files with the extension log, which are used to hold REDO logs, called online redo log files. These two files are recycled. Before any data page is written from the memory buffer to disk, you must ensure that its corresponding REDO log has been written to the online log file.
4 Archive log
DM7 databases can be run in both archived and non-archived modes.
DM7 supports multiple archiving methods. Unless otherwise specified in this document, it refers to local archiving. When the database is in archive mode and local archiving is configured, the REDO log is written to the online log file first and then asynchronously to the archive log file. The archive log file is named after the configured archive name and the time the file was created, and the extension is also log.
It is safer for the system to operate in archive mode, and the system can recover to the moment before the failure when there is a media failure, such as disk damage resulting in lost or abnormal data files. Therefore, it is recommended that the archive directory and data files be configured and saved to different physical disks.
In addition to table backup and restore, other online backups and restores must be run in archive mode.
For more information on redo logs and archiving, please refer to:
Description of physical structure of DM7 Dameng Database
Https://www.cndba.cn/dave/article/3571
DM7 Dameng Database redo Log Management and Archive Mode switching
Https://www.cndba.cn/dave/article/3575
5 checkpoint
During the operation of the DM7 database, all the operations of the user are carried out in memory. Every time you modify a record, you must first load the data page where the record is located into the BUFFER buffer, and then modify it. When the transaction runs, the generated REDO log is kept in the log buffer RLOG_BUF, each log record corresponds to a LSN, and the log is flushed when the transaction commits or the log buffer is full or when a checkpoint is performed.
Checkpoint is a database event. Its function is to write the dirty pages in the BUFFER buffer to disk according to the order in which the data pages are modified, and dynamically adjust the CKPT_LSN value in the process to free the log space.
There are two types of checkpoints for DM7: full checkpoints and partial checkpoints:
1) full checkpoint: all dirty pages in the memory buffer are written to disk and the CKPT_LSN is adjusted, resulting in a full checkpoint when the database is shut down normally.
2) partial checkpoints: determine the number of dirty pages at each checkpoint according to the parameters CKPT_FLUSH_RATE and CKPT_FLUSH_PAGES in the dm.ini configuration file. During the execution of partial checkpoints, DDL/DML operations can be performed normally, and partial checkpoints are triggered in the vast majority of cases in DM7 systems.
Several important LSN values in DM7 are as follows:
1.LSN: LSN (Log Sequence Number) is a Bigint type value automatically maintained by the system, which has the characteristics of automatic increment and global uniqueness. Each LSN value represents a physical transaction generated within the DM system. Physical Transaction (ptx for short) is a set of operations within a database to modify physical data pages, corresponding to the concept of transaction (Transaction) in the database management system. It has the characteristics of atomicity, order, irrevocability and so on.
2.CUR_LSN: the current LSN of the system, representing the maximum LSN value that has been assigned. When a physical transaction commits, the system assigns it a unique LSN value (CUR_LSN + 1) and modifies the CUR_LSN value to CUR_LSN + 1.
3.FILE_LSN: file LSN, the maximum LSN value that has been written to the online redo log file. The FILE_LSN value is modified each time the RLOG_BUF is written to the online redo log file.
4.FLUSH_LSN:FLUSH_LSN is the maximum LSN value of the Redo log file that has been initiated but not actually written online.
5.CKPT_LSN: checkpoint LSN, all LSN backup database increment backupset'/ dm7/backup/incr_bak'
Note: if the base does not change, it cannot be incremented.
Method 2. Use DM management tools
Left node, find backup-- "Library backup--" create a new backup, and select full or incremental backup
After a successful backup, you can view the backup files in the / dm7/data/DAMENG/bak/DB_DAMENG_FULL_2019xxxx directory.
Back up tablespaces and tables
1. Back up the tablespace dmhr and back up to the dm7/backup directory
SQL > backup tablespace dmhr backupset'/ dm7/backup/dmhr_bak'
two。 Back up the employee table of dmhr and back up to the dm7/backup directory
SQL > backup table dmhr.employee backupset'/ dm7/backup/dmhr_bak'
Restore tablespace
Case: simulate tablespace tbs2 damage, restore tbs2 tablespace from hot standby
1. Delete two tablespace files for tbs2
Mv tbs2_01.dbf tbs2_01_bak.dbf
two。 Restart the database instance
3. Manually change the database instance from mount to open
SQL > alter database open
4. View tablespace
SQL > select tablespace_name,status from dba_dablespace
Tbs2 is offline at this time.
If alter tablespace tbs2 online;, it will prompt that tbs2_01.dbf does not exist.
5. Start restoring tablespaces
SQL > restore tablespace dmhr.tbs2 from backupset'/ dm7/backup/full_bak/'
Matters needing attention
The backup database and tablespace, if restored, is restored to the current time, if the backed-up table is restored, to the backup time of the table.
System tablespaces and roll tablespaces are corrupted. Reinitialize the database instance and restore it with backup.
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.