RMAN的改变跟踪
RMAN的改变跟踪功能通过在改变跟踪文件中记录每一个数据文件发生改变的数据块来提高增量备份的性能。如果改变跟踪被启用,RMAN使
RMAN的改变跟踪功能通过在改变跟踪文件中记录每一个数据文件发生改变的数据块来提高增量备份的性能。如果改变跟踪被启用,RMAN使用改变跟踪文件来标识自上次增量备份以来发生改变的数据块,这样就能避免扫描每个数据文件的所有数据块。
在启用改变跟踪后,第一次level 0级的增量备份仍然会扫描每个数据文件的所有数据块,这时改变跟踪文件不能反应数据块的状态。后续的增量备份将使用level 0级的增量备份作为父备份集这样就可以利用改变跟踪文件来进行增量备份。
使用改变跟踪不会改变执行增量备份的命令,改变跟踪本身在设置后通常需要较少的维护。
改变跟踪默认情况下是禁用的,因为它在数据库的正常操作期间会有一些小的性能开销。然而,为了在备份期间对数据文件执行完全扫描,且在两次备份期间只有少量数据块发生改变时,使用改变跟踪就是很有用的。如果你的备份策略使用增量备份,那么应该启用改变跟踪。
一旦对整个数据库创建了改变跟踪文件,默认情况下改变跟踪文件所生成的目录是由
db_create_file_dest参数来决定的。也可以在启用改变跟踪时指定改变跟踪的文件名和存储目录。
注意:在RAC环境下,为了让所有的节点都能使用改变跟踪文件应该将改变跟踪文件存储在共享存储中
Oracle保存足够的改变跟踪文件能让增量备份使用最近8个增量备份作为它的父备份。
虽然RMAN不支持对改变跟踪文件本身的备份和恢复,如果整修数据库或部分需要还原和恢复,那么恢复对改变跟踪没有影响。在还原和恢复之后,改变跟踪文件会被清除,并再次开始记录数据块的改变。在任何恢复之后下一次的增量备份都能够使用改变跟踪的数据。
启用或禁用块改变跟踪
存储块改变跟踪文件的目录是由db_create_file_dest参数来设置的,下面的语句用来启用块改变跟踪:
SQL> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING;
还可以在启用块改变跟踪时指定块改变跟踪文件创建的目录
SQL> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING
USING FILE '/mydir/rman_change_track.f' REUSE;
REUSE选项告诉Oracle会覆盖已经存在的块跟踪文件
为了禁用块改变跟踪:
SQL> ALTER DATABASE DISABLE BLOCK CHANGE TRACKING;
如果块改变跟踪文件存储在数据库区域,当禁用改变跟踪时会删除。
SQL> alter database enable block change tracking using file '/u01/app/oracle/rman_change_trace.f' reuse;
Database altered.
检查是否生成了改变跟踪文件
[root@oracle11g oracle]# ls -lrt
total 11632
drwxr-xr-x 3 oracle oinstall 4096 Sep 5 08:47 10.2.0
drwxrwxr-x 3 oracle oinstall 4096 Sep 5 09:12 oradata
drwxr-x--- 3 oracle oinstall 4096 Sep 5 09:12 admin
drwxrwxr-x 3 oracle oinstall 4096 Sep 5 09:13 flash_recovery_area
-rw-r--r-- 1 oracle oinstall 226495 Nov 18 10:55 utlu112i_8.sql
-rw-r--r-- 1 oracle oinstall 10373 Nov 18 11:02 upgrade_info.log
drwxr-xr-x 3 root root 4096 Nov 18 21:00 11.2.0
drwxrwx--- 7 oracle oinstall 4096 Nov 18 21:37 oraInventory
drwxrwxr-x 11 oracle oinstall 4096 Nov 18 21:37 diag
drwxr-xr-x 2 oracle oinstall 4096 Nov 18 21:39 checkpoints
drwxr-x--- 5 oracle oinstall 4096 Nov 19 18:55 cfgtoollogs
-rw-r--r-- 1 oracle oinstall 3261 Nov 23 21:24 upchk.log
-rw-r--r-- 1 oracle oinstall 2237 Nov 26 11:55 downgrade.log
-rw-r----- 1 oracle oinstall 11600384 Jan 26 21:32 rman_change_trace.f
禁用块改变跟踪:
SQL> alter database disable block change tracking;
Database altered.
检查是否删除了生成的改变跟踪文件
[root@oracle11g oracle]# ls -lrt
total 284
drwxr-xr-x 3 oracle oinstall 4096 Sep 5 08:47 10.2.0
drwxrwxr-x 3 oracle oinstall 4096 Sep 5 09:12 oradata
drwxr-x--- 3 oracle oinstall 4096 Sep 5 09:12 admin
drwxrwxr-x 3 oracle oinstall 4096 Sep 5 09:13 flash_recovery_area
-rw-r--r-- 1 oracle oinstall 226495 Nov 18 10:55 utlu112i_8.sql
-rw-r--r-- 1 oracle oinstall 10373 Nov 18 11:02 upgrade_info.log
drwxr-xr-x 3 root root 4096 Nov 18 21:00 11.2.0
drwxrwx--- 7 oracle oinstall 4096 Nov 18 21:37 oraInventory
drwxrwxr-x 11 oracle oinstall 4096 Nov 18 21:37 diag
drwxr-xr-x 2 oracle oinstall 4096 Nov 18 21:39 checkpoints
drwxr-x--- 5 oracle oinstall 4096 Nov 19 18:55 cfgtoollogs
-rw-r--r-- 1 oracle oinstall 3261 Nov 23 21:24 upchk.log
-rw-r--r-- 1 oracle oinstall 2237 Nov 26 11:55 downgrade.log
SQL> select filename from v$block_change_tracking;
FILENAME
--------------------------------------------------------------------------------
/u01/app/oracle/rman_change_trace.f
2.关闭数据库.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
3.使用操作系统命令将块改变跟踪文件移动到新的位置
[root@oracle11g oracle]# mv rman_change_trace.f rman_change_trace_new.f
4.mount数据库,更改块改变跟踪文件
SQL> startup mount
ORACLE instance started.

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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

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

