Sie sind auf Seite 1von 37

Oracle Optimized Solution for Backup and

Recovery
Zero to Database Backup and Recovery in 60 Minutes
ORACLE HANDS ON LAB

ORACLE OPEN WORLD 2014

Table of Contents
Lab Overview

Environment Overview

Environment Start Up

Start the Virtual Machines

Start the VirtualBox Manager

Start the database server DB01

Start the Oracle ZFS Storage Appliance ZBA01

Start the Tape Backup Server - OSB01

Login into the three systems

Getting Started

Disk Environment Setup

Oracle ZFS Storage Appliance Setup Process

Start the Oracle ZFS Storage Appliance Graphical User Interface

Configure the Project and Shares

Mount the NFS Shares on the Database Host


Tape Environment Setup
Configure Oracle Secure Backup

11
12
12

Add host to OSB Domain from OSB01

12

Create user for OSB

13

Create Content Managed Media Family for DB

13

Create Storage Selector for DB

14

ORACLE OPTIMIZED SOLUTION FOR ORACLE SUPERCLUSTER BACKUP AND RECOVERY

Backup the Database


Performing Database Backups To Disk

15
15

Create RMAN backup of XE database from DB01

15

To monitor the backups being written to the Oracle ZFS Storage Appliance

18

Verify backup completed with a status 0 from RMAN

18

Check that there was data written to the Oracle ZFS Storage Appliance

19

Performing Database Backups to Tape

19

Create RMAN backup of XE database from DB01

19

Verify Backup on OSB from DB01 is running

20

Verify the backup completed with a status 0 from RMAN

21

Verify the backup completed successfully on the OSB01 host

21

Recover the Database


Performing Database Recovery From Disk

22
22

Breaking the Database

22

Simulate losing a data file

22

Offline Affected table users table

22

Recovering the Database

23

Start the database restore

24

Verify the table space users recovered

25

Performing Database Recovery From Tape

26

Breaking the Database

26

Simulate losing a data file

26

Offline Affected table users table

26

ORACLE OPTIMIZED SOLUTION FOR ORACLE SUPERCLUSTER BACKUP AND RECOVERY

Verify table space is in recover status

27

Recovering the Database

28

Start the database restore

28

Verify the table space users recovered

29

Conclusion

31

References

32

ORACLE OPTIMIZED SOLUTION FOR ORACLE SUPERCLUSTER BACKUP AND RECOVERY

Lab Overview
In this hands-on lab you will perform simple backup and recovery of a database using disk and tape backup and
recovery hardware. The lab is focused on marching through the steps to show how it is done, but does not provide
details on the software and hardware being used. For details on the hardware, software and best practices please
see the Oracle Optimized Solution for Backup and recovery. The resources section of this guide provides links to
the Optimized Solution and all the products emulated in the lab.

Environment Overview
The environment for the lab consists of three virtual machines to emulate a database server, a storage array and a
tape hardware and software environment. These systems emulate the most common hardware and software
configurations found in most computing environments. The process used to do backup and recovery is very
similar to what you will see in the lab on real systems. Note the HOLXXXX number could be different then as
seen below.

Environment Start Up
The environment may or not be already running when you sit to do the lab. The following steps show how to start
the virtual machines if they are not already running. If there are any other virtual machines running that are not
show below please close them for the best possible hands-on lab experience. The three virtual machines used in
the lab are shown in the following diagram.

Start the Virtual Machines


The following steps show to start the virtual machines for the lab. If they are already running, just review this
section to understand how the environment was started. The following diagram shows the three virtual machines
and the login information used in these. Please not the login information now as it is not repeated throughout the
lab.

1 |

Oracle Optimized Solution for Oracle SuperCluster Backup and Recovery

Start the VirtualBox Manager


On the desktop of the laptop you are using there is an icon as show in the diagram below. Double click on this
icon to start the VirtualBox Manager.

Start the database server DB01


From Virtual Box Manager start DB01: Highlight the VM DB01 and click the start arrow. Note the HOLXXXX could
be different then seen below.

Start the Oracle ZFS Storage Appliance ZBA01


From Virtual Box Manager start DB01: Highlight the VM DB01 and click the start arrow. Note the HOLXXXX could
be different then seen below.

2 | ORACLE OPTIMIZED SOLUTION FOR ORACLE SUPERCLUSTER BACKUP AND RECOVERY

Start the Tape Backup Server - OSB01


From Virtual Box Manager start OSB01: Highlight the VM OSB01 and click the start arrow. Note the HOLXXXX
could be different then seen below.

Login into the three systems


Once the three systems get started you should have three windows on your desk to as seen below. Login on
each system using the credentials seen below each window in the diagram below.

Note you may lose control of your mouse when you click on the virtual machine windows. On the lower right hand
side of the window there will be a special key setup to regain mouse control. The special key assigned to this
feature may be different on each laptop. When you press the special key you should the mouse reappear on the
laptop desktop.

3 | ORACLE OPTIMIZED SOLUTION FOR ORACLE SUPERCLUSTER BACKUP AND RECOVERY

Getting Started
You do not have to go through the entire lab if you do not wish to. If you would like to only focus on disk backup
or focus on tape backups you can skip to the sections you would like to focus on, though the sections of this guide
need to be processed in the order they are found in this guide. The lab is designed that you can go through the
entire lab for disk and tape backups in less than one hour.

Disk Environment Setup


The following sections cover how to setup the Oracle ZFS Storage Appliance used in the lab to store database
backups.

Oracle ZFS Storage Appliance Setup Process


Start the Oracle ZFS Storage Appliance Graphical User Interface
Start the Firefox web browser on the laptop desktop by clicking on Applications, then click on Internet and then
click on Firefox Web Browser.

Enter the Oracle ZFS Storage Appliance address as seen below. https://192.168.56.160:215. You will need to
setup the security certificates on the web browser to use the interface. Click on the hyperlink Or you can add an
exception

4 | ORACLE OPTIMIZED SOLUTION FOR ORACLE SUPERCLUSTER BACKUP AND RECOVERY

Next click on Add Exception

5 | ORACLE OPTIMIZED SOLUTION FOR ORACLE SUPERCLUSTER BACKUP AND RECOVERY

Next click on Confirm Security Exception

Now login with the Username root and the Password root and then click on LOGIN.

6 | ORACLE OPTIMIZED SOLUTION FOR ORACLE SUPERCLUSTER BACKUP AND RECOVERY

Configure the Project and Shares


Click on Shares in the top line of the interface.

Click on the play button next to Projects on the left hand side of the window.

Click on the (+) Button next to ALL on the far left under Projects pane to create a new project.

Name the project XE, then click on APPLY.

7 | ORACLE OPTIMIZED SOLUTION FOR ORACLE SUPERCLUSTER BACKUP AND RECOVERY

In the new Project go the General section by clicking on the Project name EX and then on General.

On the General tab change the mount point to be /export/DB01/XE and Synchronous write bias to Throughput.
Then click APPLY.

8 | ORACLE OPTIMIZED SOLUTION FOR ORACLE SUPERCLUSTER BACKUP AND RECOVERY

Next click on Protocols and add a network NFS exception as listed below by clicking on the + icon next NFS
Exceptions, then click APPLY.

Go back to shares section by clicking on Shares and then click on the + next to Filesystems to create the
filesystems to be used to store backups in the lab.

We will now create four filesystems backup01, backup02, backup03, and backup04.
Add the name and click Apply, Repeat for each file system.
Filesystem backup01.

9 | ORACLE OPTIMIZED SOLUTION FOR ORACLE SUPERCLUSTER BACKUP AND RECOVERY

Filesystem backup02.

Filesystem backup03.

Filesystem backup04.

When you are done the Shares screen should look like this. Be sure to check your mount points, if they do not
match the guide the lab will not work in later steps.

10 | ORACLE OPTIMIZED SOLUTION FOR ORACLE SUPERCLUSTER BACKUP AND RECOVERY

The ZFS Storage Appliance is now configured and ready for use. Keep the interface open to monitor backups
later on in the lab.

Mount the NFS Shares on the Database Host


These steps are on done on the DB01 host logged in as root.
On the DB01 server in roots home directory /root/ run the create mount script
mountZBA.sh will create the directory paths and edit the fstab for you.

[root@DB01 ~]# bash /root/mountZBA.sh


[root@DB01 ~]#
Edit /etc/fstab

Locate the lines which include /DB01/ and uncomment the line so we can
mount it. Use the arrow keys to navigate to the # characters on each line then
press the letter x to delete the #. Hold down the shift key and type ZZ to exit
and save the changes.

[root@DB01 ~]# vi /etc/fstab


192.168.56.160:/export/DB01/XE/backup01 /DB01/XE/backup01 nfs
rw,bg,hard,nointr,rsize=131072,wsize=1048576,tcp,vers=3,timeo=600
192.168.56.160:/export/DB01/XE/backup02 /DB01/XE/backup02 nfs
rw,bg,hard,nointr,rsize=131072,wsize=1048576,tcp,vers=3,timeo=600
192.168.56.160:/export/DB01/XE/backup03 /DB01/XE/backup03 nfs
rw,bg,hard,nointr,rsize=131072,wsize=1048576,tcp,vers=3,timeo=600
192.168.56.160:/export/DB01/XE/backup04 /DB01/XE/backup04 nfs
rw,bg,hard,nointr,rsize=131072,wsize=1048576,tcp,vers=3,timeo=600
Mount the new paths

Run mount a, then run df k to see the filesystems mounted.

[root@DB01 ~]# mount -a


[root@DB01 ~]# df -k
Filesystem
1K-blocks
Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
35708736
5033204 28832332 15% /
/dev/sda1
101086
12126
83741 13% /boot
tmpfs
2097152
265880
1831272 13% /dev/shm
shmfs
2097152
265880
1831272 13% /dev/shm
192.168.56.160:/export/DB01/XE/backup01

11 | ORACLE OPTIMIZED SOLUTION FOR ORACLE SUPERCLUSTER BACKUP AND RECOVERY

0 0
0 0
0 0
0 0

76929024
0
/DB01/XE/backup01
192.168.56.160:/export/DB01/XE/backup02
76929024
0
/DB01/XE/backup02
192.168.56.160:/export/DB01/XE/backup03
76929024
0
/DB01/XE/backup03
192.168.56.160:/export/DB01/XE/backup04
76929024
0
/DB01/XE/backup04
[root@DB01 ~]#

76929024

0%

76929024

0%

76929024

0%

76929024

0%

Set permissions on your new mounts

Run chown oracle:dba R /DB01 and then ls l /DB01 to see the permissions
set.

[root@DB01
[root@DB01
total 4
drwxr-xr-x
[root@DB01

~]# chown oracle:dba -R /DB01


~]# ls -l /DB01
6 oracle dba 4096 Oct
~]#

