Escolar Documentos
Profissional Documentos
Cultura Documentos
Oracle RMAN command files are plain-text files and similar to shell scripts in U
NIX or batch files in Microsoft Windows. Listing 1 shows a very simple example c
ommand file named backup_ts_users.rman used to back up the USERS tablespace. The fil
e extension .rman is not necessary, but it is helpful in making the meaning of t
he file clear.
Code Listing 1: Command file for backing up USERS tablespace
connect target /
connect catalog rman/secretpass@rmancat
run {
allocate channel c1 type disk format '/orabak/%U';
backup tablespace users;
}
You can call a command file in several ways. From the Oracle RMAN prompt, you ca
n call the example command file as follows:
RMAN> @backup_ts_users.rman
Note that the command file is executed by the @ sign. It is important, however,
to provide the full name of the command file, including the extension. (The Orac
le RMAN executable does not expect or apply a default extension.)
You can also call the command file directly from the command line as
rman @backup_ts_users.rman
This approach for calling the script is highly useful in shell scripts or batch
files for making backups. Also note that instead of using the @ sign to call the
command file, you can use the cmdfile parameter as follows:
rman cmdfile=backup_ts_users.rman
Note that the CONNECT clauses are inside the backup_ts_users.rman command file,
so there is no reason to provide the password in the command line meaning that you
can eliminate the risk of accidental exposure of the password. Had we not inclu
ded the password of the catalog user rman inside the command file, we would have
had to call the Oracle RMAN executable like this: