Beruflich Dokumente
Kultur Dokumente
Recovery
Zero to Database Backup and Recovery in 60 Minutes
ORACLE HANDS ON LAB
Table of Contents
Lab Overview
Environment Overview
Environment Start Up
Getting Started
11
12
12
12
13
13
14
15
15
15
To monitor the backups being written to the Oracle ZFS Storage Appliance
18
18
Check that there was data written to the Oracle ZFS Storage Appliance
19
19
19
20
21
21
22
22
22
22
22
23
24
25
26
26
26
26
27
28
28
29
Conclusion
31
References
32
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.
1 |
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.
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.
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
Now login with the Username root and the Password root and then click on LOGIN.
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.
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.
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.
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.
The ZFS Storage Appliance is now configured and ready for use. Keep the interface open to monitor backups
later on in the lab.
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.
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%
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
2012 XE
(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.
[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.
[all]
XE
[all]
DB01
[none]
[any]
osb01_db01_mf
undefined
1 hour
7ffb4dde-ed0e-102f-a3c5-0800278d216a
All rights
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.
All rights
State
--------completed
completed
completed
completed
completed
oracle/3.1
none
archivelog backup
successfully at 2013/09/22.11:23
[root@OSB01 ~]#
completed
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
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
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$
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
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$
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
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$
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
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$
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
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
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.
References
DESCRIPTION
URL
http://www.oracle.com/technetwork/products/secure-backup/overview/index.html
http://www.oracle.com/us/products/servers/overview/index.html
Oracle Solaris 11
http://www.oracle.com/technetwork/server-storage/solaris11/overview/index.html
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
http://www.oracle.com/us/products/enterprise-manager/index.html
http://www.oracle.com/us/products/servers-storage/storage/tape-
Software
storage/acsls/overview/index.html
http://www.oracle.com/us/products/servers-storage/storage/storagesoftware/oraclekeymanager/overview/index.html
http://www.oracle.com/us/products/storage/overview/index.html
http://www.oracle.com/technetwork/server-storage/hardware-solutions/index.html
Backup and
Recovery
Worldwide Inquiries
Phone: +1.650.506.7000
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