2012 XE

Tape Environment Setup


The following sections cover how to setup the Oracle Secure Backup server used in the lab to store database
backups. The tape hardware has already been setup on the OSB01 server.

Configure Oracle Secure Backup


The following sections are done on the OSB01 host logged in as root.
Add host to OSB Domain from OSB01
To do tape backups with RMAN the RMAN client must be a member of the OSB domain. This step adds the client
host to the OSB domain.

Run obtool mkhost on the OSB Admin host.


obtool mkhost DB01

[root@OSB01 ~]# obtool lsh


OSB01
admin,mediaserver,client
service
[root@OSB01 ~]# obtool mkhost DB01
[root@OSB01 ~]# obtool lsh
DB01
client
service
OSB01
admin,mediaserver,client

12 | ORACLE OPTIMIZED SOLUTION FOR ORACLE SUPERCLUSTER BACKUP AND RECOVERY

(via OB)

in

(via OB)

in

(via OB)

in

service
[root@OSB01 ~]#
Create user for OSB
Along with having a client you also will require a user with at least rman permissions. This step will create a oracle
OSB user which is tied to the unix user oracle. We will pre authorize it for RMAN and Cmdline access from the DB
client to the OSB domain.

Run obtool mkuser from the OSB Admin host


obtool mkuser -c oracle -U oracle h DB01:oracle:+cmdline+rman oracle

[root@OSB01 ~]# obtool mkuser -c oracle -U oracle -h


DB01:oracle:+cmdline+rman oracle
[root@OSB01 ~]# obtool lsuser -l oracle
oracle:
Password:
(not set)
User class:
oracle
Given name:
[none]
UNIX name:
oracle
UNIX group:
[none]
Windows domain/acct:
[none]
NDMP server user:
no
Email address:
[none]
UUID:
9edd9762-ed0d-102f-a3c5-0800278d216a
Preauthorized access:
Hostname:
DB01
Username:
oracle
Windows domain:
[all]
RMAN enabled:
yes
Cmdline enabled:
yes
[root@OSB01 ~]#

Create Content Managed Media Family for DB


Since this is a RMAN setup we will also create a content managed media family. This media family type allows
RMAN to control retention rather then OSB.

Run obtool mkmf on the OSB Admin Server


obtool mkmf -w 2d -C -a -c "DB01 XE media family" osb01_db01_mf

[root@OSB01 ~]# obtool mkmf -w 2d -C -a -c "DB01 XE media family"


osb01_db01_mf
[root@OSB01 ~]# obtool lsmf -l osb01_db01_mf
osb01_db01_mf:
Write window:
2 days
Keep volume set:
content manages reuse
Appendable:
yes
Volume ID used:
unique to this media family
Comment:
DB01 XE media family
UUID:
49401496-ed0e-102f-a3c5-0800278d216a

13 | ORACLE OPTIMIZED SOLUTION FOR ORACLE SUPERCLUSTER BACKUP AND RECOVERY

[root@OSB01 ~]#
Create Storage Selector for DB
The last component for the OSB <-> DB configuration is the storage selector. Storage Selectors allow us to assign
resources to specific RMAN clients, Databases, etc.

Run obtool mkssel from the OSB Admin Server:


obtool mkssel -d XE -h DB01 -f osb01_db01_mf -c '*' db01_xe_ssel

[root@OSB01 ~]# obtool mkssel -d XE -h DB01 -f osb01_db01_mf -c '*'


db01_xe_ssel
[root@OSB01 ~]# obtool lsssel db01_xe_ssel -l
db01_xe_ssel:
Content:
Database:
Database IDs:
Host:
Restrictions:
Copy number:
Media family:
Encryption:
Resource wait time:
UUID:
[root@OSB01 ~]#

[all]
XE
[all]
DB01
[none]
[any]
osb01_db01_mf
undefined
1 hour
7ffb4dde-ed0e-102f-a3c5-0800278d216a

14 | ORACLE OPTIMIZED SOLUTION FOR ORACLE SUPERCLUSTER BACKUP AND RECOVERY

Backup the Database


The following sections cover how to perform database backups being stored on disk or tape.
The following sections are done on the DB01 host logged in as root and then logged in as oracle in the terminal
window. To access the oracle user on the DB01 host login as root then super user to oracle as seen below.

[root@DB01 ~]# su - oracle


-bash-3.2$
Performing Database Backups To Disk
Create RMAN backup of XE database from DB01
To simplify the lab we have provided a very simple rman backup run command.

From the DB01 host as the user oracle run rman


rman cmdfile=/u01/app/oracle/rman_disk_backup.rman
After starting the rman backup move on to the next step in the Oracle ZFS
Storage Appliance interface. (The RMAN backup will run for a few minutes)

-bash-3.2$ rman cmdfile=/u01/app/oracle/rman_disk_backup.rman


Recovery Manager: Release 11.2.0.2.0 - Production on Sun Sep 22
11:31:22 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates.
reserved.

All rights

RMAN> connect target


2> run {
3> sql 'alter system set "_backup_disk_bufcnt"=64';
4> sql 'alter system set "_backup_disk_bufsz"=1048576';
5> allocate channel zba1 device type disk
6> format '/DB01/XE/backup01/%U';
7> allocate channel zba2 device type disk
8> format '/DB01/XE/backup02/%U';
9> allocate channel zba3 device type disk
10> format '/DB01/XE/backup03/%U';
11> allocate channel zba4 device type disk
12> format '/DB01/XE/backup04/%U';
13> backup database;
14> backup archivelog all not backed up;
15> }
16>
connected to target database: XE (DBID=2676154581)
using target database control file instead of recovery catalog
sql statement: alter system set "_backup_disk_bufcnt"=64

