|Operating System Image Copies
|Use the Operating System to create Image Copies
Use the Operating System to create Image Copies in Oracle
In Oracle 12c, the concept of "Image Copies" is indeed a recognized and integral part of the backup strategy, and these can be created using Oracle Recovery Manager (RMAN). However, it's important to clarify that while RMAN facilitates the creation of image copies, it does not directly utilize the operating system's native file copying utilities to do so.
An image copy in Oracle 12c is a bit-for-bit copy of a database file, such as a datafile, control file, or archived redo log. These image copies are created and managed by RMAN and are stored in a format that is directly accessible by the Oracle Database. The primary advantage of an image copy is its straightforward nature: it is an exact replica of the database file, which can be readily used in recovery scenarios.
To create an image copy of a database, the DBA uses RMAN with commands specifically designed for this purpose. Here’s a basic example:
BACKUP AS COPY DATABASE;
This command instructs RMAN to create image copies of all datafiles in the database. RMAN manages these copies, keeping track of their locations and statuses, which is crucial for efficient database recovery and maintenance.
While it is technically possible for a DBA to use operating system commands (like `cp` on UNIX/Linux or `copy` on Windows) to manually create copies of database files, these methods are not recommended for several reasons:
- Consistency: Operating system-level copies may not be consistent, especially if the database is open and in use. RMAN ensures that the image copies are consistent and usable for recovery.
- Integration with Oracle: RMAN is fully integrated with Oracle Database, and it maintains important metadata about backups. This integration is crucial for efficient and reliable backup management and recovery processes.
- Advanced Features: RMAN offers advanced features such as block-level checks, compression, and encryption, which are not available with basic operating system file copy commands.
In summary, while Oracle 12c relies on RMAN to create image copies of the database, it does not typically use operating system utilities for this purpose due to consistency, integration, and feature-set considerations. RMAN is the recommended tool for creating and managing image copies in Oracle databases.
In earlier lessons, we mentioned that an image copy is very much like an operating system copy of a file. In fact, you can use operating system
copy commands to make image copies of data files, archive logs, and control files.
Creating image copies from the Operating System
Because you will be making an image copy from outside the Oracle environment, you have to make sure that the database copy you are making is consistent. One way of ensuring this consistency is to make the copy while the database is offline. The other way of insuring consistency is to use
ALTER TABLESPACE tablespace_name BEGIN BACKUP
before you start the operating system copy and ALTER TABLESPACE tablespace_name END BACKUP after you have completed the operating system copy. Once you have taken one of these steps, you simply use the appropriate
command for your operating system. For a UNIX system, the command is
; for an NT system, the command is
Image Copies and Backup Sets
Database backups created by Oracle Recovery Manager (RMAN) are stored as image copies or backup sets
Image copies are exact byte-for-byte copies of files. You can create an image copy by copying a file at the operating system level.
Unlike copying files at the operating system level, however, image copies created through RMAN are recorded in the RMAN repository so that RMAN can use these copies during database restore operations and recovery. RMAN can restore files only if they are recorded in the RMAN repository. RMAN can create image copies only on disk. Backup sets are logical entities produced by the RMAN BACKUP command.
This command can produce one or more backup sets on disk or tape devices. Although image copies cannot use all RMAN features, their advantages are that you can apply incremental backups to them (synthetic full backups) and you can use them directly in place without first copying them, for very fast restores. Each backup set contains one or more physical files called backup pieces. A backup piece stores the backup of one or more database files in a compact RMAN-specific format. One advantage of backup sets is that RMAN uses unused block compression to save space in backing up data files. Only those blocks in the data files that have been used to store data are included in the backup set. Backup sets can also be compressed, encrypted, sent to tape, and use advanced unused-space compression that is not available with datafile copies.
Cataloging OS image copies
When you make an image copy using RMAN, the image copy is automatically included in the recovery catalog.
Because an operating system (OS) image copy is made outside of RMAN, you should explicitly catalog any operating system image copies you make. The syntax for cataloging an OS image copy is:
catalog datafilecopy 'filespec';
is the pathname of the copied file. The next lesson is the module wrap-up.
Backup sets are a logical structure used by Oracle Recovery Manager (RMAN) to organize and manage database backups.