Read Pro Oracle Database 11g Administration Online

Authors: Darl Kuhn

Tags: #Oracle DBA

Pro Oracle Database 11g Administration (93 page)

BOOK: Pro Oracle Database 11g Administration
3.31Mb size Format: txt, pdf, ePub
ads

1. Issue the mkds command and followed by the name of the dataset file.

ob> mkds bllnx1_home-oracle.ds

2. The vi editor is invoked, and a dataset template is displayed.

3. Comment out or remove all existing lines, and add the following lines: include host BLLNX1

include path /home/oracle {

exclude oracle database files

exclude path /home/oracle/temp

}

4. Save the file by typing Esc key, : and wq!

5. The following prompt is displayed. Press the Enter key to confirm the changes.

Apply your changes, if any [yes]?

You just created a dataset file. For descriptions of other dataset commands, refer to Table 20–5.

Table 20–5.
Dataset Commands

Command Meaning

catds

To display the contents of a dataset file.

cdds

To change the dataset directory.

chkds

To check the syntax in a dataset file.

edds

To modify a dataset file.

lsds

To list the dataset file and dataset directory names.

mkds

To create a dataset file or dataset directory.

pwdds

To show the current directory in the dataset directory tree.

rends

To rename a dataset file or dataset directory.

rmds

To delete a dataset file or dataset directory.

559

CHAPTER 20 ■ ORACLE SECURE BACKUP

Configuring Backup Windows

The backup window defines the range of time the scheduled backups are allowed to run. The default backup window is daily 00:00 to 24:00. If there is no backup window defined, the scheduled backups are not going to run at all.

For production servers, you may want the backups to run daily only between 1 a.m. and 5 a.m. when there is minimal database traffic. To define a range of time for your backup window, perform the following steps:

1. Remove the existing daily 00:00-24:00 backup window, since it overlaps the backup window you want to create by issuing the rmbw command, as shown here:

ob> rmbw daily

2. Issue the lsbw command.

ob> lsbw

There are no backup windows.

This result indicates that the daily backup window is already removed.

3. To create the backup window, issue the addbw command. The following example defines the backup window daily from 01:00 to 0500:

ob> addbw --times '01:00-05:00' ,mon,tue,wed,thu,fri,sat,sun

For other backup window commands, refer to Table 20–6.

Table 20–6.
Backup Window Commands

Command Meaning

addbw

To add a backup window.

chkbw

To check whether there is a backup window defined.

lsbw

To list the backup windows.

rmbw

To remove a backup window.

setbw

To modify a backup window.

Configuring Backup Schedules and Triggers

The backup schedule defines what data to backup, where to store the backup, and how the backup runs, while the triggers define when a backup is scheduled to run. For what data to backup, set the specific datasets. For where to store the backup, set the specific tape drives. If no specific tape drive is selected, then any available tape drive will be used. For how the backup runs, set the job priority and backup encryption options. The lower the value of the job priority number, the greater preference is assigned to the job by the scheduler. The default value of the job priority is 100 and no for the encryption option.

The following example uses the MKSCHED command to create a backup schedule named bllnx1_home-oracle.sched for dataset bllnx1_home-oracle.ds:

560

CHAPTER 20 ■ ORACLE SECURE BACKUP

ob> mksched --dataset bllnx1_home-oracle.ds bllnx1_home-oracle.sched After creating the backup schedule, create a trigger to define when to run the scheduled backup. The following example uses the CHSCHED command to define a trigger for schedule bllnx1_home-oracle.sched to run daily at 02:00 (2 a.m.). The -a option means the addtrigger, the –d option means day, the –t option means time, and the –f means media family.

ob> chsched -a -d daily -t 02:00 -f APRESS_OS bllnx1_home-oracle.sched To display the information about the backup schedules, issue the lssched command, like so: ob> lssched -l bllnx1_home-oracle.sched

bllnx1_home-oracle.sched:

Type: backup

State: enabled

Dataset: bllnx1_home-oracle.ds

Encryption: no

UUID: 1ea82008-bfdd-102d-a743-0002a530c867

Trigger 1:

Day/date: daily

At: 02:00

Backup level: full

Media family: APRESS_OS