15 | ORACLE OPTIMIZED SOLUTION FOR ORACLE SUPERCLUSTER BACKUP AND RECOVERY

sql statement: alter system set "_backup_disk_bufsz"=1048576


allocated channel: zba1
channel zba1: SID=46 device type=DISK
RMAN-06908: WARNING: operation will not run in parallel on the
allocated channels
RMAN-06909: WARNING: parallelism require Enterprise Edition
allocated channel: zba2
channel zba2: SID=37 device type=DISK
allocated channel: zba3
channel zba3: SID=36 device type=DISK
allocated channel: zba4
channel zba4: SID=45 device type=DISK
Starting backup at 22-SEP-13
channel zba1: starting full datafile backup set
channel zba1: specifying datafile(s) in backup set
input datafile file number=00002
name=/u01/app/oracle/oradata/XE/sysaux.dbf
channel zba1: starting piece 1 at 22-SEP-13
channel zba1: finished piece 1 at 22-SEP-13
piece handle=/DB01/XE/backup01/0kokg0so_1_1 tag=TAG20130922T113136
comment=NONE
channel zba1: backup set complete, elapsed time: 00:02:41
channel zba1: starting full datafile backup set
channel zba1: specifying datafile(s) in backup set
input datafile file number=00001
name=/u01/app/oracle/oradata/XE/system.dbf
channel zba1: starting piece 1 at 22-SEP-13
channel zba1: finished piece 1 at 22-SEP-13
piece handle=/DB01/XE/backup01/0lokg11q_1_1 tag=TAG20130922T113136
comment=NONE
channel zba1: backup set complete, elapsed time: 00:04:55
channel zba1: starting full datafile backup set
channel zba1: specifying datafile(s) in backup set
input datafile file number=00004
name=/u01/app/oracle/oradata/XE/users.dbf
channel zba1: starting piece 1 at 22-SEP-13
channel zba1: finished piece 1 at 22-SEP-13
piece handle=/DB01/XE/backup01/0mokg1b2_1_1 tag=TAG20130922T113136
comment=NONE
channel zba1: backup set complete, elapsed time: 00:00:15
channel zba1: starting full datafile backup set
channel zba1: specifying datafile(s) in backup set
input datafile file number=00003
name=/u01/app/oracle/oradata/XE/undotbs1.dbf
channel zba1: starting piece 1 at 22-SEP-13
channel zba1: finished piece 1 at 22-SEP-13
piece handle=/DB01/XE/backup01/0nokg1bi_1_1 tag=TAG20130922T113136
comment=NONE

16 | ORACLE OPTIMIZED SOLUTION FOR ORACLE SUPERCLUSTER BACKUP AND RECOVERY

channel zba1: backup set complete, elapsed time: 00:00:07


channel zba1: starting full datafile backup set
channel zba1: specifying datafile(s) in backup set
including current control file in backup set
channel zba1: starting piece 1 at 22-SEP-13
channel zba1: finished piece 1 at 22-SEP-13
piece handle=/DB01/XE/backup01/0ookg1bp_1_1 tag=TAG20130922T113136
comment=NONE
channel zba1: backup set complete, elapsed time: 00:00:10
channel zba1: starting full datafile backup set
channel zba1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel zba1: starting piece 1 at 22-SEP-13
channel zba1: finished piece 1 at 22-SEP-13
piece handle=/DB01/XE/backup01/0pokg1cj_1_1 tag=TAG20130922T113136
comment=NONE
channel zba1: backup set complete, elapsed time: 00:00:07
Finished backup at 22-SEP-13
Starting backup at 22-SEP-13
current log archived
skipping archived log file
/u01/app/oracle/fast_recovery_area/XE/archivelog/2012_09_30/o1_mf_1_6_8
6k7f28m_.arc; already backed on 02-OCT-12
skipping archived log file
/u01/app/oracle/fast_recovery_area/XE/archivelog/2012_09_30/o1_mf_1_7_8
6kgsdow_.arc; already backed on 02-OCT-12
skipping archived log file
/u01/app/oracle/fast_recovery_area/XE/archivelog/2012_10_02/o1_mf_1_8_8
6odn8y7_.arc; already backed on 02-OCT-12
skipping archived log file
/u01/app/oracle/fast_recovery_area/XE/archivelog/2012_10_02/o1_mf_1_9_8
6om30t7_.arc; already backed on 02-OCT-12
channel zba1: starting archived log backup set
channel zba1: specifying archived log(s) in backup set
input archived log thread=1 sequence=10 RECID=5 STAMP=826802566
channel zba1: starting piece 1 at 22-SEP-13
channel zba1: finished piece 1 at 22-SEP-13
piece handle=/DB01/XE/backup01/0qokg1d7_1_1 tag=TAG20130922T114023
comment=NONE
channel zba1: backup set complete, elapsed time: 00:00:08
channel zba1: starting archived log backup set
channel zba1: specifying archived log(s) in backup set
input archived log thread=1 sequence=11 RECID=6 STAMP=826803623
channel zba1: starting piece 1 at 22-SEP-13
channel zba1: finished piece 1 at 22-SEP-13
piece handle=/DB01/XE/backup01/0rokg1df_1_1 tag=TAG20130922T114023
comment=NONE
channel zba1: backup set complete, elapsed time: 00:00:01
Finished backup at 22-SEP-13
released channel: zba1
released channel: zba2
released channel: zba3

