Professional Documents
Culture Documents
Zacharie AMELI TCHOUALA (frzack@yahooฺcom) has a non-transferable license to use this Student Guideฺ
Zacharie AMELI TCHOUALA (frzack@yahooฺcom) has a non-transferable license to use this Student Guideฺ
s a
)h a
m
co eฺ
o ฺ
o uid
a h
y 12c:
Oracle Database @ n t GBackup
k de
ac tuWorkshop
and Recovery
f r z S
A ( i s
L
AActivitysGuide
e t h
U
C HO e to u
2 0T ens
L I% le lic
A ME erab
a r ie nsf
a c h -tra
Z non
D78850GC10
Edition 1.0
August 2013
D83661
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Disclaimer
This document contains proprietary information and is protected by copyright and other intellectual property laws. You may copy and
print this document solely for your own use in an Oracle training course. The document may not be modified or altered in any way.
Except where your use constitutes "fair use" under copyright law, you may not use, share, download, upload, copy, print, display,
perform, reproduce, publish, license, post, transmit, or distribute this document in whole or in part without the express authorization
of Oracle.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
The information contained in this document is subject to change without notice. If you find any problems in the document, please
report them in writing to: Oracle University, 500 Oracle Parkway, Redwood Shores, California 94065 USA. This document is not
warranted to be error-free.
If this documentation is delivered to the United States Government or anyone using the documentation on behalf of the United
States Government, the following notice is applicable:
o uid
y a h
Author @ n t G
Maria Billings
k
ac tude
f r z
Technical Contributors and Reviewers L A ( this S
Chris Andrews,Tim Chien, Donna Cooksey,
A Constantin,
URaluca se Stefan Dolea, Gerlinde
H
Frenzen, Joel Goodman, Daniela Hansell,
O t o u
Dominique Jeunot, Sean Kim, Gwen Lazenby,
Naoki Kato, Olga Krakovna, Cris0 T C sPavan
Pedregal, e
% 2 c e nBreederode, Lachlan Williams Sangar, Ron Soltani,
Nisankara Rao, Puneet
E LI ble li
Jim Spiller, Branislav Valny, Harald van
A M e rausing: oracletutor
This book i ewas f
published
s
c h ar tran
Za non-
Table of Contents
Practices for Lesson 1: Introduction ..............................................................................................................1-1
Practices for Lesson 1: Overview ...................................................................................................................1-2
Practice 1-1: Exploring the Course Environment ...........................................................................................1-3
Practices for Lesson 2: Getting Started .........................................................................................................2-1
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
r i e
Practice 5-2:
A a fBackup
Creatings er Schedule.....................................................................................................5-5
c ha for Lesson
Practices
- t r an6: Creating Backups ....................................................................................................6-1
a onfor Lesson 6: Overview...................................................................................................................6-2
Z Practices
n
Practice 6-1: Configuring Block Change Tracking ..........................................................................................6-3
Practice 6-2: Using Incremental Backup ........................................................................................................6-4
Practices for Lesson 7: Improving Your Backups ........................................................................................7-1
Practices for Lesson 7: Overview ...................................................................................................................7-2
Practice 7-1: Backing up Other Database Files .............................................................................................7-3
Practice 7-2: Backing up ASM Metadata........................................................................................................7-14
Practice 7-3: Creating an Archival Backup .....................................................................................................7-16
Practices for Lesson 8: Using RMAN-Encrypted Backups...........................................................................8-1
Practices for Lesson 8: Overview ...................................................................................................................8-2
Practice 8-1: Encrypting a Backup with RMAN ..............................................................................................8-3
Practice 8-2: Restoring an Encrypted Backup ................................................................................................8-7
Practices for Lesson 9: Diagnosing Database Failure ..................................................................................9-1
Practices for Lesson 9: Overview ...................................................................................................................9-2
Practice 9-1: Diagnosing and Repairing Database Failure .............................................................................9-3
Practice 9-2: Performing and Analyzing Instance Recovery ..........................................................................9-7
Practice 9-3: Analyzing Database Failure in ASM ..........................................................................................9-11
Practice 9-4: Repairing Block Corruption .......................................................................................................9-15
Copyright © 2013. Oracle and/or its affiliates. All rights reserved.
2 T ns
0 ............................................................................................................14-11
Practice 14-3: Using Flashback Table
Practices for Lesson 15:L %
I leDatabase
Flashback
c e
li ..............................................................................................15-1
E
M 15: Overview
Practices for Lesson ab.................................................................................................................15-2
A
e ns f e r
a r i
Practice 15-1: Enabling Flashback Logging ...................................................................................................15-3
s a
Important Note )h a
m
co eฺ
o
o uidฺ
y a h
You can expect to find slight difference in sample outputs,kscreen@ n t G
a c d e
shots, etc. between
the training environment you are working on and what
( frz is sgiven
S tuin eKit (course material).
Since OU courses might have more than one
A LA e hi
trainingtenvironment such as Desktop,
Grid, Cloud environment etc. we are bound
H OU ttoo see
us slight differences.
Some of the known differences 0 T C
are: nse
I % 2 i c e
• Difference E L
in numberlof l
e available ASM disks / shared disk devices.
M a b
r i
• Slight e Adifference
s f erin sample outputs and screen grabs.
a c ha -tran
Z non
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
Practices for @ Lessonn t G1:
k
ac tude
Introduction
( f r z S
L A h i s
U AChapterse1 t
C HO e to u
2 0T ens
L I% le lic
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
Assumptions
The student has an ACES environment with a Linux operating system. Preinstalled are:
• Oracle Database 12c (12.1) with three active database instances:
• orcl (your main training database using Automatic Storage Management (ASM)
with its +ASM instance
• rcat (for your RMAN catalog)
• em12rep (for Oracle Enterprise Manager Cloud Control).
• Oracle Enterprise Manager Cloud Control s a
Staged software includes: )h a
m
co eฺ
• Oracle Secure Backup
o ฺ
o uid
y a h
Tasks
@ n t G
k
ac tude
1. Log in to the machine as oracle with the password of oracle.
f r z S icon or by right-
2. Open a terminal window, either by double-clicking( on the Terminal
L i
Ain Terminal.
h s
A se t
clicking the mouse button and selecting Open
U
H O to uorcl, rcat and em12rep. Confirm this, for
3. There should be four instances running: +ASM,
example, by using the pgrep C e command which displays the process monitor
(pmon) background process 0 T
2 ice
-lf pmon
with itsn s
instance name.
$ pgrep E
I %
-lf pmonle l
L
14366A f e ab
Mora_pmon_emrep
r
a ie ora_pmon_rcat
r19558 n s
h r a
Zac no21223n-t ora_pmon_orcl
23313 asm_pmon_+ASM
$
4. Optionally, if you want to see all processes associated with the orcl instance, use the
pgrep –lf orcl command.
$ pgrep -lf orcl
. . .
21271 oracle+ASM_asmb_orcl
(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
21273 ora_mmnl_orcl
. . .
The oracle+ASM_asmb_orcl process shows you that the ORCL instance is using ASM.
Note: The output above is abbreviated to save space and avoid cluttering this document
with information that is not required for a specific task.
$ su - grid
Password: oracle <<< not displayed >>>
$ . oraenv
ORACLE_SID = [grid] ? +ASM
The Oracle base has been changed from /u01/app/oracle to
/u01/app/grid
$
6. a
Confirm that the listener is listening for each of the four instances. (You will see additional
s
XDB instances.)
) h a
$ lsnrctl status m
co12-JUN-
o o ฺ eฺ
LSNRCTL for Linux: Version 12.1.0.1.0 - Production
a h on
u i d
2013 10:21:08 y t G
c
Copyright (c) 1991, 2013, Oracle. All rights
a k@ dreserved.
e n
( frz s Stu
Connecting to
A LA e thi
OU to us
(DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER H
C se
0 T
2 icen LISTENER
------------------------
Alias I %
L ble l
E
AM fera
Version
-ieProduction
TNSLSNR for Linux: Version 12.1.0.1.0
a rStartaDaten s
a c h - t r 11-JUN-2013 12:46:33
Z noUptime n 0 days 21 hr. 34 min. 40 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File
/u01/app/grid/product/12.1.0/grid/network/admin/listener.ora
Listener Log File
/u01/app/grid/diag/tnslsnr/EDRSR39P1/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=edRSr39p1.us.oracle.co
m)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=edRSr39p1.us.oracle.co
m)(PORT=5501))(Presentation=HTTP)(Session=RAW))
service...
Service "emrep" has 1 instance(s).
Instance "emrep", status READY, has 1 handler(s) for this
service...
Service "emrepXDB" has 1 instance(s).
Instance "emrep", status READY, has 1 handler(s) for this
service...
Service "orcl" has 1 instance(s).
s a
Instance "orcl", status READY, has 1 handler(s) for this
)h a
service...
m
co eฺ
Service "orclXDB" has 1 instance(s).
o ฺ
o uid
a h
Instance "orcl", status READY, has 1 handler(s) for this
y
service...
@ n t G
Service "rcat" has 1 instance(s). k
ac tude
f r z
A ( this S
Instance "rcat", status READY, has 1 handler(s) for this
L
UA use
service...
O
Service "rcatXDB" has 1 instance(s).
H e to
T C
Instance "rcat", status READY, has 1 handler(s) for this
0 ens
service... 2
I le lic
%
L
The command completed successfully
$ A ME erab
r ieto being
n s f
c a
7. Return
h $ exit tra
the oracle OS user.
a
Z no n -
logout
$ whoami
oracle
$
8. Confirm that the ORCL database is in NOARCHIVELOG mode. There are different ways to
do this. This activity guide shows you first the SQL*Plus way.
a. Use . oraenv to set your environment variables for the orcl database instance.
$ . oraenv
ORACLE_SID = [oracle] ? orcl
The Oracle base has been set to /u01/app/oracle
$
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -
64bit Production
With the Partitioning, Automatic Storage Management, OLAP,
Advanced Analytics
and Real Application Testing options
SQL>
Note: To avoid cluttering the output, the above banner information will not be repeated.
s a
c. Query the LOG_MODE column of the v$database view (and any other information that
might interest you).
)h a
m
co eฺ
SQL> select name, log_mode, db_unique_name from v$database;
o ฺ
o uid
y a h
NAME LOG_MODE DB_UNIQUE_NAME
@ n t G
k
ac tude
--------- ------------ ------------------------------
( f r z S
ORCL NOARCHIVELOG orcl
L A h i s
SQL>
U A se t
H howeyoutoareucurrently logged into SQL*Plus.
d. Confirm your understanding of O
C
T DUAL;
SQL> SELECT USER0FROM
2 ns
% c e
E LI ble li
USER
A M era
a r ie nsf
------------------------------
a c h SYS-tra
Z non
SQL>
Note: When you execute sqlplus / as sysdba, you are using OS security credentials
and are logged in as the SYS user.
e. Optionally: If you want to test your logon with Oracle Net Services, use the service
name (@orcl in this example):
SQL> exit
$ sqlplus sys@orcl as sysdba
. . .
Enter password: oracle_4U <<<not displayed
Connected.
SQL>
Note: In this course, all Oracle training passwords are oracle_4U, all OS passwords are
oracle. This obviously not secure and only done for your convenience during the course.
Please refer to the Oracle Database Security Guide for guidelines on how to choose
passwords.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
$
Note: To avoid cluttering the output, the above banner information will not be repeated.
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
Practices for @ Lesson n t G2:
k
c ude
aStarted
Getting
( f r z S t
A LA e2 this
Chapter
H OU to us
0 T C se
I % 2 icen
E L ble l
A M era
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
Assumptions
You start in a terminal window, in which the environment variables are pointing to the ORCL
instance. (Revisit the previous practice if you are not sure how to set the environment variables
with . oraenv.)
Tasks
1. Logged in to a terminal window as oracle OS user, invoke the RMAN client with the
SYSBACKUP role. Note that both double and single quotes are needed.
s a
$ rman target "'/ as sysbackup'"
)h a
Recovery Manager: Release 12.1.0.1.0 - Production on Wed Jun 12 m
co eฺ
10:29:38 2013
o ฺ
o uid
a h
Copyright (c) 1982, 2013, Oracle and/or its affiliates. All
y
rights reserved. @ n t G
k
ac tude
f r z
connected to target database: ORCL (DBID=1345675044)
RMAN>
L A ( this S
Note: To avoid cluttering the output, the A banner
Uabove s e information will not be repeated.
2. Confirm that the ORCL database H O to u
is in NOARCHIVELOG mode.
T C e
RMAN> SELECT NAME,
% 2 0 DBID,
c e nsLOG_MODE FROM V$DATABASE;
E LI ble li
using M target a
A f e r database control file instead of recovery catalog
a ie ns
rNAME DBID LOG_MODE
h r a
Zac noORCLn-t
--------- ---------- ------------
1343765865 NOARCHIVELOG
RMAN>
3. Display the default user name with which you logged in.
RMAN> SELECT USER FROM DUAL;
USER
------------------------------
SYSBACKUP
RMAN>
Note: You logged in with the SYSBACKUP privilege (that connects you as the SYSBACKUP
user), which is very similar to the SYSDBA privilege, except that it does not include the
SELECT privileges for user-content tables. By default, SYSDBA can see the content of user
tables, but SYSBACKUP cannot. (Both can query the data dictionary and dynamic views.)
a c h
n - tra the database was in NOARCHIVELOG mode. This is not
and
Z no allowed
// because when restored, the file will require redo application
// before it is usable, and redo is not currently being saved
// beyond the contents of the online redo logs.
// *Action: Take the tablespace offline clean or close the
database and retry
// the copy or backup.
$
Should you get "oerr: command not found", then the environment variables might not
be set.
Note: The next lesson reviews the database structures to deepen your understanding. Note
the suggested action.
database closed
database dismounted
Oracle instance shut down
+DATA/ORCL/BACKUPSET/2013_06_12/nnndf0_tag20130612t103848_0.272.
817900729
List of Datafiles in backup set 2
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 1896642 12-JUN-13
+DATA/ORCL/DATAFILE/system.257.817894153
2 Full 1896642 12-JUN-13
s a
+DATA/ORCL/DATAFILE/example.269.817894393
)h a
3 Full 1896642 12-JUN-13
m
co eฺ
+DATA/ORCL/DATAFILE/sysaux.256.817894089
o ฺ
o uid
4 Full 1896642 12-JUN-13
y a h
+DATA/ORCL/DATAFILE/undotbs1.259.817894231
@ n t G
6 Full 1896642 12-JUN-13 k
ac tude
f r z
A ( this S
+DATA/ORCL/DATAFILE/users.258.817894229
L
BS Key Type LV Size
O UA
Devicese
u Type Elapsed Time Completion
Time H t o
C se-----------
------- ---- -- 0
2 T
----------n ------------ ------------
% li c e
---
E LI e
Full bl9.64M
3
A M BP eKey:
r a DISK 00:00:04 12-JUN-13
a c h -tra
TAG20130612T103848
n
Z no+DATA/ORCL/BACKUPSET/2013_06_12/ncsnf0_tag20130612t103848_0.273.
Piece Name:
817900857
SPFILE Included: Modification time: 12-JUN-13
SPFILE db_unique_name: ORCL
Control File Included: Ckp SCN: 1896642 Ckp time: 12-JUN-
13
RMAN>
Question: Which objects are in the backup sets, shown above?
Possible answer: The first and third backup set contain the control and SPFILE, the
second backup set contains data files.
When the RMAN configurable parameter CONTROLFILE AUTOBACKUP is disabled (OFF)
during a backup operation, then two control file backups are created: one before and one
after the backup, each for a different SCN with different tags.
The second backup set contains the data files.
Assumptions
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
You completed practice 2-1 (and have a backup of your closed database in NOARCHIVELOG
mode).
The $LABS environment variable points to the /home/oracle/labs training directory (which
is your course home directory). Unless indicated otherwise, start all practices in this directory.
Tasks
1. In the $LABS directory is a Linux file that executes a test case. Navigate into your course
home directory and review the setup_02_02.sh file with the cat command. (Best
s a
Practice Tip: In later practices, it is also recommended to first review a script file before
executing it.) )h a
m
co eฺ
o ฺ
o uid
$ cd $LABS
y a h
$ cat setup_02_02.sh @ n t G
k
ac tude
#!/bin/sh
( f r z S
# -- DISCLAIMER:
L A t h i s
# -- This script is provided
U A forseeducational purposes only. It
is
HO t o u
# -- NOT supported
0 T Cby
s e
Oracle World Wide Technical Support.
%2 haslicbeen
# -- The script n
e tested and appears to work as
intended. LI
M E should
a b lealways run new scripts on a test instance
# --
i e A fer
You
a r n
initially.
a s
h # -t r
Zac no#nconfigure the environment
. $LABS/set_db.sh
-- Create user
CREATE USER BAR22 IDENTIFIED BY oracle_4U
DEFAULT TABLESPACE bar22tbs
QUOTA UNLIMITED ON bar22tbs;
s a
-- create table and populate
)h a
-- be sure table is at least 2 blocks long m
co eฺ
CREATE TABLE BAR22.barcopy o ฺ
o uid
TABLESPACE bar22tbs
y a h
@ n t G
AS SELECT * FROM HR.EMPLOYEES;
k
ac tude
f r z
INSERT INTO BAR22.BARCOPY
L A ( this S
UA use
SELECT * FROM BAR22.BARCOPY;
O
C H e to
2 T
0 ens
INSERT INTO BAR22.BARCOPY
L %
SELECT * FROM
e l ic
I BAR22.BARCOPY;
ME erab l
A
ie nsf
a rEOF
h -tra
a c
Z no#n Switch logfile
sqlplus / as sysdba >> /tmp/setup.log 2>&1 <<EOF
. oraenv >>/dev/null
ORAENV_ASK=''
$
Question: What do these two files do together?
Possible answer: set_db.sh uses . oraenv to set the environment variables for the
ORCL instance.
setup_02_02.sh first attempts to drop a user and tablespace (if they exist from previous
s a
tests). Then it creates the BAR22 user, BAR22TBS tablespace, and the BARCOPY table. The
BARCOPY table is filled with rows from the HR.EMPLOYEES table. )h a
m
co eฺ
After that, SYSDBA switches log files and executes a checkpoint.
o ฺ
osystemuoridin ASM)?
Question: Where is the data file for the tablespace located (in thea
y h
file
Possible answer: In the file system @ n t G
k
ac toruas deis recommended for
3. You can either perform these tasks by entering the commands
f r z
( window S as the default oracle OS
now, execute the setup_02_02.sh file in the terminal
L A h i s
user.
U A se t
$ ./setup_02_02.sh
H O to u
$ C
0T ense
2 c
I% toletheli/tmp/setup.log
4. The output is redirected file. You can review the output while the
E L
script is executing.
question A ab (Space lines have been removed
- If you
M instructor.
with yourfe r
do not understand it at the completion of the script, discuss your
to avoid cluttering the
r i e s
c ha $ cat
output).
- t r an
a
Z non /tmp/setup.log
DROP USER bar22 CASCADE
*
ERROR at line 1:
ORA-01918: user 'BAR22' does not exist
Tablespace created.
User created.
Grant succeeded.
Table created.
107 rows created.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -
64bit Production
With the Partitioning, Automatic Storage Management, OLAP,
Advanced Analytics
and Real Application Testing options
SQL> SQL>
System altered.
s a
)h a
SQL> m
co eฺ
System altered. o ฺ
o uid
y a h
@Enterprise
n t G
SQL> Disconnected from Oracle Database c12c
a k d e Edition
Release 12.1.0.1.0 - 64bit Production z
fr s S
(Storage t u
With the Partitioning, Automatic
A L e thi Management, OLAP,
A
OU tooptions us
Advanced Analytics
and Real Application H
Setup complete. 0T
C seTesting
I % 2 icen
$
E L ble l
Question: Do
A M the efirstratwo error messages signal a problem with your setup?
r ie answer:
Possible n s f No. They occur when a user and tablespace do not exist (possibly from
c a
ha previous a
trexecution of the script). It is important that the object creation (marked in green)
a
Z isnexecuted
o n - without errors.
5. Optionally, log into SQL*Plus as SYSDBA, review the new table.
$ sqlplus / as sysdba
Note: Only the last row of the BARCOPY table is displayed (to avoid clutter) with the total
count of rows. (The total should be 428; the last row could be different.)
6. Optionally, to list the archive log mode, execute the archive log list command in
SQL*Plus and then exit SQL*Plus.
SQL> archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
s a
Oldest online log sequence
Current log sequence
10
12 )h a
m
co eฺ
SQL> exit
o ฺ
o uid
$
y a h
Note: Your sequence numbers may be different. @ n t G
7. Crash the ORCL database with the srvctl utility; thatais,
k
cperformudthee srvctl stop
f r z
database -d orcl -o abort command in a (terminal window. S t
$ srvctl stop database -d orcl A this
LA-o eabort
$ H OU to us
8. Optionally, list your pmon 0 T C ora_pmon_orcl
processes. se should not appear in the list.
% 2 c e n
$ pgrep -lf
E LI pmon l e li
14366 M
A r ab
ora_pmon_emrep
f e
a ie ora_pmon_rcat
r19558 n s
h r a
t asm_pmon_+ASM
Zac no$n-
23313
9. Optionally, log in to SQL*Plus as SYSDBA, attempt to query your test table, and exit.
$ sqlplus / as sysdba
...
Connected to an idle instance.
SQL> SELECT * FROM BAR22.BARCOPY;
SELECT * FROM BAR22.BARCOPY
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0
SQL> exit
$
If you attempt to query your test file in the idle instance, the ORA-01034 error is displayed.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Overview
In this practice, you use the RMAN client to recover your ORCL database.
Assumptions
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
You have a terminal window open with the environment variables pointing to the ORCL database
instance. This practice has optional steps for learning purposes.
Tasks
1. Because the ORCL database is in NOARCHIVELOG mode, you know that you need to first
mount the instance.
a. Log in to RMAN.
$ rman target "'/ as sysbackup'"
s a
...
)h a
connected to target database: ORCL (DBID= 1345675044, not open) m
co eฺ
RMAN> o ฺ
o uid
y a h
b. Optionally, list your backups.
@ n t G
RMAN> list backup;
a k
c ude
using target database control file ( f r z t recovery catalog
insteadSof
A LA e this
List of Backup Sets
H OU to us
===================
0 T C se
I % 2 icen
E L ble l
A M Typee raLV Size
r i e
BS Key
s f Device Type Elapsed Time Completion
c ha -------
Time
- t r an---- -- ---------- ----------- ------------ ------------
a
Z no-n
2 Full 1.30G DISK 00:01:59 12-JUN-13
BP Key: 2 Status: AVAILABLE Compressed: NO Tag:
TAG20130612T103848
Piece Name:
+DATA/ORCL/BACKUPSET/2013_06_12/nnndf0_tag20130612t103848_0.272.
817900729
List of Datafiles in backup set 2
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 1896642 12-JUN-13
+DATA/ORCL/DATAFILE/system.257.817894153
2 Full 1896642 12-JUN-13
+DATA/ORCL/DATAFILE/example.269.817894393
3 Full 1896642 12-JUN-13
+DATA/ORCL/DATAFILE/sysaux.256.817894089
Time
------- ---- -- ---------- ----------- ------------ ------------
-
3 Full 9.64M DISK 00:00:04 12-JUN-13
BP Key: 3 Status: AVAILABLE Compressed: NO Tag:
TAG20130612T103848
Piece Name:
+DATA/ORCL/BACKUPSET/2013_06_12/ncsnf0_tag20130612t103848_0.273.
817900857 s a
SPFILE Included: Modification time: 12-JUN-13 )h a
m
co eฺ
SPFILE db_unique_name: ORCL
o
o uidฺ
Control File Included: Ckp SCN: 1896642 h
Ckp time: 12-JUN-
y a
13
@ n t G
RMAN> k
ac tude
f r z
( it was
Note: There is no data file for your test case because S
created after your backup.
2. Attempt to recover the database with the A L A t h i s command. Expect an error.
U s e
RECOVER DATABASE
Then exit RMAN.
C HO e to u
RMAN> recover database;
2 0atT ns
Starting recover
I % l i e
c12-JUN-13
allocated L
E channel:
b le ORA_DISK_1
M er
A ORA_DISK_1: a
r i e
channel
s f SID=249 device type=DISK
c ha RMAN-00571:
- t r an ===============================================
a n
Z noRMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS
RMAN-00571: ===============================================
RMAN-03002: failure of recover command at 12-JUN-13
RMAN-06094: datafile 5 must be restored
RMAN> exit
Recovery Manager complete.
$
Note the error about your missing data file. – A complete recovery in NOARCHIVELOG mode
is only possible, if all the changes since the last backup are contained in the online redo
logs. In real life, this is highly unlikely and you have two possible recovery paths:
1) Drop the missing tablespace or
2) Recover the entire database to the time of the last backup.
Database altered.
E LI ble li
+DATA/ORCL/DATAFILE/system.257.810505935 SYSTEM
A M era
+DATA/ORCL/DATAFILE/sysaux.256.810505861 SYSAUX
ie ns f
r+DATA/ORCL/DATAFILE/users.258.810506011 USERS
h a r a
n-t
Zac no+DATA/ORCL/DATAFILE/undotbs1.259.810506011
+DATA/ORCL/DATAFILE/example.269.810506153 EXAMPLE
UNDOTBS1
SQL>
Note: ASM assigns unique filenames, expect you numbers to be different.
e. To cleanup this test case, drop the BAR22 user and then exit SQL*Plus.
SQL> DROP USER bar22 CASCADE;
User dropped.
SQL> exit
$
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
Practices for @Lesson n t G3:
k
ac for de
Configuring
f r z t u
A ( this S
Recoverability
L
O UA use
C H e Chapter
to 3
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
In these practices you configure the default backup destination, set the RMAN display data and
time format, configure control file autobackup, configure the backup retention policy, and
configure a device for backup.
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
Overview
In this practice you determine the default backup destination setting, change it to the +FRA disk
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
group, set the DB_RECOVERY_FILE_DEST_SIZE initialization parameter, and verify that the
default location is being used.
Next, you enable ARCHIVELOG mode and restart the ORCL database instance.
Assumptions
You have two terminal windows open, each with the environment variables set for the ORCL
database instance. Use $LABS as your working directory. Unless otherwise indicated, always
work from that directory.
s a
Tasks
)h a
1. The DB_RECOVERY_FILE_DEST parameter specifies the default location for the m Fast
coshoweฺ
o ฺ
Recovery Area. View the parameter by logging in to SQL*Plus and using the
o uid
parameter command.
y a h
$ sqlplus / as sysdba @ n t G
k
ac tude
f r z
A ( this S
SQL> show parameter db_recovery_file_dest
L
O UA use TYPE
NAME
C H e to VALUE
2 0T ens
------------------------------------ ----------- -------------
L I% le lic
db_recovery_file_dest string +DATA
A ME erab
db_recovery_file_dest_size big integer 4800M
a r ie nsf
a c h SQL>
n - tra
Z2. Change
no the parameter to use the +FRA disk group as the default backup destination.
SQL> ALTER SYSTEM SET db_recovery_file_dest ="+FRA";
System altered.
SQL>
3. Verify your changed parameter.
SQL> show parameter db_recovery_file_dest
NAME TOTAL_MB
------------------------------ ----------
FRA 14628
DATA 21942
SQL>
Note: These (or similar) values are expected for your training environment. If you had need
to change the FRA size, you could do it with the ALTER SYSTEM SET
db_recovery_file_dest_size = nn command.
5. s a
Place the ORCL database in archive log mode. Several tools are available to change the log
)h a
mode for a database: Enterprise Manager and SQL*Plus which is shown in the solution.
a. Place the ORCL database in MOUNT mode m
co eฺ
o ฺ
o uid
SQL> SHUTDOWN IMMEDIATE
y a h
Database closed.
@ n t G
Database dismounted. k
ac tude
f r z
ORACLE instance shut down.
L A ( this S
O UA use
SQL> STARTUP MOUNT
C H e to
T
0 Area
ORACLE instance started.
2 ns 534462464 bytes
Total System% c e
LI ble li
Global
Fixed Size
M E a 2290416 bytes
r i e A Size
Variable
s f er 276827408 bytes
c ha Database
- t r an Buffers 247463936 bytes
a
Z noRedo n Buffers 7880704 bytes
Database mounted.
SQL>
b. Execute the ALTER DATABASE ARCHIVELOG command.
SQL> ALTER DATABASE ARCHIVELOG;
Database altered.
SQL>
c. Open the database, list the archive logs, and then exit SQL*Plus
SQL> ALTER DATABASE OPEN;
Database altered.
Note: The database is now in ARCHIVELOG mode. After a mode change like this, it is best
practice to perform a backup of the entire database.
6. In a terminal window (which is pointing to ORCL), log in to the RMAN client and execute the
BACKUP DATABASE command, and then exit RMAN.
$ rman target "'/ as sysbackup'"
connected to target database: ORCL (DBID=1345675044, not open)
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
Assumptions
You completed the previous practice.
You have two terminal windows open, each with the environment variables set for the ORCL
database instance. Use $LABS as your working directory. Unless otherwise indicated, always
work from that directory.
Tasks
s a
1. Set the NLS_LANG and NLS_DATE_FORMAT variables such that RMAN includes time )h a
m
information in any timestamp values.
Use the editor of your choice (vi, gedit) and add the following two o o
lines
ฺctoothe end
eฺ of the
a h u i d
~oracle/.bashrc file: y t G
export NLS_LANG=american_america.al32utf8
a c k@ den
(
export NLS_DATE_FORMAT="yyyy-mm-dd:hh24:mi:ss"frz s Stu
a. In a terminal window, invoke your editor.
A LA thi use the gedit editor.
The solutions
e
$ gedit ~oracle/.bashrcOU us
H
C se t o
0 T
b. Copy and paste%
I using
l en buttons and icons in the editor, then save your
2 the imouse
c
changes and
M ELcloseabthelegedit window.
i e A fer
a r a n s
h t r
Zac non-
Note: If you are not copying and pasting the variables, then double-check that the
NLS_LANG value is written correctly: with... a (letter "l", not digit '1').
. /etc/bashrc
fi
. . .
BS Key Type LV Size Device Type Elapsed Time Completion
Time
------- ---- -- ---------- ----------- ------------ ------------
-
2 Full 1.30G DISK 00:01:59 2013-06-
12:10:40:47
BP Key: 2 Status: AVAILABLE Compressed: NO Tag:
TAG20130612T103848
Piece Name:
+DATA/ORCL/BACKUPSET/2013_06_12/nnndf0_tag20130612t103848_0.272.
817900729
List of Datafiles in backup set 2
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- ------------------- ----
c ha -------
Time
- t r an---- -- ---------- ----------- ------------ ------------
a
Z no-n
4 Full 1.31G DISK 00:02:06 2013-06-
12:14:59:46
BP Key: 4 Status: AVAILABLE Compressed: NO Tag:
TAG20130612T145740
Piece Name:
+FRA/ORCL/BACKUPSET/2013_06_12/nnndf0_tag20130612t145740_0.256.8
17916261
List of Datafiles in backup set 4
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- ------------------- ----
1 Full 1930404 2013-06-12:14:53:14
+DATA/ORCL/DATAFILE/system.257.817894153
2 Full 1930404 2013-06-12:14:53:14
+DATA/ORCL/DATAFILE/example.269.817894393
Assumptions
You completed the previous practice.
You have two terminal windows open, each with the environment variables set for the ORCL
database instance. Use $LABS as your working directory.
s a
Tasks a
) h is
1. Logged in to an RMAN session as SYSBACKUP, check whether control file autobackup m
co eฺ
enabled. o ฺ
o uid
a
See step 2a in the previous practice, if you wish to review the login.
y h
@ n t G
RMAN> show controlfile autobackup; k
ac tude
f r z Swith db_unique_name
RMAN configuration parametersLfor A ( database
h i s
ORCL are: U A se t
O to u OFF; # default
CONFIGURE CONTROLFILEHAUTOBACKUP
C
0T ense
2
I% le lic
RMAN>
L
ME eisrnot
Note: Autobackup
A abenabled.
riecontrol
2. Enable
n f
s autobackup.
file
h a r a
n-t configure controlfile autobackup on;
Zac noRMAN>
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored
RMAN>
Note: The control file and SPFILE will be automatically backed.
3. View the current retention policy setting.
RMAN> show retention policy;
RMAN>
b. Check the retention policy setting again.
s a
RMAN> show retention policy;
)h a
m
co eฺ
RMAN configuration parameters for database with db_unique_name o ฺ
o uid
ORCL are:
a h
CONFIGURE RETENTION POLICY TO REDUNDANCY @ 1; y n t G
k
ac tude
RMAN>
f r z S OBSOLETE command.
with(the DELETE
5. Delete obsolete backups from prior practices A i s
L
A se t h
RMAN> DELETE OBSOLETE; U u
O betoapplied
RMAN retention policy C Hwill e to the command
0 T
RMAN retention2policy is s
n set to redundancy 1
ice
I% le lORA_DISK_1
allocated Lchannel:
A
channelMEORA_DISK_1:
e r ab SID=280 device type=DISK
f
ie nsthe following obsolete backups and copies:
rDeleting
c h a tra
a n -
Type Key Completion Time
Z no-------------------- ------ ------------------ -----------------
Filename/Handle
---
Backup Set 2 2013-06-12:10:40:47
Backup Piece 2 2013-06-12:10:40:47
+DATA/ORCL/BACKUPSET/2013_06_12/nnndf0_tag20130612t103848_0.272.
817900729
Backup Set 3 2013-06-12:10:40:58
Backup Piece 3 2013-06-12:10:40:58
+DATA/ORCL/BACKUPSET/2013_06_12/ncsnf0_tag20130612t103848_0.273.
817900857
Note: These are old backup pieces which were created with default parameters. So they
were stored in the +DATA disk group (before you changed the backup destination to the
+FRA disk group).
6. Review the schema to see which data file contains the USERS tablespace.
RMAN> REPORT SCHEMA;
using target database control file instead of recovery catalog
Report of database schema for database with db_unique_name ORCL
s a
List of Permanent Datafiles )h a
m
co eฺ
===========================
o ฺ
o Name
File Size(MB) Tablespace h
RB segs Datafile
y a G uid
c k @ ent
---- -------- -------------------- ------- --------------------
d
frza s Stu
1 800 SYSTEM ***
(
+DATA/ORCL/DATAFILE/system.257.817894153
2 357 EXAMPLE
A LA e*** thi
O U us
+DATA/ORCL/DATAFILE/example.269.817894393
3 800 SYSAUXC H e to ***
0 T
2 icen s
+DATA/ORCL/DATAFILE/sysaux.256.817894089
165 LI% UNDOTBS1
l
4
E
M rab l e ***
+DATA/ORCL/DATAFILE/undotbs1.259.817894231
6ie A5 sfe USERS
a r
h -tra n ***
a c
Z non
+DATA/ORCL/DATAFILE/users.258.817894229
• Enterprise Manager Database Express 12 (EM Express) to view the existing control
files (as SYSDBA).
• srvctl to stop and start the database (as oracle OS user).
• asmcmd to copy the control file from the +DATA to the +FRA diskgroup (as grid OS
user).
• SQL*Plus and an editor to update the CONTROL_FILES parameter in the initialization
parameter file (as SYSDBA).
Assumptions s a
You completed the previous practice and have two terminal windows open (each pointing ) a
hto the
ORCL instance). m
co eฺ
o
o uidฺ
Tasks y a h
@ G
onnat different disk to
k
Your overall task is to verify that you have at least two control files,
ac tools
each e
( f r z
ensure redundancy. This practice also introduces you to different
S tudfor learning purposes.
1. Using a Browser, launch EM Express for yourA
L ORCL database
t h is by entering
http://<hostname>:5500/em as theA
O U URL.use
CH if sthe
Note: EM Express is only available
explore in a later practice,0isTavailable e to ofistheopen.
database
regardless
(Cloud Control, which you
state of the target database.)
I
If you are unsure about % l i c en you can query it in a terminal window.
2your hostname,
M
$ hostname EL --long
a b le
i e A fer
a r a n s
edRSr39p1.us.oracle.com
h r
Zac a.noLog n-int as the SYS user with the oracle_4U password, using the SYSDBA role.
$
s a
)h a
m
co eฺ
o
o uid ฺ
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie n1:sfOn the Control Files: General page, how many control files do you have?
Question
a c h Answer:
n - tra 2
Z noQuestion 2: Are they located on different disks?
Answer: No
4. When you are finished reviewing the information available in this interface, click Logout
(top-right).
Note: EM Express is designed for open databases (not for closed or mounted ones).
To ensure redundancy, "move" one control file to a location on the +FRA disk group. Name the
mulitplexed control file: +FRA/ORCL/CONTROLFILE/control02.ctl.
5. Confirm and note the current location and name of one control file.
a. Switch to the grid OS user with the oracle password and point your environment
variables to the +ASM instance.
$ su - grid
Password: oracle <<< not displayed
[grid@host01 ~]$ . oraenv
ORACLE_SID = [grid] ? +ASM
Current.260.821786929
Current.261.817894297
ASMCMD>
Note: You can list the control files with multiple tools, in SQL*Plus with the SHOW
PARAMETER CONTROL_FILES command.
Note the precise name and location of one control file that you will keep in the +DATA disk
group. You need it in a later task step.
________________________________________________________________________
s a
__
)h a
6. m
Confirm or create a synonym for the controlfile directory in the +FRA disk group.
o create
cgroup,
o
a. If there is no synonym for the controlfile directory in the +FRA disk
o ฺ e ฺ
one. a h u i d
y t G
ASMCMD> ls +FRA/orcl/controlfile
a c k@ den
ASMCMD-08002: entry 'controlfile' does
( frz not S tu in directory
exist
'+FRA/orcl/'
A LA e this
OU to us
ASMCMD> mkdir +FRA/orcl/controlfile
ASMCMD> H
C se
b. Exit the asmcmd tool 0 T
2 ithe
and n OS user.
I % l c egrid
ASMCMD> exit
E L ble
$ A M e ra
i e s f
c h ar$ exitt r an
a
Z no$n -
logout
Use RMAN to mulitplex the control file and restart the database instance with the control files in
the +DATA and +FRA disk groups. Optionally, view the control_files parameter. The
commands include:
a. rman target "'/ as sysbackup'"
b. ALTER SYSTEM SET CONTROL_FILES = '<+DATA location1>, <'+FRA'>'
SCOPE=SPFILE;
c. SHUTDOWN IMMEDIATE;
d. STARTUP NOMOUNT;
e. RESTORE CONTROLFILE FROM '+DATA location1';
f. ALTER DATABASE MOUNT;
g. ALTER DATABASE OPEN;
$ rman target "'/ as sysbackup'"
Note for after class: To use an automatically generated file name, enter '+FRA'. In class,
enter the entire control file name as shown above, so that future scripts can work with
control02.ctl.
RMAN> shutdown immediate;
database closed
database dismounted
Oracle instance shut down
s a
RMAN> STARTUP NOMOUNT; )h a
m
co eฺ
connected to target database (not started)
o ฺ
o uid
Oracle instance started
a h
534462464 bytesy t G
Total System Global Area
k @ n
Fixed Size 2290416
f r z acbytestude
Variable Size (
276827408
A i s S
bytes
Database Buffers L
A 247463936
e h
t bytes
U s
Redo Buffers
C HO e to u7880704 bytes
2 0T ens FROM
RMAN> RESTORE
L I% le lic
CONTROLFILE
MErestore
'+DATA/ORCL/CONTROLFILE/current.260.821786929';
A
Starting
f e r ab at 2013-07-27:15:08:12
a ie channel
rusing n s ORA_DISK_1
h r a
n-t ORA_DISK_1: copied control file copy
Zac nochannel
output file name=+DATA/ORCL/CONTROLFILE/current.260.821786929
output file name=+FRA/ORCL/CONTROLFILE/control02.ctl
Finished restore at 2013-07-27:15:08:16
control_files
+DATA/ORCL/CONTROLFILE/current.260.821786929,
+FRA/ORCL/CONTROLFILE/control02.ctl
RMAN> exit
$
7. Optionally, view the modified control files in SQL*Plus.
SQL> show parameter control_files s a
)h a
m
co eฺ
NAME TYPE
ฺ
VALUE
o
o---------------
------------------------------------ -----------
y a h
G uid
-
c k @ ent
rza Stud
control_files string
+DATA/ORCL/CONTROLFILE/current.260.821786929,
( f
+FRA/ORCL/CONTROLFILE/control02.ctl
A LA e this
SQL>
O U us
C H
8. Optionally, view the modified control files into
EM Express. (If you would like to review the
e practice
0 T
navigation, see the first three
2 ofsthis
steps n 3-4.)
% c e
E LI ble li
A M era
a r ie nsf
a c h -tra
Z non
Assumptions
You completed the previous practices and have a terminal window open (pointing to the ORCL
instance).
Tasks
1. Using a Browser, launch Cloud Control for your ORCL database by entering
https://<hostname>:7802/em as the URL.
s a
The first time you enter, you must accept the untrusted connection. In Firefox, click I
)h a
Understand the Risks > Add Exception > With "Permanently store this exception"
selected, click Confirm Security Exception. m
co eฺ
2. o ฺ
o uid
Log in as the SYSMAN user with the oracle_4U password.
y a h
@ n t G
a. If the License Agreement page is displayed, click I Accept.
k
ac tude
b. You do not need to select any item on the Select Enterprise Manager Home page.
f r z
A ( this S
3. Configure the Databases page as your home page in Cloud Control.
L
a. Click Targets (top-left) > Databases > Search List.
O UA use
b. For your own convenience, make this your home page by clicking SYSMAN (top-right)
C H e to
> Set Current Page as My Home.
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
Note - only if you are new to Cloud Control: For your "after-class" learning, consider
viewing videos on OLL or youTube.
• Oracle Enterprise Manager 12c: Perform a Simple Installation
• Oracle Enterprise Manager 12c: Console Overview and Customization
If you query OLL with the search "Enterprise Manager Cloud Control", you will receive over
140 suggestions. View anything that interests you.
s a
)h a
m
coas part
o
Note: The databases appear on this list because they have been "discovered"
o ฺ e ฺ of
the course setup. a h u i d
5. To confirm your current recovery settings, click Availability >
y
@ en
Backup &t G
Recovery >
c k
Recovery Settings.
a. The first time you perform this task, you need(fto provide
tud credentials. Click
rza Sdatabase
Named. A LA e this
Note: The NC_SYSDBA named credential
H OU hast o us set up for you in Cloud Control. For
been
0 T C viewing
your "after-class" learning, consider
s e ortheyouTube.
Oracle Enterprise Manager 12c: Create
n
I%2 le lice
and Use Named Credentials video on OLL
L
A ME erab
a r ie nsf
a c h -tra
Z non
s a
a. Question: Is ARCHIVELOG mode enabled?
)h a
m
Answer: Yes, because it was configured in a previous practice.
co eฺ
b. Question: Is the fast recovery area enabled? o ฺ
o uid
y a h
Answer: Yes, because the FRA was configured in a previous practice.
@ n t G
c. k
ac tude
Question: Where is the location of the fast recovery area?
Answer: +FRA f r z
d. L A ( this S
Question: Which essential DBA tasks can you perform in this section?
UA use
Answer: You can change the location, size or retention time for the fast recovery area,
O
H e to
as well as enable the Flashback Database functionality.
C
e. 2 T
0 ens
Question: Does changing the size of the Fast Recovery Area require the database to
I le lic
%
be restarted?
L
ME erab
Answer: No, a restart is not required for this change.
A
a r ie nsf
a c h -tra
Z non
Assumptions
You completed the previous practice and are logged in to Cloud Control as the SYSMAN user.
Tasks
1. Click Administration > Storage > Redo Log Groups and note how many members are in
the “# of Members” column.
Answer: There are two members in each group.
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a
2. c hSelect one
n - traof your Inactive Redo Log Groups and click Edit to see where each member of
Z that nogroup is stored. You will see both members in the +DATA disk group.
− Select the group you wish to modify and click edit. Select a member and click
Remove.
a. On the Edit Redo Log Group page, click Add.
b. Set Disk Group to FRA, click Continue.
c. Click Apply.
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L %
e l ic provided.
I is automatically
E ab
Note: The file name
M l
4. Click Redo
r i e A
s f er in the locator link and repeat the previous task step 3 for each of
Log Groups
c a tran
the redo log
hOptionally, groups.
a
5.
Z thenoSQL n-command
on the Edit Redo Log Group page, click Show SQL, and then Return to view
that will be executed on your behalf.
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
Practices for @ Lesson n t G4: Using
k
ac Recovery de Catalog
the RMAN
( f r z S t u
L A h i s
U AChapterse4 t
C HO e to u
2 0T ens
L I% le lic
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
Assumptions
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
The rcat database has been created as part of the practice setup. The initialization parameters
have been set as follows:
DB_RECOVERY_FILE_DEST = /u01/app/oracle/fast_recovery_area
DB_RECOVERY_FILE_DEST_SIZE = 10000M
You are in a terminal window with the environment variables pointing to the rcat database
instance.
Tasks
s a
1. Log in to SQL*Plus as the SYS user with the SYSDBA role and create a tablespace named
)h a
RCATBS to hold the repository data. Make it 15 MB in size. m
$ sqlplus / as sysdba o ฺ co eฺ
a h o uid
@ y t G
SQL> CREATE TABLESPACE rcatbs DATAFILE
k n
de15M REUSE;
'/u01/app/oracle/oradata/rcat/rcat01.dbf'
f r z ac SIZE t u
Tablespace created.
A ( i s S
L
A se t h
SQL>
U
HO ecatalog
2. Create a user that will own the recovery
C t o udata. Name the user RCATOWNER. The
default tablespace should0
2 Tthe RCAT
be
n stablespace, and the user should have unlimited
quota on that tablespace.
I% l ic e
SQL> CREATE L
E ab USERl e
rcatowner IDENTIFIED BY "oracle_4U" DEFAULT
M
A fercatbs
TABLESPACE r QUOTA unlimited on rcatbs;
r i e s
c ha SQL>
User
- t r an
created.
a
Z non
3. Grant the RECOVERY_CATALOG_OWNER role to the RCATOWNER user. Exit from SQL*Plus.
SQL> GRANT recovery_catalog_owner to rcatowner;
Grant succeeded.
SQL> exit
$
Assumptions
You finished the previous practice. A terminal window is open with the environment variables
pointing to the rcat database instance.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Tasks
1. Connect to the recovery catalog database by using RMAN. Log in as the recovery catalog
owner you just created.
$ rman catalog rcatowner@rcat
Assumptions
You finished the previous practices. A terminal window is open.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Tasks
1. Set up the environment for the ORCL database. (If you were to continue in your previous
RMAN session, you would be pointing to the wrong database.)
$ . oraenv
ORACLE_SID = [orcl] ? orcl
$
2. a
Connect to the target database (to be registered) and the recovery catalog database by
s
using RMAN.
)h a
$ rman target "'/ as sysbackup'" catalog rcatowner@rcat m
co eฺ
o ฺ
o uid
y a h
connected to target database: ORCL (DBID=1345675044)
@ n t G
recovery catalog database Password: oracle_4U
a k
c ude <<<not displayed
connected to recovery catalog database z
(fr is S t
A
L e th
U A
RMAN>
H O to us
C se
3. Register the database in theTcatalog.
0
RMAN> register
I % 2database;
l i c en
M EL able
r i e
database
s f er
A registered in recovery catalog
c ha starting
- t r an full resync of recovery catalog
a
Z nofull n resync complete
RMAN>
4. To verify that the registration was successful, execute the REPORT SCHEMA command.
Then exit.
RMAN> REPORT SCHEMA;
Report of database schema for database with db_unique_name ORCL
6 5 USERS NO
+DATA/ORCL/DATAFILE/users.258.817894229
Assumptions
You completed the previous practices.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Enterprise Manager Cloud Control 12c is installed. The ORCL and RCAT database instances are
added as managed targets.
If you would like to review the Cloud Control login procedure, see practice 3-5 for the Enterprise
Manager login as the SYSMAN user and the Database Login with the named NC_SYSDBA
credentials. Navigate to the orcl home page.
Tasks
1. In Enterprise Manager, navigate to Availability > Backup & Recovery > Recovery
s a
Catalog Settings.
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
2. Login with the named NC_SYSDBA credentials and then click the Add Recovery Catalog
button.
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
%
c. Click NamedLinI the Database
e l ic Credentials section and ensure that NC_SYSDBA is
ME erab
selected. l
A
itoeseeMore f
d. rClick
a a n s
Details, then click Test. - You should get a Success message.(Scroll down
a c h -trit.)
Z no n
e. Click Next.
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
c. Click Next. ( f r z S
L A h i s
t configuration and click Finish. (A
Processing window may appear.) OU
A review
6. On the Add Recovery Catalog: Review page,
s e your
C H e to u
2 0T ens
L I% le lic
A ME erab
a r ie nsf
a c h -tra
Z non
7. Back on the Recovery Catalog Settings page, select Use Recovery Catalog.
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
( f r z S
A information
The processing window may appear, followed byLthe h i s
t that the target database has
been registered in the recovery catalog. UA e
H O to us
0 T C se
I % 2 icen
E L ble l
A M era
a r ie nsf
a c h -tra
Z non
backups), enable archive log mode, and back up your RCAT database.
You back up the recovery catalog to implement a backup strategy of incremental backups
applied to image copies. This provides a method of fast restore by switching to the image copy
rather than copying the backups back to the original location.
The practice performs the tasks in command line, but a SYSDBA can also perform them in Cloud
Control. (Perform the tasks in one chosen interface.)
Navigation tips:
• a
To configure the retention policy: RCAT home page > Availability > Backup & Recovery
s
a
> Backup Settings > Policy tab > Delete archived redo log files after they have been
)h
backed up the specified number of times > Backups: 2
m
co eฺ
• ฺ
To enable archive log mode: RCAT home page > Availability > Backup & Recovery >
o
o uid
y a h
Recovery Settings > ARCHIVELOG Mode* The database must be restarted. (A wizard
will guide you through the steps.)
@ n t G
• k
ac tude
To back up the database: RCAT home page > Availability > Backup & Recovery >
f r z
A ( this S
Schedule Backup > Schedule Customized Backup > Full > Next > Disk > Next > One
L
Time (Immediately) > Next > Submit Job.
A se
U
Assumptions
C H e to u
O
0 T A terminal
You finished the previous practices.
2 ns window is open with the environment variables
% c e
E LI ble li
pointing to the ORCL database instance.
Tasks A M era
r s f policy with at least redundancy 2.
ie thenretention
c a
1. Configure
ra and use the recovery catalog database as the target, with no catalog
ha. Start-tRMAN
a n
Z nospecified.
$ rman target sys@rcat
RMAN> exit
$
2. To enable archive log mode:
a. Ensure that the environment variables are set for the RCAT database.
$ . oraenv
ORACLE_SID = [rcat] ? rcat
The Oracle base remains unchanged with value /u01/app/oracle
b. a
Log in to SQL*Plus. Configure the recovery catalog database for ARCHIVELOG mode.
s
Exit SQL*Plus.
)h a
$ sqlplus / as sysdba m
co eฺ
SQL> SHUTDOWN IMMEDIATE o ฺ
o uid
y a h
Database closed.
@ n t G
Database dismounted. k
ac tude
f r z
A ( this S
ORACLE instance shut down.
L
SQL> STARTUP MOUNT O UA use
C H e to
2 T
ORACLE instance started.
0 ens
L %
I Globale l icArea 743243776 bytes
E ab
Total System
MSize l
A
Fixed
e f e r 2292816 bytes
i
arVariable s
n Size
c h t r a 301990832 bytes
n-
Za noDatabase Buffers 432013312 bytes
Redo Buffers 6946816 bytes
Database mounted.
3. Back up the recovery catalog database as an image copy and a base for incremental
backups. This provides a method of fast restore by switching to the image copy rather than
copying the backups back to the original location. (You can use a terminal window pointing
to RCAT).
a. Start RMAN and use the recovery catalog database as the target, with no catalog
specified.
$ rman target sys@rcat
name=/u01/app/oracle/fast_recovery_area/RCAT/datafile/o1_mf_sysa
ux_8vmwtscl_.dbf tag=TAG20130613T162912 RECID=2 STAMP=818008172
channel ORA_DISK_1: datafile copy complete, elapsed time:
00:00:26
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001
name=/u01/app/oracle/oradata/rcat/system01.dbf
output file
name=/u01/app/oracle/fast_recovery_area/RCAT/datafile/o1_mf_syst
em_8vmwvlw5_.dbf tag=TAG20130613T162912 RECID=3 STAMP=818008196
channel ORA_DISK_1: datafile copy complete, elapsed time:
00:00:25
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002
name=/u01/app/oracle/oradata/rcat/example01.dbf
a c h -tra00:00:03
Z non channel ORA_DISK_1: starting datafile copy
input datafile file number=00006
name=/u01/app/oracle/oradata/rcat/users01.dbf
output file
name=/u01/app/oracle/fast_recovery_area/RCAT/datafile/o1_mf_user
s_8vmwxx6w_.dbf tag=TAG20130613T162912 RECID=8 STAMP=818008253
channel ORA_DISK_1: datafile copy complete, elapsed time:
00:00:03
channel ORA_DISK_1: starting incremental level 0 datafile backup
set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 2013-06-13:16:30:56
channel ORA_DISK_1: finished piece 1 at 2013-06-13:16:30:59
piece
handle=/u01/app/oracle/fast_recovery_area/RCAT/backupset/2013_06
Answer: Yes
c. Review the output (find the tablespace that you created for the recovery catalog) and
then exit.
RMAN> exit
$
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
Practices for @ Lesson n t G5:
k
c ude and
aStrategies
Backup( f r z S t
A LA e this
Terminology
H OU Chapter
t o us5
0 T C se
I % 2 icen
E L ble l
A M era
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
Assumptions
The full range of Oracle backup and recovery tools are available.
Tasks
1. The first case is an online transaction processing (OLTP) database, handling a large
number of transactions per day. The business requirements are no data loss, with minimal
downtime. The time to restore and recover must be less than an hour. The database is 300
GB. Several TB of disk space is available for backups. All the available disks have the
same properties (size, I/O rate, and latency). Tape backup is available.
s a
)h
Question: What steps do you take to protect the database (for instance place the database a
in ARCHIVELOG mode)? m
co eฺ
Question: How much disk space will you need? o ฺ
o uid
Question: What is the retention policy? y a h
@ n t G
Question: Will you use a Fast Recovery Area? k
ac tude
Question: Will you use backupsets or image copies? f r z
L A ( this S
Questions: Will you use full or incremental backups?
Question: What recovery method will you use?
O UA use
C H e to
2. The database is a Decision 2 T
0 Support s (DSS). Data is loaded via SQL*Loader files
nSystem
% c e
li databases. The database DSS keeps data for 10 years.
E LI btransaction
each night from several
l e
A M
The transaction databases
r a only keep 1 year worth of data. The data is updated only in the
r n s fe and
ie are databases,
transaction is replaced in the DSS database. Only new and updated
c a
records
htablespaces
t r aare used to hold the
transferred to the DSS database. The DSS database is 10 TB. Separate
a -
non What else do you need to know to design a backup strategy?
data by year. There are approximately 200 tablespaces.
Z Question:
Examples: What is the cost, availability, and speed of disk storage?
Question: What steps do you take to protect the database?
Question: How much disk or tape space will you need?
Question: What is the retention policy?
Question: Will you use a Fast Recovery Area?
Question: Will you use backupsets or image copies?
Questions: Will you use full or incremental backups?
Question: What recovery method will you use?
3. The database is a recovery catalog, holding the RMAN catalog information for more than 20
databases in the company. Backups and restore operations may be going on at anytime.
The databases are mission critical.
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
Assumptions
The previous practices have been completed.
You are logged into Cloud Control as SYSMAN and have the menus of the rcat home page
displayed.
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
Tasks O UA use
Schedule nightly disk-based incrementalC H online
e o
tbackups for your whole database, including
0
2 ce
archive logs. Configure the archive
T logs n s
for deletion from disk after the backup is complete.
Schedule the backup L forI%
executionliat 11:00 PM. The schedule should be in effect indefinitely.
M
1. In Cloud Control,
E navigate
a b leto Availability > Backup & Recovery > Schedule Backup.
e r
AchoosefeNC_SYSDBA
r i
2. If needed,
a n s as Database Credentials.
h t r a
Zac non-
s a
)h a
m
co eฺ
o
o uid ฺ
y a h
@ n t G
k
ac tude
f r z
( confirm Sor select the following settings
4. On the Schedule Customized Backup: Options
L A page,
h i s
and then click Next.
U A se t
Backup Type HO e to u
Incremental Backup
C
Backup Mode 0T ens
Online2Backup
L I%• Also e l ic up all archived logs on disk
Advanced
ME era b l back
A f • Delete all archived logs from disk after they are successfully
h a rie ans backed up
c t r
Za non- • Delete obsolete backups
s a
)h a
m
co eฺ
o
o uidฺ
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 Backup:nsSettings page, select Disk as your backup location,
5. On the Schedule Customized % c e
and then click E LI ble li
Next.
A
6. On the Schedule M Customized
e ra Backup: Schedule page, confirm or select the following
r i e s f
c
settings
hJoba Name-
and
t r an
then click Next.
a
Z non NIGHTLY_BACKUP
Job Description Whole Database Backup
Repeating Selected (Notice how additional context-sensitive details are
displayed.)
Frequency By Days
Type
Repeat Every 1
Repeat Until Indefinite
Start Time. 11:00 PM (This time should not interfere with your regular course
hours; so your instructor might suggest a different time.)
Time Zone Your time zone (you instructor might suggest a time zone.)
s a
)h a
m
cothe RMAN
o
7. On the Schedule Customized Backup: Review page, review your settings
o ฺ
and e ฺ
script, and then click Submit Job. a h u i d
y t G
a c k@ den
( frz s Stu
A LA e thi
H OU to us
0 T C se
I % 2 icen
E L ble l
A M era
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
10. Click the Job Activity link in the navigation bar.
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
T
The Job Activity page displays
2 ns > Job
0 a summary of your jobs. You might decide to use it in later
%
I le li
practices also by navigating: c e
Enterprise > Activity.
L
A MEfrom
Navigation Tip: There
r a b ways to navigate to a database home page, for example, if
are multiple
e RCAT to the ORCL database, you can click: Targets > All Targets,
you wish to navigate
r i e s f the
then click
c an Database Instance link or use the History pull-down.
ha the-trorcl
a
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
Practices for @ Lesson n t G6:
k
acBackups de
Creating
( f r z S t u
L A h i s
U AChapterse6 t
C HO e to u
2 0T ens
L I% le lic
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
backup.
Note: The BCT file can only contain 8 bitmaps, so the backup cannot be optimized if there have
been more than 8 incremental backups since the parent level backup that the new incremental
will be based on. Consider the 8-bitmap limit when developing your incremental backup
strategy. For example, if you make a level 0 database backup followed by 7 differential
incremental backups, then the block change tracking file now includes 8 bitmaps. If you then
make a cumulative level 1 incremental backup, RMAN cannot optimize the backup because the
bitmap corresponding to the parent level 0 backup is overwritten with the bitmap that tracks the
current changes.
s a
Assumptions )h a
co eฺm
The previous practices have been completed.
o ฺ
o database
You have a terminal window open in the $LABS directory pointing to the h
y a orcl
G uid
instance.
c k @ ent
d
Tasks ( frza s Stu
1. Configure block change tracking to place the A file tinhthe
LBCT i default data file creation
destination. A
U us e
H O to database with administrator privileges.
a. Start SQL*Plus and connect
T C
0 ens
to your orcl
e
$ sqlplus / as2sysdba
L %
e l ic
I DB_CREATE_FILE_DEST
b. Ensure that
M E ab
the l initialization parameter is set to the correct
i e A fer
location.
a r a n s PARAMETER DB_CREATE_FILE_DEST
h SQL>
rSHOW
Zac noNAME n-t TYPE VALUE
------------------------------------ ----------- -------------
db_create_file_dest string +DATA
SQL>
c. Enable block change tracking. Execute the following ALTER DATABASE statement:
SQL> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING;
Database altered.
SQL>
Note: In practice 6-2, step 6, you will disable block change tracking again, because it is not
a meaningful setting for this training environment.
2. Exit SQL*Plus.
SQL> exit
Note: Applying the incremental backup to the level 0 image copies makes the level 0 backup
the same as if you had taken a level 0 instead of the level 1.
Assumptions
The previous practices have been completed.
You have two terminal windows open in the $LABS directory, each pointing to the orcl
database instance.
Tasks s a
1. Execute the lab_06_02_01.sh script from the labs directory. This script creates) theh a
m
INVENTORY tablespace, the INVENTORY user, and populates the schema in
mode. (The execution of the script might take a while because severalo o ฺcoNOLOGGING
tables with eฺ
over
a h u i d
90,000 rows are created. Your row count might be different.) y t G
$ cd $LABS
a c k@ den
$ ./lab_06_02_01.sh
( frz s Stu
. . .
A LA e thi
5 U6 7s
SQL> 2 3
91418 rows created.C
4
H O t o u 8 9 10
0 T s e
I % 2 icen
SQL> 2 L
E l e l
A
Commit Mcomplete.
f e r ab
a ie n2 s
rSQL>
a c h
n -
Tabletraaltered.
Z noSQL> SQL>
Index created.
SQL> SQL>
Table altered.
SQL> SQL>
Table altered.
RMAN> run {
2> ALLOCATE CHANNEL "ch1" DEVICE TYPE DISK FORMAT
"/u01/backup/orcl/%U";
3> BACKUP AS COPY TAG 'BASE01' INCREMENTAL LEVEL 0 DATABASE;
4> }
E L ble l
A
RMAN> M era
iethe backup
b.arAs n s f is performed, notice where the backup files are created. Be sure to
a c h create
n - traa tag for this backup. In this example 'BASE01' is the tag.
Z3. Innanother
o terminal window (in the $LABS directory, pointing to the orcl database
instance), start a workload that updates your database by executing the
lab_06_02_03.sh script.
Note: The script updates over 2000 rows (but this is not important.)
$ ./lab_06_02_03.sh
. . .
2745 rows updated.
. . .
$
4> }
allocated channel: ch1
channel ch1: SID=48 device type=DISK
O UA use
channel ch1: specifying datafile(s) in backup set
C H e to
input datafile file number=00001
2 T
0 ens
name=+DATA/ORCL/DATAFILE/system.257.817894153
L I le lic
%
channel ch1: starting piece 1 at 2013-06-14:10:58:56
A ME erab
channel ch1: finished piece 1 at 2013-06-14:10:58:59
a r ie nsf
piece handle=/u01/backup/orcl/0ooc5l3g_1_1 tag=INCR_UPDATE
a c h -tracomment=NONE
Z non channel ch1: backup set complete, elapsed time: 00:00:03
channel ch1: starting incremental level 1 datafile backup set
channel ch1: specifying datafile(s) in backup set
input datafile file number=00002
name=+DATA/ORCL/DATAFILE/example.269.817894393
channel ch1: starting piece 1 at 2013-06-14:10:58:59
channel ch1: finished piece 1 at 2013-06-14:10:59:02
piece handle=/u01/backup/orcl/0poc5l3j_1_1 tag=INCR_UPDATE
comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:03
channel ch1: starting incremental level 1 datafile backup set
channel ch1: specifying datafile(s) in backup set
input datafile file number=00005
name=/u01/backup/orcl/inventory01.dbf
input datafile file number=00004
name=+DATA/ORCL/DATAFILE/undotbs1.259.817894231
a c h -tra5_0koc5kj7
Z non recovering datafile copy file number=00006
name=/u01/backup/orcl/data_D-ORCL_I-1345675044_TS-USERS_FNO-
6_0loc5kja
recovering datafile copy file number=00007
name=/u01/backup/orcl/data_D-ORCL_I-1345675044_TS-INVENTORY_FNO-
7_0joc5kj0
channel ch1: reading from backup piece
/u01/backup/orcl/0qoc5l3n_1_1
channel ch1: piece handle=/u01/backup/orcl/0qoc5l3n_1_1
tag=INCR_UPDATE
channel ch1: restored backup piece 1
channel ch1: restore complete, elapsed time: 00:00:03
Finished recover at 2013-06-14:11:07:38
RMAN>
6. Disable block change tracking in the training environment. You can execute the command
either in SQL*Plus or in RMAN.
RMAN> ALTER DATABASE DISABLE BLOCK CHANGE TRACKING;
Statement processed
RMAN>
7. Exit the RMAN client and cleanup your test data by executing the cleanup_06_02.sh
script which removes the INVENTORY tablespace and the INVENTORY user. s a
RMAN> exit )h a
m
co eฺ
$ ./cleanup_06_02.sh
o ฺ
o uid
$
y a h
8. Optionally, use another terminal window to view the output in@ n t G
the /tmp/cleanup.log file
c k e
while the script is executing.
( f r z a
S t ud
$ cat /tmp/cleanup.log
A thison Thu Mar 21 20:13:45
LProduction
SQL*Plus: Release 12.1.0.1.0 A
U use
2013 O
H Oracle.
to
Copyright (c) 1982, T
0 enC2013,se All rights reserved.
SQL> Connected. 2
I% le lic
L
SQL>
A ME edropped.
r ab
ie ns
Tablespace
rSQL> f
c h a a
trdropped.
a
Z no n -
User
SQL> Disconnected from Oracle Database 12c Enterprise Edition
Release 12.1.0.1.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP,
Advanced Analytics
and Real Application Testing options
$
9. As SYSBACKUP, delete obsolete backups.
$ rman target "'/ as sysbackup'"
17916399
Backup Set 6 2013-06-12:15:22:45
Backup Piece 6 2013-06-12:15:22:45
+FRA/ORCL/BACKUPSET/2013_06_12/nnndf0_tag20130612t152244_0.258.8
17917765
Archive Log 7 2013-06-12:21:00:51
+FRA/ORCL/ARCHIVELOG/2013_06_12/thread_1_seq_13.260.817938049
Backup Set 7 2013-06-12:15:22:48
s a
Backup Piece 7 2013-06-12:15:22:48
)h
+FRA/ORCL/AUTOBACKUP/2013_06_12/s_817917765.259.817917767
a
m
co eฺ
Archive Log 8 2013-06-12:22:05:18
o ฺ
o uid
+FRA/ORCL/ARCHIVELOG/2013_06_12/thread_1_seq_14.261.817941915
y a h
Archive Log 9 2013-06-12:22:11:44
@ n t G
k
ac tude
+FRA/ORCL/ARCHIVELOG/2013_06_12/thread_1_seq_15.262.817942299
f r z
A ( this S
Archive Log 10 2013-06-12:22:13:36
L
+FRA/ORCL/ARCHIVELOG/2013_06_12/thread_1_seq_16.263.817942411
Archive Log
O UA use
11 2013-06-13:03:10:29
H e to
+FRA/ORCL/ARCHIVELOG/2013_06_13/thread_1_seq_17.264.817960227
C
Archive Log
2 T
0 ens 12 2013-06-13:09:16:53
I le lic
%
+FRA/ORCL/ARCHIVELOG/2013_06_13/thread_1_seq_18.268.817982211
L
A ME erab
Backup Set 8 2013-06-13:09:23:03
a r ie nsf
Backup Piece 8 2013-06-13:09:23:03
a c h -tra+FRA/ORCL/AUTOBACKUP/2013_06_13/s_817982579.270.817982583
Z non Backup Set
Backup Piece
9
9
2013-06-13:16:45:36
2013-06-13:16:45:36
+FRA/ORCL/BACKUPSET/2013_06_13/nnndf0_tag20130613t164329_0.271.8
18009011
Backup Set 10 2013-06-13:16:45:51
Backup Piece 10 2013-06-13:16:45:51
+FRA/ORCL/AUTOBACKUP/2013_06_13/s_818008864.272.818009151
Backup Set 11 2013-06-13:17:08:11
Backup Piece 11 2013-06-13:17:08:11
+FRA/ORCL/BACKUPSET/2013_06_13/nnndf0_tag20130613t170556_0.273.8
18010363
Control File Copy 2 2013-06-13:17:09:19
/u01/backup/dontouch/control.ctl
Backup Set 12 2013-06-13:17:08:22
Backup Piece 12 2013-06-13:17:08:22
+FRA/ORCL/AUTOBACKUP/2013_06_13/s_818009728.256.818010501
A ME erab
Backup Piece 18 2013-06-14:10:59:16
a r ie nsf
/u01/backup/orcl/0qoc5l3n_1_1
handle=+FRA/ORCL/BACKUPSET/2013_06_12/nnndf0_tag20130612t152244_
0.258.817917765 RECID=6 STAMP=817917764
deleted archived log
archived log file
name=+FRA/ORCL/ARCHIVELOG/2013_06_12/thread_1_seq_13.260.8179380
49 RECID=7 STAMP=817938051
deleted backup piece
backup piece
s a
handle=+FRA/ORCL/AUTOBACKUP/2013_06_12/s_817917765.259.817917767
RECID=7 STAMP=817917767
)h a
deleted archived log m
co eฺ
archived log file o ฺ
o uid
y a h
@ n t G
name=+FRA/ORCL/ARCHIVELOG/2013_06_12/thread_1_seq_14.261.8179419
15 RECID=8 STAMP=817941918 k
ac tude
deleted archived log
f r z
archived log file
L A ( this S
UA use
name=+FRA/ORCL/ARCHIVELOG/2013_06_12/thread_1_seq_15.262.8179422
O
H e to
99 RECID=9 STAMP=817942304
C
T
0 ens
deleted archived log
2
I le lic
%
archived log file
L
ME erab
name=+FRA/ORCL/ARCHIVELOG/2013_06_12/thread_1_seq_16.263.8179424
A
11 RECID=10 STAMP=817942416
ie nsf
a r
h -tra
deleted archived log
a c
Z non archived log file
name=+FRA/ORCL/ARCHIVELOG/2013_06_13/thread_1_seq_17.264.8179602
27 RECID=11 STAMP=817960229
deleted archived log
archived log file
name=+FRA/ORCL/ARCHIVELOG/2013_06_13/thread_1_seq_18.268.8179822
11 RECID=12 STAMP=817982213
deleted backup piece
backup piece
handle=+FRA/ORCL/AUTOBACKUP/2013_06_13/s_817982579.270.817982583
RECID=8 STAMP=817982582
deleted backup piece
backup piece
handle=+FRA/ORCL/BACKUPSET/2013_06_13/nnndf0_tag20130613t164329_
0.271.818009011 RECID=9 STAMP=818009011
deleted backup piece
a c hNote: Your
n - traoutput may be different depending on the repetition of practices.
Z10. Optionally,
no crosscheck all data file copies of the ORCL database. Then exit.
RMAN> crosscheck datafilecopy all;
RMAN> exit
$
Note: Five validated backup should remain.
11. Optionally, view your backups in Cloud Control.
a. Navigate from the orcl home page: Availability > Backup & Recovery > Backup
Reports.
b. If needed, select the NC_SYSDBA as your Named Credential for the database login.
s a
c. You can customize the View Backup Report page. By default, the all types of backups
are displayed, sorted by start time in descending order. )h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
Note: Some practices intentionally introduce errors for your learning purpose. Your output
might look different, but it should have a mixture of COMPLETED and FAILED backups.
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
Practices for @ Lesson n t G7:
k
ac Your e
dBackups
Improving
( f r z S t u
L A h i s
U AChapterse7 t
C HO e to u
2 0T ens
L I% le lic
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
Assumptions
The previous practices have been completed.
You are in a terminal window pointing to the orcl database instance.
Tasks
1. Log in to SQL*Plus and back up the control file to a binary file in the /u01/backup/orcl
directory.
Note: You have already configured automatic backup for the control file. These commands
show you how to perform a manual backup of the control file (for learning purposes). s a
a. Log in to SQL*Plus as SYSBACKUP. )h a
m
co eฺ
$ sqlplus / as sysbackup
o ฺ
o uid
. . .
y a h
SQL> show user @ n t G
k
ac tude
USER is "SYSBACKUP"
f r z
SQL>
L A ( this S
b. Use the ALTER DATABASE BACKUP U A se command.
CONTROLFILE
O
H CONTROLFILE
t o u TO
SQL> ALTER DATABASE BACKUP
0 C
T nse
'/u01/backup/orcl/control.ctl';
I % 2 i ce
Database altered.
SQL> L
E able l
M
A to record er the names of all data files that are included in the control file at the
c. Be
r i esure
s f
a c ha time-tofrathisn backup.
Z noSQL> n SELECT name FROM v$datafile;
NAME
--------------------------------------------------------------
+DATA/ORCL/DATAFILE/system.257.817894153
+DATA/ORCL/DATAFILE/example.269.817894393
+DATA/ORCL/DATAFILE/sysaux.256.817894089
+DATA/ORCL/DATAFILE/undotbs1.259.817894231
+DATA/ORCL/DATAFILE/users.258.817894229
SQL>
--------------------------------------------------------------
--------------------------------------------------------------
--------------------------------------------------------------
--------------------------------------------------------------
--------------------------------------------------------------
MEMBER
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
--------------------------------------------------------------
+FRA/ORCL/ONLINELOG/group_3.269.817982249
+DATA/ORCL/ONLINELOG/group_3.267.817894323
+FRA/ORCL/ONLINELOG/group_2.267.817982173
+DATA/ORCL/ONLINELOG/group_2.265.817894313
+FRA/ORCL/ONLINELOG/group_1.266.817982075
+DATA/ORCL/ONLINELOG/group_1.263.817894305
6 rows selected.
s a
)h a
SQL>
m
co eฺ
--------------------------------------------------------------
o
o uidฺ
--------------------------------------------------------------
y a h
@ n t G
k
--------------------------------------------------------------
ac tude
r z
--------------------------------------------------------------
f
A ( this S
--------------------------------------------------------------
L
UA use
--------------------------------------------------------------
O
2. Back up the control file to a traceH file. Thento
view the trace file and exit SQL*Plus.
Note: This command creates T C
0 a SQL e
s to re-create a control file.
% 2 c e nscript
a. Use the ALTERLIDATABASE e i
lBACKUP CONTROLFILE TO TRACE SQL command.
E l
ab BACKUP CONTROLFILE TO TRACE AS
M eDATABASE
A
SQL> ALTER
f r
h a rie ans
'/u01/backup/orcl/control.sql';
a c n - tr
Z noDatabase altered.
SQL> exit
b. View the trace file in a terminal window. What can you learn from its content?
$ cat /u01/backup/orcl/control.sql
-- The following are current System-scope REDO Log Archival
related
-- parameters and can be included in the database initialization
file.
--
-- LOG_ARCHIVE_DEST=''
-- LOG_ARCHIVE_DUPLEX_DEST=''
--
-- LOG_ARCHIVE_FORMAT=%t_%s_%r.dbf
--
-- DB_UNIQUE_NAME="orcl"
-- FAL_CLIENT=''
-- FAL_SERVER=''
--
-- LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST'
-- LOG_ARCHIVE_DEST_1='MANDATORY NOREOPEN NODELAY'
-- LOG_ARCHIVE_DEST_1='ARCH NOAFFIRM EXPEDITE NOVERIFY SYNC'
-- LOG_ARCHIVE_DEST_1='NOREGISTER NOALTERNATE NODEPENDENCY'
-- LOG_ARCHIVE_DEST_1='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED
s a
NODB_UNIQUE_NAME'
-- LOG_ARCHIVE_DEST_1='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILES)' )h a
m
co eฺ
-- LOG_ARCHIVE_DEST_STATE_1=ENABLE
o ฺ
o uid
y a h
-- @ n t G
k
ac each dofe which creates a
-- Below are two sets of SQL statements,
( f r z S t u
new
L A
-- control file and uses itAto open the h i s
t database. The first set
opens U
O to u s e
C H e
-- the database with
0 T the NORESETLOGS
n s option and should be used
a r-- s
set opens
a n
h t r
Zac no--n-if online logs are unavailable.
be used
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
s a
LOGFILE
)h a
GROUP 1 ( m
co eฺ
o
'+DATA/ORCL/ONLINELOG/group_1.263.817894305',ฺ
o uid
a h
'+FRA/ORCL/ONLINELOG/group_1.266.817982075'
y
@ n t G
) SIZE 50M BLOCKSIZE 512,
k
ac tude
GROUP 2 (
f r z
A ( this S
'+DATA/ORCL/ONLINELOG/group_2.265.817894313',
L
UA use
'+FRA/ORCL/ONLINELOG/group_2.267.817982173'
O
H e to
) SIZE 50M BLOCKSIZE 512,
C
2
GROUP 3 ( T
0 ens
L I le lic
%
'+DATA/ORCL/ONLINELOG/group_3.267.817894323',
A ME erab
'+FRA/ORCL/ONLINELOG/group_3.269.817982249'
a r ie nsf
) SIZE 50M BLOCKSIZE 512
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "ORCL" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
m
co eฺ
archived log file
o ฺ
o uid
name=+FRA/ORCL/ARCHIVELOG/2013_06_15/thread_1_seq_27.280.8181433
y a h
51 RECID=21 STAMP=818143355
@ n t G
archived log file k
ac tude
f r z
name=+FRA/ORCL/ARCHIVELOG/2013_06_15/thread_1_seq_28.279.8181577
A ( this S
21 RECID=22 STAMP=818157724
L
archived log file
O UA use
H e to
name=+FRA/ORCL/ARCHIVELOG/2013_06_15/thread_1_seq_29.278.8181721
C
2 T
65 RECID=23 STAMP=818172168
0 ens
I le lic
%
archived log file
L
ME erab
name=+FRA/ORCL/ARCHIVELOG/2013_06_15/thread_1_seq_30.277.8181865
75 RECID=24 STAMP=818186577
A
ie nsf
a r
h -tra
archived log file
a c
Z non
name=+FRA/ORCL/ARCHIVELOG/2013_06_15/thread_1_seq_31.276.8182010
31 RECID=25 STAMP=818201035
archived log file
name=+FRA/ORCL/ARCHIVELOG/2013_06_16/thread_1_seq_32.275.8182297
13 RECID=26 STAMP=818229718
archived log file
name=+FRA/ORCL/ARCHIVELOG/2013_06_16/thread_1_seq_33.274.8182404
33 RECID=27 STAMP=818240435
archived log file
name=+FRA/ORCL/ARCHIVELOG/2013_06_16/thread_1_seq_34.256.8182446
05 RECID=28 STAMP=818244609
archived log file
name=+FRA/ORCL/ARCHIVELOG/2013_06_16/thread_1_seq_35.273.8182620
21 RECID=29 STAMP=818262025
archived log file
name=+FRA/ORCL/ARCHIVELOG/2013_06_16/thread_1_seq_36.272.8182875
77 RECID=30 STAMP=818287581
Note: A downward pointing triangle marks this column as "order by descending" First
Change Number.
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
Assumptions
The ORCL target database has at least some of the data files are stored in ASM. The Grid
Infrastructure was installed by the grid OS user.
You are logged in to a terminal window.
Tasks
1. Switch to the grid OS user and set the environment to connect to the +ASM instance
s a
$ su - grid
)h a
Password: oracle <<< not displayed m
co eฺ
$ . oraenv o ฺ
o uid
ORACLE_SID = [grid] ? +ASM
y a h
@ n t G
The Oracle base for k
ac tude
r z
ORACLE_HOME=/u01/app/oracle/product/12.1.0/grid is
f
/u01/app/oracle
L A ( this S
$
O UA use
2. Invoke asmcmd.
C H e to
$ asmcmd
2 T
0 ens
ASMCMD>
L I le lic
%
ME emdbackup
3. Use the ASMCMD
A r ab command to create a backup of ASM metadata. Place the
riein the
backup
n s f
/u01/backup/asm_meta directory.
h a r a
Zac noDiskn-t group
ASMCMD> md_backup /u01/backup/asm_meta/asm_metadata_BAR1
metadata to be backed up: FRA
Disk group metadata to be backed up: DATA
Current alias directory path: ASM/CONTROLFILE
Current alias directory path: ORCL/AUTOBACKUP/2013_06_17
Current alias directory path: ORCL/ONLINELOG
Current alias directory path: ORCL/AUTOBACKUP/2013_06_14
Current alias directory path: ASM
Current alias directory path: ORCL
Current alias directory path: ORCL/controlfile
Current alias directory path: ORCL/AUTOBACKUP
Current alias directory path: ORCL
Current alias directory path: ORCL/CONTROLFILE
Current alias directory path: DB_UNKNOWN
Current alias directory path: ORCL/ONLINELOG
Current alias directory path: DB_UNKNOWN/PARAMETERFILE
$ exit
logout
$
5. Optionally, display your current OS user log in.
$ whoami
oracle
$
Note: You are again logged in as the oracle OS user. s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
Assumptions
You are in a terminal window as oracle OS user, pointing to the orcl database instance.
Tasks
1. Ensure that you are logged in to RMAN using the recovery catalog.
$ rman target "'/ as sysbackup'" catalog rcatowner@rcat
s a
...
)h a
recovery catalog database Password: oracle_4U <<<not displayed
m
co eฺ
connected to recovery catalog database
o ฺ
o uid
y a h
@ n t G
RMAN>
k
ac state.tude
f r z
2. Create a backup copy of the entire database in a mounted
RMAN> SHUTDOWN IMMEDIATE;
L A ( this S
O UA use
database closed C H e to
2
database dismounted T
0 ens
L %
I lshut
Oracle instance
e l icdown
A ME erab
r ie STARTUP
n s f MOUNT;
c a RMAN>
h -tra
a n
Z noconnected to target database (not started)
Oracle instance started
database mounted
a c h -traname=+DATA/ORCL/DATAFILE/example.269.817894393
Z non RMAN-03009: failure of backup command on ORA_DISK_1 channel at
06/17/2013 09:50:54
ORA-19811: cannot have files in DB_RECOVERY_FILE_DEST with keep
attributes
continuing other job steps, job failed will not be re-run
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004
name=+DATA/ORCL/DATAFILE/undotbs1.259.817894231
RMAN-03009: failure of backup command on ORA_DISK_1 channel at
06/17/2013 09:50:56
ORA-19811: cannot have files in DB_RECOVERY_FILE_DEST with keep
attributes
continuing other job steps, job failed will not be re-run
channel ORA_DISK_1: starting datafile copy
input datafile file number=00006
name=+DATA/ORCL/DATAFILE/users.258.817894229
RMAN-00571: ===============================================
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
RMAN>
Question: Why did the backup command fail?
Possible answer: It failed because a backup with the KEEP attribute (an archival backup)
cannot be written to the Flash Recovery Area. Allowing this has the potential of causing the
Flash Recovery Area to quickly run out of space. This error forces you to specify a different
location.
4. Create an archival backup with a FORMAT clause that causes the backup to be written to
the /u01/backup directory.
RMAN> BACKUP DATABASE FORMAT '/u01/backup/%U' TAG keep_db_tag
s a
KEEP forever RESTORE POINT KEEPDB;
)h a
m
co eฺ
Starting backup at 2013-06-17:09:53:45 o ฺ
o uid
y a h
@ n t G
using channel ORA_DISK_1 k
ac tude
f r z S
Aor( backed
backup will never be obsolete
archived logs will not be kept L t h i s up
U A fullsedatafile
channel ORA_DISK_1: starting
H O o u backup set
t datafile(s) in backup set
channel ORA_DISK_1:Cspecifying
0 T s e
I % l i en
input datafile2file number=00003
c
EL abfile
le number=00001
name=+DATA/ORCL/DATAFILE/sysaux.256.817894089
input M
i e A fer datafile
a r a n s
name=+DATA/ORCL/DATAFILE/system.257.817894153
a c h -
input t r datafile file number=00002
Z no n
name=+DATA/ORCL/DATAFILE/example.269.817894393
input datafile file number=00004
name=+DATA/ORCL/DATAFILE/undotbs1.259.817894231
input datafile file number=00006
name=+DATA/ORCL/DATAFILE/users.258.817894229
channel ORA_DISK_1: starting piece 1 at 2013-06-17:09:53:46
channel ORA_DISK_1: finished piece 1 at 2013-06-17:09:55:21
piece handle=/u01/backup/16ocdeda_1_1 tag=KEEP_DB_TAG
comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:35
a c h $ -tra
Z6. Fornoannalternate view of the backups, optionally, log in to Cloud Control as the SYSMAN user
and navigate to Availability > Backup & Recovery > Manage Current Backups. (Look
for the KEEP_DB_TAG tag.)
7. If you do not see your archival backup (that is, there is no backup with Forever in the
Keep column), then:
a. Set the NC_ORACLE host credentials at the bottom of the page, click Crosscheck All.
b. Execute the job Immediately. Click Submit Job > View Job to confirm that the job
execution succeeds.
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tudeSPFILE, and
Note: The Backup Sets tabbed page shows the archival CONTROLFILE,
( f r z S
DATAFILE.
L A h i s
t navigate; Availability > Backup &
8. Optionally, to view your restore points In A
Cloud Control,
U s e
Recovery > Restore Points.
C HO e to u
2 0T ens
L I% le lic
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
Practices for @ Lessonn t G8: Using
k
ac tudeBackups
( f z
RMAN-Encrypted
r S
L A h i s
U AChapterse8 t
C HO e to u
2 0T ens
L I% le lic
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
Assumptions
You logged in to Enterprise Manger Cloud Control as the SYSMAN user and have the orcl
home page displayed.
You also have a terminal window open in the /home/oracle/labs directory pointing to the
orcl instance.
Tasks
1. In a terminal window, execute the lab_08_01_01.sh script (as oracle OS user). This
s a
script creates the ENC user and the ENCTBS tablespace for this practice. The output can be
viewed in the /tmp/setup.log file. )h a
m
co eฺ
$ ./lab_08_01_01.sh
o ฺ
o uid
$ a h
y If tneeded,
@
Backup. n
G log in with
2. Navigate to Availability > Backup & Recovery > Schedule k
ac tude
the NC_SYSDBA named credentials.
f r z
( CredentialsS are set to NC_ORACLE .
3. On the Schedule Backup page, ensure that the
L A Host
h i s
t Backup.
A Customized
select Tablespaces, and then click Schedule
U s e
4. On the Schedule Customized Backup:
t o u page, click Add.
HO Tablespaces
C
0T then
5. Select the ENCTBS tablespace, se the Select button.
click
2 e n
I%Customized
6. Back on the Schedule
L e l ic Backup: Tablespaces page, click Next.
ME erab l
A
ie nsf
a r
h -tra
a c
Z non
password, but please ensure that you will remember it. When you use password
encryption, you must provide the same password for the backup and restore
operations. This is an appropriate technique for backups that will be restored at a
remote location.
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
Note: You can use the Oracle Encryption AWallet s(also
Ulater e known as keystore) only after it is
created and opened which is done O
H e to
in a u
practice.
d. Click Next. T C
0 ens
% 2 ic Settings page, accept Disk as the destination, and
I le lBackup:
8. On the Schedule Customized
L
click Next.
A ME Customized
e rab Backup: Schedule page, enter BACKUP_ENC as Job Name,
9. On theeSchedule
ri the Job n s f
c h a
accept
t r a Description, ensure the Schedule is One Time (Immediately), and then
a
Z non -
click Next.
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
T
0 inentexts form because that would be a security violation.
Note: The password is not displayed
2
L I% lline
If you are using the command
e l ic
interface, then you also use the SET ENCRYPTION ON...
IDENTIFIED BY E b ONLY command in your RMAN script to enable password
encryption. A
Mpasswordr a
e Job.
riView n s fe
11. h
c a
Click
tra orcl page click the Show link of the Backup Script.
a
Z no
12. On n
the -
Execution:
14. If your backup job is still running, click the Refresh icon (top-right).
15. Optionally, click the Succeeded link in the Status column for Step: Backup, review the
Output Log, and then click Execution:orcl in the navigation bar.
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
( howisyouScan return to the orcl home
16. From the Execution:orcl page there are several Aways
page. For example, click History > orcl. U A se th
L
HO e> orcl
(Alternatives are Targets > Databases
C t o uor All Targets > orcl (Database Instance).
2 0T ens
L I% le lic
A ME erab
Note: Most
r s f practice is optional, but the last cleanup and backup tasks (step 16) are
ieof the nnext
a
h -tra
mandatory.
c
a
Z non
Assumptions
You completed the previous practice and remember your encryption password.
You are logged in to Cloud Control as the SYSMAN user and have the orcl home page
displayed.
You also have a terminal window open. a
as
Tasks
m )h
1. In the terminal window create an issue by aborting the ORCL database andฺc o the
data file of the ENCTBS tablespace. Then mount the database. h o o deleting
i d eฺ
a u
$ srvctl stop database -d orcl -o abort @y t G
a c k den
frz s Stu
$
(
LA e thi
$ rm /u01/backup/orcl/enctbs01.dbf
A
O-dU orcl u-os mount
$
$ srvctl start database
C seH t o
0 T
enis removed.
$
I % 2the dataicfile
2. Optionally, confirm that
EL able l
M
A fer
$ ls /u01/backup/orcl
a r i e n
0vocdc7h_1_1s
h r a
n-t
Zac nocontrol.sql
control.ctl
data_D-ORCL_I-1345675044_TS-EXAMPLE_FNO-2_0hoc5khd
data_D-ORCL_I-1345675044_TS-SYSAUX_FNO-3_0eoc5ket
data_D-ORCL_I-1345675044_TS-SYSTEM_FNO-1_0goc5kga
data_D-ORCL_I-1345675044_TS-UNDOTBS1_FNO-4_0ioc5ki6
data_D-ORCL_I-1345675044_TS-USERS_FNO-6_0loc5kja
$
Your output may look different, but you should not see the enctbs01.dbf data file.
3. In Cloud Control, navigate to Availability > Backup & Recovery > Perform Recovery. (If
needed, log in with the NC_SYSDBA named credentials.)
Note: It could be that the database failure was already discovered, but for the sake of your
learning experience execute the following steps.
4. On the Perform Recovery page:
a. Select Tablespaces as Recovery Scope.
b. Ensure that "Recover to current time or a previous point-in-time" is selected.
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H eTablespaces
to
5. On the Perform Object Level
0 T Recovery:
n s page, click Next.
Note: If the ENCTBS% is2 c e click Add, select ENCTBS, and click the Select
not displayed
i
L I l
button.
M E able
i e A fer
a r a n s
h t r
Zac non-
7. On the Perform Object Level Recovery: Schedule page, enter RECOVERY_ENC as Job
Name, accept the Job Description, and click Next.
8. On the Perform Object Level Recovery: Review page, click Edit RMAN Script.
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac in tthisde
For the command line interface, you enter the commands ( f r zshown
u
S RMAN script.
A
Note: The password is not displayed for securityLreasons. th i s
A sdatabase,
inUan online
e
H O
Note: If you perform this type of recovery
t o u you would see the following
SQL> exit
$
14. Mandatory cleanup and backup tasks:
a. Execute the cleanup_08_02.sh script from the $LABS directory to remove the test
data used in this practice. The output can be viewed in the /tmp/cleanup.log file.
$ ./cleanup_08_02.sh
$
s a
b. Execute the backup_orcl.sh script from the $LABS directory to create a new )h a
database backup for the next practices. The output can be viewed in the om
/tmp/backup.log file.
o o ฺc eฺ
$ ./backup_orcl.sh y ah Guid
c k @ ent
$
d
( frza s Stu
A LA e thi
H OU to us
0 T C se
I % 2 icen
E L ble l
A M era
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
Practices for @ Lesson n t G9:
k de
ac Database
Diagnosing
( f r z S t u Failure
A LA e9 this
Chapter
H OU to us
0 T C se
I % 2 icen
E L ble l
A M era
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
Assumptions
In the $LABS directory, you have a terminal window open, pointing to the orcl instance.
Tasks
1. Execute the setup_09_01.sh script. This script creates the BAR91TBS tablespace in the
file system, the BAR91 user, the BARCOPY table and populates the table. The script
continues and takes a backup of the tablespace and updates the table. The output of the
script can be viewed in the /tmp/setup.log file.
s a
$ ./setup_09_01.sh
)h a
$
m
co theeฺ
2. Execute the break_09_01.sh script. This script deletes a data file ando ฺ
causes
o uidfile.
a h
database to fail. The output of the script can be viewed in the /tmp/break.log
y
@ n t G
$ ./break_09_01.sh k
ac tude
$
f r z S
3. Continue in another terminal window as theL A ( user
oracle t h i s
with the environment variables
A
U uObserve
pointing to orcl. Attempt to start the database. s e the error message. Exit SQL*Plus.
H O o
$ sqlplus / as sysdba
0 T C se t
I % 2 icen
Connected Lto an idle
E l e l instance.
A M erab
r ie startup
n s f
c a SQL>
h Total traSystem Global Area 534462464 bytes
a n
Z noFixed Size-
2290416 bytes
Variable Size 276827408 bytes
Database Buffers 247463936 bytes
Redo Buffers 7880704 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 5 - see DBWR trace
file
ORA-01110: data file 5: '/u01/backup/orcl/bar91tbs01.dbf'
SQL> exit
========================
no manual actions available
s a
Automated Repair Options
======================== )h a
m
co eฺ
Option Repair Description
o
o uidฺ
------ ------------------
y a h
1 Restore and recover datafile 5 @ n t G
k
ac tude
f r z
Strategy: The repair includes complete media recovery with no
data loss
L A ( this S
UA use
Repair script:
O
/u01/app/oracle/diag/rdbms/orcl/orcl/hm/reco_2262014231.hm
H e to
RMAN>
T C
Note: If you see more % 2
than c e ns manual action, focus on the one that references
0one optional
bar91tbs01.dbf. E LI ble li
6. Use the DataA MRecovery
e ra Advisor to repair the failure. Examine the script that was generated
i e s f
r repairanbefore it executes. Enter Y or YES when prompted to execute the script and
forathis
a c h
to open - tr database.
the
n
Z noRMAN> repair failure;
Strategy: The repair includes complete media recovery with no
data loss
Repair script:
/u01/app/oracle/diag/rdbms/orcl/orcl/hm/reco_2262014231.hm
name=+FRA/ORCL/DATAFILE/bar91tbs.274.818358829
destination for restore of datafile 00005:
/u01/backup/orcl/bar91tbs01.dbf
channel ORA_DISK_1: copied datafile copy of datafile 00005
output file name=/u01/backup/orcl/bar91tbs01.dbf RECID=0 STAMP=0
Finished restore at 2013-06-17:18:01:10
Assumptions
In the $LABS directory, you have a terminal window open, pointing to the orcl instance.
Tasks
1. Abort the instance and restart it. You can abort the instance in multiple ways:
• The simplest is to use the SQL*Plus SHUTDOWN ABORT command or the stop
database –d orcl –o abort SRVCTL command (shown below).
• Other methods, such as finding the process id of the SMON process and executing the
s a
kill -9 <pid> OS command may not be effective if you are working in a
)h a
environment where Oracle Restart is installed, as in the classroom. m
co eฺ
$ srvctl stop database -d orcl -o abort o
o uidฺ
y a h
$
@ n t G
$ srvctl start database -d orcl k
ac the most de
2. Examine the alert log for the orcl instance. Starting( f r zfrom t u
S recent entries at the
A Whatth i s
U
to recover the instance and ensure database ALconsistency?
bottom of the file find the restart of the instance.
s e
are the steps the instance performed
1: diag/rdbms/orcl/orcl
2: diag/rdbms/emrep/emrep
3: diag/rdbms/rcat/rcat
Q: to quit
Please select option:
c. Examine the alert log in the gedit window. Interesting portions of an alert log are
shown in the next few steps.
d. Find the output from "terminating" (start your search from the bottom upwards).
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
e. Find the release of the database that you started and its spfile location.
…
Starting up:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -
64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real
Application Testing options.
ORACLE_HOME = /u01/app/oracle/product/12.1.0/dbhome_1
System name:Linux
Node name:EDRSR39P1
processes = 300
…
f. Find the instance recovery action. The redo roll forward action makes the database
consistent.
. . .
Completed: ALTER DATABASE MOUNT /* db agent *//* {0:0:9369} */
ALTER DATABASE OPEN /* db agent *//* {0:0:9369} */
2013-06-17 18:05:52.096000 +00:00
s a
Beginning crash recovery of 1 threads
)h a
parallel recovery started with 2 processes m
co eฺ
Started redo scan o ฺ
o uid
Completed redo scan
y a h
@ n t G
k
read 623 KB redo, 323 data blocks need recovery
ac tude
Started redo application at
f r z
A ( this S
Thread 1: logseq 48, block 3
L
UA use
2013-06-17 18:05:53.520000 +00:00
O
H e to
Recovery of Online Redo Log: Thread 1 Group 3 Seq 48 Reading mem
C
0
2 T
0 ens
I le lic
%
Mem# 0: +DATA/ORCL/ONLINELOG/group_3.267.817894323
L
ME erab
Mem# 1: +FRA/ORCL/ONLINELOG/group_3.269.817982249
A
Completed redo application of 0.51MB
ie nsf
a r
h -tra
2013-06-17 18:05:55.515000 +00:00
a c
Z non
Completed crash recovery at
Thread 1: logseq 48, block 1250, scn 2412497
323 data blocks read, 323 data blocks written, 623 redo k-bytes
read
. . .
Completed: ALTER DATABASE OPEN /* db agent *//* {0:0:9369} */
CJQ0 started with pid=56, OS id=4097
2013-06-17 18:06:38.382000 +00:00
db_recovery_file_dest_size of 4800 MB is 35.23% used. This is a
user-specified limit on the amount of space that will be used by
this
database for recovery-related files, and does not reflect the
amount of
space available in the underlying filesystem or ASM diskgroup.
...
Note: After other processes perform their activities, transaction rollback is enabled and any
transactions that were incomplete are rolled back.
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
Assumptions
You completed the previous practices and have time for this additional one.
In the $LABS directory, you have a terminal window open, pointing to the orcl instance.
Tasks
1. To prepare your practice environment, execute the setup_09_03.sh script.. This script
creates a tablespace in ASM, a user, a table and populates the table. Then the script takes
a backup of the tablespace and updates the table. The output of the script is redirected to
s a
/tmp/setup.log.
)h a
$ ./setup_09_03.sh
m
co eฺ
$
o ฺ
oto fail.uToiddelete an
2. Execute the break_09_03.sh script. This script causes the database a h
y as training
ASM file, the session switches to the grid user (which has oracle@ n t G password),
then returns as the oracle user. The output of the script
k de to
acis redirected
( f r z S t u
/tmp/break.log.
L A h i s
$ ./break_09_03.sh
U A se t
Password: oracle <<< H notO displayed
t o u
$ C
0T ense
3. Start the database Iin%
2 icview the error, and then exit.
L l e l
SQL*Plus,
A ME /erasabsysdba
$ sqlplus
a r ie nsf
a c h Connected
n - tra to an idle instance.
Z no
SQL> startup
ORACLE instance started.
-----------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------
b. Execute the commands.
$ rman target "'/ as sysbackup'"
. . .
connected to target database: ORCL (DBID=1345675044, not open)
RMAN> list failure;
s a
using target database control file instead of recovery catalog
)h a
Database Role: PRIMARY m
co eฺ
o ฺ
o uid
List of Database Failures
y a h
@ n t G
========================= k
ac tude
f r z S
Failure ID Priority Status
L A ( Detected
Time
t h i s Summary
---------- -------- --------- A
U us e
------------------- -------
O
H e to2013-06-17:18:40:42 One or more
8 HIGH
T C
0 are
OPEN
smissing
non-system datafiles
2 e n
L I% le lic
RMAN> M E afailure;
advise b
A f e r
a r ie ns
Database Role: PRIMARY
a c h -tra
Z noList n of Database Failures
=========================
C HO e to u
contents of repair
2 0T script:
e ns
# restore
L % li c
I andlerecover datafile
E b
M e(radatafile
restore 5 );
A f
h a rie recover
a n s datafile 5;
a c n - t
sqlr 'alter database datafile 5 online';
Z no
Do you really want to execute the above repair (enter YES or
NO)? y
executing repair script
s a
Do you want to open the database (enter YES or NO)? y
)h a
database opened m
co eฺ
o
o uidฺ
RMAN> exit
y a h
@ n t G
$
k
acthe orcl e
dinstance.
( f r
5. Optionally, as oracle OS user examine the alert log zfor
S t u For sample
questions, review the previous practice.
LA e thfile is
A
U us
6. As oracle OS user execute the cleanup_09_03.sh to remove the practice
O
H toetheto/tmp/cleanup.log file. Close all terminal
environment. The output is redirected
windows. T
0 ensC
% 2
I le lic
$ ./cleanup_09_03.sh
L
$
A ME erab
a r ie nsf
a c h -tra
Z non
Assumptions
In the $LABS directory, you have two terminal windows open, pointing to the orcl instance.
Tasks
1. Set up for this practice by executing the setup_09_04.sh. This script creates the BC
user, the BCTBS tablespace, and the BCCOPY table. The table is populated, a backup is
taken and the table is updated to prepare for this practice. The output can be viewed with
the cat /tmp/setup.log Linux command.
s a
$ ./setup_09_04.sh
$ )h a
m
co eฺ
o ฺ
2. Corrupt a data file created in the previous step by executing the break_09_04.sql
o uid
script.
a h
Note: The corrupt block error is expected. The script performs @ayquery against
t G the BCCOPY
k n
table to force the corrupt block to be discovered.
f r z ac tude
$ sqlplus /nolog @break_09_04.sql(
A i s S
. . . L
A se t h
BLOCK_NO OU
FILE_NO
C H e to u
---------- ----------
2 0T129 ens
I% le lic
7
L
E ab
A
System Maltered.
er
r i e s f
c ha 'Enter- t r anBlock number when prompted'
a
Z noEnter n value for block_no: 129 <<< enter your BLOCK_NO
0+1 records in
0+1 records out
80 bytes (80 B) copied, 4.1543e-05 s, 1.9 MB/s
0+1 records in
0+1 records out
79 bytes (79 B) copied, 4.2713e-05 s, 1.8 MB/s
. . .
$
------ ------------------
1 Recover multiple corrupt blocks in datafile 5
Strategy: The repair includes complete media recovery with no
data loss
Repair script:
/u01/app/oracle/diag/rdbms/orcl/orcl/hm/reco_3058543729.hm
RMAN>
5. Use the RMAN REPAIR FAILURE command to recover the corrupted blocks.
s a
Note: The name of the repair script is listed so that you can inspect it before you execute it.
)h a
RMAN> REPAIR FAILURE;
m
cowitheฺno
Strategy: The repair includes complete media recovery
o ฺ
o uid
data loss
y a h
Repair script:
@ n t G
k
ac tude
/u01/app/oracle/diag/rdbms/orcl/orcl/hm/reco_3058543729.hm
f r z
L A ( this S
contents of repair script:
A multiple
Ufor se blocks
# block media recovery O
H e t129 u
o to 130;
T
recover datafile C
0 ens
5 block
% 2
I want ic execute the above repair (enter YES or
L l e l
ME erab
Do you really to
NO)?Ay
a r ie nsfrepair script
executing
a c h -tra
n
Z noStarting recover at 2013-06-18:11:40:32
using channel ORA_DISK_1
RMAN>
7. Exit RMAN and clean up from the block corruption practice by executing the
cleanup_09_04.sh script. The output can be viewed with the cat
/tmp/cleanup.log Linux command.
RMAN> exit
...
$ ./cleanup_09_04.sh
$
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
Practices for @Lesson n t G10:
k de
c Recovery
aand
Restoref r z t u
A ( this S
Concepts
L
O UA use
C H e Chapter
to 10
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
Assumptions
You are familiar with Oracle backup and recovery.
Tasks
Case 1: The backups are taken during a nightly shutdown, with an incremental backup strategy.
A level 1 backup is applied to the previous Level 0 backup each night. The ARCHIVE LOG LIST
command shows the following:
SQL> archive log list
s a
Database log mode No Archive Mode
)h a
Automatic archival Disabled
m
co eฺ
Archive destination
o ฺ
USE_DB_RECOVERY_FILE_DEST
o uid
Oldest online log sequence 61
y a h
@ n t G
Next log sequence to archive 63
k
ac tude
Current log sequence
f r z 63
S
A disk containing the SYSAUX tablespace data files
L Ahas( crashed.
t h i s
a. Is complete recovery possible? What U Aare thessteps?
e
Answer: Yes, if all the redo logC HO
files t
from most o u
the recent backup to the current log file are
available. Restore the SYSAUX
2 0T data e n se recover the data files, and open the database.
files,
b. If complete recovery
L I% islenotlicpossible what are the steps to recover as much as possible.
What data
A ME(transactions)
r a b will be lost?
r ie current
Answer: feANY missing redo log files, between the time the backup was taken
If theresare
n
c a the a
hthis case,-trrestore
and time (when the database shutdown) a complete recovery is not possible. In
a
non command), and open the database with the RESETLOGS option. Any transactions
Z RECOVER all the database files, apply the most recent incremental backups (RMAN
between the time of the backup and the current time will be lost.
Case 2: The database backups are taken nightly online, with an incremental backup strategy. A
level 1 backup is applied to the previous level 0 backup each night. The ARCHIVE LOG LIST
command shows the following:
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 61
Next log sequence to archive 63
Current log sequence 63
A data file that is part of the application tablespace, containing critical data has been lost.
Describe the steps to perform a complete recovery.
Case 3: The effects of a batch job that was incorrectly executed on the database last night at
8:00 p.m. have been removed by performing an incomplete recovery to 6:00 p.m. After the
incomplete recovery the database was reopened. The checks that were performed following the
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
recovery revealed that some critical transactions performed prior to 7:15 p.m. are not in the
database.
c. What are valid options to recover these transactions?
Answer: The incomplete recovery can be restarted by using a control file that matches the
structure of the previous incarnation of the database at 7:15 p.m. and restoring a backup of
the database from before 6:00 p.m. Then an incomplete recovery using the archive log files
from the previous incarnation can be performed to recover the database to its state at
7:15pm.
d. Describe the requirements for recovering these transactions.
s a
)h a
Answer: The backup used in the previous incomplete recovery or an older backup must be
m
available. The archive log files and redo for that incarnation must be available. When using
co eฺ
o ฺ
RMAN, set the incarnation number to get the proper set of redo and archive logs.
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
Practices for @ Lesson n t G11:
k
ac Recovery de
Performing
( f r z S t u
L A h i s
U AChapterse11 t
C HO e to u
2 0T ens
L I% le lic
A ME erab
a r ie nsf
a c h -tra
Z non
Ensure that you completed the practice 7-3 "Creating an Archival Backup", because in case a
recovery fails the duplicated database files can be used for a "rescue" operation.
Possible recovery steps by using the archival backup:
a. With your environment variables pointing to the ORCL instance, log in to RMAN and
connect to the RMAN catalog:
rman target "'/ as sysbackup'" catalog rcatowner@rcat
b. Confirm the name of the restore point to be used, KEEPDB in this example:
LIST RESTORE POINT ALL;
c. Restore and recover your database by using your restore point: s a
RESTORE DATABASE UNTIL RESTORE POINT 'KEEPDB'; )h a
m
co eฺ
RECOVER DATABASE UNTIL RESTORE POINT 'KEEPDB';
o ฺ
o theuRESETLOGS
d. Because your database is now at an earlier point in time, open ithwith
y a id
option, and display the newly created DBID:
@ ent G
c k d
frza s Stu
ALTER DATABASE OPEN RESETLOGS;
SELECT DBID FROM V$DATABASE; (
A
e. In most environments, Oracle recommends thi a new backup after a recovery:
LA to eperform
H
BACKUP DATABASE PLUS ARCHIVELOGOU to uDELETEs INPUT;
C
0T ense
2
I% le lic
L
A ME erab
a r ie nsf
a c h -tra
Z non
Assumptions
In the $LABS directory, you have three terminal windows open, pointing to the orcl instance.
Tasks
1. Execute the setup_11_01.sh script and ensure that you have a backup of the entire
database in ARCHIVELOG mode. For example, use the RMAN client to execute:
BACKUP DATABASE PLUS ARCHIVELOG DELETE INPUT;
s a
or use the backup_orcl.sh script. The output is in /tmp/backup.log.
)h a
$ ./setup_11_01.sh m
co eฺ
$ o ฺ
o uid
y a h
$ ./backup_orcl.sh
@ n t G
$
c k de
frza s Stu script which removes
2. Cause a failure in the database by executing the (break_11_01.sh
the USERS tablespace.
A LA e thi
O U environment,
To delete a file in ASM in the Oracle training
u s you need to execute the rm
command as the GRID user, so C H o
you will betasked for the password. Enter oracle when
e output of the script is redirected to
prompted (it might take a 0
2 T
little n
while). sThe
/tmp/break.log.I% l ic e
L l e
ME erab
$ ./break_11_01.sh
A
a r ie nsforacle <<< not displayed
Password:
SQL> startup
ORACLE instance started.
ME ASYNC
csec) -----
A
Executing
f e r ab actions
a ie END
r----- n s DDE Actions Dump (total 0 csec) -----
h -t r a
Zac noORA-01157:
n
file
cannot identify/lock data file 6 - see DBWR trace
L %
---------- I--------
e l ic--------- ------------------- -------
8 ME eHIGH a l
b OPEN 2013-07-23:20:20:33 One or more
A r
a r ie nsf
non-system datafiles are missing
a c h -tra
n
Z noanalyzing automatic repair options; this may take some time
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=248 device type=DISK
analyzing automatic repair options complete
Repair script:
/u01/app/oracle/diag/rdbms/orcl/orcl/hm/reco_1589431370.hm
RMAN>
b. Optionally, to preview the potential repair:
RMAN> repair failure preview;
21562075
channel ORA_DISK_1: piece
handle=+FRA/ORCL/BACKUPSET/2013_07_23/nnndf0_tag20130723t194112_
0.290.821562075 tag=TAG20130723T194112
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 2013-07-23:20:34:32
s a
Starting recover at 2013-07-23:20:34:32
)h a
using channel ORA_DISK_1
m
co eฺ
o ฺ
o uid
starting media recovery
y a h
media recovery complete, elapsed time: 00:00:02 @ n t G
k
ac tude
f r z
Finished recover at 2013-07-23:20:34:36
L A ( this S
A se
sql statement: alter H OU todatafile
database u 6 online
C
0T ense
repair failure complete
2
I% le lic
L
E toabopen the database (enter YES or NO)? y
A M
Do you want
er
r i e
database
s f
openend.
c ha RMAN>
- t r an
a
nonData Recovery Advisor for other failures.
Z9. Check
RMAN> list failure;
Database Role: PRIMARY
no failures found that match specification
RMAN>
10. Cleanup your test case with the cleanup_11_01.sh script from the $LABS directory
(output is in /tmp/cleanup.log).
$ ./cleanup_11_01.sh
$
11. In your RMAN session, back up the database with the BACKUP DATABASE PLUS
ARCHIVELOG command. The output is in /tmp/backup.log. Then exit.
RMAN> BACKUP DATABASE PLUS ARCHIVELOG;
RMAN> exit
$
Assumptions
A full backup exists and the archive log files from the time of the backup to the current time are
available.
Tasks
1. Set up for this practice by executing the setup_11_02.sh script from the $LABS directory.
With this script a new tablespace and user are created. The user creates a table and
populates it. A backup of the tablespace is performed and then the table is updated. The
s a
output is in the /tmp/setup.log file.
)h a
$ ./setup_11_02.sh m
co eฺ
$ o
o uidฺ
a h
y script.
2. Cause a failure in the database by executing the break_11_02.sh
@ n t GBefore the
a k
c ude is simulated and
failure the user table is updated several times. An extended period of time
several log switches occur.
( z
fr s St
Because a file is deleted in ASM, you need L
A toA hi password for the grid user.
providetthe
e
/tmp/break.log file. H OU tpassword.
When prompted, enter oracle as training
o us The output is in the
0 T C se
$ ./break_11_02.sh
I % 2 icen
L
The last digit
E l e l salary indicates how many times this table
of the
has been
A M updated
f e r ab
h a rie SALARY
a n s
t r
Zac non- 24009
----------
System altered.
C HO e to u
T ns
Mandatory Manual0Actions
2
I% le lice
========================
L
A MEor e/u01/backup/orcl/bartbs.dbf
1. If file
r a b restore it was unintentionally
a c h files,- tr open the database read/write, then drop and re-create the
n
Z notablespace and import the data.
3. Contact Oracle Support Services if the preceding
recommendations cannot be used, or if they do not fix the
failures selected for repair
2 0 T ns
e
I% leatlic2013-06-24:14:59:54
Starting recover
L
ME eraORA_DISK_1
using channel
A b
f
ie nsmedia recovery
rstarting
c h a tra
a
Z no n -
archived log for thread 1 with sequence 21 is already on disk as
file
+FRA/ORCL/ARCHIVELOG/2013_06_24/thread_1_seq_21.292.818952643
archived log for thread 1 with sequence 22 is already on disk as
file
+FRA/ORCL/ARCHIVELOG/2013_06_24/thread_1_seq_22.291.818952645
archived log for thread 1 with sequence 23 is already on disk as
file
+FRA/ORCL/ARCHIVELOG/2013_06_24/thread_1_seq_23.290.818952649
archived log for thread 1 with sequence 24 is already on disk as
file
+FRA/ORCL/ARCHIVELOG/2013_06_24/thread_1_seq_24.289.818952653
archived log for thread 1 with sequence 25 is already on disk as
file
+FRA/ORCL/ARCHIVELOG/2013_06_24/thread_1_seq_25.288.818952655
RMAN-00571: ===============================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS
RMAN-00571: ===============================================
RMAN-03002: failure of recover command at 06/24/2013 14:59:55
RMAN-06053: unable to perform media recovery because of missing
log
RMAN-06025: no backup of archived log for thread 1 with sequence
26 and starting SCN of 2280353 found to restore
s a
)h a
RMAN>
m
co eฺ
The error message indicates that archive log file 26 is missing. o ฺ
othat is,uthe
Note: If you get two RMAN-06025 error messages, focus on the latest a
y h
one, idone with
the highest digits also in the following steps. @ ent G
c k
In a production system you would determine if there z
( fris aanother S ud of this file, possibly in
tcopy
an OS backup that is unknown to RMAN. If the archive logsfile can be found and restored, a
A
complete recovery is possible. For this practice LA assume
e thi the archive log file is lost.
Note: The archive log sequence number
H OU that t o usfind may be different than the one shown
you
in the example. Make note of your
0 T C missing s e archive log sequence number:
n
Iis%not2 possible
______________
9. Complete recovery L l i cein this situation. Use your SQL*Plus session to determine
how much dataM Ewill bealost.
b leIn this example, the current redo log file is sequence number 29
and logi e A 26feisrmissing. So all the data contained in log files 26 through 29 will
number
r
bealost. ran
s
h
Zac noSQL> n-t archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 27
Next log sequence to archive 29
Current log sequence 29
SQL>
Note: If you attempt to query the CURRENT_SCN column of the V$DATABASE view, you will
get a value of 0 (zero), not the last "current" SCN.
RMAN> SELECT NAME, DBID, CURRENT_SCN, LOG_MODE, OPEN_MODE FROM
V$DATABASE;
12. Restore the entire database from a backup that was taken before the missing archive log
file with the RESTORE DATABASE UNTIL SEQUENCE nn command.
RMAN> RESTORE DATABASE UNTIL SEQUENCE 26; (Enter your missing log
sequence number)
s a
skipping datafile 5; already restored to file
)h a
/u01/backup/orcl/bartbs.dbf
m
co eฺ
o ฺ
channel ORA_DISK_1: starting datafile backup set restore
o uid
a h
channel ORA_DISK_1: specifying datafile(s) to restore from
y
backup set
@ n t G
k
ac tude
channel ORA_DISK_1: restoring datafile 00001 to
f r z
A ( this S
+DATA/ORCL/DATAFILE/system.261.818611365
L
UA use
channel ORA_DISK_1: restoring datafile 00002 to
O
+DATA/ORCL/DATAFILE/example.264.818592141
H e to
T C
channel ORA_DISK_1: restoring datafile 00003 to
0 ens
2
+DATA/ORCL/DATAFILE/sysaux.270.818591867
I le lic
%
L
channel ORA_DISK_1: restoring datafile 00004 to
ME erab
+DATA/ORCL/DATAFILE/undotbs1.267.818592009
A
a r ie nsf
channel ORA_DISK_1: restoring datafile 00006 to
a c h -tra+DATA/ORCL/DATAFILE/users.268.818592007
Z non channel ORA_DISK_1: reading from backup piece
+FRA/ORCL/BACKUPSET/2013_06_24/nnndf0_tag20130624t144541_0.295.8
18952345
channel ORA_DISK_1: piece
handle=+FRA/ORCL/BACKUPSET/2013_06_24/nnndf0_tag20130624t144541_
0.295.818952345 tag=TAG20130624T144541
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:02:25
Finished restore at 2013-06-24:16:03:31
RMAN>
13. Recover the database through your last available log file.
Note: If incremental backups are available they will be applied first, then the archive logs.
The number of log files that need to be applied may vary from the example shown.
RMAN> recover database until sequence 26; (Enter your missing log
sequence number)
Starting recover at 2013-06-24:16:05:20
file
+FRA/ORCL/ARCHIVELOG/2013_06_24/thread_1_seq_21.292.818952643
archived log for thread 1 with sequence 22 is already on disk as
file
+FRA/ORCL/ARCHIVELOG/2013_06_24/thread_1_seq_22.291.818952645
archived log for thread 1 with sequence 23 is already on disk as
file
+FRA/ORCL/ARCHIVELOG/2013_06_24/thread_1_seq_23.290.818952649
archived log for thread 1 with sequence 24 is already on disk as
file s a
)h a
+FRA/ORCL/ARCHIVELOG/2013_06_24/thread_1_seq_24.289.818952653
m
co eฺ
archived log for thread 1 with sequence 25 is already on disk as
file o ฺ
o uid
y a h
+FRA/ORCL/ARCHIVELOG/2013_06_24/thread_1_seq_25.288.818952655
@ n t G
k
ac tude
channel ORA_DISK_1: starting archived log restore to default
destination
f r z
A ( this S
channel ORA_DISK_1: restoring archived log
L
UA use
archived log thread=1 sequence=20
O
H e to
channel ORA_DISK_1: reading from backup piece
C
T
0 ens
+FRA/ORCL/BACKUPSET/2013_06_24/annnf0_tag20130624t144800_0.300.8
2
I le lic
18952481
L %
ME erab
channel ORA_DISK_1: piece
A
handle=+FRA/ORCL/BACKUPSET/2013_06_24/annnf0_tag20130624t144800_
ie nsf
a r
h -tra
0.300.818952481 tag=TAG20130624T144800
a c
Z non
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file
name=+FRA/ORCL/ARCHIVELOG/2013_06_24/thread_1_seq_20.287.8189571
23 thread=1 sequence=20
channel default: deleting archived log(s)
archived log file
name=+FRA/ORCL/ARCHIVELOG/2013_06_24/thread_1_seq_20.287.8189571
23 RECID=50 STAMP=818957122
archived log file
name=+FRA/ORCL/ARCHIVELOG/2013_06_24/thread_1_seq_21.292.8189526
43 thread=1 sequence=21
archived log file
name=+FRA/ORCL/ARCHIVELOG/2013_06_24/thread_1_seq_22.291.8189526
45 thread=1 sequence=22
archived log file
name=+FRA/ORCL/ARCHIVELOG/2013_06_24/thread_1_seq_23.290.8189526
49 thread=1 sequence=23
49 RECID=44 STAMP=818952649
validation succeeded for archived log
archived log file
name=+FRA/ORCL/ARCHIVELOG/2013_06_24/thread_1_seq_24.289.8189526
53 RECID=45 STAMP=818952652
validation succeeded for archived log
archived log file
name=+FRA/ORCL/ARCHIVELOG/2013_06_24/thread_1_seq_25.288.8189526
55 RECID=46 STAMP=818952655
s a
validation failed for archived log
)h a
archived log file m
co eฺ
o ฺ
o uid
name=+FRA/ORCL/ARCHIVELOG/2013_06_24/thread_1_seq_26.287.8189526
59 RECID=47 STAMP=818952659
y a h
@ n t G
k
ac tude
validation succeeded for archived log
archived log file
f r z
A ( this S
name=+FRA/ORCL/ARCHIVELOG/2013_06_24/thread_1_seq_27.285.8189526
L
UA use
61 RECID=48 STAMP=818952661
O
H e to
validation succeeded for archived log
C
T
0 ens
archived log file
2
I le lic
%
name=+FRA/ORCL/ARCHIVELOG/2013_06_24/thread_1_seq_28.286.8189526
L
ME erab
65 RECID=49 STAMP=818952664
A
validation succeeded for archived log
ie nsf
a r
h -tra
archived log file
a c
Z non
name=+FRA/ORCL/ARCHIVELOG/2013_06_24/thread_1_seq_29.287.8189572
03 RECID=51 STAMP=818957202
Crosschecked 9 objects
RMAN>
Note: Your number of objects might be different.
17. Delete obsolete backups and then exit the RMAN client. The output is reduced to avoid
clutter.
RMAN> delete noprompt obsolete;
BAR.BARCOPY table. The last digit of the salary indicates the number of times the BARCOPY
table has been updated. The difference between this result and the result in step 2
illustrates that multiple updates could be missing after an incomplete recovery. Exit from
SQL*Plus.
SQL> select salary from bar.barcopy where rownum < 2;
SALARY
----------
2605 s a
SQL> exit )h a
m
co eฺ
$
o ฺ
o utheidnew user
19. Execute the cleanup_11_02.sh script from the $LABS directory tohremove
y a G file.
k @ n t
and tablespace created in this practice. The output is in the /tmp/cleanup.log
$ ./cleanup_11_02.sh
f r z ac tude
20. Back up the database. You have a new incarnation A ( oftthe S and the older backups
isdatabase
L h
new incarnation of the database was O UA uwhere
are obsolete, although there are certain cases
sethetheRESETLOGS
created when
older backups can be used. A
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
Practices for @ Lesson n t G12:
k de
ac Recovery
Performing
( f r z S t u II
A LA e12 this
Chapter
H OU to us
0 T C se
I % 2 icen
E L ble l
A M era
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
Assumptions
A full backup of the database is assumed. Autobackup of the control file and SPFILE is
assumed to be configured to be in the +FRA disk group.
Two terminal windows are open in the $LABS directory, pointing to the orcl instance. You are
acting as the oracle OS user.
Tasks
1. Set up for this practice by executing the setup_12_01.sh script from the $LABS directory.
s a
In this script:
)h a
• The initorcl.ora file is deleted from the $ORACLE_HOME/dbs directory; m
• A new tablespace and user are created. o ฺ co eฺ
• The user creates a table and populates it. a h o uid
@ y t G
A backup of the tablespace is performed and then thek n
ac tude
• table is updated.
• The output is in the /tmp/setup.log file. frz
L A ( this S
UA use
$ ./setup_12_01.sh
$ O
H e tothe break_12_01.sh script from the $LABS
2. Cause a failure in the databaseT C by executing
0oracleeasnstraining password for the grid OS user because the
directory. You must enter2
script deletes aEfile
%
LIin ASM.l e licoutput is in the /tmp/break.log file.
The
A M erab
a r ie nsforacle <<< not displayed
$ ./break_12_01.sh
a c h $ -tra
Password:
Z non
3. Attempt to start the database instance. Notice the error messages. Exit from SQL*Plus.
$ sqlplus / as sysdba
…
Connected to an idle instance.
SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file
'/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initorcl.ora'
SQL> exit
$
RMAN> startup;
6. Shut down the database instance and restart it with the restored SPFILE.
RMAN> shutdown;
Oracle instance shut down
RMAN> startup;
connected to target database (not started)
Oracle instance started
database mounted
s a
database opened
)h a
m
co eฺ
Total System Global Area 534462464 bytes o
o uidฺ
2290416 bytesah
Fixed Size
276827408 bytesk@
y t G
n
ac tude
Variable Size
Database Buffers
f z
247463936 rbytes
S
Redo Buffers
L A ( bytes
7880704
h i s
U A se t
RMAN>
C HO e to u
7. Execute the cleanup_12_01.sh2 0T escript ns to clean up from this practice. The output is in the
%
LI file. li c
/tmp/cleanup.log
E
M erab l e
A
$ ./cleanup_12_01.sh
ie nforsfthe next practice, backup your orcl database, remove obsolete backups,
8. Ina r
a c n - trathat no failures are listed. (The output is removed to not clutter this activity
preparation
hand ensure
Z guide.)
no Then exit.
RMAN> BACKUP DATABASE PLUS ARCHIVELOG DELETE INPUT;
RMAN> exit
$
Assumptions
A full backup of the database is available. Autobackup of the control file and SPFILE is
configured to the +FRA disk group.
Two terminal windows are open in the $LABS directory, pointing to the orcl instance. You are
acting as the oracle OS user.
Tasks s a
1. Set up for this practice by executing the setup_12_02.sh script from the $LABS )directory. h a
In this script a new tablespace and user are created. The user creates a table c m
oand ฺ
o ฺ
populates it. A backup of the tablespace is performed and then the table
a h o is updated.
u i de
The output is redirected to /tmp/setup.log and can be viewed
@ y there also
t Gduring the
k n
execution of the script.
f r z ac tude
A ( this S
$ ./setup_12_02.sh
L
UA theusbreak_12_02.sh
$
O
2. Cause a failure in the database by executing
e script from the $LABS
directory. When prompted, enter C H e t
as
o training password for the grid OS user. The
0 T
2 ice
output is in the /tmp/break.log
oracle
n s
file.
L I % l
E l e
ab <<< not displayed
$ ./break_12_02.sh
A M oracle e r
Password:
r$ie ans f
c h a trstart the database. Notice the error messages. Then exit SQL*Plus.
a
Z no
3. Attemptn -to
$ sqlplus / as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.
SQL> exit
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
1: diag/rdbms/rcat/rcat
2: diag/rdbms/emrep/emrep
3: diag/rdbms/orcl/orcl
4: diag/rdbms/dummy/orcl
s a
Q: to quit
)h a
Please select option: 3
m
co eฺ
o ฺ
o uid
Output the results to file: /tmp/alert_27975_3086_orcl_2.ado
y a h
@ n t G
k de
acthe following
/* Scroll to bottom of the file to see
( f r z S t u */
…
LA e thcontrolis
ORA-00210: cannot open the A
O U specified
u s file
ORA-00202: control file:
C H '+FRA/ORCL/CONTROLFILE/control02.ctl'
e ttoo open file
ORA-17503: ksfdopn:2
2 T
0 ens Failed
% l ic
Ientryle'control02.ctl'
+FRA/ORCL/CONTROLFILE/control02.ctl
L
ORA-15173:
M E ab does not exist in directory
i e A fer
'CONTROLFILE'
a r a n s pga_aggregate_limit of 2048 MB
h Using
r default
n-t signalled during: ALTER DATABASE MOUNT...
Zac noORA-205
Checker run found 1 new persistent data failures
5. Close the gedit window by clicking the close window icon (x) and exit adrci.
Please select option: Q
adrci> exit
$
6. Check the Data Recovery Advisor for a solution. Preview the suggested solution before
executing it..
$ rman target "'/ as sysbackup'"
connected to target database: ORCL (not mounted)
s a
Failure ID Priority Status Time Detected Summary
)h a
---------- -------- --------- ------------------- ------- m
co eฺ
509 CRITICAL OPEN o ฺ
2013-06-25:09:52:48 Control file
o uid
+FRA/ORCL/CONTROLFILE/control02.ctl is missing
y a h
@ n t G
analyzing automatic repair options; zthis
k de some time
ac maytutake
( f r S
allocated channel: ORA_DISK_1
L A t h i s
channel ORA_DISK_1: SID=240Adeviceetype=DISK
U s
analyzing automatic repair
C t o u complete
HO eoptions
2 0T ens
Mandatory Manual
L l ic
I% leActions
ME erab
========================
A
r ie manual
no
n s factions available
c a
h -tra
a n
Z noOptional Manual Actions
=======================
no manual actions available
a c h - t r
Z non
Do you really want to execute the above repair (enter YES or
NO)? y
executing repair script
8. Use the LIST FAILURE command to verify that the failure has been repaired.
RMAN> list failure;
no failures found that match specification
RMAN>
9. Clean up the practice environment by running the cleanup_12_02.sh script in another
terminal window. The output is in the /tmp/cleanup.log file.
$ ./cleanup_12_02.sh
s a
$ )h a
m
co backups,
o o ฺ
10. In preparation for the next practice, backup your orcl database, remove obsolete
eฺ
and ensure that no failures are listed. (The output is removed to not h
a
clutter i d
this activity
u
guide.) y t G
RMAN> BACKUP DATABASE PLUS ARCHIVELOG DELETE
a c k@ INPUT;
d e n
RMAN> delete noprompt obsolete; (frz S tu
RMAN> list failure;
A LA e this
RMAN> exit
H OU to us
$
0 T C se
I % 2 icen
E L ble l
A M era
a r ie nsf
a c h -tra
Z non
Assumptions
A full backup of the database is available. Autobackup of the control file and SPFILE is
configured to the +FRA and +DATA disk groups.
Two terminal windows are open in the $LABS directory, pointing to the orcl instance. You are
acting as the oracle OS user.
Tasks
1. Set up for this practice by executing the setup_12_03.sh script from the $LABS directory.
In this script a new tablespace and user are created. The user creates a table ands a
)h a
populates it. A backup of the tablespace is performed and then the table is updated.
m
co eฺ
The output is redirected to /tmp/setup.log and can be viewed there also during the
execution of the script. o ฺ
o uid
y a h
$ ./setup_12_03.sh
@ n t G
$ k
ac tude
f r z S script from the $LABS
2. Cause a failure in the database by executing the (break_12_03.sh
L A h i s
directory. When prompted, enter oracleAas training tpassword for the grid OS user. The
O
output is in the /tmp/break.log file. U use
C H e to
$ ./break_12_03.sh
2 T
0<<< notnsdisplayed
% c e
LI ble li
Password: oracle
$ E
M theedatabase.
3. Attempt e A
to start f ra Notice the error messages. Exit from SQL*Plus.
a r i n s
a c h $ sqlplus
n - tra / as sysdba
Z noConnected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 534462464 bytes
Fixed Size 2290416 bytes
Variable Size 276827408 bytes
Database Buffers 247463936 bytes
Redo Buffers 7880704 bytes
ORA-00205: error in identifying control file, check alert log
for more info
SQL> exit
$
1: diag/rdbms/rcat/rcat
2: diag/rdbms/emrep/emrep
3: diag/rdbms/orcl/orcl
4: diag/rdbms/dummy/orcl
Q: to quit
s a
a
Please select option: 3 <<< Enter your orcl alert log number
)h
m
Output the results to file: /tmp/alert_14802_1398_orcl_1.ado
co eฺ
Please select option: o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
5. Exit from viewing the alert log. (Click the x icon to close the gedit window, enter Q, and
then exit.)
…
Please select option: Q
adrci> exit
$
a c h -tra
---------- -------- --------- ------------------- -------
Z no1714 n CRITICAL OPEN 2013-06-25:10:36:12 Control file
+DATA/ORCL/CONTROLFILE/current.265.818592057 is missing
1711 CRITICAL OPEN 2013-06-25:10:36:12 Control file
+FRA/ORCL/CONTROLFILE/control02.ctl is missing
AUTOBACKUP command
4. If this is a primary database and a standby database is
available, then perform a Data Guard failover initiated from the
standby
HO e to u
RMAN> repair failure preview;
C
Strategy: The 2 0T includes
repair
e ns complete media recovery with no
data loss LI % li c
E l e
Repair
A Mscript:
f e r ab
h a rie ans
/u01/app/oracle/diag/rdbms/orcl/orcl/hm/reco_1662070021.hm
a c n - tr
Z nocontents of repair script:
# restore control file
restore controlfile from autobackup;
sql 'alter database mount';
RMAN>
8. Use RMAN command line to restore the control files and mount the database.
Note: If you use the REPAIR FAILURE command at this point, then new failures are
created, so that the database must be recovered and you need to execute these RMAN
commands (again) to complete your database recovery:
LIST FAILURE;
ADVISE FAILURE;
REPAIR FAILURE PREVIEW;
REPAIR FAILURE;
f r z
output file name=+DATA/ORCL/CONTROLFILE/current.265.819027437
A ( this S
Finished restore at 2013-06-25:11:37:22
L
O UA use
RMAN> ALTER DATABASE H MOUNT; to
C
0 ense
T
2
I% le lic
Statement Lprocessed
MEchannel:
released
A e r ab ORA_DISK_1
ie ns
rRMAN> f
9. c h a a the database.
tropen
Attempt-to
a n
Z noRMAN> ALTER DATABASE OPEN;
RMAN-00571: ===============================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS
RMAN-00571: ===============================================
RMAN-03002: failure of sql statement command at 06/25/2013
11:37:51
ORA-01589: must use RESETLOGS or NORESETLOGS option for database
open
RMAN>
Question: Why is RESETLOGS necessary?
Answer: RESETLOGS is required because the SCN in the restored control file does not
match the SCN recorded in the data files.
RMAN-00571: ================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
RMAN-00571: ===============================================
RMAN-03002: failure of sql statement command at 06/25/2013
11:40:07
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1:
'+DATA/ORCL/DATAFILE/system.261.818611365'
RMAN>
Question: Why did the database open still fail with the RESETLOGS option?
s a
)h a
Answer: The SCN in the control file is older than the SCN in the data files and the data files
have not been restored with the UNTIL cause. The database needs to be recovered so that
the control file can be synchronized with the data files. m
co eฺ
11. Recover the database. o ฺ
o uid
y a h
RMAN> recover database;
@ n t G
k
ac tude
( f r z S
Starting recover at 2013-06-25:11:40:59
L A h i s
t 2013-06-25:11:40:59
Starting implicit crosscheck
U A backup
s e at
H O to u
allocated channel: ORA_DISK_1
C
0T SID=14
channel ORA_DISK_1: sedevice type=DISK
32objects e n
Crosschecked%
lic
LI ble crosscheck
FinishedEimplicit backup at 2013-06-25:11:41:01
M
A fer a
a r i e n simplicit crosscheck copy at 2013-06-25:11:41:01
h r a
Starting
n-t channel ORA_DISK_1
Zac nousing
Crosschecked 1 objects
Finished implicit crosscheck copy at 2013-06-25:11:41:01
Assumptions
A full backup of the database is available.
Two terminal windows are open in the $LABS directory, pointing to the orcl instance. You are
acting as the oracle OS user.
Tasks
1. Cause a failure in the database by executing the break_12_04.sh script from the $LABS
directory. The output is redirected to /tmp/break.log and can be viewed there also
s a
during the execution of the script.
)h a
$ ./break_12_04.sh m
co eฺ
$ o ฺ
o uid
a h
y thet G
2. Attempt to connect to the database using a remote connection. Notice error messages.
$ sqlplus sys@orcl as sysdba @
ck ude n
z a
fr s St
(
Enter password: oracle_4U <<<Lnot
A e thi
A displayed
ERROR:
H OU to us
ORA-01017: invalid C e
0 T username/password;
n s logon denied
I%2 le lice
Enter user-name: (Control-c, then return)
L
ME connection
$
Note: The A remotefe r ab requires the use of a password file.
3. h a rieif theapassword
Check n s file exists. The name of the orcl database password file for Linux
r
-tsystems is $ORACLE_HOME/dbs/orapworcl.ora.
Zac and o n
Unix
n $ ls $ORACLE_HOME/dbs/orapw*
/u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwrcat
$
The orapworcl.ora should not be listed (because it was deleted by the
break_12_04.sh script).
Note: It is critically important to the security of your system that you protect your password
file and the environment variables that identify the location of the password file. Any user
with access to these could potentially compromise the security of the connection.
4. Optionally, view the description of the orapwd parameters. Execute orapwd in a terminal
window.
$ orapwd
Usage: orapwd file=<fname> entries=<users> force=<y/n> asm=<y/n>
dbuniquename=<dbname> format=<legacy/12> sysbackup=<y/n>
sysdg=<y/n> syskm=<y/n> delete=<y/n> input_file=<input-fname>
where
file - name of password file (required),
password - password for SYS will be prompted
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
A ME erab
sysbackup - create SYSBACKUP entry (optional and requires
a r ie nsf
the
password file. To avoid this necessity, allocate more entries than you think you will ever
need.
6. Test the remote SYSDBA login. Now it should be successful. Exit from SQL*Plus.
$ sqlplus sys@orcl as sysdba
Enter password: oracle_4U <<< not displayed
SQL>
7. Optionally, review the V$PWFILE_USERS view.
SQL> desc V$PWFILE_USERS
s a
Name Null? Type
)h a
----------------------------------------- -------- m
co eฺ
------------
- o ฺ
o VARCHAR2(30)
USERNAME y a h
G uid
SYSDBA
c k @ ent VARCHAR2(5)
d
SYSOPER
( frza s Stu VARCHAR2(5)
SYSASM
A LA e thi VARCHAR2(5)
SYSBACKUP
H OU to us VARCHAR2(5)
SYSDG
0 T C se VARCHAR2(5)
SYSKM
I % 2 icen VARCHAR2(5)
CON_ID
E L ble l NUMBER
A M era
r ie SELECT
n s f * FROM V$PWFILE_USERS;
c a SQL>
h -tra
a n
Z noUSERNAME SYSDB SYSOP SYSAS SYSBA SYSDG SYSKM
CON_ID
-------------------- ----- ----- ----- ----- ----- ----- -------
-
SYS TRUE TRUE FALSE FALSE FALSE FALSE
0
SQL>
8. Exit SQL*Plus.
SQL> exit
$
Assumptions
The temporary tablespace is named TEMP and located in +DATA/ORCL/DATAFILE.
Two terminal windows are open in the $LABS directory, pointing to the orcl instance. You are
acting as the oracle OS user.
Tasks
1. Set up for this practice by executing the setup_12_05.sh script from the $LABS directory.
In this script a new tablespace and user are created. The user creates a table, populates it
and performs a query with an ORDER BY clause. (Some of these activities use a tempfile.) s a
A backup of the tablespace is performed and then the table is updated. )h a
m
co eฺ
execution of the script. o ฺ
The output is redirected to /tmp/setup.log and can be viewed there also during the
o uid
y a h
$ ./setup_12_05.sh
@ n t G
$ k
ac tude
f r z
(break_12_05.shS script in the $LABS
2. Cause a failure in the database by executing the
L A h i s
tpassword for the grid OS user. The
directory. When prompted, enter oracleAas training e
U s
HO e to u
output is in the /tmp/break.log file.
C
$ ./break_12_05.sh
2 0 T ns
Password: oracleI% le<<<licnot e displayed
L
$
A ME erab
r e database
3. Start ithe
n s f instance. Exit from SQL*Plus.
c a tra / as sysdba
h $ sqlplus
a n -
Z noConnected to an idle instance.
SQL> startup
ORACLE instance started.
SQL> exit
b. Enter date and time values that include the time when you performed the startup
operation and then click Go.
c. You can either scroll through your selected portion of the alert log, or use your
browser's search functionality (Firefox: Ctrl+F, then enter a search word) to see the Re-
creating tempfile entry as shown in the screenshot.
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
ie and close
5. Logrout n s f all windows.
a tra
.ach -
Z no n
the loss of a wallet or to allow the backup to be recovered on a different machine you can use
password encryption instead of transparent encryption, or use both so that either the wallet or
the password will allow the backup to be recovered.
Assumptions
Two terminal windows are open in the $LABS directory, pointing to the orcl instance. You are
acting as the oracle OS user.
Tasks
s a
1. Prepare the database for encryption.
)h a
m
co eฺ
a. Set the environment variables for your orcl database instance. If it does not exist,
create a directory for the Oracle wallet named o ฺ
o uid
$ORACLE_BASE/admin/orcl/wallet.
y a h
@ n t G
$ ls $ORACLE_BASE/admin/orcl/wallet k
ac tude
( f r z S
ls: cannot access /u01/app/oracle/admin/orcl/wallet: No such
file or directory
A LA e this
OU to us
$ mkdir -p $ORACLE_BASE/admin/orcl/wallet
$ H
C se
0 T
2 icen
b. Edit the $ORACLE_HOME/network/admin/sqlnet.ora file to add the following lines:
I % l
EL = able
ENCRYPTION_WALLET_LOCATION=
M
r i e A (METHOD
(SOURCE
s f er = FILE)
a c ha -tran (METHOD_DATA =
Z non (DIRECTORY = /u01/app/oracle/admin/orcl/wallet)))
$ gedit
/u01/app/oracle/product/12.1.0/dbhome_1/network/admin/sqlnet.ora
a c n - tra
h ewallet_2013062807031379.p12
-rw-r--r--
Z no-rw-r--r-- 1 oracle asmadmin 6312 Jun 28 07:08
ewallet_2013062807082628.p12
-rw-r--r-- 1 oracle asmadmin 6312 Jun 28 07:08 ewallet.p12
SQL>
Notice that both the current keystore and the backup files have the same size.
3. Using RMAN, create a transparent encrypted backup with a password. Use the
lab_12_06_02.rman script.
a. As always it is a good idea to review a script before executing it.
$ cat lab_12_06_02.rman
set encryption on for all tablespaces algorithm 'AES128';
run {
allocate channel enc_backup_disk1 type disk format
'/u01/backup/orcl/%U';
backup as BACKUPSET tag 'TRANSPARENT' database;
28:07:13:34
piece handle=/u01/backup/orcl/2aoda53r_1_1 tag=TRANSPARENT
comment=NONE
channel enc_backup_disk1: backup set complete, elapsed time:
00:00:35
channel enc_backup_disk1: starting full datafile backup set
channel enc_backup_disk1: specifying datafile(s) in backup set
input datafile file number=00005
s a
name=/u01/backup/orcl/bartbs.dbf
)h a
input datafile file number=00002
m
co eฺ
name=+DATA/ORCL/DATAFILE/example.264.818592141
o ฺ
o uid
input datafile file number=00006
y a h
name=+DATA/ORCL/DATAFILE/users.268.818592007
@ n t G
input datafile file number=00004 k
ac tude
f r z
A ( this S
name=+DATA/ORCL/DATAFILE/undotbs1.267.818592009
L
channel enc_backup_disk1: starting piece 1 at 2013-06-
28:07:13:35
O UA use
C H e to
channel enc_backup_disk1: finished piece 1 at 2013-06-
28:07:13:50
2 T
0 ens
I le lic
%
piece handle=/u01/backup/orcl/2boda54u_1_1 tag=TRANSPARENT
L
ME erab
comment=NONE
A
a r ie nsf
channel enc_backup_disk1: backup set complete, elapsed time:
a c h -tra00:00:15
Z non Finished backup at 2013-06-28:07:13:50
M E ab
$ cat lab_12_06_03.sql
r i
--e A
s f
DISCLAIMER: er
c ha -- -This
t r anscript is provided for educational purposes only. It is
a
Z no--n NOT supported by Oracle World Wide Technical Support.
-- The script has been tested and appears to work as intended.
-- You should always run new scripts on a test instance
initially.
and P.TAG='TRANSPARENT'
/
exit
$
Assumptions
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Practice 12-6 has been completed. An encryption wallet exists and a full database backup using
transparent encryption has been created.
Two terminal windows are open in the $LABS directory, pointing to the orcl instance. You are
acting as the oracle OS user.
Tasks
1. Set up for this practice by executing the setup_12_07.sh script from the $LABS directory.
In this script a new tablespace and user are created. The user creates a table and
populates it. A backup of the tablespace is performed and then the table is updated. Thes a
output is in the /tmp/setup.log file. )h a
m
co eฺ
$ ./setup_12_07.sh
o ฺ
o uid
$
a h
y scriptt G
2. Cause a failure in the database by executing the break_12_07.sh
c k @ e n from the $LABS
fordthe grid OS user. The
frza s Stu
directory. When prompted, enter oracle as training password
output is in the /tmp/break.log file. (
A LA e thi
OU
$ ./break_12_07.sh
Password: oracle <<< H not
t o
displayedus
The Oracle base 0 T Cbeen schanged
e
2 has
e n from /u01/app/oracle to
/u01/app/grid
L I% le lic
$
M E ab
3. Attempt e A f
to start the r
edatabase. Notice the error messages.
a r i n s
a c h $ sqlplus
n - tra / as sysdba
Z noConnected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 534462464 bytes
Fixed Size 2290416 bytes
Variable Size 276827408 bytes
Database Buffers 247463936 bytes
Redo Buffers 7880704 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 3 - see DBWR trace
file
ORA-01110: data file 3:
'+DATA/ORCL/DATAFILE/sysaux.268.811233943'
SQL>
a c ha -tran
non-system datafiles are missing
n
Z noanalyzing automatic repair options; this may take some time
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=250 device type=DISK
analyzing automatic repair options complete
data loss
Repair script:
/u01/app/oracle/diag/rdbms/orcl/orcl/hm/reco_1391499873.hm
RMAN>
5. Review the repair commands with the REPAIR FAILURE PREVIEW command.
RMAN> repair failure preview;
Strategy: The repair includes complete media recovery with no
data loss
s a
Repair script:
/u01/app/oracle/diag/rdbms/orcl/orcl/hm/reco_1391499873.hm )h a
m
co eฺ
o ฺ
o uid
contents of repair script:
y a h
# restore and recover datafile
@ n t G
restore ( datafile 3 ); k
ac tude
f r z S
A3( online';
recover datafile 3;
L h i s
sql 'alter database datafile
U A se t
RMAN>
H O to u
C
0T andeexpect
6. Optionally, execute the repair se an error.
2 n
RMAN> REPAIR
L I%FAILURE;
e l ic
M E ab l
r i e A
Strategy:
s f er repair includes complete media recovery with no
The
c ha data- t r an
loss
a
Z noRepairn script:
/u01/app/oracle/diag/rdbms/orcl/orcl/hm/reco_1391499873.hm
/u01/backup/orcl/29oda52o_1_1
RMAN-00571: ===============================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS
RMAN-00571: ===============================================
RMAN-03002: failure of repair command at 06/28/2013 07:32:29
RMAN-03015: error occurred in stored script Repair Script
ORA-19870: error while restoring backup piece
/u01/backup/orcl/29oda52o_1_1
s a
ORA-19913: unable to decrypt backup
)h a
ORA-28365: wallet is not open m
co eฺ
RMAN> o ฺ
o uid
7. Because the database was restarted and the encryption wallet isynot ahconfigured
Gcan begin.
to be an
@ n t
Logged in to SQL*Plus as SYSDBA or SYSKM, openrz a ck uand
auto-login wallet, the encryption wallet must be opened before the recovery
dethen exit.
( f the t
keystore
S OPEN IDENTIFIED BY
SQL> ADMINISTER KEY MANAGEMENT A
L h i s
A se t
SET KEYSTORE
secret; U
keystore altered.
C HO e to u
2 0T ens
SQL> EXIT I%
L e l ic
$ ME erab l
A f repair the failure and open the database. Notice that one of the
ieRMANnsession,
r
8. In your
a s
a c n raencrypted backup was used to restore the tablespace.
hpieces of-tthe
Z noRMAN> REPAIR FAILURE;
Strategy: The repair includes complete media recovery with no
data loss
Repair script:
/u01/app/oracle/diag/rdbms/orcl/orcl/hm/reco_1391499873.hm
T C
2
Finished recover
% c e ns
0at 2013-06-28:07:40:16
E LI ble li
A M era alter database datafile 3 online
sql statement:
r s f
ie nfailure
h a repair
t r a complete
Zac noDon-you want to open the database (enter YES or NO)? yes
database opened
RMAN>
9. Use the LIST FAILURE command to verify that the failure has been repaired. Then exit
RMAN.
RMAN> list failure;
Database Role: PRIMARY
no failures found that match specification
RMAN> exit
Recovery Manager complete.
$
Assumptions
Practices 12-6 and 12-7 have been completed.
Two terminal windows are open in the $LABS directory, pointing to the orcl instance. You are
acting as the oracle OS user.
Tasks
1. Copy the keystore (or encryption wallet), which is located at
s a
$ORACLE_BASE/admin/orcl/wallet/ewallet.p12, to the /u01/backup/orcl
)h a
directory. m
$ cp $ORACLE_BASE/admin/orcl/wallet/ewallet.p12 o ฺ co eฺ
/u01/backup/orcl/ewallet.p12
a h o uid
@ y t G
$
k n
$ ls /u01/backup/orcl/ewal*
f r z ac tude
/u01/backup/orcl/ewallet.p12
A ( i s S
L
A se t h
$
U
O tofotheu wallet.
C Hbackup
Note: Continue only if you see the
e
0T en
2. Remove the keystore by executing
2 thesbreak_12_08.sh script. When prompted, enter
% c
oracle as trainingI passwordlifor the grid OS user. The output is in the
/tmp/break.log
M EL file.able
A fer
$ie./break_12_08.sh
a r a n s
a c h - t r
Password: oracle <<< not displayed
n
Z noThe Oracle base has been changed from /u01/app/oracle to
/u01/app/grid
$
3. Attempt to start the database by using SQL*Plus.
$ sqlplus / as sysdba
SQL> startup
Total System Global Area 534462464 bytes
Fixed Size 2290416 bytes
Variable Size 276827408 bytes
Database Buffers 247463936 bytes
Redo Buffers 7880704 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 3 - see DBWR trace
file
SQL>
5. Restore the wallet.
SQL> ! cp /u01/backup/orcl/ewallet.p12
s a
$ORACLE_BASE/admin/orcl/wallet/ewallet.p12
)h a
m
co eฺ
SQL> !ls $ORACLE_BASE/admin/orcl/wallet
o ฺ
o uid
ewallet.p12
y a h
SQL> @ n t G
k
c usession
aSQL*Plus de to execute an OS
Note: The exclamation mark (!) temporarily leaves the
( f r z S t
command.
L A h i s
6. Open the keystore. Then exit from SQL*Plus.
U A se t
SQL> ADMINISTER KEY MANAGEMENTH O to uSET KEYSTORE OPEN IDENTIFIED BY
secret;
0 C
T nse
2
I% le lice
keystore altered.
L
A ME erab
r ie exit
SQL>
n s f
c a
h -tra
SQL>
a
Z7. Use n Data Recovery Adviser RMAN commands to recover and open the database. Then
othe
n
confirm that there are no failures and exit RMAN.
$ rman target "'/ as sysbackup'"
s a
analyzing automatic repair options; this may take some time
allocated channel: ORA_DISK_1 )h a
m
co eฺ
channel ORA_DISK_1: SID=14 device type=DISK
o ฺ
o uid
analyzing automatic repair options complete
y a h
@ n t G
k
ac tude
Mandatory Manual Actions
( f r z S
========================
L A t h i s
no manual actions availableA e
U s
C HO e to u
0 T ns
Optional Manual Actions
2
I% le lice
=======================
L
A ME e+DATA/ORCL/DATAFILE/sysaux.270.819272337
1. If file
r a b renamed or moved, restore it was
a r ie nsf
unintentionally
a c h -tra
n
Z noAutomated Repair Options
========================
Option Repair Description
------ ------------------
1 Restore and recover datafile 3
Strategy: The repair includes complete media recovery with no
data loss
Repair script:
/u01/app/oracle/diag/rdbms/orcl/orcl/hm/reco_1030327383.hm
RMAN> exit
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
$
8. Clean up the practice environment by executing the cleanup_12_08.sh script. This script
removes the encrypted backups and disables encrypted backups. The output is in the
/tmp/cleanup.log file.
$ ./cleanup_12_08.sh
$
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
Practices for @Lesson n t G13:
k
ac Oraclede Secure
RMAN f r z
and t u
A ( this S
Backup
L
O UA use
C H e Chapter
to 13
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
Assumptions
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
You have an orcl database instance up and running and you performed the RMAN
configuration in earlier practices,
Two terminal windows are open in the $LABS directory, pointing to the orcl instance. You are
acting as the root OS user.
The Oracle Secure Backup software is staged and unzipped in the /stage/software
directory.
Tasks
s a
1. Log in as the root user and confirm that the /usr/local/oracle/backup directory
)h a
exists. This is the Oracle Secure Backup home directory and it is recommended to start the
m
co eฺ
installation from that directory. (If you were to choose another directory, the OSB product
o ฺ
o uid
documentation, as well as all related training files would not be synchronized and not work
y a h
as they are.)
@ n t G
$ su - root k
ac tude
Password: oracle <<< not displayed ( f r z S
# cd /usr/local/oracle/backupLA h i s
U A se t
# u
HO e toenvironment:
2. To install the OSB software TinCyour training
2 0 ens
I le lic
%
1. Execute /stage/<osb_installmedia>/setup
L
in the directory.
2. If asked,
M Eacceptabthe default to not edit the obparameters file.
A
3. eAccept thefe r to install now.
default
r i s
c ha4. Install
- t r anas an administrative server, media server and client [a]
a
Z no5.nSet the password for the encryption key store to oracle_4U.
6. Set the password for the admin user to oracle_4U.
7. Do not enter an e-mail address for admin user, just press the enter key.
8. Accept the default to not connect to tape libraries.
9. Accept the default to not connect to tape drives.
10. Exit the root OS user account.
# /stage/software/osb-10.4.0.2.0_linux.x64_cdrom120606/setup
- - - - - - - - - - - - - - - - - - - - - -
-
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
1. linux86_64
administrative server, media server, client
- - - - - - - - - - - - - - - - - - - - - -
-
Loading Oracle Secure Backup installation tools... done.
Loading linux86_64 administrative server, media server,
client... done.
s a
- - - - - - - - - - - - - - - - - - - - h- -
) a
-
o m
Loading of Oracle Secure Backup software from CD-ROM
o o ฺcis eฺ
complete.
y ah Guid
You may unmount and remove the CD-ROM. k@
e n t
c d
( frza s Stu
A thi Backup installation
LA eSecure
OU to us
Would you like to continue Oracle
with H
C Oracle
'installob' now?0T(The
2 e n se Secure Backup Installation Guide
contains complete
L ic
I% le information
l about installob.)
ME era'yes'
Please answer
A b or 'no' [yes]:
a r ie nsf
a c h - --tra- - - - - - - - - - - - - - - - - - - -
Z no-n
Welcome to installob, Oracle Secure Backup's installation
program.
Oracle Secure Backup's Web server has been loaded, but is not
yet configured.
Choose from one of the following options. The option you choose
defines
the software components to be installed.
You must now enter a password for the Oracle Secure Backup
encryption
key store. Oracle suggests you choose a password of at least 8
characters in length, containing a mixture of alphabetic and
numeric
characters.
You should now enter an email address for the Oracle Secure
Backup 'admin'
user. Oracle Secure Backup uses this email address to send job
summary
s a
reports and to notify the user when a job requires input. If you
)h a
leave this m
co eฺ
o
blank, you can set it later using the obtool's 'chuser' command.ฺ
o uid
a h
y enter
@
Do not n t G an e-mail
Please enter the admin email address: <<< k de
acentertukey.
address for admin user, just press the
( f r z S
L A t h i s
generating links for admin
U A installation
s e with Web server
HO e to u
updating /etc/ld.so.conf
C
2 0T Secure
checking Oracle
e n s Backup's configuration file
L I%
(/etc/obconfig)
e l ic
M E ab
setting l
Oracle Secure Backup directory to
i e A fer
/usr/local/oracle/backup in /etc/obconfig
a s
ar/etc/obconfig
n local database directory to /usr/etc/ob in
setting
c h t r
Za non- setting temp directory to /usr/tmp in /etc/obconfig
setting administrative directory to
/usr/local/oracle/backup/admin in /etc/obconfig
protecting the Oracle Secure Backup directory
creating /etc/rc.d/init.d/observiced
activating observiced via chkconfig
initializing the administrative domain
****************************** N O T E
******************************
On Linux systems Oracle recommends that you answer no to the
next two
questions. The preferred mode of operation on Linux systems is
to use
the /dev/sg devices for attach points as described in the
'ReadMe'
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Installation summary:
Assumptions
Two terminal windows are open in the $LABS directory, pointing to the orcl instance. You are
acting as the oracle OS user.
You completed the previous practice 13-1 and installed the software using the directories and
passwords as indicated.
Tasks
1. Execute the setup_13_osb.sh script (which calls the osb_in.sh script that updates the
osb_out.sh script with your hostname and then executes the osb_out.sh script). s a
)h a
The scripts create two virtual test libraries, some virtual test drives, inserts volumes, and
create a preauthorized oracle OSB user.
m
co eฺ
o ฺ
o uid
y a h
THESE VIRTUAL TEST DEVICES USED IN THIS PRACTICE ARE FOR TRAINING
PURPOSES ONLY. THEY ARE NOT SUPPORTED FOR PRODUCTION USE.
@ n t G
The output is in the /tmp/setup.log file. k
ac tude
Optionally, review the setup_13_osb.sh file. ( f r z S
L A h i s
$ cat setup_13_osb.sh
U A se t
#!/bin/bash
C HO e to u
# -- DISCLAIMER:T
# -- This Iscript % e ns for educational purposes only. It
20 isicprovided
is E L ble l
A MNOT supported
e ra
r i e
# --
s f by Oracle World Wide Technical Support.
n script has been tested and appears to work as
a c ha #intended.
-
--aThe
t r
Z no#n -- You should always run new scripts on a test instance
initially.
#
# Run as oracle OS user
. $LABS/set_db.sh > /tmp/setup.log
$ ./setup_13_osb.sh
s a
$
)h a
2. With the obtool command line, review the elements that you just created. co m
Note: OSB commands are case-sensitive like Linux. h o oฺ ideฺ
y u you do
aoracleGuser,
a. Log in to obtool as the admin OSB user. As preauthorized
k@ den t
not need to enter the oracle_4U password. a c
$ obtool ( frz s Stu
ob> A LA e thi
U withusthe lsmf --long command.
Ofamily
b. View the RMAN-DEFAULT media
C H e to
ob> lsmf --long 0
2 T ns
% c e
LI ble li
OSB-CATALOG-MF:
E
A M window:
Write
e r a 7 days
rie Keep n f
svolume set: 14 days
c h a t r a
a n - Appendable:
Z no Volume ID used:
yes
unique to this media family
Comment: OSB catalog backup media family
UUID: c873c726-c134-1030-bc35-002564b9985a
RMAN-DEFAULT:
Keep volume set: content manages reuse
Appendable: yes
Volume ID used: unique to this media family
Comment: Default RMAN backup media family
UUID: c79ec486-c134-1030-bc35-002564b9985a
ob>
c. View your currently configured devices with the lsdev command.
ob> lsdev
library vlib in service
drive 1 vdte1 in service
drive 2 vdte2 in service
ob>
d. List the volumes inserted into the vlib2 library with the lsvol command.
ob> lsvol -L vlib2
Inventory of library vlib2:
in 1: unlabeled, barcode
37f7a2f6c136103a016002564b9985a
in 2: unlabeled, barcode
3806a3a0c136103a016002564b9985a
s a
in 3: unlabeled,
38155878c136103a016002564b9985a )h a barcode
m
co eฺ
in 4: unlabeled,
barcode
o ฺ
o uid
38240eccc136103a016002564b9985a
barcode y a h
in 5: unlabeled,
@ n t G
383295f0c136103a016002564b9985a k
ac tude
f r z
A ( this S
in 6: unlabeled,
barcode
L
38413948c136103a016002564b9985a
in 7:
O UA use barcode
unlabeled,
H e to
3850299ec136103a016002564b9985a
C
in
2
8: T
0 ens unlabeled,
barcode
%
LI ble li c
385ed034c136103a016002564b9985a
E
M era
in 9: unlabeled,
barcode
A
ie nsf
386d898ac136103a016002564b9985a
a r
h -tra in 10: unlabeled,
barcode
a c
Z non 387c6d2ec136103a016002564b9985a
in 11: unlabeled,
barcode
388b1892c136103a016002564b9985a
in 12: unlabeled, barcode
3899e70ac136103a016002564b9985a
in 13: unlabeled, barcode
38a8d454c136103a016002564b9985a
in 14: unlabeled, barcode
38b7cf04c136103a016002564b9985a
ob>
e. Exit the obtool utility.
ob> exit
$
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
On r ie OSBnhome
your s f page, you can see jobs and their status from within the last 24 hours.
c a
hThe lower a of the page displays existing devices.
trpart
a n -
Z d.noClick Preferences and select the "Extended command output" to be On.
You see a new area which displays recent obtool commands and their status.
s a
4. a
Optionally, review the elements that were created for you. Click Configure and then click
)h
on any element that interests you.
m
co eฺ
o
o uidฺ
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 page,enreviews
a. On the Configure:
L % Hosts c
i reviewing
I youlefinished
l the roles that you chose during the software
M E ab
installation. When hosts, click Configure (either the tabbed page
i e A fer
or the breadcrumb) to return to the Configure overview page.
ar tran s
c h
Za non-
s a
)h a
m
co eฺ
o
o uidฺ
y a h
@ n t G
k
c ude media family that
aRMAN-DEFAULT
c. On the Configure: Media Families page, review
( f r z
the
S t
L A this
was created during the software installation. Return to the Configure overview page.
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
d.arOn n s f Users page, select the oracle user and click Edit.
ie the Configure:
a c h -tra
Z non
You see the page where the oracle OS user is mapped to the oracle OSB user.
s a
)h a
m
co eฺ
o
o uidฺ
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c n trathe oracle user is preauthorized for both command line (cmdline) and
hYou see-that
Z no rman operations.
f. When you finished reviewing the oracle OSB user, click Configure in the top-left.
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
c hNote: You
- a click the host name for the Apply to work.
trmuch
a n
Z a.noClick Apply. (You should see a success message.)
b. Scroll to the bottom of the page and review the obtool command.
c. Return to the OSB Home page, but do not exit the web tool.
6. Switch to a terminal window. Log in to the RMAN client in the SYSBACKUP role and
configure a channel for backing up to tape. Either enter the command on one line or use
run { ...} to configure your channel.
$ rman target "'/ as sysbackup'"
7. Optionally, review all parameters and note the ones about SBT_TAPE that were created as
part of your channel configuration.
RMAN> show all;
RMAN configuration parameters for database with db_unique_name
ORCL are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
s a
CONFIGURE CONTROLFILE AUTOBACKUP ON;
)h a
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO
m
co eฺ
'%F'; # default
o ฺ
o uid
y a h
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE
TO '%F'; # default
@ n t G
k
ac tude
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO
f r z
A ( this S
BACKUPSET; # default
L
CONFIGURE DEVICE TYPE SBT_TAPE PARALLELISM 1 BACKUP TYPE TO
BACKUPSET; # default
O UA use
H e to
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; #
C
default
2 T
0 ens
I le lic
%
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1;
L
ME erab
# default
A
a r ie nsf
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; #
a c h -tra
default
O to usAutobackup at 2013-06-
Finished Control FileHand SPFILE
0 T C se
27:09:41:02
I % 2 icen
RMAN>
E L ble l
9. Review yourM a in RMAN, then exit.
tape backups
A f e r
a ie list
rRMAN> n s backup device type SBT_TAPE;
h r a
Zac noListn-t of Backup Sets
===================
-
65 Full 9.81M SBT_TAPE 00:00:25 2013-06-
27:09:40:52
BP Key: 65 Status: AVAILABLE Compressed: NO Tag:
TAG20130627T094027
Handle: c-1346372794-20130627-00 Media: RMAN-DEFAULT-
000001
SPFILE Included: Modification time: 2013-06-26:23:02:22
SPFILE db_unique_name: ORCL
s a
Control File Included: Ckp SCN: 2521419 Ckp time: 2013-
)h a
06-27:09:40:27 m
co eฺ
o
o uid ฺ
RMAN>
y a h
RMAN> exit @ n t G
k
ac tude
$
f r z
( are stored Son volume 000001; the first
Note: The device type is SBT_TAPE, the backups
L A h i s
tand the control file.
backup contains the data file, the secondA
the SPFILEe
U s
u then click Show completed jobs.
O page,toand
10. Return to the web tool and refresh
C Hthe
2 0T ense
L I% le lic
A ME erab
ie view
11. Optionally,
r n s f jobs in the obtool with the lsj command.
the
c a
h $ obtooltra
a n -
Z noob> lsj -A
Job ID Sched time Contents
State
---------------- ----------- ------------------------------
oracle/1 none database orcl (dbid=1346372794)
completed successfully at 2013/06/27.09:40
oracle/1.1 none datafile backup
completed successfully at 2013/06/27.09:40
oracle/2 none database orcl (dbid=1346372794)
completed successfully at 2013/06/27.09:40
oracle/2.1 none controlfile autobackup
completed successfully at 2013/06/27.09:40
ob>
The output should show the successful completion for a datafile backup and
controlfile autobackup.
12. Exit all windows and tools.
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
Practices for @Lesson n t G14:
k
ac tude
Using f r z
Flashback
A ( this S
Technologies
L
O UA use
C H e Chapter
to 14
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
Assumptions
In the $LABS directory, you have two terminal windows open, pointing to the orcl instance.
You are acting as the oracle OS user.
Tasks
1. Determine how far the undo data will allow you to flash back transactions in the current
database. The V$UNDOSTAT view contains up to 4 days of statistics, over each 10 minute
s a
interval. The first row contains the current (partial) time period statistics. (Your value may be
different.) )h a
m
co eฺ
$ sqlplus / as sysdba
o
o uidฺ
a h
y where
SQL> select tuned_undoretention from v$undostat
@ n t G rownum =
1; k
ac tude
f r z
L A ( this S
UA use
TUNED_UNDORETENTION
------------------- O
H e to
1637C
2 T
0 ens
SQL>
L %
I thelvalue
e l ic
Question: What
M E ab
does of TUNED_UNDORETENTION time represent?
Answer:
r i e s f er of seconds the data is being retained in the database at any given
AThe number
n is not guaranteed by default. If the system needs more space, the
a Undotraretention
htime.
a c -
Oraclendatabase can overwrite unexpired undo with more recently generated undo data
Z2. Setnothe UNDO_RETENTION parameter and RETENTION GUARANTEE clause on the undo
tablespace to guarantee retention for 24 hours. Change the properties of the tablespace so
you will not run out of space in the tablespace.
a. Change the UNDO_RETENTION parameter to 14400 seconds (4 hours).
Note: Increasing the value of UNDO_RETENTION to more than a few days can cause
unreasonable growth of the undo tablespace.
SQL> ALTER SYSTEM SET UNDO_RETENTION = 14400 SCOPE=BOTH;
System altered.
SQL>
b. Find the name of the undo tablespace.
SQL> SHOW PARAMETER UNDO
Question: What happens if undo retention is guaranteed and no more space is available
for active undo records (either because the undo tablespace has filled, reached the
maximum size, or there is no more space left on the storage device (disk))?
Answer: Transactions fail due to lack of space in the undo tablespace.
3. View the value of the RECYCLEBIN parameter, then exit SQL*Plus.
Note: ON is the default value.
SQL> show parameter recyclebin
NAME TYPE VALUE
------------------------------------ ----------- ------------
recyclebin string on
SQL> exit
s a
)h a
m
co eฺ
Note: You see the same values as in step 2b. If you wanted to change an ฺinitialization
h
parameter, you can select the parameter, click Set and enter the desired o
o values.
i d- At this
point, you do not want to change any values, so cancel out of it. y a G u
k @ n t
f r z ac tude
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
c. When you enter recyclebin, you see the same value as shown in step 3.
d. To view the current values of the UNDOTBS1 tablespace, navigate: Storage >
Tablespaces.
Enter UNDO as Name and click Go. - You see the same values as in step 2b and 4b.
b. When you enter recyclebin and click Go, you see the same value as shown in step
3 and 4c.
c. Navigate to Administration > Storage > Automatic Undo Management and explore
the General and System Activity pages including their graphs.
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
H e to
e. Return to the orcl home page.
C
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
Assumptions
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
The RECYCLEBIN parameter is set to ON (which you confirmed in the previous practice).
In the $LABS directory, you have two terminal windows open, pointing to the orcl instance.
You are acting as the oracle OS user.
Tasks
1. Execute the setup_14_02.sh script to create the practice environment. The output is in
the /tmp/setup.log file.
$ ./setup_14_02.sh
s a
$
)h a
2. Execute the break_14_02.sh script to simulate work done by a developer. m
coThe output is
in the /tmp/break.log file. o ฺ
o uide ฺ
y a h
$ ./break_14_02.sh
@ n t G
$ k
ac tude
3. A developer (with the BAR Oracle user account) ( f r z
comes tosyou S and asks you to restore a
L A
table that was dropped. He explains thereAwere several h i
t iterations of this table but the one
he needs was named BAR102 in the O U
BAR u
schema. s e
It should have 12 columns, one of which
was named LOCATION_ID. There H
C se is t o
currently a BAR102 table in the BAR schema.
0 T
I % l c en
2 toiBAR102A.
Restore the requested table
a. Attempt to use
bin. M
EL theaSHOW
b le RECYCLEBIN command to view the contents of the recycle
A fer
r$iesqlplusn s / as sysdba
h a r a
Zac noSQL> n -t show recyclebin
SQL>
Note: There is no output. The SHOW RECYCLEBIN command shows only those objects that
belong to the current user. Because you are the DBA and do not know the password for
the BAR user, the SHOW RECYCLEBIN command does not show the dropped tables you are
interested in restoring.
b. Examine the objects in the dba_recyclebin. Optionally, change the SQL*Plus page
size to 99 lines.
SQL> set pages 99
SQL> select original_name, object_name, droptime
from dba_recyclebin
where owner ='BAR';
2 3
ORIGINAL_NAME
----------------------------------------------------------------
-
OBJECT_NAME
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
BIN$4Dj16SAXGvrgQ4sjuYtecg==$0
2013-06-28:14:47:40
BAR102
BIN$4Dj16SASGvrgQ4sjuYtecg==$0
2013-06-28:14:47:40
BAR101
s a
BIN$4Dj16SAcGvrgQ4sjuYtecg==$0
2013-06-28:14:47:40 )h a
m
co eฺ
SQL>
o ฺ
oin time.uiWith
a h
Note: Above you see the same object dropped twice at different points d the
y t G
@want etonrestore.
timestamp, you determine which version of the table you really
c k Yourdobject names will be
frza s Stu
c. Determine which object contains the column of interest.
different. Use your own values. ( i quotes because it may
A be inthdouble
A
Note: The object name from the recycle binLmust e
contain special characters.
H OU to us
SQL> select location_id
0 T C se
% 2 icen
from BAR."BIN$4Dj16SASGvrgQ4sjuYtecg==$0"
I
E
where rownum L = b1;le l
2 AM3 selecte ra location_id
i e s f
c h ar tran*
Za noERRORn- at line 1:
ORA-00904: "LOCATION_ID": invalid identifier
SQL>
d. Restore the object that has the correct columns.
SQL> FLASHBACK TABLE BAR."BIN$4Dj16SAXGvrgQ4sjuYtecg==$0" TO
BEFORE DROP RENAME TO BAR102A;
Flashback complete.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Assumptions
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
Tasks
1. Execute the setup_14_03.sh script to create the user and tables used in this practice.
The tables have a foreign-key relationship. The output is in the /tmp/setup.log file.
$ ./setup_14_03.sh
s a
$
) h a
2. Determine the current time to the nearest second. Record this as T1 m
co eฺ
____________________ o
o uidฺ
a h
y been
Note: The format of SYSDATE is not the default format. The format
@
has
n t G"Setting
altered by the
NLS_DATE_FORMAT environment variable that was set in the
a c k de
Practice titled the
Date and Time Format for RMAN."
( f rz Stu
$ sqlplus / as sysdba
A LA e this
H OU t o us
SQL> select sysdate from
0 T C se dual;
2 icen
SYSDATE LI% l
E
M erab l e
A
-------------------
ie nsf
a r2013-06-28:15:00:21
a c h SQL>
n - tra
Z3. Innanother
o terminal window, execute the break_14_03.sh script. This simulates a rogue
transaction that scrambles the data in the BARCOPY and BARDEPT tables. There is a foreign
key constraint between BARCOPY and BARDEPT. The output is in the /tmp/break.log
file.
$ ./break_14_03.sh
$
4. The HR representative reports that an employee has incorrectly changed the names of the
departments, and scrambled which employees are assigned to which departments. The
tables were correct at time T1 and no authorized changes have been made since that time.
The tables involved are BAR.BARCOPY and BAR.DEPT. Restore the tables to the state
they were at T1. You must use your own T1 values.
Because there is a foreign key relationship, both tables must be restored. (Continue in your
SQL*Plus session.)
SQL> ALTER TABLE BAR.BARDEPT ENABLE ROW MOVEMENT;
Table altered.
Flashback complete.
Flashback complete.
SQL> s a
)h a
5. Check that you have correctly restored the tables. The results of following query should
match yours, although the row order may be different. Then exit SQL*Plus. co m
SQL> @check_14_03.sql h o oฺ ideฺ
y a G u
k@ deCOUNT(*)n t
a c
frz s Stu----------
DEPARTMENT_ID DEPARTMENT_NAME
------------- ------------------------------(
100 Finance A LA e thi 24
50 Shipping O
U u s
C H t o 180
2 0 T Relations
70 Public
e n se 4
L %Executive
I90 e l ic 12
M E ab 30 l
Purchasing 24
i e A fe10r Administration 4
r s
a c ha -tran 110 Accounting 8
Z non 40 Human Resources 4
20 Marketing 8
60 IT 20
80 Sales 136
11 rows selected.
SQL> exit
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
Practices for @ Lesson n t G15:
k
ac Database de
Flashback
( f r z S t u
L A h i s
U AChapterse15 t
C HO e to u
2 0T ens
L I% le lic
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
Assumptions
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
In the $LABS directory, you have two terminal windows open, pointing to the orcl instance.
You are acting as the oracle OS user.
Tasks
1. Log in to SQL*Plus and determine whether flashback logging is enabled.
$ sqlplus / as sysdba
SQL> SELECT flashback_on FROM v$database;
s a
FLASHBACK_ON
)h a
------------------ m
co eฺ
NO o ฺ
o uid
y a h
SQL>
@ n t G
2. Create a guaranteed restore point and check your current k de status.
acFLASHBACK_ON
f r z
( usage.
Note that guaranteed restore points affect your space S t u
L A h i s
t FLASHBACK DATABASE;
SQL> CREATE RESTORE POINT rp1
U A GUARANTEE
s e
Restore point created. O
C H e to u
2 0T ensFROM V$DATABASE;
SQL> SELECT %
L I le lic
FLASHBACK_ON
A ME erab
a r ie nsf
FLASHBACK_ON
a c h -tra
------------------
Z noRESTOREn POINT ONLY
SQL>
3. Enable flashback logging with one tool of your choice.
SQL> ALTER DATABASE FLASHBACK ON;
Database altered.
SQL>
Question: Which other tool could you have used to enable flashback logging for the
database?
Possible Answer: Cloud Control
Question: What are the navigational steps for your tool of choice?
Possible answer: Cloud Control: Availability > Backup & Recovery > Recovery Settings >
Availability > Backup & Recovery > Recovery Settings.
FLASHBACK_ON
------------------
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
YES
SQL>
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
the affected objects, rather than choose a flashback of the entire database.
Assumptions
You have completed practice 15-1.
In the $LABS directory, you have two terminal windows open, pointing to the orcl instance.
You are acting as the oracle OS user.
Tasks
1. s
There are several ways how you can perform a flashback database operation, for example a
)h a
with a guaranteed restore point, SCN, time value, threads, and so on. This example uses
the SCN, but you could also use your just created RP1 restore point. m
co eฺ
o ฺ
o uid
Determine your current SCN. It is _______________. You will need to use it in a later
practice step. y a h
@ n t G
SQL> SELECT current_scn FROM v$database; k
ac tude
f r z
CURRENT_SCN L A ( this S
-----------
O UA use
2687945 C H e to
SQL> 2 T
0 ens
2. View HR data.E You
%
LIwill use
l e lic
this information for comparison during this practice.
A
a. Determine
M theesum
f r abof the SALARY column in the HR.EMPLOYEES table.
a ie SELECT
rSQL> n s sum(salary) FROM hr.employees;
h r a
n-t
Zac noSUM(SALARY)
-----------
691416
SQL>
b. Determine the total number of employees in department 90.
SQL> SELECT count(*) FROM hr.employees where department_id=90;
COUNT(*)
----------
3
SQL>
3. Execute the lab_15_02_03.sql script to update in the HR schema. It creates issues from
which this practice "recovers" by flashing back the database.
SQL> @lab_15_02_03.sql
SQL> update hr.employees
2 set department_id = 90
5 rows updated.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
s a
103 rows updated.
)h a
SQL> m
co eฺ
4. Commit your data and determine the current SCN. o ฺ
o uid
y a h
SQL> COMMIT;
@ n t G
Commit complete. k
ac tude
f r z
A ( this S
SQL> SELECT current_scn FROM v$database;
L
CURRENT_SCN
O UA use
----------- C H e to
2688058 2 T
0 ens
L I le lic
%
MEin the
SQL>
5. Query theAdata
f e r aHRbschema again and compare the results to the values you received
ina
h riequeries
the
a ninsstep 2.
r
n-t the sum of the SALARY column in the HR.EMPLOYEES table.
Zac a.noDetermine
SQL> SELECT sum(salary) FROM hr.employees;
SUM(SALARY)
-----------
679092.4
SQL>
b. Determine the total number of employees in department 90.
SQL> SELECT count(*) FROM hr.employees where department_id=90;
COUNT(*)
----------
8
SQL>
s a
Total System Global Area 534462464 a
bytes
)h
Fixed Size 2290416
mbytes
co eฺ
Variable Size 276827408
o ฺ
o uid
bytes
Database Buffers 247463936
y a h bytes
@ n t G
Redo Buffers
k
7880704
ac tude
bytes
Database mounted.
f r z
SQL> exit
L A ( this S
$
O UA use
b. Log in to RMAN and use theH to DATABASE command to flash back the
database to the SCN0 T C FLASHBACK
e
you notedninsstep 1. Exit RMAN.
2 e
I "'/le aslicsysbackup'"
%
$ rman target
E L nocatalog
A M erab
r ie flashback
RMAN>
n s f database to scn=2687945; (Enter your SCN number)
h a r a
n-t
Zac noallocated
Starting flashback at 2013-06-28:15:26:14
channel: ORA_DISK_1
channel ORA_DISK_1: SID=240 device type=DISK
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=17 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: Oracle Secure Backup
Database altered.
s a
COUNT(*)
)h a
---------- m
co eฺ
3
o
o uidฺ
SQL> a h
yopen thet database
d. After you verified that you flashed back to the desired k @
state, n G for
a c d e
read/write operations.
( frz s Stu
SQL> shutdown immediate
A LA e thi
Database closed.
Database dismounted. HO
U us
T C down. e to
ORACLE instance 0
% 2 shut
c e ns
E LI mount l e li
ab started.
SQL> startup
A Minstance
e r
rie ans
ORACLE f
c h a tr System Global Area 534462464 bytes
a n -
Z noFixed Size
Total
2290416 bytes
Variable Size 276827408 bytes
Database Buffers 247463936 bytes
Redo Buffers 7880704 bytes
Database mounted.
SQL>
7. Disable flashback logging.
SQL> ALTER DATABASE FLASHBACK OFF;
Database altered.
SQL>
SQL> exit
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
Practices for @ Lessonn t G16:
k
ac tData de
Transporting
( f r z S u
L A h i s
U AChapterse16 t
C HO e to u
2 0T ens
L I% le lic
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
Assumptions
Two terminal windows is open in the $LABS directory. ORCL is your source database, RCAT your
destination database. The practice indicates when it is necessary to switch environment
variables.
Tasks
1. Set up for this practice by executing the setup_16_01.sh script from the $LABS directory.
In this script:
s a
• A new tablespace and user are created. )h a
• The user creates a table and populates it. m
co eฺ
o ฺ
o uid
• The output is in the /tmp/setup.log file.
y a h
$ . oraenv @ n t G
k
ac tude
ORACLE_SID = [oracle] ? orcl
( f r z S
A
The Oracle base has been set to /u01/app/oracle
L h i s
$ ./setup_16_01.sh
U A se t
$
C HO e to u
2. Start a SQL*Plus session0 onTyour ORCL
ns source database and verify the prerequisites for
% 2
I le li
transporting a tablespace c
across e
platforms.
E LSYS b and Verify that the source database is in read-write mode.
a. Log in as
A M erauser
the
r$iesqlplus
n s f/ as sysdba
c a
h -tra
a
Z noSQL> n SELECT NAME, LOG_MODE, OPEN_MODE, CURRENT_SCN FROM
V$DATABASE;
s a
SQL> exit
)h a
$ m
co instance.
3. Start an RMAN session and connect to your ORCL source database asothe o ฺtarget eฺ
a h u i d
$ . oraenv y t G
ORACLE_SID = [orcl] ?
a c k@ den
The Oracle base remains unchanged(fwith rz value S tu/u01/app/oracle
$ rman target "'/ as sysbackup'"
A LA e this
RMAN>
H OU to us
4. Back up the source tablespace
0 T Cusing stheeBACKUP command with TO PLATFORM clause.
Use the DATAPUMP clause
I % l i c en that an export dump file for the tablespaces must be
2 to indicate
created for theE L blemetadata.
tablespace
M
A BACKUP e raTO PLATFORM 'Linux x86 64-bit' FORMAT
RMAN>
i e s f
c h ar'/u01/backup/test.bck'
t r a n bartbs; DATAPUMP FORMAT '/u01/backup/test.dmp'
Za non-
TABLESPACE
***
EXPDP> Dump file set for SYSBACKUP.TRANSPORT_EXP_ORCL_FbAv
is:
EXPDP>
/u01/app/oracle/product/12.1.0/dbhome_1/dbs/backup_tts_ORCL_3865
3.dmp
EXPDP>
****************************************************************
***
s a
EXPDP> Datafiles required for transportable tablespace
)h a
BARTBS: m
co eฺ
EXPDP> /u01/backup/orcl/bartbs.dbf o ฺ
o uid
y a h
EXPDP> Job "SYSBACKUP"."TRANSPORT_EXP_ORCL_FbAv" successfully
@
completed at Fri Jun 28 15:59:39 2013 elapsed 0 00:01:19
n t G
k
ac tude
Export completed
( f r z S
L A t h i s
channel ORA_DISK_1: starting
U A fullsedatafile backup set
channel ORA_DISK_1: specifyingO
H e to u
datafile(s) in backup set
C
0T number=00005
input datafile file
% 2 c e ns
LI ble li starting piece 1 at 2013-06-28:15:59:44
name=/u01/backup/orcl/bartbs.dbf
channel E ORA_DISK_1:
A M ORA_DISK_1:
e ra
r i e
channel
n s f finished piece 1 at 2013-06-28:15:59:45
a c ha piece
- t r ahandle=/u01/backup/test.bck tag=TAG20130628T155806
n
Z nochannel
comment=NONE
ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting full datafile backup set
input Data Pump dump
file=/u01/app/oracle/product/12.1.0/dbhome_1/dbs/backup_tts_ORCL
_38653.dmp
channel ORA_DISK_1: starting piece 1 at 2013-06-28:15:59:46
channel ORA_DISK_1: finished piece 1 at 2013-06-28:15:59:47
piece handle=/u01/backup/test.dmp tag=TAG20130628T155806
comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2013-06-28:15:59:47
RMAN>
RMAN> exit
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
$
Note: Normally, after you disconnected from the source database, you move the backup
sets and the Data Pump export dump file to the destination host with operating system
utilities. In this training example, you do not need to do it because you have one host
available.
6. As the SYS user, connect to the RCAT destination host as the target. (You log in as SYS,
not as SYSBACKUP because you will create the BAR user in the destination database).
$ . oraenv
ORACLE_SID = [orcl] ? rcat s a
The Oracle base remains unchanged with value /u01/app/oracle )h a
$ rman target / m
co eฺ
o ฺ
o uid
y a h
connected to target database: RCAT (DBID=590740692)
@ n t G
RMAN> k
ac tude
f r z
A this Smode.
7. Ensure that the destination database is opened in( read-write
L
RMAN> SELECT NAME, LOG_MODE,
V$DATABASE; O UA OPEN_MODE,
u se CURRENT_SCN FROM
C H e to
2 T ns file instead of recovery catalog
0 econtrol
using target % database
I le li
LLOG_MODE c
NAME E b
M ------------
a OPEN_MODE CURRENT_SCN
A e r
a r ie nsfARCHIVELOG
--------- -------------------- -----------
a c h -tra
RCAT READ WRITE 2421859
Z non
RMAN>
8. Create the BAR user and grant the CREATE SESSION privilege.
RMAN> CREATE USER BAR IDENTIFIED BY oracle_4U;
Statement processed
RMAN>
Import completed
TABLESPACE_NAME a
STATUS
s
------------------------------ )h a
---------
SYSTEM m
co eฺONLINE
SYSAUX o ฺ
o uid ONLINE
y a h
UNDOTBS1
@ n t G ONLINE
TEMP k
ac tude ONLINE
f r z
USERS
EXAMPLE L A ( this S ONLINE
ONLINE
RCATBS O UA use ONLINE
C H e to
BARTBS
2 T
0 ens READ ONLY
L I le lic
%
ME erab
8 rows selected
A
r ie exit
n s f
c a
h -tra
RMAN>
a
Z no$n
11. Clean up the practice environment by executing the cleanup_16_01.sh script. This script
removes the original and the transported tablespace, as well as the backup and dump files.
The output is in the /tmp/cleanup.log file.
$ ./cleanup_16_01.sh
$
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
Practices for @Lesson n t G17:
k de
ac Point-in-Time
Performing
f r z t u
A ( this S
Recovery
L
O UA use
C H e Chapter
to 17
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
task.
• In RMAN, perform a level 0 backup plus archive logs and delete obsolete backups.
• In SQL*Plus, create and populate a new TEST_TABLE. Note the SCN after commit.
• In RMAN, perform backup level 1.
• In SQL*Plus, create the need to recover a table by purging TEST_TABLE.
• In RMAN, recover your test table to the SCN.
• In SQL*Plus, confirm the success of the recovery.
s a
• Cleanup your practice environment.
)h a
m
co eฺ
o ฺ
o uid
Assumptions
a h
y database
Two terminal windows is open in the $LABS directory pointing to @ the orcl n t G instance.
You start as the oracle OS user.
k
ac tude
f r z
Tasks L A ( this S
A se
Usetup_17_01.sh
1. Set up for this practice by executingO
H the
t o u script from the $LABS directory.
In this script:
0 T C se
• A new tablespace and
I % 2 icare
user
l encreated.
• EL aa btable
The user creates
M le and populates it.
•
r
The A
i e output is in
s f erthe /tmp/setup.log file.
c - t an
ha $ ./setup_17_01.sh
r
a
Z no$n
2. Start a SQL*Plus session and verify your test configuration.
a. Log in as the SYS user.
$ sqlplus / as sysdba
SQL>
b. Confirm that the database is in archive log mode.
SQL> SELECT NAME, LOG_MODE, OPEN_MODE FROM V$DATABASE;
NAME LOG_MODE OPEN_MODE
--------- ------------ --------------------
ORCL ARCHIVELOG READ WRITE
SQL>
c. Confirm that compatibility is set to 12.0 or higher.
SQL> show parameters compatible
NAME TYPE VALUE
-------------------------------- ----------- ------------------
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
SQL>
SQL> -- **** Note the SCN!
SQL> SELECT NAME, CURRENT_SCN FROM V$DATABASE;
s a
NAME CURRENT_SCN
)h a
--------- ----------- m
co eฺ
ORCL 2695890
o
o uidฺ
SQL>
y a h
@ n t G
Note your own SCN. You will use it for recovery! ________ k
c your
astarted deRMAN session with
6. In your RMAN session, perform a backup level 1. Ifryou
f z t u
the tee command, then your output is redirected
L is S
A (to theth/home/oracle/rman_17.log
file. (The output of the BACKUP commandA e to not clutter this activity guide.)
O U is removed
u s
RMAN> backup incremental
C H level
e to 1 database plus archivelog;
RMAN>
2 T
0 ens
7. In SQL*Plus, create L %
I the need
e l
toicrecover a table by purging it. Optionally, view your SCN
before and M Ethe DROP
after l
ab TABLE command.
A f e r
a ie SELECT
rSQL> n s NAME, CURRENT_SCN FROM V$DATABASE;
h r a
n-t
Zac no---------
NAME CURRENT_SCN
-----------
ORCL 2696503
TABLE_NAME
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
------------------------------
BARCOPY
SQL>
9. In RMAN, recover your test table to YOUR SCN. Provide the following input with the
RECOVER command:
• Names of tables or table partitions to be recovered
• SCN (or Point in time) to which the tables or table partitions need to be recovered
s a
• Whether the recovered tables or table partitions must be imported into the target
)h a
database (default is Yes.)
m
co eฺ
• Auxiliary destination '/u01/backup/test'. o ฺ
othen execute
h
First, confirm that the directory of the auxiliary destination is emptyaand
y G uid your
RECOVER command.
c k @ ent
RMAN> HOST "ls /u01/backup/test/*";rza
( f S tud
ls: cannot access /u01/backup/test/*:
L A thNo is such file or directory
host command complete
O UA use
C H e to
RMAN-00571: ===============================================
2 T
0 ens ERROR MESSAGE STACK FOLLOWS
RMAN-00569: ===============
RMAN-00571: L %
e l ic
I ===============================================
ME ererror
RMAN-06135: l
b executing host command: Additional
a512
A f
h a rie ans
information:
a c -
Note: This
n trpositive error prior to the RECOVER command confirms that the auxiliary
Z destination
no is empty.
RMAN> RECOVER TABLE BAR.TEST_TABLE UNTIL SCN 2695890 <<Your SCN
2> AUXILIARY DESTINATION '/u01/backup/test';
compatible=12.1.0.0.0
db_block_size=8192
db_files=200
sga_target=1G
processes=80
diagnostic_dest=/u01/app/oracle
db_create_file_dest=/u01/backup/test
log_archive_dest_1='location=/u01/backup/test'
s a
#No auxiliary parameter file used
)h a
m
co eฺ
o ฺ
o uid
starting up automatic instance ORCL
y a h
@ n t G
k
ac tude
Oracle instance started
f r z
L A ( this S
Total System Global Area UA1068937216
O u se bytes
C H e to
Fixed Size
2 T
0 ens 2296576 bytes
L
Variable Size %
I le li c 281019648 bytes
Database E
M Buffers ab 780140544 bytes
A f e r
a r ie ns
Redo Buffers 5480448 bytes
renamed tempfile 1 to
/u01/backup/test/ORCL/datafile/o1_mf_temp_%u_.tmp in control
file
s a
Starting restore at 2013-06-28:17:20:28 )h a
m
co eฺ
using channel ORA_AUX_DISK_1
o ฺ
o uid
using channel ORA_AUX_SBT_TAPE_1
y a h
@ n t G
k
ac tude
f r z
channel ORA_AUX_DISK_1: starting (datafile S
L A t h i s backup set restore
U A sedatafile(s)
channel ORA_AUX_DISK_1: specifying to restore from
backup set
HOrestoring
t o u
T
channel ORA_AUX_DISK_1:
0 C s e datafile 00003 to
n
I%2 le lice reading from backup piece
/u01/backup/test/ORCL/datafile/o1_mf_sysaux_%u_.dbf
L
channel ORA_AUX_DISK_1:
E ab
M er
+FRA/ORCL/BACKUPSET/2013_06_28/nnndn0_tag20130628t170851_0.301.8
A
r i e
19306533
s f
c ha channel
- t r anORA_AUX_DISK_1: piece
a n
Z nohandle=+FRA/ORCL/BACKUPSET/2013_06_28/nnndn0_tag20130628t170851_
0.301.819306533 tag=TAG20130628T170851
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:35
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from
backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to
/u01/backup/test/ORCL/datafile/o1_mf_system_%u_.dbf
channel ORA_AUX_DISK_1: reading from backup piece
+FRA/ORCL/BACKUPSET/2013_06_28/nnndn0_tag20130628t170851_0.302.8
19306597
channel ORA_AUX_DISK_1: piece
handle=+FRA/ORCL/BACKUPSET/2013_06_28/nnndn0_tag20130628t170851_
0.302.819306597 tag=TAG20130628T170851
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:35
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
+FRA/ORCL/BACKUPSET/2013_06_28/nnndn0_tag20130628t170851_0.300.8
19306653
channel ORA_AUX_DISK_1: piece
handle=+FRA/ORCL/BACKUPSET/2013_06_28/nnndn0_tag20130628t170851_
0.300.819306653 tag=TAG20130628T170851
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
Finished restore at 2013-06-28:17:21:42
s a
)h a
datafile 1 switched to datafile copy
input datafile copy RECID=15 STAMP=819307303 file ฺco
m
h o o ideฺ
name=/u01/backup/test/ORCL/datafile/o1_mf_system_8wvkj0r0_.dbf
y a G u
datafile 4 switched to datafile copy
k@ file
e n t
input datafile copy RECID=16 STAMP=819307303 a c d
( frz s Stu
name=/u01/backup/test/ORCL/datafile/o1_mf_undotbs1_8wvkk3tw_.dbf
datafile 3 switched to datafile
A LAcopye thi
input datafile copy RECID=17 O U STAMP=819307303
us file
H
C se t o
name=/u01/backup/test/ORCL/datafile/o1_mf_sysaux_8wvkgxph_.dbf
0 T
2 icen
I %
L Memory lScript:
contents of
E l e
{ AM
f e r ab
h a r#iesetarequested
n s point in time
r
-tuntil scn 2695890;
Zac noset n
# online the datafiles restored or switched
sql clone "alter database datafile 1 online";
sql clone "alter database datafile 4 online";
sql clone "alter database datafile 3 online";
# recover and open database read only
recover clone database tablespace "SYSTEM", "UNDOTBS1",
"SYSAUX";
sql clone 'alter database open read only';
}
executing Memory Script
a c h -tra
Z nosql n statement: alter database open read only
contents of Memory Script:
{
sql clone "create spfile from memory";
shutdown clone immediate;
startup clone nomount;
sql clone "alter system set control_files =
''/u01/backup/test/ORCL/controlfile/o1_mf_8wvkgn5h_.ctl''
comment=
''RMAN set'' scope=spfile";
shutdown clone immediate;
startup clone nomount;
# mount database
sql clone 'alter database mount clone database';
}
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
database closed
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2016, Oracle and/or its affiliatesฺ
database dismounted
Oracle instance shut down
s a
Fixed Size 2296576
)h a bytes
Variable Size m
285213952
co eฺ
bytes
Database Buffers o ฺ
775946240
o uid
bytes
Redo Buffers
y a h 5480448 bytes
@ n t G
k
ac tude=
( f r z
sql statement: alter system set control_files
S
A i s
''/u01/backup/test/ORCL/controlfile/o1_mf_8wvkgn5h_.ctl''
L h
A se t
comment= ''RMAN set'' scope=spfile
U
H O to u
Oracle instance shut C
0T ense down
2
I%auxiliaryic database (not started)
L
E ab
connected to l e l
A Minstance
er started
r i e
Oracle
s f
a c ha -tran
Z noTotal n System Global Area 1068937216 bytes
Fixed Size 2296576 bytes
Variable Size 285213952 bytes
Database Buffers 775946240 bytes
Redo Buffers 5480448 bytes
database opened
@ t G
EXPDP> Processing object type TABLE_EXPORT/TABLE/TABLE
n
EXPDP> Processing object type k
ac tude
f r z
A ( this S
TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
L
EXPDP> Processing object type
UA use
TABLE_EXPORT/TABLE/STATISTICS/MARKER
O
C H e to
EXPDP> ORA-39127: unexpected error from call to export_string
2 T
0 ens
:=SYS.DBMS_TRANSFORM_EXIMP.INSTANCE_INFO_EXP('AQ$_ORDERS_QUEUETA
I le lic
%
BLE_S','IX',1,1,'12.01.00.00.00',newblock)
L
ME erab
ORA-00376: file 2 cannot be read at this time
A
a r ie nsf
ORA-01110: data file 2:
a c h -tra'+DATA/ORCL/DATAFILE/example.264.818592141'
Z non ORA-06512: at "SYS.DBMS_TRANSFORM_EXIMP", line 197
ORA-06512: at line 1
ORA-06512: at "SYS.DBMS_METADATA", line 9901
ORA-39127: unexpected error from call to export_string
:=SYS.DBMS_TRANSFORM_EXIMP.INSTANCE_INFO_EXP('AQ$_STREAMS_QUEUE_
TABLE_S','IX',1,1,'12.01.00.00.00',newblock)
ORA-00376: file 2 cannot be read at this time
ORA-01110: data file 2:
'+DATA/ORCL/DATAFILE/example.264.818592141'
ORA-06512: at "SYS.DBMS_TRANSFORM_EXIMP", line 197
ORA-06512: at line 1
ORA-06512: at "SYS.DBMS_METADATA", line 9901
EXPDP> . . exported "BAR"."TEST_TABLE"
5.992 KB 3 rows
EXPDP> Master table "SYS"."TSPITR_EXP_ukoA_Cmxe" successfully
loaded/unloaded
d. RMAN creates E LIa Data l e li export dump file that contains the recovered objects.
Pump
A M r b
arecovered
e. RMAN
r i e s f
importsethe objects into the target database.
hf. a RMAN t r n the auxiliary instance.
aremoves
a c
Z10. Delete -
nobsolete archive logs and then exit RMAN. The output is removed to avoid clutter.
noRMAN> delete noprompt obsolete;
RMAN> exit
$
11. In SQL*Plus, query all rows of the test table to confirm the success of the recovery. Then
exit.
SQL> SELECT * FROM BAR.TEST_TABLE;
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
Practices for @ Lessonn t G18:
k de
ac atDatabase
Duplicating
( f r z S u
L A h i s
U AChapterse18 t
C HO e to u
2 0T ens
L I% le lic
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
• Use ASMCA to confirm sufficient disk space for the duplicated database.
• Prepare the destination for the future DBTEST database with Oracle Net connectivity,
password file, and a minimal initdbtest.ora file.
• Confirm source database configuration settings.
• Duplicate the ORCL database by using RMAN.
• Test access to the cloned database.
Assumptions s a
)h a
Two terminal windows is open in the $LABS directory pointing to the orcl database instance.
Work as the oracle OS user unless the task indicates the grid OS user. m
co eฺ
o ฺ
o uid
y a h
@ n t G
Tasks k
c ude
aoracle
r
1. In a terminal window, log in as the grid OS user fwith
( z S t as training password and
point your environment variables to the +ASM A
A L instance.
e t his
$ su - grid
O U us
Password: oracle <<< C H e to
not displayed
$ . oraenv 2 T
0 ens
%
ORACLE_SIDLI= [grid] e l ic? +ASM
ME ebase l
ab has been changed from /u01/app/oracle to
The AOracle
f r
a ie ns
r/u01/app/grid
c h $ -tra
a
Z2. Use n asmca utility to create the DISK2 disk group for your duplicate database.
nothe
a. Enter asmca to start the utility which opens in a separate window.
$ asmca
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
c ude
aclick
b. Click Create and enter Disk Group Name: DISK2,
( f r z S t
Redundancy: External
A thentclick i s
A se h
(None), and select two available disks,Land OK.
U
C HO e to u
2 0T ens
L I% le lic
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
e. rClick s f then Yes to confirm your exit.
ie Exit,nand
c a
h -tra
a
non as oracle OS user pointing to the orcl instance. Prepare Oracle Net
Z3. Continue
connectivity with the netca utility. Add a dbtest entry to the tnsnames.ora file.
$ netca
a. On the Oracle Net Configuration Assistant: Welcome page, select Local Net Service
Name configuration and click Next.
b. Confirm that Add is selected and click Next.
c. Enter dbtest as Service Name and click Next.
d. Select TCP as protocol and click Next.
e. Enter your host and domain name (for example, edRSr39p1.us.oracle.com) in the
Host name field. If you are unsure about the format, execute the command in the next
step to view currently active examples.
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
g. Select No, do not test, becauseO UAdbtest
your u seinstance does not yet exist, and click
Next. C H e to
h. Confirm dbtest as2Net
T
0 Service nsName and click Next.
% c e
li Would you like to configure another net service name
I question:
i. Answer No EtoLthe l e
MNext.erab
and click
A
ie should
j. rYou n s f the message: Net service name Configuration Complete! Click
see
c a
h Next. tra
a n -
Z k.noClick Finish.
$ netca
RCAT =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST =
edRSr39p1.us.oracle.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = rcat)
s a
)
)h a
) m
co eฺ
o ฺ
o uid
y a h
DBTEST =
@ n t G
(DESCRIPTION = k
ac tude
f r z
A ( thi=s S
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = LTCP)(HOST
UA =u1521))
edRSr39p1.us.oracle.com)(PORT
O se
) C H e to
2
(CONNECT_DATA
T
0 = ens
L I le lic= dbtest)
%
(SERVICE_NAME
)M
E ab
r i e A
s f er
ha -tran
)
a c
Z noORCL n =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST =
edRSr39p1.us.oracle.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
$
5. Comparing the DBTEST entry with the ORCL configuration, your notice that (SERVER =
DEDICATED) is missing.
a. Update the tnsnames.ora file with the gedit or vi editor so that the ORCL and
DBTEST configurations follow the same pattern.
$ gedit $ORACLE_HOME/network/admin/tnsnames.ora
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L
b. After you finished % l icconfirm that the entry is now:
I yourleedit,
... AM
E ab
r i e s f er
c
DBTEST
- t r an
ha (DESCRIPTION=
a
Z non (ADDRESS_LIST =
=
(ADDRESS = (PROTOCOL = TCP)(HOST =
edRSr39p1.us.oracle.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dbtest)
)
)
6. Copy the file into the equivalent grid home directory,
/u01/app/grid/product/12.1.0/grid/network/admin in this example.
$ cp
/u01/app/oracle/product/12.1.0/dbhome_1/network/admin/tnsnames.o
ra /u01/app/grid/product/12.1.0/grid/network/admin/tnsnames.ora
$
/u01/app/oracle/product/12.1.0/dbhome_1/
The Oracle base for
ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1/ is
/u01/app/oracle
$
b. Create the $ORACLE_HOME/dbs/orapwdbtestfile with the orapwd utility.
$ orapwd file=$ORACLE_HOME/dbs/orapwdbtest entries=15
password=oracle_4U
$ s a
)h a
c. Optionally, confirm that the file exists.
m
co eฺ
$ ls $ORACLE_HOME/dbs/*ora*
o ฺ
o uid
/u01/app/oracle/product/12.1.0/dbhome_1//dbs/init.ora
y a h
@ n t G
k
/u01/app/oracle/product/12.1.0/dbhome_1//dbs/orapwdbtest
ac tude
r z
/u01/app/oracle/product/12.1.0/dbhome_1//dbs/orapworcl
f
A ( this S
/u01/app/oracle/product/12.1.0/dbhome_1//dbs/orapwrcat
L
UA use
/u01/app/oracle/product/12.1.0/dbhome_1//dbs/pfileorcl.ora
O
H e to
/u01/app/oracle/product/12.1.0/dbhome_1//dbs/spfileorcl.ora
C
2 T
0 ens
/u01/app/oracle/product/12.1.0/dbhome_1//dbs/spfilercat.ora
L I le lic
%
/u01/app/oracle/product/12.1.0/dbhome_1//dbs/spfileukoA.ora
$
A ME erab
r
8. In the
n f create a minimal initdbtest.ora file with the following entries:
iesame directory,
s
c a tra
h db_name=dbtest
a n -
Z noremote_login_passwordfile=exclusive
Then confirm your content with the cat command.
$ vi $ORACLE_HOME/dbs/initdbtest.ora
$ cat $ORACLE_HOME/dbs/initdbtest.ora
db_name=dbtest
remote_login_passwordfile=exclusive
$
9. Point environment variables to the dbtest instance (as shown in step 7 a). Log in to
SQL*Plus as SYSDBA, start the dbtest instance in NOMOUNT mode with the
initdbtest.ora file. Then exit.
$ . oraenv
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
$
$ sqlplus / as sysdba
SQL>
SQL> startup NOMOUNT
pfile='/u01/app/oracle/product/12.1.0/dbhome_1/dbs/initdbtest.or
a'
ORACLE instance started.
s a
Total System Global Area 229683200 bytes
)h a
Fixed Size 2286176 bytes m
co eฺ
Fixed Size 2286800 bytes o
o uidฺ
Variable Size 171969328 bytes
y a h
@ n t G
Redo Buffers 5095424 bytes k
ac tude
SQL> exit
f r z
$
L A ( this S
UA ussettings
10. Confirm the ORCL source database configuration
O e in SQL*Plus.
C
a. With your environment variables H pointed
e toto orcl, you logged in to SQL*Plus as
SYSBDA. Confirm that2 T ns
0compatibility is set to 12.0 or higher to take advantage of
I
the features new % l
to Oracle i c e
Database 12c.
M ELparameters
a b le compatible
i e A fer
SQL> show
a rNAME
a n s TYPE VALUE
h r
Zac no--- n-t
------------------------------------ ----------- ---------------
$
Note: If your values differ, discuss with your instructors which steps you may need to take
to prepare the database that you wish to duplicate.
11. In your cloning session set the $TNS_ADMIN environment variable as oracle OS user,
because the server processes will try to resolve the AUXILIARY service name by using
$TNS_ADMIN/tnsnames.ora.
$ export
TNS_ADMIN=/u01/app/grid/product/12.1.0/grid/network/admin
$ echo $TNS_ADMIN s a
/u01/app/grid/product/12.1.0/grid/network/admin )h a
m
co eฺ
$
o ฺ
12. Use RMAN to duplicate the ORCL database as DBTEST database.aho uid
Note that for the target and catalog, the service names @ y
are used, n
but
G
t NOT for the
c k e
d pointing to the dbtest
frza s Stu
auxiliary connection. So you must set the environment variables
instance. (
A LA e thi
OU to us
$ . oraenv
ORACLE_SID = [orcl] ?Hdbtest
0 T C se ?
I % 2 icen
ORACLE_HOME = [/home/oracle]
/u01/app/oracle/product/12.1.0/dbhome_1
The Oracle E L baseblfor
e l
A M era
ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1 is
i e s f
c h ar$ echot r an$ORACLE_SID
/u01/app/oracle
a
Z nodbtest n -
$
$ rman target sys/oracle_4U@orcl auxiliary sys/oracle_4U catalog
rcatowner/oracle_4U@rcat
RMAN>
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
'+DATA','+DISK2','ORCL','DBTEST'
SET DB_RECOVERY_FILE_DEST_SIZE='10G';
RMAN> DUPLICATE TARGET DATABASE TO dbtest FROM ACTIVE DATABASE
SPFILE PARAMETER_VALUE_CONVERT
'+DATA','+DISK2','ORCL','DBTEST'
SET DB_RECOVERY_FILE_DEST_SIZE='10G';
2> 3>
Starting Duplicate Db at 2013-06-29:09:10:25 s a
new incarnation of database registered in recovery catalog )h a
m
co eฺ
starting full resync of recovery catalog
o ฺ
o uid
full resync complete
y a h
allocated channel: ORA_AUX_DISK_1
@ n t G
k
ac tude
channel ORA_AUX_DISK_1: SID=12 device type=DISK
f r z
A ( this S
current log archived
L
contents of Memory Script: O UA use
C H e to
{
2 T ns
0from eservice
L I %
restore clone
l i c 'orcl' spfile to
E able
'/u01/app/oracle/product/12.1.0/dbhome_1/dbs/spfiledbtest.ora';
M
r i e A clone
sql
s f er "alter system set spfile=
a c ha "; -tran
''/u01/app/oracle/product/12.1.0/dbhome_1/dbs/spfiledbtest.ora''
Z no}n
executing Memory Script
a c n - tr
Z no statement: alter system set DB_RECOVERY_FILE_DEST_SIZE =
sql
10G comment= '''' scope=spfile
L A ( this S
''+FRA/DBTEST/CONTROLFILE/control02.ctl'',
''+DISK2/DBTEST/CONTROLFILE/current.256.819364259'' comment=
U A se
HO e to u
''Set by RMAN'' scope=spfile
C
0T system
sql statement:2alter
% c e ns set db_name = ''ORCL'' comment=
E L ble i
''Modified Iby RMAN lduplicate'' scope=spfile
A M era
r ie statement:
sql
n s f alter system set db_unique_name = ''DBTEST''
c h a t
comment=r a ''Modified by RMAN duplicate'' scope=spfile
a
Z no n -
Oracle instance shut down
database mounted
a c h -trabackup set
Z non channel ORA_AUX_DISK_1: restoring datafile 00006 to +DATA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 2013-06-29:09:14:23
a r i e s
"+DATA/DBTEST/DATAFILE/sysaux.257.819364383",
n
h -t r a
Zac non"+DATA/DBTEST/DATAFILE/users.263.819364463";
"+DATA/DBTEST/DATAFILE/undotbs1.258.819364449",
name=+DATA/DBTEST/DATAFILE/users.263.819364463 RECID=4
STAMP=819364519
$ sqlplus / as sysdba
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
Practices for @ Lessonn t G19:
k
ac tude
RMAN ( f r z
Troubleshooting
S and
A LA e this
Tuning
H OU Chapter
t o us19
0 T C se
I % 2 icen
E L ble l
A M era
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
c ha starting
- t r an DB rebuild log file: /stage/MBS/logs/BAR.rebuild
a n
Z nofinished rebuild: Check logfiles in /stage/MBS/logs
#
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
Practices for @ Lessonn t G20:
k
ac tude
Workshop
( f r z S
L A h i s
U AChapterse20 t
C HO e to u
2 0T ens
L I% le lic
A ME erab
a r ie nsf
a c h -tra
Z non
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
instructor) so that you have the opportunity to recover with no or minimal data loss in a real-life
scenario.
Assumptions
You are familiar with Oracle backup and recovery. You completed practice 19, so that the ORCL
and RCAT databases are in the default configuration, as it was at the beginning of the course.
Tasks
1. Configure the recovery settings. Use Enterprise Manager or commands as shown in the
s a
)h a
practices to configure the settings you wish to use to protect your database. Assume that
m
this is a production database, and the business requirement is minimum loss of data.
co eฺ
Complete recovery is desired if at possible. Consider the following:
o ฺ
o uid
− ARCHIVELOG mode (practice 3.1)
y a h
@ n t G
− Archive log file destination (practice 3.1) k
ac tude
− Fast recovery area f r z
− Default backup location L A ( this S
− Backupsets or image copies U
A se
C
− Incremental or full backups H e to u
O
0T (suggested
− Backup retention2policy e ns redundancy of 2 for these exercises) (practice
3.3) %
LI ble li c
E
M anderlocation
a of control files (practice 3.4)
i e A
− Number
f
ar− Number a s
n and location of redo log files
c h - t r
Za no−nLocation of parameter and password files (practice 12)
− Tablespaces and location of the data files
− Backup strategy for the control file (practice 3.3, 7.1)
− Loss of ASM disks (practice 7.2)
− Use of a recovery catalog (practice 4)
2. Record the DBID of the orcl database: _______________________
3. Check the capacity of the +FRA diskgroup regularly. If it gets too full, archive logging will
stall and the database will stop.
Note: Your instructor will advise you if you should set the DB_RECOVERY_FILE_DEST
parameter to /u01/backup/orcl for more disk space.
4. After your database is fully configured for your backup and recovery strategy, perform two
backups of your choice.
Assumptions
Practices 19 and 20-1 have been completed.
Tasks
1. The first step in every scenario is to log in to the database and attempt to start it.
2. Diagnose the problem by reviewing the error messages, alert log, or other indicators.
3. Decide on a recovery plan, and implement it. a
4. as
IMPORTANT: If you perform an incomplete recovery, you must perform a new backup to
protect your database. m )h
5. ฺ co eฺ
When you are satisfied that the database has been recovered and protected ask the
o
instructor to assign another scenario.
a h o uid
@ y t G
k n
f r z ac tude
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non
In each of the scenarios, a new tablespace with a new schema is created. Sometimes it has
been backed up. A check of the alert log will show tablespaces created since the last backup. A
new schema has been created in the USERS tablespace.
If the instructor initiates the crash scenarios (which is the recommended method), then the
instructor will ftp to your training environment and locally initiate one of the scenarios.
Use the following commands only if you work without an instructor and want to introduce your
own "crash scenario". (Replace nn with the scenario number.)
$ cd $WORKS
s a
$ ./wksh_20_nn.sh
)h a
Password: oracle <<< not displayed m
co eฺ
$ o
o uidฺ
y a h
@ n t G
After most recoveries it is highly recommended to take a new full k database
ac tude
backup.
f r z
Assumptions
L A ( this S
The recovery strategy you put in place may have
been taken out of ARCHIVELOG mode,O
UA beensecompromised. The database may have
the type ofubackups used may have changed, or
C H be tlost.
safe may e
o
particular files you expected to be
2 T
0 ens
Warmup Scenarios: L I le lic
%
E lossaofba redo log file (inactive).
Mthe
1. Recover A
r
from
ie redo s f erfile has been lost. A complete recovery is possible.
c
Anainactive
ha. Start-tthe
r andatabase instance. Normal operation of the instance is not affected as long
log
a
Z noasnat least one group member is still functioning.
b. It's important to review the end of the alert_orcl.log to see the error. A redo log
file is missing.
c. Determine which redo log file group is missing.
d. Determine the status of the redo log group: CURRENT, ACTIVE, or INACTIVE from
V$LOG.
e. You can restore the missing log file by dropping the lost redo log member and adding a
new member.
f. If the group with the missing log file has been archived, you can clear the log group to
re-create the missing file ALTER DATABASE CLEAR [UNARCHIVED] LOGFILE
GROUP <number> command.
g. Perform a full backup.
file is missing.
c. Determine which redo log file group is missing.
d. Determine the status of the redo log group (CURRENT, ACTIVE, or INACTIVE) from
V$LOG. Record the sequence number and starting SCN of the missing group.
Note: If the V$LOG view is not available, shut down the database and use the
STARTUP MOUNT command.
e. You can restore the missing log file by dropping the lost redo log member and adding a
new member.
s a
f.
)h a
If the group with the missing log file has been archived, you can clear the log group to
re-create the missing file ALTER DATABASE CLEAR [UNARCHIVED] LOGFILE m
co eฺ
GROUP <number> command.
o ฺ
o uid
g. a h
Start RMAN and list failures. If the database cannot be made consistent, then an
y
@ t
incomplete recovery is required. You can perform it with the REPAIR FAILURE
n G
command. Notice the UNTIL SCN clause.
k
ac tude
f r z
h.
A ( this S
Perform a full backup. (This is required especially after an incomplete recovery.)
L
A
3. Loss of a keystore with loss of a H OU to use
tablespace.
T
This scenario does an encrypted
0 C backup. e The tablespace is lost and keystore is lost. A
swallet)
backup of the keystore% 2
(or c e
encryption n is in /u01/backup/orcl/ewallet.p12.
L I e l i
M E abis l"secret".
The keystore password The keystore was created in the default location in
i e A fer
the $ORACLE_BASE/admin/orcl/wallet/ewallet.p12 directory.
a.arDetermine
a s
nthe failure. (Loss of a data file will be the first error.)
c h t r
n- the data file. (The restore will fail with an error on encrypted backup.)
Za b.noRestore
c. Attempt to open the keystore as SYSDBA.
ADMINISTER KEY MANAGEMENT SET KEYSTORE OPEN IDENTIFIED BY
secret;
This fails with ORA-28367: wallet does not exist
d. Restore the keystore to the default location and then open the keystore.
e. Use LIST FAILURE, …, REPAIR FAILURE.
f. Open the database.
g. Revert to unencrypted backups. Execute the cleanup_20_03.sh script (which takes
a new level 0 backup).
b. As grid OS user with the environment variables pointing to +ASM, use ASMCMD to
view the ASM disk groups by using the lsdg command.
$ asmcmd lsdg
c. Restore the DATA disk group with the md_restore command.
Note: This command restores the disk group to the original disks. This does not work if
the disks do not exist. The directory structure is also restored.
$ asmcmd md_restore --full -G data /u01/backup/orcl/dgbackupDATA
s a
Current Diskgroup metadata being restored: DATA
)h a
Diskgroup DATA created!
m
co eฺ
System template BACKUPSET modified!
o ฺ
o uid
System template FLASHFILE modified!
y a h
@
System template CHANGETRACKING modified!
n t G
k
ac tude
f r z
System template TEMPFILE modified!
A ( this S
System template ONLINELOG modified!
L
UA use
System template FLASHBACK modified!
O
H e to
System template CONTROLFILE modified!
C
T
0 ens
System template ASMPARAMETERFILE modified!
2
I le lic
%
System template DATAGUARDCONFIG modified!
L
ME erab
System template DATAFILE modified!
A
a r ie nsf
System template OCRFILE modified!
control file loss. The REPAIR FAILURE PREVIEW command will provide additional
information.
f. Restore the data files.
g. Once the control file is restored and the database mounted, determine which redo log
groups should be cleared. Hint: ADVISE FAILURE will show which files are missing.
h. If there are multiplexed copies of the redo log files skip to Step i. There may one or
more redo log groups that were not archived or multiplexed. Proceed with an
incomplete recovery.
s a
− In SQL*Plus, clear the unarchived log file.
)h a
− In RMAN, restore the data file. m
− Recover the database. o ฺ co eฺ
a h o uid
− Open the database. (If the database was consistent when the ASM disk group was
@ y t G
lost, reset logs will not be necessary.)
k n
i. Recover the database.
f r z ac tude
j. A ( this S
If the multiplexed copies of the redo logs exist, then drop the missing redo log file
L
O UA use
members and add new log file members on the DATA disk group. Find the names of
the missing and existing files, DROP and ADD with the commands shown replacing the
C H e to
2 T
file names with names from your listings.
0 ens
WARNING: Be sure to drop the missing redo logs and not the existing logs.
L I le lic
%
A ME erab
Note: One of the groups will give an error that it is the current log file. Skip that one and
do all the others with your own group names, then use the ALTER SYSTEM SWITCH
a r ie nsf
LOGFILE command. Afterward DROP and ADD from the remaining log file group.
a c h $ sqlplus
n - tra / as sysdba
Z noSQL> ALTER DATABASE OPEN;
SQL> select group#, status, member from v$logfile;
SQL> ALTER DATABASE DROP LOGFILE MEMBER '
+DATA/orcl/onlinelog/group_n.nnn.nnnnnnnnn';
SQL> ALTER DATABASE ADD LOGFILE MEMBER '+DATA' TO GROUP n;
Hint: Check the backups that are available by using the LIST BACKUP command.
There are two possible recovery paths: 1) Drop the missing tablespace or 2) Recover the
entire database to the time of the last backup. With option 1, you lose everything in the
single tablespace, and it must be re-entered by some other means. With option 2, you will
lose everything entered since the last backup. This is the option presented with the ADVISE
FAILURE command.
Option 1: Issue the following commands.
Note: The BARTBS tablespace has been lost. If the data is important it must be
s a
reconstructed by some other means. In this solution the database does not get a new
incarnation. )h a
m
co eฺ
$ sqlplus / as sysdba
o ฺ
SQL> ALTER DATABASE DATAFILE OFFLINE FOR DROP; ho id
y a G u
SQL> ALTER DATABASE OPEN;
c k @ ent
SQL> DROP TABLESPACE BARTBS INCLUDINGaCONTENTS d AND DATAFILES;
( frz s Stu
LA e thi
SQL> EXIT;
A
Option 2: Issue the following commands.
H OU to us
$ rman target /
0 T C se
RMAN> list failure;
I % 2 icen
RMAN> advise
E L ble lfailure;
RMAN> M repair a
A f e r failure;
a ie exit
rRMAN> n s
h r a
-trecovering the database execute the cleanup_20_07.sh script from the
Zac c.noAfter
n
/home/oracle/workshops directory.
8. Recover the control file using the control file trace file.
The scenario creates a control file trace at /u01/backup/orcl/control.trc. The
controlfile autobackup is not available.
a. Start the database instance by using SQL*Plus and determine the failure.
b. Determine that all the control files are missing by viewing the alert_orcl.log file.
c. Use amscmd ls +DATA/ORCL/* to determine that all the other files are present.
d. Find the control file trace file and make a copy to control.sql. Edit the
control.sql file.
e. Make sure all the data files are listed including the data file for the BARTBS tablespace.
f. Because all the redo logs are still in place, use the Set #1 the NORESETLOGS case.
Note: The control files will be created in the locations specified in the initialization
parameter file.
$ sqlplus / as sysdba
SQL> shutdown
j. Execute the control.sql file.
SQL> @control.sql
k. If the script fails, check the file existence again and correct the script. HINT: The online
log files may be in the ASM diskgroups.
l. Check that the database is in ARCHIVELOG mode.
SQL> archive log list
s a
a
) h the
m. At this point, check the incarnation table and the backups that are recorded. Check
m
co eฺ
controlfile autobackup configuration. Check that all the tablespaces are correctly
configured. o ฺ
o uid
y a h
$ rman target /
@ n t G
RMAN> list incarnation; k
ac tude
f r z
A ( this S
RMAN> list backup summary;
L
UA use
RMAN> show controlfile autobackup;
RMAN> report schema; O
H e to
T C
using target database
% 2 c ns for file
0 econtrol instead of recovery catalog
L I le li
Report of database schema database with db_unique_name ORCL
A ME erab
rList f
ie ofnPermanent
s Datafiles
c a tra
h ===========================
a n -
Z noFile Size(MB) Tablespace RB segs Datafile Name
---- -------- -------------------- ------- ---------------------
-
1 800 SYSTEM ***
+DATA/orcl/datafile/system01.dbf
2 800 SYSAUX ***
+DATA/orcl/datafile/sysaux01.dbf
3 165 UNDOTBS1 ***
+DATA/orcl/datafile/undotbs01.dbf
4 5 USERS ***
+DATA/orcl/datafile/users01.dbf
5 357 EXAMPLE ***
+DATA/orcl/datafile/example01.dbf
6 10 BARTBS ***
/u01/app/oracle/oradata/orcl/BARtbs01.dbf
Scenarios:
For the following scenarios, diagnose the failure and perform the recovery. There are minimal
hints.
9. Loss of tablespace and current redo log file group
This scenario will require an incomplete recovery followed by a new backup. s a
)h a
c m
o ฺthe
10. Recover from the loss of all control files and a tablespace. This will requireฺrestoring
control file from a backup set.
h o
o uide
a
y backups
This scenario requires that there is a backup of the control file. Either G must be
k @ e n t
done INCLUDING CONTROLFILE or with the CONTROLFILE
z a c it requires
d
AUTOBACKUP
u
ON. It is
possible to restore using a control file backup to trace,
( but t
fr sIn allScases a complete
that you know the
L A
location of the data files belonging to the lost tablespace.
t h i recovery
is possible.
O UA use
C H e to
2 0
11. Loss of all control files, and Ta s dropped and re-created since the last backup.
tablespace
n
Hint: The creation of%
I the tablespace
l e
ic is visible in the alert log.
L l e
A ME erwith ab backups that have not been cataloged. Recover using an
12. Loss of a f
tablespace
rie abackup n s set.
h a
uncataloged
r
Zac The o n -t creates a copy of backup files in the /u01/backup/alt directory.
setup
n
Hint: Catalog the existing backup files, then recover using the REPAIR FAILURE
command.
s a
)h a
m
co eฺ
o ฺ
o uid
y a h
@ n t G
k
ac tude
f r z
L A ( this S
O UA use
C H e to
2 T
0 ens
L I le lic
%
A ME erab
a r ie nsf
a c h -tra
Z non