LokkBox Oracle Backup and Restore
LokkBox Oracle Backup and Restore
LokkBox Oracle Backup and Restore
DOCUMENTATION
ORACLE BACKUP & RESTORE OPERATIONS
Copyright Notice
The use and copying of this product is subject to a license agreement. Any other use is prohibited. No part of this publication may be
reproduced, transmitted, transcribed, stored in a retrieval system or translated into any language in any form by any means without the prior
written consent of us. Information in this manual is subject to change without notice and does not represent a commitment on the part of the
vendor. We do not warrant that this document is error free. If you find any errors in this document, please report to us in writing.
This product includes software developed by the Apache Software Foundation (http://www.apache.org/).
Trademarks
Microsoft, Windows, Microsoft Exchange Server and Microsoft SQL Server are registered trademarks of Microsoft Corporation.
Sun, Solaris, SPARC, Java and Java Runtime Environment are registered trademarks of Sun Microsystems Inc.
Oracle, Oracle 8i, Oracle 9i are registered trademarks of Oracle Corporation.
Lotus, Domino, Notes are registered trademark of IBM Corporation.
Red Hat is registered trademark of Red Hat, Inc.
Linux is registered trademark of Linus Torvalds.
Apple and Mac OS X are registered trademarks of Apple Computer, Inc.
All other product names are registered trademarks of their respective owners.
Disclaimer
Lokkbox LLC will not have or accept any liability, obligation or responsibility whatsoever for any loss, destruction or damage (including
without limitation consequential loss, destruction or damage) however arising from or in respect of any use or misuse of or reliance on this
document. By reading and following the instructions in this document, you agree to accept unconditionally the terms of this Disclaimer and as
they may be revised and/or amended from time to time by Lokkbox LLC without prior notice to you.
ORACLE BACKUP & RESTORE OPERATIONS
1 Backup/Restore Oracle 8i/9i/10g/11g
This chapter will describe in details how Lokkbox OBM backup your Oracle Database Server and how
you can restore an Oracle database using the backup files.
1.1 Requirements
i. Lokkbox OBM must be installed onto the computer that can connect to your Oracle
Database Server using TCP/IP protocol.
ii. Data from Oracle database will be backed up to a temporary directory before they are
sent to Lokkbox OBS. Please make sure you have sufficient space on your computer
to store these data when you run the backup job.
iii. Database must be in archived log mode
For Oracle 8i
connect internal;
d. Shutdown database
shutdown immediate
e. Start and mount database
startup mount
f. Switch database to archived log mode
ORACLE BACKUP & RESTORE OPERATIONS
Oracle 10g Example:
$ export ORACLE_SID=GDB1
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Database altered.
Database altered.
ORACLE BACKUP & RESTORE OPERATIONS
a. Grant permission to system account
For Oracle 8i
SVRMGRL> @?/javavm/install/initjvm.sql;
SVRMGRL> @?/rdbms/admin/catalog.sql;
SVRMGRL> @?/rdbms/admin/catproc.sql;
SVRMGRL> @?/javavm/install/initdbj.sql;
Grant succeeded.
1.2 Overview
Lokkbox OBM will backup your Oracle database by taking the following steps.
ORACLE BACKUP & RESTORE OPERATIONS
iv. If the backup type to run is [Archived Log Backup type],
f. all archived log files will be copied to the temporary directory specified by this
backup set
v. Run all Post-Commands of this backup set
vi. Upload all files copied to the temporary directory to Lokkbox OBS
vii. Remove temporary files from the temporary directory
Note:
If your Oracle database is running on Windows, please install Lokkbox OBM onto the company
running the Oracle database if Lokkbox OBM is to backup this Oracle database. This would shorten
the time required to backup the Oracle database.
ORACLE BACKUP & RESTORE OPERATIONS
e. Enter the system password, the Oracle Database Server Host Name, TNS Port
and SID.
f. Select the tablespace(s) you want to backup.
ORACLE BACKUP & RESTORE OPERATIONS
g. Set the backup schedule for database backup and archived log backup.
Note: You can have more than one schedule in a backup set, i.e. you can
perform intra-day transaction log backup by adding more than one daily
transaction log backup schedule to your backup set.
h. Set the encryption algorithm, encryption mode and encrypting key for this
backup set.
ORACLE BACKUP & RESTORE OPERATIONS
a. Press the [Backup] button on the main page of Lokkbox OBM dialog.
b. Select the backup type (e.g. Database Backup, Archived Log Backup) you
would like to perform. Select the backup set you want to run and select [Online
Backup Service] to start backing up your files to Lokkbox OBS. If applicable, you
can change the In-File Delta Type also.
ORACLE BACKUP & RESTORE OPERATIONS
d. When the backup finished, you should see Backup Completed Successfully.
Page 9 of 28
Last updated: August 11, 2009
ORACLE BACKUP & RESTORE OPERATIONS
1.4 How to restore an Oracle Database
Please follow the instructions below to restore your Oracle 9i/10g/11g databases from Lokkbox OBS.
Please refer to the [Quick Start - Backup File] section for information on how to
download backup files from Lokkbox OBS.
$ export ORACLE_SID=GDB1
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
ORACLE BACKUP & RESTORE OPERATIONS
For recovering a database that currently does not exist
Control files, data files and archived logs are stored on Lokkbox OBS along with
their full path information. You just need to put all these files back to their original
locations when performing a database restore.
For example:
/obm_restore/Oracle Database
Server/oracle/product/10.2.0/db_1/dbs/spfileGDB1.ora
/obm_restore/Oracle Database
Server/oracle/product/10.2.0/db_1/flash_recovery_area/GDB1/
Move to
/oracle/product/10.2.0/db_1/admin/GDB1/
/oracle/product/10.2.0/db_1/dbs/initGDB1.ora
/oracle/product/10.2.0/db_1/dbs/spfileGDB1.ora
/oracle/product/10.2.0/db_1/flash_recovery_area/GDB1/
/oracle/product/10.2.0/db_1/oradata/GDB1/
ORACLE BACKUP & RESTORE OPERATIONS
iv. Rename database files (Only for restoring database to a new location)
For example:
background_dump_dest = /oracle/OraHome1/admin/GDB2/bdump
control_files = (/oracle/OraHome1/oradata/GDB2/control01.ctl,
/oracle/OraHome1/oradata/GDB2/control02.ctl,
/oracle/OraHome1/oradata/GDB2/control03.ctl)
core_dump_dest = /oracle/OraHome1/admin/GDB2/cdump
user_dump_dest = /oracle/OraHome1/admin/GDB2/udump
Change to
background_dump_dest = /new_db_location/OraHome1/admin/GDB2/bdump
control_files = (/new_db_location/OraHome1/oradata/GDB2/control01.ctl,
/new_db_location/OraHome1/oradata/GDB2/control02.ctl,
/new_db_location/OraHome1/oradata/GDB2/control03.ctl)
core_dump_dest = /new_db_location/OraHome1/admin/GDB2/cdump
user_dump_dest = /new_db_location/OraHome1/admin/GDB2/udump
b. You may need to quote the values of dispatchers as a single argument.
ORACLE BACKUP & RESTORE OPERATIONS
Open the trace file that just created, and then check for the filename of each
datafile, log file and tempfile.
For example:
ORACLE BACKUP & RESTORE OPERATIONS
'/oracle/product/10.2.0/db_1/oradata/GDB1/redo01.log' TO
'/new_db_location/oradata/GDB1/redo01.log';
$ export ORACLE_SID=GDB1
Database altered.
ORACLE BACKUP & RESTORE OPERATIONS
'/new_db_location/oradata/GDB1/system01.dbf';
Database altered.
Database altered.
Database altered.
Database altered.
Database altered.
Database altered.
Database altered.
Database altered.
ORACLE BACKUP & RESTORE OPERATIONS
Database altered.
v. Restore Database
$ rman target /
c. Start and mount database
e.g. /oracle/OraHome1/dbs/o1_mf_1_2_3m5h1svs_.arc
/oracle/OraHome1/dbs/o1_mf_1_3_3m5h1yby_.arc
in this case, the sequence number of archived redo log is 4.
e. Open database
$ export ORACLE_SID=GDB1
$ rman target /
ORACLE BACKUP & RESTORE OPERATIONS
ORACLE BACKUP & RESTORE OPERATIONS
/oracle/product/10.2.0/db_1/flash_recovery_area/GDB1/archivelog/2007_11_08/o1_mf_1_3_3m5h1yb
y_.arc
archive log
filename=/oracle/product/10.2.0/db_1/flash_recovery_area/GDB1/archivelog/2007_11_08/o1_mf_1_2_
3m5h1svs_.arc thread=1 sequence=2
archive log
filename=/oracle/product/10.2.0/db_1/flash_recovery_area/GDB1/archivelog/2007_11_08/o1_mf_1_3_
3m5h1yby_.arc thread=1 sequence=3
media recovery complete, elapsed time: 00:00:01
Finished recover at 08-NOV-07
database opened
For Oracle 8i
$ svrmgrl
c. Connect to the target database
Oracle 8i Example:
$ svrmgrl
ORACLE BACKUP & RESTORE OPERATIONS
ORACLE instance started.
Total System Global Area 95874448 bytes
Fixed Size 64912 bytes
Variable Size 52744192 bytes
Database Buffers 40960000 bytes
Redo Buffers 2105344 bytes
Database mounted.
vi. (Optional) Create Net Service Name and Database Service Listener
ORACLE BACKUP & RESTORE OPERATIONS
$ netmgr
expand [Oracle Net Configuration]
expand [Local]
select [Service Naming]
click “+” icon on the toolbar
Net Service Name Wizard will be launched to guide you through creating a net
service name
click [File] on the menu bar
[Save Network Configuration] on the menu bar
ORACLE BACKUP & RESTORE OPERATIONS
1.5 How to restore a single tablespace
Restoring a tablespace required a backup of datafiles consistent with the existing archived logs and
control files, as redo will be applied during the restore operation.
Please follow the instructions below to restore a tablespace from Lokkbox OBS.
Please refer to the [Quick Start - Backup File] section for information on how to
download backup files from Lokkbox OBS.
ii. Set ORACLE_SID to your databaseʼs System Identifier (SID)
$ sqlplus “/ as sysdba”
iv. Shutdown database
Datafile names and paths can be found by using the REPORT SCHEMA command.
$ rman target /
c. Start and mount database
For example:
ORACLE BACKUP & RESTORE OPERATIONS
/oracle/OraHome1/oradata/GDB1/undotbs01.dbf
3 20480 CWMLITE ***
/oracle/OraHome1/oradata/GDB1/cwmlite01.dbf
4 20480 DRSYS *** /oracle/OraHome1/oradata/GDB1/drsys01.dbf
5 141440 EXAMPLE ***
/oracle/OraHome1/oradata/GDB1/example01.dbf
6 25600 INDX *** /oracle/OraHome1/oradata/GDB1/indx01.dbf
7 20480 ODM *** /oracle/OraHome1/oradata/GDB1/odm01.dbf
8 10240 TOOLS *** /oracle/OraHome1/oradata/GDB1/tools01.dbf
9 25600 USERS *** /oracle/OraHome1/oradata/GDB1/users01.dbf
10 39040 XDB *** /oracle/OraHome1/oradata/GDB1/xdb01.dbf
11 0 TS1 *** /oracle/OraHome1/oradata/GDB1/TS1_datafile1.dbf
12 0 TS1 *** /oracle/OraHome1/oradata/GDB1/TS1_datafile2.dbf
13 0 TS1 *** /oracle/OraHome1/oradata/GDB1/TS1_datafile3.dbf
e. Put all the downloaded backup of datafile/s that constitute the tablespace to the
listed location
For example:
/obm_restore/Oracle Database
Server/oracle/OraHome1/oradata/GDB1/TS1_datafile1.dbf
/obm_restore/Oracle Database
Server/oracle/OraHome1/oradata/GDB1/TS1_datafile2.dbf
/obm_restore/Oracle Database
Server/oracle/OraHome1/oradata/GDB1/TS1_datafile3.dbf
Move to
/oracle/OraHome1/oradata/GDB1/TS1_datafile1.dbf
/oracle/OraHome1/oradata/GDB1/TS1_datafile2.dbf
/oracle/OraHome1/oradata/GDB1/TS1_datafile3.dbf
ORACLE BACKUP & RESTORE OPERATIONS
If your datafiles does not consistent with the database, you should see:
In this case, you need to find the consistent datafiles in order to restore the
tablespace.
Page 23 of 28
Last updated: August 11, 2009
ORACLE BACKUP & RESTORE OPERATIONS
In this case, you need to find the missing archive log files in order to restore the
tablespace.
i. Open database
$ export ORACLE_SID=GDB1
$ rman target /
ORACLE BACKUP & RESTORE OPERATIONS
database mounted
ORACLE BACKUP & RESTORE OPERATIONS
database opened
ORACLE BACKUP & RESTORE OPERATIONS
1.6 Export and Import a Database (Logical Backup)
While physical backup of database files permit the full reconstruction of database, logical backup is a
useful supplement to physical backup for some purposes. For instance, logical backup using the
export and import utilities are the only method that Oracle supports for moving an existing database
from one platform to another.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Export done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
///////////////////////
// ... exporting ... //
///////////////////////
. exporting dimensions
. exporting post-schema procedural objects and actions
. exporting user history table
. exporting default and system auditing options
. exporting statistics
Export terminated successfully without warnings.
ORACLE BACKUP & RESTORE OPERATIONS
Please refer to the document ʻBacking up filesʼ available on www.lokkbox.com for
information on how to upload backup files to Lokkbox OBS.
iv. Import the full database from the downloaded backup of dump file
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
///////////////////////
// ... importing ... //
///////////////////////