You just scheduled a backup named bllnx1_home-oracle.sched that is going to run daily at 2 a.m. To monitor the jobs, refer to the “OSB Job Monitoring” section in this chapter.

To remove a backup schedule, issue the rmsched command, as shown here: ob> rmsched bllnx1_home-oracle.sched

Performing On-Demand File-System Backups

To run a one-time backup on a specific client host use the backup command. In the following example, the dataset file is bllnx1_home-oracle.ds, which was created earlier: ob> backup --dataset bllnx1_home-oracle.ds --go

If you omit the --go option, the backup request is still in the queue. You can issue the lsbackup command to display the backup requests that are queued, as shown here: ob> lsbackup

Item # Save data

1 dataset bllnx1_home-oracle.ds

To forward the backup request to the OSB scheduler, issue the following backup command with the GO option, as shown here:

ob> backup --go

To manually back up the OSB catalog of the admin server, issue the following backup command: ob> backup --level 0 --dataset OSB-CATALOG-DS --go

To monitor the backup jobs you have submitted, refer to the “OSB Job Monitoring” section of this chapter.

561

CHAPTER 20 ■ ORACLE SECURE BACKUP


Note
By default, OSB-CATALOG-SCHED is scheduled to run daily at 1 a.m. to backup the OSB catalog using the dataset file OSB-CATALOG-DS.

File System Restore

There are three options on how you can restore from a file-system backup:

• catalog-based restore

• raw restore

• obtar command

In a catalog-based restore, you provide the directory and file, which you can browse from the OSB

catalog. In both the raw restore and the obtar command, you provide the volume ID and file number.

The volume ID is the unique name (that contains the media family) assigned to a tape volume, and the file number is the number of the backup image on the tape volume. Both the catalog-based restore and raw restore are performed using the obtool utility, while the obtar commands are issued at the operating system prompt.

Performing Catalog-Based Restore

For a catalog-based restore, you can browse the OSB catalog to determine and verify the files you want to restore. In the following example, you want to restore the file /home/oracle/scripts/rmanbkup.sh of the client host BLLNX1. To restore the files using the OSB catalog, perform the following steps: 1. Set the host variable to BLLNX1, which is the source host.

ob> set host BLLNX1

2. Issue the cd command to navigate to the directory.

ob> cd /home/oracle/scripts

3. Issue the ls command to verify the files in the directory.

ob> ls -l rmanbkup.sh

-rwxr-xr-x oracle.oinstall 782 2010/01/13.18:14 rmanbkup.sh (0) 4. Issue the restore command.

ob> restore '/home/oracle/scripts/rmanbkup.sh' --go

To monitor the restore job, refer to the OSB Job Monitoring section (covered a bit later in this chapter).

Performing a Raw Restore

To restore a data using the raw restore, you must know the volume ID and file number where to extract the data from. However, you know that the backups are using a particular media family, which can make the search a bit easier.

562

CHAPTER 20 ■ ORACLE SECURE BACKUP

In the following example, you are going to restore the file /home/oracle/scripts/rmanbkup.sh from a tape volume that has media family APRESS_OS.

1. Issue the lsvol command with --contents option to display the contents of the volumes associated to media family APRESS_OS:

ob> lsvol --contents --family APRESS_OS --nobarcode

VOID OOID Seq Volume ID Family Created Attributes 2845 2845 1 APRESS_OS-000001 APRESS_OS 10/21.04:41 open; closes 10/28.04:41

BSOID File Sect Level Host Size Created Attributes 31250 1 1 0 BLLNX1 208.6 MB 10/21.04:41

31258 2 1 0 BLLNX1 208.8 MB 10/21.06:04

31260 3 1 0 BLLNX1 210.1 MB 10/21.12:23

31261 4 1 0 BLLNX1 210.1 MB 10/21.12:34

2. According to the output shown above, you want to restore from a backup taken on 10/21.06:04 (i.e. October 21 at 6:04am). The corresponding file number is 2, and the volume ID is APRESS_OS-000001. Issue the following restore command, as shown here. The -R option indicates a raw restore operation and does not use an OSB catalog, while the –F option means the filenumber, and the –v option means the volume ID.

ob> restore -R -F 2 -v APRESS_OS-000001 /home/oracle/scripts/rmanbkup.sh --go To monitor the restore job, refer to the “OSB Job Monitoring section” of this chapter.

Performing an obtar Restore

When you run the OSB restores, they are actually translated to obtar commands in the background. The obtar commands are issued at the operating system level. The obtar command is seldom used to perform restore operations, since you need to provide the volume ID and file number, which is not readily available especially if you have no access to the OSB catalog.

In the following example, you are going to restore the file /home/oracle/scripts/rmanbkup.sh from the tape that has volume ID APRESS_OS-000001 at file number 2.

1. Issue the loadvol command to manually load the tape that has volume ID

APRESS_OS-000001 to an available tape drive. Here I used tape drive vdrive8.

ob> loadvol -D vdrive8 --volume APRESS_OS-000001

2. To check the contents of the tape, issue the obtar command with -t option.

$ obtar -t -f vdrive8

3. To perform the restore operation using the obtar command, issue the following command with the -x option. The -F option means the file number, and the -k option avoids overwriting the existing file.

$ obtar -F 2 -x -f vdrive8 -k /home/oracle/scripts/rmanbkup.sh

4. Since you restore using the obtar command, which is executed at the operating system level, you can’t monitor the restore job using the obtool utility.

However, one way to verify whether the file is restored is to issue the ls OS

command.

$ ls -l /home/oracle/scripts/rmanbkup.sh

563

CHAPTER 20 ■ ORACLE SECURE BACKUP

OSB Job Monitoring

You submitted a backup or restore operation for an Oracle database using RMAN or file-system data using Oracle Enterprise Manager (OEM), OSB Web tool, or obtool utility, and you want to check whether the job is active, pending, or completed. To check the status of an OSB job, issue the lsjob command and catxcr command to show the details about the operation of a job.

Listing Jobs

To display the jobs that are still running, issue lsjob command with the --active or -a option. For other job states, use --complete or -c option for completed jobs, --pending or -p for pending jobs, --

inputrequest or -i for jobs currently requesting input, and --all or -A to display all jobs regardless of the job state. For example, to list active jobs:

ob> lsjob --active

For RMAN jobs, use the --dbname or -d option to limit the output for a specific Oracle database. If you know the database ID, you can use the --dbid or -I option instead. This example uses the dbname parameter:

ob> lsjob --active --dbname DB11R2

In the following output, the State column indicates that the job is still running. Once the job is done without errors, the State column displays “completed successfully.”

Job ID Sched time Contents State

---------------- ---------- ------------------ -----------------------------

apress_oracle/83.1 none incremental backup running since 2010/10/22.22:13

For file-system jobs, use the --host or -h option to limit the output for a specific client host, as shown here:

ob> lsjob --active --host BLLNX1

Job ID Sched time Contents State

---------------- ----------- ------------- --------------------------------

apress_admin/36.1 none backup BLLNX1 running since 2010/10/22.22:11

To monitor active jobs, use the lsjob command. If there are several active jobs running, you can filter the output by providing the job ID. However, if the job is already completed, you can use the same command, but you need to remove the -a option and provide the corresponding job ID. I usually run the lsjob command with the following options:

ob> lsjob -a -l -j -o -R -L -C

The prior command displays detailed information about the status of the job. Here is some sample output:

apress_oracle/83:

Type: database DB11R2 (dbid=4187425583)

Scheduled time: none

Introduction time: 2010/10/22.22:12

Earliest exec time: 10/22.22:12

Last update time: 2010/10/22.22:12

Expire time: never

State: processed; Oracle job(s) scheduled

Priority: 100

564

CHAPTER 20 ■ ORACLE SECURE BACKUP

Run on host: (administrative server)

Attempts: 0

Log:

apress_oracle/83.1:

Type: incremental backup

Backup piece: tclr1n5v_1_1

Family: APRESS_RMAN

BOOK: Pro Oracle Database 11g Administration
3.31Mb size Format: txt, pdf, ePub
ads

Other books

The Lady Chosen by Stephanie Laurens
Bastard by J L Perry
Birds of the Nile by N E. David
The Unseen by Bryan, JL
Lakeside Romance by Lisa Jordan
Halo: Contact Harvest by Joseph Staten