Lesson 8 | Using the delete and validate command |
Objective | Use delete command to remove data from your recovery catalog |
Using the Delete and Validate Command
Change...delete
Use the delete command to remove data from your recovery catalog and the validate command to check the validity of your recovery catalog.
There may be instances when you need to re-create your database. You may need to re-create some data files, move them to other locations, or rename them. After you do this, the information in the recovery catalog may contain invalid data.
You can remove this information through the use of the delete
command.
The delete
command is used to remove any old or unused file references from the control file and/or recovery catalog.
The delete
command is different from any of the other change
command options in that it will tell the underlying operating system to delete files physically.
When RMAN has to talk to the operating system, you have to allocate a channel. Allocating a channel will beis discussed later in this course. The following example uses the allocate
command.
Example
In this example, we will perform the following steps:
- Allocate a channel to talk to a disk
- Perform the
change delete
command.
- Release the channel.
An example is when you have changed your backup strategy and relocated where backup data file copies reside. The old backup files may still be
known to the recovery catalog. The code below demonstrates how to get rid of this information.
RMAN>allocate channel for delete type = 'disk';
RMAN>change datafilecopy 'd:\backup\userorc1.bak' delete;
RMAN>release channel;
Change...validate
When you have gone through the process of deleting several files, you may be unsure whether the recovery catalog properly reflects what is left.
The validate
command will reconcile what is left on disk with what is in the recovery catalog.
If a file is found to not exist, the reference to the file is removed from the recovery catalog and the control file.
The validate
command can also be used to validate a control file if a recovery catalog is not present.
Example
You have been working with your client's archivelog files and are not sure whether you have deleted all references in the recovery catalog.
The following command will reconcile the recovery catalog with the actual files that exist on the disk:
RMAN>change archivelog all validate;
The next lesson is the module conclusion.