17 | ORACLE OPTIMIZED SOLUTION FOR ORACLE SUPERCLUSTER BACKUP AND RECOVERY

released channel: zba4


Recovery Manager complete.
-bash-3.2$
To monitor the backups being written to the Oracle ZFS Storage Appliance
Go back to the Oracle ZFS Storage Appliance interface and click on Status near the top right of the interface
window. Note it may take a couple of minutes to see any activity due to the performance of the virtual machines.

Verify backup completed with a status 0 from RMAN

view STDOUT from step 1.

18 | ORACLE OPTIMIZED SOLUTION FOR ORACLE SUPERCLUSTER BACKUP AND RECOVERY

Check that there was data written to the Oracle ZFS Storage Appliance
Go back to the Oracle ZFS Storage Appliance interface and click on Shares near the top center of the interface
window. Note it may take a couple of minutes to see that there has been any data written due to the performance
of the virtual machines.

Performing Database Backups to Tape


Create RMAN backup of XE database from DB01
To simplify the lab we have provided a very simple rman backup run command.

From the DB01 host as the user oracle run rman


rman cmdfile=/u01/app/oracle/rman_tape_backup.rman
After starting the rman backup move on to the next step on the OSB01 host.
(The RMAN backup will run for a few minutes)

-bash-3.2$ rman cmdfile=/u01/app/oracle/rman_tape_backup.rman


Recovery Manager: Release 11.2.0.2.0 - Production on Mon Oct 1
18:59:20 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates.
reserved.

All rights

RMAN> connect target


2> run {
3> allocate channel tc1 device type sbt;
4> backup database;
5> backup archivelog all not backed up;
6> }
7>
8>
connected to target database: XE (DBID=2676154581)
using target database control file instead of recovery catalog
allocated channel: tc1

19 | ORACLE OPTIMIZED SOLUTION FOR ORACLE SUPERCLUSTER BACKUP AND RECOVERY

channel tc1: SID=28 device type=SBT_TAPE


channel tc1: Oracle Secure Backup
Starting backup at 01-OCT-12
-bash-3.2$
Verify Backup on OSB from DB01 is running
While the backup is running you can monitor the backup job on the OSB01 host.

Using the OSB obtool command list the active jobs


obtool lsj

[root@OSB01 ~]# obtool lsj


Job ID
Sched time Contents
State
---------------- ----------- ------------------------------ -------------------------------------oracle/3
none
database XE (dbid=2676154581)
processed; Oracle job(s) scheduled
oracle/3.1
none
archivelog backup
running
since 2013/09/22.11:22
[root@OSB01 ~]#
RMAN STDOUT continued ( This will take a few minutes)

channel tc1: starting full datafile backup set


channel tc1: specifying datafile(s) in backup set
input datafile file number=00002
name=/u01/app/oracle/oradata/XE/sysaux.dbf
input datafile file number=00001
name=/u01/app/oracle/oradata/XE/system.dbf
input datafile file number=00004
name=/u01/app/oracle/oradata/XE/users.dbf
input datafile file number=00003
name=/u01/app/oracle/oradata/XE/undotbs1.dbf
channel tc1: starting piece 1 at 01-OCT-12
channel tc1: finished piece 1 at 01-OCT-12
piece handle=0fnmmbcc_1_1 tag=TAG20121001T185924 comment=API Version
2.0,MMS Version 10.4.0.2
channel tc1: backup set complete, elapsed time: 00:01:26
channel tc1: starting full datafile backup set
channel tc1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel tc1: starting piece 1 at 01-OCT-12
channel tc1: finished piece 1 at 01-OCT-12
piece handle=0gnmmbf2_1_1 tag=TAG20121001T185924 comment=API Version
2.0,MMS Version 10.4.0.2
channel tc1: backup set complete, elapsed time: 00:00:35
Finished backup at 01-OCT-12
Starting backup at 01-OCT-12
current log archived

20 | ORACLE OPTIMIZED SOLUTION FOR ORACLE SUPERCLUSTER BACKUP AND RECOVERY

skipping archived log file


/u01/app/oracle/fast_recovery_area/XE/archivelog/2012_09_30/o1_mf_1_6_8
6k7f28m_.arc; already backed on 30-SEP-12
skipping archived log file
/u01/app/oracle/fast_recovery_area/XE/archivelog/2012_09_30/o1_mf_1_7_8
6kgsdow_.arc; already backed on 30-SEP-12
skipping archived log file
/u01/app/oracle/fast_recovery_area/XE/archivelog/2012_09_30/o1_mf_1_8_8
6kjfqjg_.arc; already backed on 30-SEP-12
skipping archived log file
/u01/app/oracle/fast_recovery_area/XE/archivelog/2012_09_30/o1_mf_1_9_8
6l0pblb_.arc; already backed on 30-SEP-12
skipping archived log file
/u01/app/oracle/fast_recovery_area/XE/archivelog/2012_09_30/o1_mf_1_10_
86l0zo53_.arc; already backed on 30-SEP-12
channel tc1: starting archived log backup set
channel tc1: specifying archived log(s) in backup set
input archived log thread=1 sequence=11 RECID=6 STAMP=795553287
channel tc1: starting piece 1 at 01-OCT-12
channel tc1: finished piece 1 at 01-OCT-12
piece handle=0hnmmbg8_1_1 tag=TAG20121001T190127 comment=API Version
2.0,MMS Version 10.4.0.2
channel tc1: backup set complete, elapsed time: 00:00:35
Finished backup at 01-OCT-12
released channel: tc1
Recovery Manager complete.
Verify the backup completed with a status 0 from RMAN

view STDOUT from step 1.

Verify the backup completed successfully on the OSB01 host


When the job is completed you can verify it finished with out any errors on the OSB01 host.

Verify Backup completed with a status 0 via OSB


obtool lsj -c -T

[root@OSB01 ~]# obtool lsj -c -T


Job ID
Sched time Contents
---------------- ----------- ----------------------------------------------------------oracle/1
none
database XE (dbid=2676154581)
successfully at 2013/09/22.11:21
oracle/1.1
none
datafile backup
successfully at 2013/09/22.11:21
oracle/2
none
database XE (dbid=2676154581)
successfully at 2013/09/22.11:22
oracle/2.1
none
datafile backup
successfully at 2013/09/22.11:22
oracle/3
none
database XE (dbid=2676154581)
successfully at 2013/09/22.11:23

21 | ORACLE OPTIMIZED SOLUTION FOR ORACLE SUPERCLUSTER BACKUP AND RECOVERY

State
--------completed
completed
completed
completed
completed

oracle/3.1
none
archivelog backup
successfully at 2013/09/22.11:23
[root@OSB01 ~]#

completed

Recover the Database


The following sections cover how to perform database restores that are stored on disk or tape.
The following sections are done on the DB01 host logged in as root and then logged in as oracle in the terminal
window. To access the oracle user on the DB01 host login as root then super user to oracle as seen below.

[root@DB01 ~]# su - oracle


-bash-3.2$

Performing Database Recovery From Disk


Breaking the Database
The following sections will remove a data file to be restored in the following sections.
Simulate losing a data file
In order to simulate a recovery event we will rip a data file out from under the XE instance.

On the DB01 host move the users.dbf file out of the way.
mv /u01/app/oracle/oradata/XE/users.dbf
/u01/app/oracle/oradata/XE/_users.dbf

-bash-3.2$ mv /u01/app/oracle/oradata/XE/users.dbf
/u01/app/oracle/oradata/XE/_users.dbf
-bash-3.2$
Offline Affected table users table
As the oracle user on DB01 we will take this table offline

Run sqlplus
SHELL> sqlplus / as sysdba
SQL> alter tablespace users offline immediate;
SQL> quit

-bash-3.2$ sqlplus / as sysdba


SQL*Plus: Release 11.2.0.2.0 Production on Sun Sep 22 12:18:18 2013
Copyright (c) 1982, 2011, Oracle.

All rights reserved.

22 | ORACLE OPTIMIZED SOLUTION FOR ORACLE SUPERCLUSTER BACKUP AND RECOVERY

Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit
Production
SQL> alter tablespace users offline immediate;
Tablespace altered.
SQL> quit
Disconnected from Oracle Database 11g Express Edition Release
11.2.0.2.0 - 64bit Production
-bash-3.2$
Verify table space is in recover status
Before we recover lets verify the database is broken. For this task we created a simple canned sql query.

As the oracle user on DB01 host run the following from oracles home directory
sqlplus / as sysdba @check_table.sql
Should show table in RECOVER status

-bash-3.2$ sqlplus / as sysdba @check_table.sql


SQL*Plus: Release 11.2.0.2.0 Production on Sun Sep 22 12:19:06 2013
Copyright (c) 1982, 2011, Oracle.

All rights reserved.

Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit
Production
NAME
------------------------------------------------------------------------------STATUS
------/u01/app/oracle/oradata/XE/users.dbf
RECOVER
Disconnected from Oracle Database 11g Express Edition Release
11.2.0.2.0 - 64bit Production
-bash-3.2$

Recovering the Database


Now that we have taken a backup, and broken the database lets recover it from our backup.

23 | ORACLE OPTIMIZED SOLUTION FOR ORACLE SUPERCLUSTER BACKUP AND RECOVERY

Start the database restore


This step needs to be run from the oracle user ID home directory to make sure the script is available.

Run the cd command to make sure you are in the oracle user ID home directory
Run rman cmdfile=rman_disk_restore.rman
Example:

-bash-3.2$ cd
-bash-3.2$ rman cmdfile=rman_disk_restore.rman
Recovery Manager: Release 11.2.0.2.0 - Production on Sun Sep 22
12:25:13 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates.
reserved.

All rights

RMAN> connect target


2> run {
3> sql 'alter system set "_backup_disk_bufcnt"=64';
4> sql 'alter system set "_backup_disk_bufsz"=1048576';
5> allocate channel zba1 device type disk
6> format '/DB01/XE/backup01/%U';
7> allocate channel zba2 device type disk
8> format '/DB01/XE/backup02/%U';
9> allocate channel zba3 device type disk
10> format '/DB01/XE/backup03/%U';
11> allocate channel zba4 device type disk
12> format '/DB01/XE/backup04/%U';
13> SQL "alter tablespace users offline immediate";
14> restore tablespace users;
15> recover tablespace users delete archivelog maxsize 2M;
16> SQL "alter tablespace users online";
17> }
18>
connected to target database: XE (DBID=2676154581)
using target database control file instead of recovery catalog
sql statement: alter system set "_backup_disk_bufcnt"=64
sql statement: alter system set "_backup_disk_bufsz"=1048576
allocated channel: zba1
channel zba1: SID=41 device type=DISK
RMAN-06908: WARNING: operation will not run in parallel on the
allocated channels
RMAN-06909: WARNING: parallelism require Enterprise Edition
allocated channel: zba2
channel zba2: SID=42 device type=DISK
allocated channel: zba3