Hot Topics

MySQL is an open source relational database management system, mainly used to store and retrieve data quickly and reliably. Its working principle includes client requests, query resolution, execution of queries and return results. Examples of usage include creating tables, inserting and querying data, and advanced features such as JOIN operations. Common errors involve SQL syntax, data types, and permissions, and optimization suggestions include the use of indexes, optimized queries, and partitioning of tables.

MySQL is chosen for its performance, reliability, ease of use, and community support. 1.MySQL provides efficient data storage and retrieval functions, supporting multiple data types and advanced query operations. 2. Adopt client-server architecture and multiple storage engines to support transaction and query optimization. 3. Easy to use, supports a variety of operating systems and programming languages. 4. Have strong community support and provide rich resources and solutions.

Solutions to Oracle cannot be opened include: 1. Start the database service; 2. Start the listener; 3. Check port conflicts; 4. Set environment variables correctly; 5. Make sure the firewall or antivirus software does not block the connection; 6. Check whether the server is closed; 7. Use RMAN to recover corrupt files; 8. Check whether the TNS service name is correct; 9. Check network connection; 10. Reinstall Oracle software.

The method to solve the Oracle cursor closure problem includes: explicitly closing the cursor using the CLOSE statement. Declare the cursor in the FOR UPDATE clause so that it automatically closes after the scope is ended. Declare the cursor in the USING clause so that it automatically closes when the associated PL/SQL variable is closed. Use exception handling to ensure that the cursor is closed in any exception situation. Use the connection pool to automatically close the cursor. Disable automatic submission and delay cursor closing.

In Oracle, the FOR LOOP loop can create cursors dynamically. The steps are: 1. Define the cursor type; 2. Create the loop; 3. Create the cursor dynamically; 4. Execute the cursor; 5. Close the cursor. Example: A cursor can be created cycle-by-circuit to display the names and salaries of the top 10 employees.

To stop an Oracle database, perform the following steps: 1. Connect to the database; 2. Shutdown immediately; 3. Shutdown abort completely.

Building a Hadoop Distributed File System (HDFS) on a CentOS system requires multiple steps. This article provides a brief configuration guide. 1. Prepare to install JDK in the early stage: Install JavaDevelopmentKit (JDK) on all nodes, and the version must be compatible with Hadoop. The installation package can be downloaded from the Oracle official website. Environment variable configuration: Edit /etc/profile file, set Java and Hadoop environment variables, so that the system can find the installation path of JDK and Hadoop. 2. Security configuration: SSH password-free login to generate SSH key: Use the ssh-keygen command on each node

SQL statements can be created and executed based on runtime input by using Oracle's dynamic SQL. The steps include: preparing an empty string variable to store dynamically generated SQL statements. Use the EXECUTE IMMEDIATE or PREPARE statement to compile and execute dynamic SQL statements. Use bind variable to pass user input or other dynamic values to dynamic SQL. Use EXECUTE IMMEDIATE or EXECUTE to execute dynamic SQL statements.
