欢迎进入Oracle社区论坛,与200万技术人员互动交流 >>进入 如果我们指定以alter database open resetlogs打开数据库,那么我们当前online line日志的sequence number会归为1,并且之前的日志信息都会被抛弃。 以下条件需要使用resetlog 1)在不完全恢复(介质
欢迎进入Oracle社区论坛,与200万技术人员互动交流 >>进入
如果我们指定以alter database open resetlogs打开数据库,那么我们当前online line日志的sequence number会归为1,并且之前的日志信息都会被抛弃。
以下条件需要使用resetlog
1)在不完全恢复(介质恢复)
2)使用备份控制文件(backup的控制文件一般从日志文件和数据库的信息以及SCN的信息,相比目前的状态都已经过期了)
使用resetlogs打开数据库(log sequence number变为1)后无必完整地备份一次数据库。而且这一操作会抛弃所有在上一次恢复没有用到的日志信息,确保不被重新用与恢复。
在重建控制文件的时候需要注意:
create controlfile resetlogs/noresetlogs
1).用noresetlogs重建控制文件时,控制文件中 datafile checkpoint scn来自online logs中的Current log头
2).用resetlogs重建控制文件时,控制文件中datafile Checkpoint SCN来自各数据文件头(Start SCN)。
如果system checkpoint scn,datafile checkpoint scn,start scn 不全相等,需要介质恢复.
如果stopscn null需要实例恢复
小小的总结一下各种情况:
1、系统正常关闭:
会使得:system checkpoint scn = datafile checkpoint scn = start scn = stop scn
1)system checkpoint scn = datafile checkpoint scn = start scn,不需要介质恢复
2)stop scn is not null = start SCN,不需要实例恢复
2、系统异常关闭:
会使得:system checkpoint scn = datafile checkpoint scn = start scn = stop scn
1)system checkpoint scn = datafile checkpoint scn = start scn,不需要介质恢复
2)stop scn is null,需要实例恢复
3、旧数据文件
会使得:system checkpoint scn = datafile checkpoint scn > start scn,stop scn is null/ is not null
1)system checkpoint scn = datafile checkpoint scn > start scn
需要介质恢复成system checkpoint scn = datafile checkpoint scn = start scn
2)stop scn is null,需要实例恢复,is not null 不需要实例恢复
4、备份控制文件
会使得:system checkpoint scn = datafile checkpoint scn
1)system checkpoint scn = datafile checkpoint scn
2)为保证上一次恢复没有用到log日志不被使用,必须在恢复完成后用resetlogs打开数据库
5、以noresetlogs方式重建控制文件
在以这种方式重建控制文件时,控制文件中的datafile checkpoint scn来自于Online logs中的Current log头,因此
current log scn = system checkpoint scn = datafile scn >= start scn(如果数据文件为备份而来则会大于start SCN,如果是当前的则为相等于start SCN), stop scn not null/null
1)current log scn = system checkpoint scn = datafile checkpoint scn >= start scn,因此需要介质恢复成system checkpoint scn = datafile scn = start scn = redolog scn(当前日志最大SCN)
2)stopscn is not null 不需要实例恢复
6、以resetlogs方式重建控制文件
控制文件中datafile checkpoint scn 来自各数据文件头(start scn),而且system checkpoint scn会归为0
system checkpoint scn
1)system checkpoint scn
2)stopscn is not null 不需要实例恢复,而且因为SCN已经为redolog scn,log已经不能使用,必须用resetlogs方式打开数据库
Explain the ACID properties (Atomicity, Consistency, Isolation, Durability).Apr 16, 2025 am 12:20 AMACID attributes include atomicity, consistency, isolation and durability, and are the cornerstone of database design. 1. Atomicity ensures that the transaction is either completely successful or completely failed. 2. Consistency ensures that the database remains consistent before and after a transaction. 3. Isolation ensures that transactions do not interfere with each other. 4. Persistence ensures that data is permanently saved after transaction submission.
MySQL: Database Management System vs. Programming LanguageApr 16, 2025 am 12:19 AMMySQL is not only a database management system (DBMS) but also closely related to programming languages. 1) As a DBMS, MySQL is used to store, organize and retrieve data, and optimizing indexes can improve query performance. 2) Combining SQL with programming languages, embedded in Python, using ORM tools such as SQLAlchemy can simplify operations. 3) Performance optimization includes indexing, querying, caching, library and table division and transaction management.
MySQL: Managing Data with SQL CommandsApr 16, 2025 am 12:19 AMMySQL uses SQL commands to manage data. 1. Basic commands include SELECT, INSERT, UPDATE and DELETE. 2. Advanced usage involves JOIN, subquery and aggregate functions. 3. Common errors include syntax, logic and performance issues. 4. Optimization tips include using indexes, avoiding SELECT* and using LIMIT.
MySQL's Purpose: Storing and Managing Data EffectivelyApr 16, 2025 am 12:16 AMMySQL is an efficient relational database management system suitable for storing and managing data. Its advantages include high-performance queries, flexible transaction processing and rich data types. In practical applications, MySQL is often used in e-commerce platforms, social networks and content management systems, but attention should be paid to performance optimization, data security and scalability.
SQL and MySQL: Understanding the RelationshipApr 16, 2025 am 12:14 AMThe relationship between SQL and MySQL is the relationship between standard languages and specific implementations. 1.SQL is a standard language used to manage and operate relational databases, allowing data addition, deletion, modification and query. 2.MySQL is a specific database management system that uses SQL as its operating language and provides efficient data storage and management.
Explain the role of InnoDB redo logs and undo logs.Apr 15, 2025 am 12:16 AMInnoDB uses redologs and undologs to ensure data consistency and reliability. 1.redologs record data page modification to ensure crash recovery and transaction persistence. 2.undologs records the original data value and supports transaction rollback and MVCC.
What are the key metrics to look for in an EXPLAIN output (type, key, rows, Extra)?Apr 15, 2025 am 12:15 AMKey metrics for EXPLAIN commands include type, key, rows, and Extra. 1) The type reflects the access type of the query. The higher the value, the higher the efficiency, such as const is better than ALL. 2) The key displays the index used, and NULL indicates no index. 3) rows estimates the number of scanned rows, affecting query performance. 4) Extra provides additional information, such as Usingfilesort prompts that it needs to be optimized.
What is the Using temporary status in EXPLAIN and how to avoid it?Apr 15, 2025 am 12:14 AMUsingtemporary indicates that the need to create temporary tables in MySQL queries, which are commonly found in ORDERBY using DISTINCT, GROUPBY, or non-indexed columns. You can avoid the occurrence of indexes and rewrite queries and improve query performance. Specifically, when Usingtemporary appears in EXPLAIN output, it means that MySQL needs to create temporary tables to handle queries. This usually occurs when: 1) deduplication or grouping when using DISTINCT or GROUPBY; 2) sort when ORDERBY contains non-index columns; 3) use complex subquery or join operations. Optimization methods include: 1) ORDERBY and GROUPB


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

SublimeText3 English version
Recommended: Win version, supports code prompts!

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment






