Backup and Recovery of Sap Systems On Aws For Linux Maxdb and db2 v1.6
Backup and Recovery of Sap Systems On Aws For Linux Maxdb and db2 v1.6
Authors:
Amazon
Web
Services
sap-‐on-‐[email protected]
Protera
Technologies
http://www.protera.biz
Version:
1.6
–
March
2012
Table
of
Contents
Prerequisite
Documents
...........................................................................................................................
4
SAP
on
Amazon
Web
Services
..............................................................................................................
4
SAP
on
MaxDB
......................................................................................................................................
4
SAP
on
DB2
UDB
...................................................................................................................................
4
Scope
of
this
Document
...........................................................................................................................
5
Components
for
SAP
Backup
and
Restore
on
AWS
infrastructure
...........................................................
5
Amazon
Elastic
Compute
Cloud
(EC2)
..............................................................................................
5
Amazon
Simple
Storage
Service
(Amazon
S3)
..................................................................................
5
Amazon
Elastic
Block
Storage
(EBS)
.................................................................................................
6
Amazon
Virtual
Private
Cloud
(VPC)
.................................................................................................
6
Storage
layout
of
SAP
systems
on
EBS
volumes
.......................................................................................
6
Backup
and
Restore
procedures
using
AWS
infrastructure
.....................................................................
8
SAP
on
MaxDB
backups
using
AWS
Infrastructure
...............................................................................
8
SAP
on
DB2
backups
using
AWS
Infrastructure
..................................................................................
10
Restore
...............................................................................................................................................
11
Common
backup
and
restore
operations
on
Amazon
EC2
instances
and
EBS
volumes
........................
11
Backup:
creating
a
new
EBS
volume
with
an
empty
file
system
........................................................
11
Backup:
creating
an
EBS
snapshot
onto
Amazon
S3
of
an
EBS
volume
.............................................
12
Backup:
dismounting
file
system(s)
and
detaching
an
EBS
Volume
...................................................
12
Backup:
creating
a
full
offline
Amazon
EC2
Amazon
Machine
Image
(AMI)
......................................
12
Detailed
steps
to
create
the
Amazon
Machine
Image
(AMI)
.........................................................
13
Examples
for
backing
up
SAP
System
components
using
AWS
infrastructure
.......................................
14
Example
1:
database
backup
to
an
EBS
backup
file
system
...............................................................
14
Example
1a:
full
online
data
and
log
backup
for
MaxDB
................................................................
15
Create
MaxDB
backup
templates
...............................................................................................
15
Back
up
the
database
using
Database
Studio
.............................................................................
16
Back
up
the
database
transaction
logs
using
Database
Studio
..................................................
16
Back
up
the
database
using
DBMCLI
..........................................................................................
16
Back
up
the
database
log
using
DBMCLI
....................................................................................
16
Amazon
Elastic
Block
Store
(EBS)
snapshots
are
point
in
time
images
of
volumes
which
are
persisted
to
Amazon
S3.
These
snapshots
can
be
used
as
the
starting
point
for
new
Amazon
EBS
volumes,
and
protect
data
for
long-‐term
durability.
The
same
snapshot
can
be
used
to
instantiate
as
many
volumes
as
desired.
Database
and
OS
backups
can
be
accomplished
via
provided
OS
and
DBMS
backup
tools
and
in
addition
utilizing
Amazon
EBS
snapshots
to
secure
these
backups.
Complete
offline
system
backups
to
a
so
called
Amazon
machine
Image
(AMI)
will
also
be
described.
Amazon
EC2
provides
different
instance
types
to
meet
different
computing
needs.
The
specific
Amazon
EC2
instance
types
that
are
currently
supported
for
SAP
application
deployments
are
listed
in
SAP
note
1588667.
Further information on Amazon EC2 can be found at http://aws.amazon.com/ec2/.
Further information on Amazon S3 can be found at http://aws.amazon.com/s3/.
EBS
also
provides
the
ability
to
create
point-‐in-‐time
snapshots
of
volumes,
which
are
persisted
to
Amazon
S3.
These
snapshots
can
be
used
as
the
starting
point
for
new
EBS
volumes,
and
protect
data
for
long-‐term
durability.
The
same
snapshot
can
be
used
to
instantiate
as
many
volumes
as
required.
Amazon
VPC
is
not
a
direct
prerequisite
for
the
backup-‐
and
restore-‐operations
that
are
described
in
this
guide.
However,
SAP
systems
themselves
are
only
supported
on
Amazon
Web
Services
infrastructure
when
deployed
within
an
Amazon
VPC.
Further information on Amazon VPC can be found at http://aws.amazon.com/vpc/.
It
is
recommended
to
separate
OS,
SAP,
DBMS,
DB
Data
and
DB
transaction
log
components
onto
different
EBS
volumes.
In
addition,
separate
file
systems
will
be
used
to
store
the
following
types
of
backups
on
MaxDB:
This translates to the recommended file system layout for MaxDB on linux as shown in Table 1.
Note
that
file
systems
printed
in
bold
belong
to
the
usual
SAP
system,
and
the
other
file
systems
are
additional
ones
to
store
backups.
The
tags
will
be
used
in
the
following
sections
to
distinguish
the
file
system
groups.
As
DB2
can
be
configured
to
have
a
separate
file
system
to
archive
its
transaction
logs
automatically,
a
file
system
for
transaction
log
backups
like
we
have
on
MaxDB
is
not
required
for
DB2.
Table
2
shows
how
a
recommended
file
system
layout
could
look
like
for
DB2
on
Linux.
Table 2: A recommended file system layout for an SAP system on DB2 on Linux
:
/db2/<SID>/sapdata<n>
Note
that
the
file
system
for
MaxDB
transaction
log
backups
/db_log_backups
in
Table
1
been
replaced
by
/db2/<SID>/log_archive
for
DB2
(Table
2).
The
content
of
this
DB2
file
systems
is
managed
by
the
DB2
RDBMS
itself.
1. Create
a
classical
backup
to
a
separate
staging
file
system
(on
EBS
storage)
2. Create
an
EBS
snapshot
of
the
staging
file
system
An
EBS
snapshot
is
automatically
persisted
onto
highly
available
Amazon
S3
storage.
Multiple
snapshots
of
a
file
system
will
be
stored
incrementally,
which
means
that
only
changed
blocks
with
respect
to
the
previous
snapshot
will
be
stored
to
Amazon
S3.
The
following
sections
will
apply
the
above
described
general
procedure
to
the
different
backup
types
for
SAP
systems
on
MaxDB
or
DB2.
In
the
figure,
each
file
system
tag
listed
in
Table
1
is
represented
by
an
EBS
volume
symbol.
The
following
3
types
of
backup
sequences
are
displayed:
1. OS-‐EXE:
backup
of
the
OS-‐EXE
file
systems
to
the
OS-‐EXE-‐BACKUPS
file
system,
using
an
OS
specific
copy
program
like
tar
on
Linux.
Subsequent
persistence
into
Amazon
S3
by
creating
a
snapshot
of
the
EBS
volume
that
holds
the
OS-‐EXE-‐BACKUPS
file
system.
2. DB-‐DATA:
MaxDB
COMPLETE
or
INCREMENTAL
backup
to
the
DB-‐DATA-‐BACKUPS
file
system.
Subsequent
persistence
onto
Amazon
S3
by
creating
an
EBS
snapshot
of
the
volume
that
holds
the
DB-‐DATA-‐BACKUPS
file
system.
NOTE:
DIRECT
SNAPSHOTS
OF
DB-‐DATA
AND
DB-‐LOG
VOLUMES
ARE
ALSO
POSSIBLE
USING
MAXDB
I/O
SUSPEND/RESUME
FUNCTIONALITY,
BUT
THESE
METHODS
ARE
NOT
WITHIN
THE
SCOPE
OF
THIS
GUIDE.
3. DB-‐LOG:
MaxDB
LOG
backup
to
the
DB-‐LOG-‐BACKUPS
file
system.
Subsequent
persistence
into
Amazon
S3
by
creating
an
EBS
snapshot
of
the
volume
that
holds
the
DB-‐LOG-‐BACKUPS
file
system.
NOTE:
MAXDB
LOG
BACKUPS
CAN
ALSO
BE
AUTOMATED
USING
ITS
AUTOSAVE
LOG
MECHANISM.
THIS
WILL
BE
DESCRIBED
LATER
IN
THIS
GUIDE.
Figure
2:
SAP
on
DB2,
overview
of
backup
types
and
procedures
using
AWS
infrastructure
As
mentioned
before
in
the
section
“Storage
layout
of
SAP
systems
on
EBS
volumes”,
DB2
functionality
is
used
to
manage
transaction
log
archiving
itself
to
the
DB2-‐LOG-‐ARCHIVE
file
system,
which
also
resides
on
an
EBS
volume
(Figure
2).
Direct
EBS
snapshots
can
be
made
of
this
file
system,
so
that
its
contents
are
regularly
persisted
onto
Amazon
S3
storage.
It
is
recommended
to
create
an
EBS
snapshot
of
the
associated
volume
each
time
a
new
transaction
log
has
been
archived
into
the
DB2-‐LOG-‐ARCHIVE
file
system.
Note
that
EBS
snapshots
are
written
incrementally
to
Amazon
S3,
differential
to
the
previous
snapshot,
which
means
that
previously
snapshotted
data
are
not
stored
over
and
over
again,
just
once.
This
makes
the
snapshot
procedure
fast
and
cost
efficient.
Recapitulating for DB2, the following backup procedures can be distinguished:
Restore
For
each
backup
type,
its
last
backup
can
usually
directly
be
restored
from
its
associated
staging
file
system.
If
the
file
staging
system
is
not
accessible
anymore
or
an
older
backup
is
required,
a
new
EBS
volume
can
be
created
out
of
a
snapshot
that
was
created
in
the
past
of
the
parent
EBS
volume.
The
new
EBS
volume
can
then
be
attached
and
mounted
onto
the
Amazon
EC2
instance
where
restore
and
(database)
recovery
is
taking
place.
Common
backup
and
restore
operations
on
Amazon
EC2
instances
and
EBS
volumes
This
section
briefly
documents
some
common
operations
on
Amazon
EC2
instances
and
EBS
volumes
that
are
used
for
backup
and
restore
purposes.
The
operations
are
described
as
if
they
would
be
performed
from
the
graphical
Amazon
Management
Console,
available
at
https://console.aws.amazon.com/ec2
However,
all
operations
can
be
fully
automated
using
the
Amazon
EC2
web
service
API
and/or
Command
Line
Tools.
For
more
information
please
visit:
http://aws.amazon.com/documentation/ec2/
Backup:
creating
a
new
EBS
volume
with
an
empty
file
system
1) Create
a
new
EBS
volume
a. Log
in
to
AWS
EC2
Management
Console
https://console.aws.amazon.com/ec2
1. On
Volumes,
click
on
Create
Volume
2. Type
the
size
3. Select
the
same
availability
zone
as
the
AWS
instance
to
be
attached
b. Select
the
volume
c. Click
on
Attach
Volume
1. Select
the
instance
2. Choose
a
free
device
name
(write
this
name
down)
pvcreate /dev/sdX
vgcreate vgbackup /dev/sdX
lvcreate -L <SIZE> -n backups vgbackup
mkfs.ext3 /dev/vgbackup/backups
mkdir -p /backups
mount /dev/vgbackup/backups /backups
NOTE:
THE
COMMAND
HAS
BEEN
PROVIDED
AS
AN
EXAMPLE;
YOU
CAN
USE
LVM2
OR
DIRECT
PARTITIONS
TO
STORE
BACKUPS.
THE
SELECTION
OF
THE
MOUNT
POINT
(/BACKUPS)
IS
ARBITRARY
Backup:
creating
an
EBS
snapshot
onto
Amazon
S3
of
an
EBS
volume
1) Make
sure
that
the
EBS
volume
is
not
written
to.
NOTE:
IF
POSSIBLE,
THE
FILE
SYSTEM(S)
ON
THE
EBS
VOLUME
CAN
BE
DISMOUNTED
TO
ENSURE
THAT
NO
WRITE
I/O
IS
OCCURRING.
WRITE
I/O
TO
A
FILE
SYSTEM
BEING
SNAPPED
CAN
CAUSE
INCONSISTENCIES
ON
THE
SNAPSHOT
COPY.
2) Log
in
to
AWS
EC2
Management
Console
https://console.aws.amazon.com/ec2
3) Go
to
volumes
and
select
the
volume
to
snapshot
4) Click
on
Create
Snapshot
5) Type
the
name
and
description.
NOTE:
CHOOSE
A
UNIQUE
BUT
EASILY
IDENTIFIABLE
NAME
THAT
INCLUDES
A
TIMESTAMP
AND/OR
SEQUENCE
NUMBER
6) Click
on
Yes
Create
7) You
can
monitor
the
progress
on
Snapshot
navigation
menu
umount /backups
vgchange vgbackup –a n
vgexport vgbackup
b. Log
in
to
AWS
EC2
Management
Console
https://console.aws.amazon.com/ec2
c. Go
to
Volumes
and
select
the
volume
to
remove
d. Click
on
Detach
Volume
e. Click
on
Yes,
Detach
on
the
popup
window
f. When
detached,
click
on
Delete
volume
Backup:
creating
a
full
offline
Amazon
EC2
Amazon
Machine
Image
(AMI)
If
the
SAP
system
can
be
shut
down
for
a
period
of
time,
a
full
image
of
the
system
can
be
created.
The
Amazon
Machine
Image
(AMI)
offline
backup
creates
a
snapshot
of
each
EBS
volume
and
stores
it
onto
Amazon
S3
storage.
The
AMI
can
be
used
as
a
golden
image,
to
spin
up
new
instances
in
case
of:
A
full
AMI
backup
should
be
performed
(at
least)
after
the
SAP
system
is
installed,
but
best
after
each
low-‐level
change
of
the
OS,
SAP
or
DBMS,
like
for
instance:
Briefly, the steps to create a full offline AMI are as follows:
su - <sidadm>
stopsap all
2) Make
sure
that
the
SAP
and
database
instances
are
shut
down
completely
by
monitoring
the
processes
and
logs.
If
the
database
was
not
able
to
shut
down
due
to
still
active
connections,
then
issue
the
following
commands:
For
MaxDB
su – <sidadm>
dbmcli db_offline
For DB2
su – db2<sid>
db2stop force
3) Log
in
to
AWS
EC2
Management
Console
https://console.aws.amazon.com/ec2
su - <sidadm>
startsap all
The AMI should now be available for Amazon EC2 instance deployment in the ‘AMIs’ section.
Examples
for
backing
up
SAP
System
components
using
AWS
infrastructure
The
following
sections
merely
provide
basic
examples
for
backing
up
MaxDB
and
DB2
LUW
databases
on
AWS
infrastructure.
Please
consult
the
documentation
referenced
in
section
“Prerequisite
Documents”
at
the
beginning
of
this
guide
as
a
complete
reference.
In addition, specific references will be provided within the sections wherever suitable.
Example
1:
database
backup
to
an
EBS
backup
file
system
To
recapitulate,
the
following
general
procedure
will
be
followed:
1) Online
Database
backups
are
performed
to
EBS
volume
dedicated
for
backups
2) Transaction
log
backups
are
performed
to
EBS
volume
dedicated
to
offline
(archived)
DB
logs
3) The
EBS
volumes
for
DB
backups
and
offline/archived
logs
are
snapshot
on
a
recurring
basis
to
Amazon
S3.
The
incremental
snapshots
ensure
point
in
time
database
recovery
in
case
of
disaster.
4) Snapshots
are
tagged
with
descriptions
of
backup
type
and
time.
Backups are created using the DBMS tools listed in Table 3.
Apart
from
the
general
references
mentioned
in
section
“Prerequisite
Documents”,
specific
MaxDB
Backup
/
Recovery
examples
can
also
be
found
at
“SAP
MaxDB
HowTo”
on
the
SAP
Community
Network
(SCN).
k. Click
Ok
l. Create
a
Backup
template
for
LOG
Backup
Name
<Template
Name>
can
be
LOG
Backup
Type
LOG
Device
Type
FILE
Backup
Tool
NONE
Device/File
/db_log_backups/<SID>_LOG
Compressed
Unselect
su - <sid>adm
#start an utility session
dbmcli –d <SID> -U c -uUTL
#start backup using the template FULL
backup_start FULL
3) Wait
until
the
backup
has
completed
su - <sid>adm
#start an utility session
dbmcli –d <SID> -U c -uUTL
#start backup using the template FULL
backup_start LOG
The
EBS
snapshot
creation
of
the
volume
that
holds
the
DB-‐LOG-‐BACKUPS
file
system
can
now
be
automated
through
a
script,
time-‐synchronized
with
the
automatic
log
backup.
Steps
to
enable
rollforward
recovery
and
set
up
DB2
logfile
management:
1) Stop
SAP
and
DB2
2) Enable
rollforward
recovery
by
updating
the
database
configuration
parameter
LOGARCHMETH1:
su – db2<sid>
db2 update db cfg for <SID> using logarchmeth1
DISK:/db2/<SID>/log_archive
The
database
will
now
be
placed
in
backup
pending
state.
A
full
database
backup
must
be
taken.
From
this
point
onwards
DB2
will
automatically
archive
log
files
from
the
/db2/<SID>/log_dir
filesystem
to
the
/db2/<SID>/log_archive
filesystem.
5) Start SAP
Make
sure
the
DB2-‐DATA-‐BACKUPS
file
system
has
enough
storage
space,
and
proper
read/write
permissions.
The
file
system
names
listed
in
Table
2
will
be
used
for
the
examples.
If
required,
please
follow
steps
described
in
the
section
“Backup:
creating
a
new
EBS
volume
with
an
empty
file
system”.
Please
remember
to
use
the
references
mentioned
in
section
“Prerequisite
Documents”
as
primary
documentation.
In
addition
the
SAP
on
DB2
UDB
for
Unix
and
Windows
(DB6)
forum
on
the
SAP
Community
Network
(SCN)
can
be
consulted
for
other
questions.
The
following
sections
merely
provide
examples
and
should
not
be
used
as
a
general
reference.
Two options to back up the DB2 LUW database will be shown in the following sections:
• Option
1:
back
up
the
database
directly
from
the
SAP
system
• Option
2:
back
up
the
database
using
the
CLI
Option
1:
back
up
the
database
directly
from
the
SAP
system
1) Log
in
to
the
SAP
system
with
an
admin
user
2) Execute
the
transaction
/nDBACOCKPIT
3) On
the
left
screen
panel,
navigate
to
Jobs/DBA
Planning
Calendar
4) In
the
calendar
area,
select
any
cell
representing
time
older
than
current
time
and
click
on
‘Add’
button.
5) On
the
pop-‐up
window,
select
‘Database
Backup
to
Device’
action,
choose
‘Online’
backup
mode
with
‘Include
Logs’
option
and
enter
/db2_data_backups
in
the
‘Device/Directory’
field
6) Click
on
‘Execute
Immediately’
button
su – db2<sid>
#start online compressed backup including logs
db2 backup database <sid> online to "/db2_data_backups" compress \
include logs
This message is shown in the following log file, located in the backup directory:
<SID>.0.db2<sid>.NODE0000.CATN0000.<datetime stamp>.001
4) Backup
the
database
manager
configuration
required
to
rebuild
the
database:
su – db2<sid>
cd /db2_data_backups
db2cfexp <SID>_cfg_backup.txt BACKUP
5) Backup
the
DB2
recovery
history
file:
su – db2<sid>
cp /db2/<SID>/db2<sid>/NODE0000/SQL00001/db2rhist.asc \
/db2_data_backups
As
from
DB2
UDB
V9.5,
automatic
log
file
retention
management
can
be
configured
in
addition.
This
is
described
in
the
example
above
and
in
the
Database
Administration
Guide
"SAP
on
IBM
DB2
for
Linux,
Unix
and
Windows",
section
“DB2
V9.5
and
Higher
Only:
Automatic
Log
File
and
Backup
Retention”.
The
EBS
volume
holding
DB2-‐LOG-‐ARCHIVE
file
system
should
be
sent
to
Amazon
S3
on
a
regular
basis
by
creating
a
direct
snapshot,
optimally
each
time
after
a
transaction
log
was
written
into
the
DB2-‐LOG-‐
ARCHIVE
file
system.
The
snapshot
can
be
taken
directly
without
dismounting
the
file
system.
NOTE:
THIS
OS
BACKUP
CANNOT
BE
USED
TO
RESTORE
THE
DATABASE,
AS
DATABASE
DATA
AND
TRANSACTION
LOGS
ARE
SPECIFICALLY
EXCLUDED
FROM
THE
BACKUP.
AFTER
RESTORING
THIS
BACKUP,
RESTORE
AND
RECOVERY
OF
THE
DATABASE
SHOULD
FOLLOW.
1) Ensure
you
have
enough
space
on
the
file
system
/os_exe_backups
for
the
OS
backup.
NOTE:
DATABASE
DATA,
TRANSACTION
LOGS
AND
MOUNTED
BACKUP
FILE
SYSTEMS
WILL
BE
EXCLUDED
FROM
THIS
BACKUP
2) Start
the
OS
backup
a. Logon
into
the
OS
start
a
tar
backup
on
the
/os_exe_backups
file
system
NOTE:
THE
USE
OF
COMPRESSION
AFFECTS
THE
CPU
UTILIZATION
AND
BACKUP
TIME.
CHOOSE
TO
USE
COMPRESSION
OR
NOT
BY
ADDING
OR
REMOVING
THE
“-‐-‐GZIP”
PARAMETER
OF
THE
TAR
COMMAND
For
database
type
of
MaxDB
use
this
script
as
an
example:
export exclusion_file=/os_exe_backups/backup-exclude-dirs.txt
export backup_file=/os_exe_backups/backup.tar.gz
export log_file=/os_exe_backups/backup.stdout
export error_log_file=/os_exe_backups/backup.stderr
#to monitor
#tail -f $log_file
#tail -f $error_log_file
NOTE:
THE
COMMAND
HAS
BEEN
PROVIDED
AS
AN
EXAMPLE,
PLEASE
TEST
AND
CHANGE
AS
REQUIRED.
For database type of DB2 use this script as an example:
#to monitor
#tail -f $log_file
#tail -f $error_log_file
NOTE:
THE
COMMANDS
HAVE
BEEN
PROVIDED
AS
AN
EXAMPLE,
PLEASE
TEST
AND
CHANGE
AS
REQUIRED.
To
send
the
backup
to
Amazon
S3,
create
an
EBS
snapshot
of
the
EBS
volume
that
holds
the
/os_exe_backups
file
system.
You
can
refer
to
the
section
“Backup:
creating
an
EBS
snapshot
onto
Amazon
S3
of
an
EBS
volume”
for
the
required
steps.
“GET http://169.254.169.254/latest/meta-data/instance-id”
Linux
tools
like
curl
or
wget
can
be
used
to
issue
the
above
HTTP
command
from
a
local
shell
on
the
Amazon
EC2
instance.
More
information
on
using
Amazon
EC2
instance
metadata
is
available
at
http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/AESDG-‐chapter-‐instancedata.html
Create
an
Amazon
instance
using
the
“golden
backup”
AMI
of
the
original
system
1) Log
in
to
the
AWS
EC2
Management
Console
https://console.aws.amazon.com/ec2
2) Within
AMIs
select
your
“golden
backup”
AMI
and
click
Launch
The
“golden
backup”
AMI
should
be
created
before,
as
described
in
the
previous
section
“Backup:
creating
a
full
offline
Amazon
EC2
Amazon
Machine
Image
(AMI)”
a. On
Instance
Details
1. Choose
an
instance
type
that
is
supported
for
SAP
Check
SAP
note
1588667
–
SAP
on
Amazon
Web
Services
(AWS)
2. Select
the
VPC
and
Subnet
3. Click
on
Continue
4. Type
the
IP
Address
(Select
the
same
IP
address
of
the
server
you
want
to
recover)
5. Check
the
Termination
Protection
6. Click
on
Continue
7. On
Name,
type
the
name
of
the
instance
b. On
Create
Key
Pair
1. Select
the
existing
Key
Pairs
from
Choose
From
your
existing
Key
Pairs
2. Click
on
Continue
c. On
CONFIGURE
FIREWALL
1. Choose
an
existing
SG
or
Create
a
new
one
NOTE:
DEPENDING
ON
THE
SAP
INSTANCE
TYPE,
THE
PORTS
REQUIRED
WOULD
BE
TCP/22,
TCP/3200,
TCP/3300,
TCP/3600.
d. On
REVIEW
1. Click
on
Launch
For the MaxDB database type, use this script as an example:
Example:
vgscan
vgimport vgbackup
vgchange vgbackup -a y
mkdir /os_exe_backups
mount /dev/vgbackup/os_exe /os_exe_backups
4) Restore
the
OS
Example:
#Backup the current fstab
cp /etc/fstab /etc/fstab.<timestamp>
#Restore the OS
cd /
tar -zxvf /os_exe_backups/backup.tar.gz
The system is now ready for database restore and recovery.
Example
2:
Restoring
and
Recovering
the
Database
from
Amazon
S3
In
general,
restore
and
recovery
of
databases
requires
careful
planning
and
preparation
before
execution.
Take
time
for
root-‐cause
analysis
to
be
better
able
to
identify
the
most
efficient
recovery
strategy
before
executing.
This
guide
does
not
intend
to
replace
the
original
backup
and
restore
documentation
of
the
database
vendors
that
was
referenced
in
section
“Prerequisite
Documents”.
As
restore
and
recovery
scenarios
are
most
diverse
and
dependent
on
the
environment
and
failure
cause,
it
is
strongly
recommended
to
follow
the
original
documentation
in
case
of
a
real
failure.
The
following
sections
describe
some
basic
examples
of
MaxDB
and
DB2
database
restore
and
recovery,
to
get
an
initial
idea
how
that
works
on
Amazon
infrastructure.
a. Only
if
required,
create
a
new
EBS
volume
based
on
an
Amazon
S3
snapshot
backup
1. On
Volumes,
click
on
Create
Volumes
2. Type
the
Size
of
the
Volume
3. Select
the
same
Availability
Zone
as
the
Instance
4. On
Snapshot
select
the
latest
OS
backup
5. Click
on
Yes,
Create
#Fix permissions
chown sdb:sdba /sapdb/<SID>/sapdata
chown sdb:sdba /sapdb/<SID>/saplog
#logon as <sid>adm
su - <sid>adm
backup_history_open
backup_history_list -r last -c
label,action,pages,firstlog,lastlog,media
db_connect
recover_start FULL data
#logon as <sid>adm
su - <sid>adm
su - <sid>adm
backup_history_open
backup_history_list -r last -c
label,action,pages,firstlog,lastlog,media
service_connect
#If the recovery ends with -8020 error code and you still
have logs to recover that are not listed in the backup
history, you can continue with the following commands,
where <YYY> is the next log to recover, recover log by log
until you restore the latest available log.
db_restartinfo
#If the consistent=1 the database can start
d. Use
the
following
commands
to
start
the
recovery
if
you
want
to
restore
in
point
in
time
recovery
su - <sid>adm
backup_history_open
backup_history_list -r last -c
label,action,pages,firstlog,lastlog,media
service_connect
db_connect
recover_start LOG log <XXX> UNTIL <date> <time>
#If the recovery ends with -8020 error code and you still
have logs to recover that are not listed in the backup
history, you can continue with the following commands,
where <YYY> is the next log to recover, recover log by log
until you restore the latest available log.
umount /db_data_backups
vgchange vgbackup –a n
vgexport vgbackup
c. Logon
in
to
the
AWS
EC2
Management
Console
https://console.aws.amazon.com/ec2/
d. Go
to
Volumes
and
select
the
volume
to
remove
e. Click
on
Detach
Volume
f. Click
on
Yes,
Detach
on
the
popup
window
g. When
detached,
click
on
Delete
Volume
Example
2b:
DB2
LUW
restore
and
recovery
from
Amazon
S3
1) If
this
is
an
DR,
make
sure
you
have
restored
the
OS
2) Mount
the
Amazon
S3
Database
backup
on
the
instance
a. Create
an
EBS
volume
based
on
an
Amazon
S3
DB
backup
snapshot
1. On
Volumes,
click
on
Create
Volumes
2. Type
the
Size
of
the
Volume
3. Select
the
same
Availability
Zone
as
the
Instance
4. On
Snapshot
select
the
latest
DB
backup
5. Click
on
Yes,
Create
Example:
vgscan
vgimport vgbackup
vgchange vgbackup -a y
mkdir /backups
mount /dev/vgbackup/backups /db2_data_backups
a. Create
an
EBS
volume
based
on
an
AmazonS3
log
backup
snapshot
1. On
Volumes,
click
on
Create
Volumes
2. Type
the
Size
of
the
Volume
3. Select
the
same
Availability
Zone
as
the
Instance
4. On
Snapshot
select
the
latest
log
backup
5. Click
on
Yes,
Create
Example:
vgscan
vgimport vgbackuplog
vgchange vgbackuplog -a y
mkdir /backuplogs
mount /dev/vgbackuplog/backuplogs /backuplogs
# Log on as db2<sid>
su – db2<sid>