24 | ORACLE OPTIMIZED SOLUTION FOR ORACLE SUPERCLUSTER BACKUP AND RECOVERY

channel zba3: SID=28 device type=DISK


allocated channel: zba4
channel zba4: SID=33 device type=DISK
sql statement: alter tablespace users offline immediate
Starting restore at 22-SEP-13
channel zba1: starting datafile backup set restore
channel zba1: specifying datafile(s) to restore from backup set
channel zba1: restoring datafile 00004 to
/u01/app/oracle/oradata/XE/users.dbf
channel zba1: reading from backup piece
/DB01/XE/backup01/0mokg1b2_1_1
channel zba1: piece handle=/DB01/XE/backup01/0mokg1b2_1_1
tag=TAG20130922T113136
channel zba1: restored backup piece 1
channel zba1: restore complete, elapsed time: 00:00:07
Finished restore at 22-SEP-13
Starting recover at 22-SEP-13
starting media recovery
media recovery complete, elapsed time: 00:00:01
Finished recover at 22-SEP-13
sql statement: alter tablespace users online
released channel: zba1
released channel: zba2
released channel: zba3
released channel: zba4
Recovery Manager complete.
-bash-3.2$
Verify the table space users recovered
Check the status of the table space with the following commands.

sqlplus / as sysdba @check_table.sql


As oracle from oracle users home dir run the following
bash-3.2$ sqlplus / as sysdba @check_table.sql

-bash-3.2$ sqlplus / as sysdba @check_table.sql


SQL*Plus: Release 11.2.0.2.0 Production on Sun Sep 22 12:22:03 2013
Copyright (c) 1982, 2011, Oracle.

All rights reserved.

25 | ORACLE OPTIMIZED SOLUTION FOR ORACLE SUPERCLUSTER BACKUP AND RECOVERY

Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit
Production
NAME
------------------------------------------------------------------------------STATUS
------/u01/app/oracle/oradata/XE/users.dbf
ONLINE
Disconnected from Oracle Database 11g Express Edition Release
11.2.0.2.0 - 64bit Production
-bash-3.2$

Performing Database Recovery From Tape


Breaking the Database
The following sections will remove a data file to be restored in the following sections.
Simulate losing a data file
In order to simulate a recovery event we will rip a data file out from under the XE instance.

On the DB01 host move the users.dbf file out of the way.
mv /u01/app/oracle/oradata/XE/users.dbf
/u01/app/oracle/oradata/XE/_users.dbf

-bash-3.2$ mv /u01/app/oracle/oradata/XE/users.dbf
/u01/app/oracle/oradata/XE/_users.dbf
-bash-3.2$
Offline Affected table users table
As the oracle user on DB01 we will take this table offline

Run sqlplus
SHELL> sqlplus / as sysdba
SQL> alter tablespace users offline immediate;
SQL> quit

-bash-3.2$ sqlplus / as sysdba


SQL*Plus: Release 11.2.0.2.0 Production on Sun Sep 22 12:18:18 2013

26 | ORACLE OPTIMIZED SOLUTION FOR ORACLE SUPERCLUSTER BACKUP AND RECOVERY

Copyright (c) 1982, 2011, Oracle.

All rights reserved.

Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit
Production
SQL> alter tablespace users offline immediate;
Tablespace altered.
SQL> quit
Disconnected from Oracle Database 11g Express Edition Release
11.2.0.2.0 - 64bit Production
-bash-3.2$

Verify table space is in recover status


Before we recover lets verify the database is broken. For this task we created a simple canned sql query.

As the oracle user on DB01 host run the following from oracles home directory
sqlplus / as sysdba @check_table.sql
Should show table in RECOVER status

-bash-3.2$ sqlplus / as sysdba @check_table.sql


SQL*Plus: Release 11.2.0.2.0 Production on Sun Sep 22 12:19:06 2013
Copyright (c) 1982, 2011, Oracle.

All rights reserved.

Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit
Production
NAME
------------------------------------------------------------------------------STATUS
------/u01/app/oracle/oradata/XE/users.dbf
RECOVER
Disconnected from Oracle Database 11g Express Edition Release
11.2.0.2.0 - 64bit Production
-bash-3.2$

27 | ORACLE OPTIMIZED SOLUTION FOR ORACLE SUPERCLUSTER BACKUP AND RECOVERY

Recovering the Database


Now that we have taken a backup, and broken the database lets recover it from our backup.
Start the database restore
This step needs to be run from the oracle user ID home directory to make sure the script is available.

Run the cd command to make sure you are in the oracle user ID home directory
Run rman cmdfile=rman_tape_recover.rman
Example:

-bash-3.2$ cd
-bash-3.2$ rman cmdfile=rman_tape_recover.rman
Recovery Manager: Release 11.2.0.2.0 - Production on Sun Sep 22
12:19:40 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates.
reserved.

All rights

RMAN> connect target;


2> run {
3> allocate channel tc1 device type sbt;
4> SQL "alter tablespace users offline immediate";
5> restore tablespace users;
6> recover tablespace users delete archivelog maxsize 2M;
7> SQL "alter tablespace users online";
8> }
9>
connected to target database: XE (DBID=2676154581)
using target database control file instead of recovery catalog
allocated channel: tc1
channel tc1: SID=41 device type=SBT_TAPE
channel tc1: Oracle Secure Backup
sql statement: alter tablespace users offline immediate
Starting restore at 22-SEP-13
channel tc1: starting datafile backup set restore
channel tc1: specifying datafile(s) to restore from backup set
channel tc1: restoring datafile 00004 to
/u01/app/oracle/oradata/XE/users.dbf
channel tc1: reading from backup piece 0hokg05d_1_1
channel tc1: piece handle=0hokg05d_1_1 tag=TAG20130922T111908
channel tc1: restored backup piece 1
channel tc1: restore complete, elapsed time: 00:00:55
Finished restore at 22-SEP-13
Starting recover at 22-SEP-13

28 | ORACLE OPTIMIZED SOLUTION FOR ORACLE SUPERCLUSTER BACKUP AND RECOVERY

starting media recovery


archived log for thread 1 with sequence 10 is already on disk as file
/u01/app/oracle/fast_recovery_area/XE/archivelog/2013_09_22/o1_mf_1_10_
93y9v452_.arc
archived log for thread 1 with sequence 11 is already on disk as file
/u01/app/oracle/fast_recovery_area/XE/archivelog/2013_09_22/o1_mf_1_11_
93ybw6xv_.arc
archived log file
name=/u01/app/oracle/fast_recovery_area/XE/archivelog/2013_09_22/o1_mf_
1_10_93y9v452_.arc thread=1 sequence=10
media recovery complete, elapsed time: 00:00:00
Finished recover at 22-SEP-13
sql statement: alter tablespace users online
released channel: tc1
Recovery Manager complete.
-bash-3.2$
Verify the table space users recovered
Check the status of the table space with the following commands.

sqlplus / as sysdba @check_table.sql


As oracle from oracle users home dir run the following
bash-3.2$ sqlplus / as sysdba @check_table.sql

-bash-3.2$ sqlplus / as sysdba @check_table.sql


SQL*Plus: Release 11.2.0.2.0 Production on Sun Sep 22 12:22:03 2013
Copyright (c) 1982, 2011, Oracle.

All rights reserved.

Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit
Production
NAME
------------------------------------------------------------------------------STATUS
------/u01/app/oracle/oradata/XE/users.dbf
ONLINE
Disconnected from Oracle Database 11g Express Edition Release
11.2.0.2.0 - 64bit Production

29 | ORACLE OPTIMIZED SOLUTION FOR ORACLE SUPERCLUSTER BACKUP AND RECOVERY

30 | ORACLE OPTIMIZED SOLUTION FOR ORACLE SUPERCLUSTER BACKUP AND RECOVERY

Conclusion
Though this has been a very brief tour of database backup and recovery we hope it has been helpful to you. You
can build your own virtual machines and download the Oracle ZFS Storage Appliance simulator to build your own
environment. Oracle does not publicly distribute these labs in full, but they very simple to build.

31 | ORACLE OPTIMIZED SOLUTION FOR ORACLE SUPERCLUSTER BACKUP AND RECOVERY

References
DESCRIPTION

URL

Oracle Secure Backup software

http://www.oracle.com/technetwork/products/secure-backup/overview/index.html

Oracle Sun servers

http://www.oracle.com/us/products/servers/overview/index.html

Oracle Solaris 11

http://www.oracle.com/technetwork/server-storage/solaris11/overview/index.html

Oracle Solaris Cluster technical

http://www.oracle.com/technetwork/server-storage/solaris-cluster/overview/index.html

resources
Oracle Linux

http://www.oracle.com/us/technologies/linux/overview/index.htm

Oracle Enterprise Manager

http://www.oracle.com/us/products/enterprise-manager/index.html

StorageTek ACSLS Manager

http://www.oracle.com/us/products/servers-storage/storage/tape-

Software

storage/acsls/overview/index.html

Oracle Key Manager

http://www.oracle.com/us/products/servers-storage/storage/storagesoftware/oraclekeymanager/overview/index.html

Oracle storage products

http://www.oracle.com/us/products/storage/overview/index.html

Oracle Optimized Solutions

http://www.oracle.com/technetwork/server-storage/hardware-solutions/index.html

Oracle Optimized Solution for

MOS Note #1558851.1

Backup and
Recovery

32 | ORACLE OPTIMIZED SOLUTION FOR ORACLE SUPERCLUSTER BACKUP AND RECOVERY

Oracle Corporation, World Headquarters

Worldwide Inquiries

500 Oracle Parkway

Phone: +1.650.506.7000

Redwood Shores, CA 94065, USA

Fax: +1.650.506.7200

CONNECT WITH US

blogs.oracle.com/oracle

twitter.com/oracle

Copyright 2014, Oracle and/or its affiliates. All rights reserved. This document is provided for information purposes only, and the
contents hereof are subject to change without notice. This document is not warranted to be error-free, nor subject to any other
warranties or conditions, whether expressed orally or implied in law, including implied warranties and conditions of merchantability or
fitness for a particular purpose. We specifically disclaim any liability with respect to this document, and no contractual obligations are
formed either directly or indirectly by this document. This document may not be reproduced or transmitted in any form or by any
means, electronic or mechanical, for any purpose, without our prior written permission.

oracle.com

Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

facebook.com/oracle

Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and
are trademarks or registered trademarks of SPARC International, Inc. AMD, Opteron, the AMD logo, and the AMD Opteron logo are
trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group. 0814

Das könnte Ihnen auch gefallen