oracle db在omf自动管理文件下并在文件存放在ASM里,如果手工rename 一个文件OMF文件,oracle会自动删除原有文件,以下是测试 SQL SELECT file#,name FROM v$datafile; FILE# NAME---------- ----------------------------------------------------------------
oracle db在omf自动管理文件下并在文件存放在ASM里,如果手工rename 一个文件OMF文件,oracle会自动删除原有文件,以下是测试
SQL> SELECT file#,name FROM v$datafile; FILE# NAME ---------- -------------------------------------------------------------------------------- 1 +ASMDATA/racdb/datafile/system.256.814462679 2 +ASMDATA/racdb/datafile/sysaux.257.814462681 3 +ASMDATA/racdb/datafile/undotbs1.258.814462681 4 +ASMDATA/racdb/datafile/users.259.814462681 5 +ASMDATA/racdb/datafile/undotbs2.264.814462949 6 +ASMDATA/racdb/datafile/test.268.815753637 7 +ASMDATA/racdb/datafile/goldengate.341.820339679 8 +ASMDATA/racdb/datafile/ccdata.375.844202017 9 +ASMDATA/racdb/datafile/soe.460.844203543 10 +ASMDATA/racdb/datafile/big_test.661.852999379 10 ROWS selected.
这里先通过rman backup as copy 备份一个文件
[oracle@rac1 ~]$ rman target / Recovery Manager: Release 11.2.0.3.0 - Production ON Fri Jul 18 11:59:24 2014 Copyright (c) 1982, 2011, Oracle AND/OR its affiliates. ALL rights reserved. connected TO target DATABASE: RACDB (DBID=812079559) RMAN> backup AS copy datafile 10 format '+ASMDATA/racdb/datafile/big_test01.dbf'; Starting backup at 18-JUL-14 USING target DATABASE control file instead OF recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=76 instance=racdb1 device TYPE=DISK channel ORA_DISK_1: starting datafile copy INPUT datafile file NUMBER=00010 name=+ASMDATA/racdb/datafile/big_test.661.852999379 output file name=+ASMDATA/racdb/datafile/big_test01.dbf tag=TAG20140718T115951 RECID=4 STAMP=853243196 channel ORA_DISK_1: datafile copy complete, elapsed TIME: 00:00:08 Finished backup at 18-JUL-14 RMAN>
[grid@rac1 ~]$ asmcmd ls -lASMCMD> State TYPE Rebal Name MOUNTED EXTERN N ASMDATA/ MOUNTED EXTERN N DATA/ ASMCMD> ASMCMD> ASMCMD> ls -l +ASMDATA/racdb/datafile/big_test01.dbf TYPE Redund Striped TIME Sys Name N big_test01.dbf => +ASMDATA/RACDB/DATAFILE/BIG_TEST.664.853243193 ASMCMD> ls -l +ASMDATA/racdb/datafile/big_test.661.852999379 TYPE Redund Striped TIME Sys Name DATAFILE UNPROT COARSE JUL 18 11:00:00 Y big_test.661.852999379 ASMCMD> ls -l +ASMDATA/racdb/datafile/big_test* TYPE Redund Striped TIME Sys Name DATAFILE UNPROT COARSE JUL 18 11:00:00 Y BIG_TEST.661.852999379 DATAFILE UNPROT COARSE JUL 18 11:00:00 Y BIG_TEST.664.853243193 N big_test01.dbf => +ASMDATA/RACDB/DATAFILE/BIG_TEST.664.853243193
这里直切swtich datafile 看下
RMAN> switch datafile 10 TO copy; USING target DATABASE control file instead OF recovery catalog datafile 10 switched TO datafile copy "+ASMDATA/racdb/datafile/big_test01.dbf" RMAN> recover datafile 10; Starting recover at 18-JUL-14 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=80 instance=racdb1 device TYPE=DISK starting media recovery media recovery complete, elapsed TIME: 00:00:02 Finished recover at 18-JUL-14 RMAN> SQL 'alter database datafile 10 online'; SQL statement: ALTER DATABASE datafile 10 online ASMCMD> ls -l +ASMDATA/racdb/datafile/big_test* TYPE Redund Striped TIME Sys Name DATAFILE UNPROT COARSE JUL 18 12:00:00 Y BIG_TEST.661.852999379 DATAFILE UNPROT COARSE JUL 18 12:00:00 Y BIG_TEST.664.853243193 N big_test01.dbf => +ASMDATA/RACDB/DATAFILE/BIG_TEST.664.853243193
从这里在看两个文件都存在,所以说在文件OMF命名格式下,rman的switch datafile 不会删除文件
下面看下在sqlplus下直接rename
SQL> ALTER DATABASE datafile 10 offline; DATABASE altered. SQL> SQL> ALTER DATABASE RENAME file '+ASMDATA/racdb/datafile/big_test01.dbf' TO '+ASMDATA/racdb/datafile/big_test.661.852999379'; DATABASE altered. SQL> recover datafile 10; Media recovery complete. SQL> ALTER DATABASE datafile 10 online; DATABASE altered. Completed: ALTER DATABASE RENAME file '+ASMDATA/racdb/datafile/big_test01.dbf' TO '+ASMDATA/racdb/datafile/big_test.661.852999379' Fri Jul 18 12:08:21 2014 ALTER DATABASE RECOVER datafile 10 Media Recovery START Serial Media Recovery started WARNING! Recovering DATA file 10 FROM a fuzzy backup. It might be an online backup taken WITHOUT entering the BEGIN backup command. Recovery OF Online Redo Log: Thread 1 GROUP 2 Seq 337 Reading mem 0 Mem# 0: +ASMDATA/racdb/onlinelog/group_2.262.814462797 Media Recovery Complete (racdb1) Completed: ALTER DATABASE RECOVER datafile 10 ALTER DATABASE datafile 10 online Completed: ALTER DATABASE datafile 10 onlin
ASMCMD> ls -l +ASMDATA/racdb/datafile/big_test* Type Redund Striped Time Sys Name DATAFILE UNPROT COARSE JUL 18 12:00:00 Y BIG_TEST.661.852999379 DATAFILE UNPROT COARSE JUL 18 12:00:00 Y BIG_TEST.664.853243193 N big_test01.dbf => +ASMDATA/RACDB/DATAFILE/BIG_TEST.664.853243193
这里看到从手工命令的文件切换到OMF命令的文件,原文件也没用被删除。
看下omf切换到手工命令文件
SQL> ALTER DATABASE datafile 10 offline; DATABASE altered. SQL> ALTER DATABASE RENAME file '+ASMDATA/racdb/datafile/big_test.661.852999379' TO '+ASMDATA/racdb/datafile/big_test01.dbf'; DATABASE altered. SQL> recover datafile 10; Media recovery complete. SQL> ALTER DATABASE datafile 10 online; DATABASE altered.
alter日志文件如下
alter database rename file '+ASMDATA/racdb/datafile/big_test.661.852999379' to '+ASMDATA/racdb/datafile/big_test01.dbf' Deleted Oracle managed file +ASMDATA/racdb/datafile/big_test.661.852999379 Completed: alter database rename file '+ASMDATA/racdb/datafile/big_test.661.852999379' to '+ASMDATA/racdb/datafile/big_test01.dbf' Fri Jul 18 12:12:35 2014
明显看出文件被delete ,Deleted Oracle managed file
ASMCMD> ls -l +ASMDATA/racdb/datafile/big_test* Type Redund Striped Time Sys Name DATAFILE UNPROT COARSE JUL 18 12:00:00 Y BIG_TEST.664.853243193 N big_test01.dbf => +ASMDATA/RACDB/DATAFILE/BIG_TEST.664.853243193
从asmcmd看到只剩下一个文件
原文地址:Oracle Db Rname datafile/redofile on ASM, 感谢原作者分享。

