如果才RMAN参数中配置了MAXIECESIZE的值为一个给定的具体值时,那么再FORMAT中必须叫上%p的通配符,否则一旦备份片超过设定的上限
今天去客户那里搭建DG,当创建RMAN备份集的时候,遇到了个问题,导致备份集始终无法生成,由于客户的备份集为10G左右,一次备份就要一个多小时,开始浪费了不少时间,诊断后发现,原来问题出在MAXPIECESIZE上,下面自己做了个测试,来说明这个故障现象和解决方法:
[root@ora10g ~]# su - Oracle
[oracle@ora10g ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on 24 14:32:34 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select open_mode from v$database;
OPEN_MODE
----------
READ WRITE
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
[oracle@ora10g ~]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on 24 14:32:52 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORA10G (DBID=4175411955)
RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 5;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/orabackup/backupsets/ora10g-%F.ctl';
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE 10000 M; --最大备份集限制
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE;
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/10.2.0/db_1/dbs/snapcf_ora10g.f'; # default
RMAN> exit
Recovery Manager complete.
[oracle@ora10g ~]$ cd /u01/orabackup/scripts/
[oracle@ora10g scripts]$ ls -l
total 4
-rwxr-xr-x 1 oracle oinstall 2443 Dec 24 14:29 backup_full.sh
[oracle@ora10g scripts]$ ./backup_full.sh
RMAN> RMAN> RMAN> RMAN> RMAN> RMAN> RMAN> RMAN> RMAN> RMAN> 2> 3> RMAN> RMAN> RMAN> RMAN> [oracle@ora10g backupsets]$ ls -lrth
total 190M
-rw-r----- 1 oracle oinstall 9.8M Dec 24 14:24 ora10g-4175411955_20141224_867162246_380.arc
-rw-r----- 1 oracle oinstall 1.7M Dec 24 14:24 ora10g-4175411955_20141224_867162255_381.arc
-rw-r----- 1 oracle oinstall 439K Dec 24 14:24 ora10g-4175411955_20141224_867162257_382.arc
-rw-r----- 1 oracle oinstall 747K Dec 24 14:33 ora10g-4175411955_20141224_867162820_384.arc
-rw-r----- 1 oracle oinstall 170M Dec 24 14:36 ora10g-4175411955_20141224_867162823_385.db
-rw-r----- 1 oracle oinstall 491K Dec 24 14:36 ora10g-4175411955_20141224_867162990_386.arc
-rw-r----- 1 oracle oinstall 7.3M Dec 24 14:36 ora10g-c-4175411955-20141224-00.ctl
[oracle@ora10g backupsets]$
根据刚才的配置,正确的生成了RMAN备份集,总大小为190M左右,,其中最大的数据文件的备份集为170M,而在RMAN脚本中配置的
在备份脚本中,配置了format格式为“$ORACLE_SID-%I_%T_%t_%s.db”,以下为脚本具体的语句:
backup as compressed backupset database format '$RMAN_BACKUPSETS/$ORACLE_SID-%I_%T_%t_%s.db' tag 'db_bak' plus archivelog format '$RMAN_BACKUPSETS/$ORACLE_SID-%I_%T_%t_%s.arc' not backed up 1 times delete all input tag 'arc_bak';
当把MAXPIECESIZE的值改小,比之前最大的备份集大小(170M)还要小,比方说改成100M后,再运行之前的备份脚本,然后查看RMAN输出的日志文件,发现报ORA-27038,提示文件已经存在:
[oracle@ora10g backupsets]$ cat ../logs/rman.log |grep ORA-
ORA-19504: failed to create file "/u01/orabackup/backupsets/ora10g-4175411955_20141224_867163196_389.db"
ORA-27038: created file already exists
channel ORA_DISK_1: starting piece 2 at 2014-12-24
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup plus archivelog command at 12/24/2014 14:41:52
ORA-19504: failed to create file "/u01/orabackup/backupsets/ora10g-4175411955_20141224_867163196_389.db"
ORA-27038: created file already exists
Additional information: 1
正常情况下,生成的最大备份集有170M,但是刚才通过修改MAXPIECESIZE参数为100M后,在生成备份集时,一旦备份集大小超过100M时,就会自动生成第2个备份片,而由于我在format中仅仅是配置了“$ORACLE_SID-%I_%T_%t_%s.db”,这几个通配符的含义是:
%I -- DBID
%T -- 日期时间(年月日)
%t -- 自动生成的时间戳
%s -- 备份集序列号(Sequence)
当第一个备份片达到MAXPIECESIZE限定的100M后,想去生成第2个文件,但是由于这几个通配符不足以区分备份集中的备份片(生成了同一个文件名),当第2个备份片创建时提示文件已存在,最终导致备份失败。
解决这个问题的方法有2种:
1. 在format参数中增加%p通配符
当超过MAXPIECESIZE后,只有%p才能够生成不同的备份片,因为%t这个时间戳不足以区分不同的别分片的名称
[oracle@ora10g backupsets]$ . ../scripts/backup_full.sh

InnoDBBufferPool reduces disk I/O by caching data and indexing pages, improving database performance. Its working principle includes: 1. Data reading: Read data from BufferPool; 2. Data writing: After modifying the data, write to BufferPool and refresh it to disk regularly; 3. Cache management: Use the LRU algorithm to manage cache pages; 4. Reading mechanism: Load adjacent data pages in advance. By sizing the BufferPool and using multiple instances, database performance can be optimized.

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

MySQL is worth learning because it is a powerful open source database management system suitable for data storage, management and analysis. 1) MySQL is a relational database that uses SQL to operate data and is suitable for structured data management. 2) The SQL language is the key to interacting with MySQL and supports CRUD operations. 3) The working principle of MySQL includes client/server architecture, storage engine and query optimizer. 4) Basic usage includes creating databases and tables, and advanced usage involves joining tables using JOIN. 5) Common errors include syntax errors and permission issues, and debugging skills include checking syntax and using EXPLAIN commands. 6) Performance optimization involves the use of indexes, optimization of SQL statements and regular maintenance of databases.

MySQL is suitable for beginners to learn database skills. 1. Install MySQL server and client tools. 2. Understand basic SQL queries, such as SELECT. 3. Master data operations: create tables, insert, update, and delete data. 4. Learn advanced skills: subquery and window functions. 5. Debugging and optimization: Check syntax, use indexes, avoid SELECT*, and use LIMIT.

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

MySQL is an open source relational database management system that is widely used in Web development. Its key features include: 1. Supports multiple storage engines, such as InnoDB and MyISAM, suitable for different scenarios; 2. Provides master-slave replication functions to facilitate load balancing and data backup; 3. Improve query efficiency through query optimization and index use.

SQL is used to interact with MySQL database to realize data addition, deletion, modification, inspection and database design. 1) SQL performs data operations through SELECT, INSERT, UPDATE, DELETE statements; 2) Use CREATE, ALTER, DROP statements for database design and management; 3) Complex queries and data analysis are implemented through SQL to improve business decision-making efficiency.

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA


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

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

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

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

Dreamweaver CS6
Visual web development tools