Sei sulla pagina 1di 4

1.

Part I: The Traditional Approach


For the purpose of our demonstration, the production server is proddb001 and the database on
this server is FIN1P, a production Oracle database with the companys financial information. The
DBA has been asked to set up and schedule Oracle RMAN backups for this database. The DBA
writes the shell scripts and places them on the server following the setup steps below.
These steps must be followed for every database server requiring Oracle RMAN backups for its
databases. If the databases are on an active-passive clusterfor example, a SUN HA cluster or
any such technologythen the steps would be followed for each server.
1. As the root UNIX user add the line oracle to /etc/cron.d/cron.allow in order to allow
the oracle UNIX user to use the cron utility in UNIX.
2. As the oracle UNIX user, add the following to the crontab:
30 21 * * * dba/scripts/rman_backup_db.sh FIN1P

As per crontabl syntax, this calls the rman_backup_db.sh script at 21:30 hours on each
day. The script is asked to execute against the FIN1P database by specifying this database
name as the first and only argument.
3. Log on as a DBA to database FIN1P in SQL*Plus and create an externally identified
user :
create user ops$oracle identified externally;

This has the effect that the Oracle UNIX user can log on to SQL*Plus as the Oracle
database user without specifying the passwordin other words, the user is identified
externally. Note that SYSDBA database privileges are needed for taking RMAN backups,
so the Oracle UNIX user should be a member of the dba UNIX group.
This is the technique used most often with scripts that log in to the database, especially
those that require DBA rights for database-level backups. It is not a good idea to hardcode database passwords in scripts, because the scripts are UNIX files and may be
readable by anyone on the computer (unless the file permissions are locked down). So as
a safety precaution, an externally identified Oracle user can be used to log in as the DBA
and perform the backup. This circumvents the need for specifying the database password
in the script.

4. In this approach you would use a Filer volume for the Oracle RMAN backups. Database
standards for the corporate environment maintain that the backup volume must be
mounted as /U99 at the server level.
In /etc/vfstab, make sure that there is an entry for the backup mount point:
ausmelb-corp-netappsfiler-tier3:/vol/vol1/dbbackup - /U99 nfs - yes
hard,vers=3,intr,suid,proto=udp,rsize=32768,wsize=32768

NetApp documentation should be consulted on the appropriate mount options, because


these may differ as per the UNIX flavor of the host, the version of the filer, and the
technology in use.
If there is no such entry, consult with the storage department in corporate IT and ask them
to allocate a volume to the server and add it to this file. The mount point will now be
mounted every time the server is rebooted, or it can be mounted manually using the
mount command as the root UNIX user:
mkdir /U99
mount /U99

5.
As the root UNIX user, execute the following at the UNIX command prompt:
chown R oracle:dba

/U99

This is to make sure that the /U99 backup mount point and all subdirectories (as specified
by the R argument) under this mount point are owned by the oracle UNIX user and dba
UNIX group, so Oracle RMAN is able to create backup pieces under this mount point.
6. Assuming that /home/oracle is the Oracle UNIX users home directory, perform the
following steps as the Oracle UNIX user:
mkdir
mkdir
mkdir
mkdir
mkdir
mkdir
mkdir

/home/oracle/dba
/home/oracle/dba/scripts
/home/oracle/dba/logs
/home/oracle/dba/work
/U99/FIN1P
/U99/FIN1P/rmancmd
/U99/FIN1P/log

These commands create the UNIX subdirectories into which the UNIX script is placed
and to which the logs are written, as well as creating temporary working directories and
the directories for the generated Oracle RMAN command script and Oracle RMAN
runtime log file.
7. Under the subdirectory /home/oracle/dba/scripts, create the file rman_backup_db.sh using
vi or any UNIX editor. The script, when executed every day at the specified time set in
cron, will generate the following Oracle RMAN command file
/U99/FIN1P/rmancmd/rman_FIN1P.cmd:
#
#
#

Creation

Porus Homi Havewala

07/06/2008

# Configure RMAN settings


CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 3 DAYS;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO
'$BACKUPDIR/cf_%F';
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEVICE TYPE disk PARALLELISM 3;
CONFIGURE DEFAULT DEVICE TYPE TO disk;
CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT '$BACKUPDIR/b_%U';
CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT '$BACKUPDIR/b_%U';
CONFIGURE CHANNEL 3 DEVICE TYPE DISK FORMAT '$BACKUPDIR/b_%U';
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '$BACKUPDIR/snapcf_${DBNAME}.f';

# Perform backup of database and archivelogs, deleting


archivelogs
BACKUP DATABASE PLUS ARCHIVELOG DELETE INPUT;

# Maintainance commands for crosschecks and deleting


ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE DISK;
CROSSCHECK BACKUP;
DELETE NOPROMPT EXPIRED BACKUP;
DELETE NOPROMPT OBSOLETE DEVICE TYPE DISK;
CROSSCHECK ARCHIVELOG ALL;
DELETE NOPROMPT EXPIRED ARCHIVELOG ALL;
# End of RMAN command script

backed up

expired backups

8.
As can be seen from the Oracle RMAN commands, a recovery window of three days is
specified as the Oracle RMAN retention policy, which means that all backups necessary
to recover up to the last three days of data will be retained. Obviously this setting may

need to be changed, depending on the size of the database and the free space available in
the backup mount point /U99 at any point. The DBA needs to closely monitor this space
and change the recovery window if necessary.
9. Control file autobackup is also configured, so the control file will be automatically
backed up along with every database or archive log backup. This is especially important
because we are using the nocatalog mode of Oracle RMAN, so all the history of our
backups is only in the control file.
10. A parallelism setting of 3 is used, which means that three Oracle RMAN channels will be
used to actually create the backup pieces. This will increase the speed of the backup,
depending on the structure of the disk subsystem.

Potrebbero piacerti anche