InnoDB 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.

Key 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.

Usingtemporary 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

MySQL/InnoDB supports four transaction isolation levels: ReadUncommitted, ReadCommitted, RepeatableRead and Serializable. 1.ReadUncommitted allows reading of uncommitted data, which may cause dirty reading. 2. ReadCommitted avoids dirty reading, but non-repeatable reading may occur. 3.RepeatableRead is the default level, avoiding dirty reading and non-repeatable reading, but phantom reading may occur. 4. Serializable avoids all concurrency problems but reduces concurrency. Choosing the appropriate isolation level requires balancing data consistency and performance requirements.

MySQL is suitable for web applications and content management systems and is popular for its open source, high performance and ease of use. 1) Compared with PostgreSQL, MySQL performs better in simple queries and high concurrent read operations. 2) Compared with Oracle, MySQL is more popular among small and medium-sized enterprises because of its open source and low cost. 3) Compared with Microsoft SQL Server, MySQL is more suitable for cross-platform applications. 4) Unlike MongoDB, MySQL is more suitable for structured data and transaction processing.

MySQL index cardinality has a significant impact on query performance: 1. High cardinality index can more effectively narrow the data range and improve query efficiency; 2. Low cardinality index may lead to full table scanning and reduce query performance; 3. In joint index, high cardinality sequences should be placed in front to optimize query.

The MySQL learning path includes basic knowledge, core concepts, usage examples, and optimization techniques. 1) Understand basic concepts such as tables, rows, columns, and SQL queries. 2) Learn the definition, working principles and advantages of MySQL. 3) Master basic CRUD operations and advanced usage, such as indexes and stored procedures. 4) Familiar with common error debugging and performance optimization suggestions, such as rational use of indexes and optimization queries. Through these steps, you will have a full grasp of the use and optimization of MySQL.

MySQL's real-world applications include basic database design and complex query optimization. 1) Basic usage: used to store and manage user data, such as inserting, querying, updating and deleting user information. 2) Advanced usage: Handle complex business logic, such as order and inventory management of e-commerce platforms. 3) Performance optimization: Improve performance by rationally using indexes, partition tables and query caches.


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

SublimeText3 Chinese version
Chinese version, very easy to use

SublimeText3 Mac version
God-level code editing software (SublimeText3)

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Dreamweaver Mac version
Visual web development tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool