Creating Backup Sets   «Prev  Next»

Lesson 2Using backup sets
ObjectiveReview the concept of a backup set.

Using Backup Sets in Oracle(Review Concept)

A the database environment. Making an image copy of your data files or archive logs is very similar to making a file copy from the operating system prompt, in fact, you learned earlier that you can use operating system utilities to create an image file.

Use Operating System Utilities to create an image file in Oracle 12c

Making an image copy of data files or archived logs in Oracle is somewhat similar to a file copy operation in an operating system, and you can use operating system utilities to create such copies.
Before you begin, note that it's important to ensure that the database or the data file is in a consistent state or offline to prevent inconsistencies.
Here's an example of how you can use operating system utilities to create an image copy:
First, you need to locate the file you want to copy. To find the path of the data file, you can use the following SQL query:
SELECT file_name 
FROM dba_data_files 
WHERE tablespace_name = 'TABLESPACE_NAME';

Replace 'TABLESPACE_NAME' with the name of the tablespace for which you want to find the data file.
Once you have the file location, you need to make sure the file is safe to copy. It's safer to copy a datafile when the tablespace is offline, or the database is in backup mode, or the database is shut down.
To take the tablespace offline, use the following SQL command:
ALTER TABLESPACE tablespace_name OFFLINE NORMAL;

Replace 'tablespace_name' with the name of your tablespace.
Now you can use the operating system commands to copy the file.
In Linux, you might use:
cp /path/to/original/datafile.dbf /path/to/copy/datafile_copy.dbf

In Windows, you might use:
copy C:\path\to\original\datafile.dbf C:\path\to\copy\datafile_copy.dbf

After the copy operation is complete, remember to bring the tablespace back online if you took it offline:
ALTER TABLESPACE tablespace_name ONLINE;

Please note, while this process does create a copy of your data files or archived logs, it isn't a substitute for a proper backup strategy, as it lacks many of the safeguards and features provided by Oracle's RMAN tool, such as incremental backups, backup verification, and so on. Use it carefully and always ensure you have a proper backup strategy in place.

Oracle backup set

Recovery Manager creates backup sets, a process that works within the Oracle environment. This integration means that the problems associated with an image log disappear. For instance, you have to use alter database commands to let your Oracle8 database know when you are starting and stopping your online backups to an image copy. This is because your Oracle8 database handles its own tracking and management of input and output to the database file, for reasons of data integrity and performance. The operating system, which handles the creation of an image copy, is unaware of this additional information, so Oracle8 has to write additional information to the redo log files for all the transactions handled during an image copy. A backup set is also aware of the contents of the blocks in the database files. A backup set does not include database blocks that have never been used, compressing the size of the backup.
In the next lesson, you will learn more about the syntax used to create a backup set.