Lesson 7 | Using stored scripts |
Objective | Use the run command. |
Using Stored Scripts in Oracle
In the previous lesson, you learned about managing stored scripts within Recovery Manager. This lesson introduces you to the run
command, which is used to execute stored scripts.
In addition, the run
command allows you to execute operating system commands and SQL commands.
When the run
command operates, two things happen. The commands are compiled into blocks or steps of PL/SQL code.
Then, these steps are then stored in memory and executed. The compiled version of your script is not stored for later use. Take a look at some samples of the run
command in the SlideShow below:
Oracle Run Command Examples
It should be noted that you could use the run
command to execute the same syntax that you might have in a stored script. Below is an example of using the run
command to back up the USER_DATA tablespace.
run{
allocate channel 1 type disk;
backup
incremental level = 0
format 'd:\backup\orc1_%s_%p'
(tablespace 'user_data');
};
In the next lesson, you will learn what data dictionary views are available to you to interrogate the recovery catalog.