Solved

DB2 V9.1 Z/OS Backup and Point in time Recovery JCLs, Recomendations

Posted on 2009-04-11
21
1,496 Views
Last Modified: 2012-05-06
Req help on DB2 V9.1 Z/OS Backup and Point in time Recovery JCLs, steps , Recomendations
0
Comment
Question by:SAKETHREDDY
  • 7
  • 6
  • 5
  • +1
21 Comments
 
LVL 57

Expert Comment

by:Raja Jegan R
Comment Utility
This should help you out:

Replace the following things in the code below to work out

DB_Name represents the name of your database.
dir_path represents the path of the backup file

Execute one by one to get it done correctly.
-- DB2 Backup Procedure:
 

db2 CONNECT TO DB_Name

db2 QUIESCE DATABASE IMMEDIATE FORCE CONNECTIONS

db2 CONNECT RESET

db2 BACKUP DATABASE DB_Name TO dir_path

db2 CONNECT TO DB_Name

db2 UNQUIESCE DATABASE

db2 CONNECT RESET
 

-- DB2 Restore Procedure:
 

db2 CONNECT TO DB_Name

db2 QUIESCE DATABASE IMMEDIATE FORCE CONNECTIONS

db2 CONNECT RESET

db2 RESTORE DATABASE DB_Name FROM dir_path TAKEN AT 20080917150234

db2 CONNECT TO DB_Name

db2 UNQUIESCE DATABASE

db2 CONNECT RESET

Open in new window

0
 

Author Comment

by:SAKETHREDDY
Comment Utility
Could you give me on Z/os , and for full Database , i need to setup for tablespace and table level
0
 

Author Comment

by:SAKETHREDDY
Comment Utility
i need only Tablespace and Table level not for Database level
Advance thank you .
0
 
LVL 37

Expert Comment

by:momi_sabag
Comment Utility
hi
you can find samples of jcl code in the db2 utility guide and reference,
regarding your question,
it is impossible to recover a table in db2 for zos using the recover utility, you can only recover a complete tablespace

if you do wish to recover a single table, these are your options:
1) use dsn1copy to copy the image file to a new tablespace with identical objects (only different names), and from there, take the table you need
2) use the unload utility and unload data from the image file, then you can load that data into the table you need

what is your purpose?
0
 
LVL 24

Expert Comment

by:Tomas Helgi Johannsson
Comment Utility
      Hi!

Take a look at the manual
http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/topic/com.ibm.db29.doc.admin/db2z_backupandrecover.htm

The first comment from rrjegan17 is a backup procedure for DB2 on LUW (Linux Unix and Windows) and is not recommended procedure for DB2 on z/OS.

Regards,
   Tomas Helgi
0
 
LVL 24

Expert Comment

by:Tomas Helgi Johannsson
Comment Utility
Also take a look at chapter 6 in  this book
http://www.redbooks.ibm.com/Redbooks.nsf/RedbookAbstracts/sg247473.html?Open

Regards,
    Tomas Helgi


0
 
LVL 24

Expert Comment

by:Tomas Helgi Johannsson
Comment Utility
0
 

Author Comment

by:SAKETHREDDY
Comment Utility
I have one database with 150 tablespaces. i need to take the full image copy for all segmented 150 tablespaces. could you give me simple example JCL. i have created 150 GDGs for eatch tablespace.  
0
 
LVL 37

Accepted Solution

by:
momi_sabag earned 334 total points
Comment Utility
why do you want to use gdgs ?
db2 provides the template utility which will allow you to dynamically set the name of the backup file,
you can have it containing the tablespace name and backup date for example
it's hard for me to give you sample jcl since i don't have a mainframe where i'm at right now, but the jcl should be rather straight forward, something like:

//runbck  exec pgm=dsnutilb,parm='DB2X' (this is the name of the subsystem)
//SYSPRINT  DD SYSOUT=*
//SYSIN   DD *
  listdef copylist
   include dbname.*         (this is for all tablespace in the database, if you want, you can specify them individually by repating the include part for example -  listdeft copylist  include dbname.ts1 include dbname.ts2)

  template cpyfile
    dsn 'xxxxx.xxxx.&db..&sp..&d'    

  copy tablespace copylist cpyddn cpyfile
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:SAKETHREDDY
Comment Utility
thank you , it is working fine for me.

Colud you give me the Point in time recovery steps and small example (DB2 v9 on Z/os only)
0
 
LVL 37

Expert Comment

by:momi_sabag
Comment Utility
point in time recory is a bit more tricky
do you need to do it to a single tablespace or to the entire system?
0
 

Author Comment

by:SAKETHREDDY
Comment Utility
Single tablespace is good for me
Advance thank you
0
 
LVL 24

Assisted Solution

by:Tomas Helgi Johannsson
Tomas Helgi Johannsson earned 166 total points
Comment Utility
0
 
LVL 24

Expert Comment

by:Tomas Helgi Johannsson
Comment Utility
You can get a batch jcl for the recover to logpoint
by issuing the proper command in the DB2 Admin on a Tablespace level ( U.VP in the line of the tablespace involved).

Regards,
    Tomas Helgi
0
 
LVL 37

Assisted Solution

by:momi_sabag
momi_sabag earned 334 total points
Comment Utility
when recovering a single tablespace you can either recover to a point in time (that is an rba in the log) or to a quiesce point / backup image

if you are recovering to a shrlevel reference backup image, or to a queisce point, then you can be sure your data will be consistent
if you recover to a rba, you must make sure no transactions were open at that rba, which is a very complex thing to do, thus, less recommended

jcl sample:
//runbck  exec pgm=dsnutilb,parm='DB2X' (this is the name of the subsystem)
//SYSPRINT  DD SYSOUT=*
//SYSIN   DD *
 recover tablespace dbname.tablespace_name
  torba  <rba comes here>                              or
  tocopy <backup file name comes here>

make sure to rebuild the indexes after you recover
0
 

Author Comment

by:SAKETHREDDY
Comment Utility
Thanks you very much ..

In above JCL on
torba  <rba comes here>   --> could you give me more details ..                          
0
 
LVL 37

Expert Comment

by:momi_sabag
Comment Utility
rba is a point in the log
if you want to recover to a specific point in time you need to find out what was the rba at that time and specify that rba in the recover statement
0
 

Author Comment

by:SAKETHREDDY
Comment Utility
Could you tell me how to find out the rba, could you give me sample example.
0
 
LVL 37

Expert Comment

by:momi_sabag
Comment Utility
there are no examples for this task.
finding the rba is not trivial
if you know the time you want to recover to , you need to perform the following steps:
1) print out the bsds using dsnj003 utility
2) locate in the archive log or active log part which log files contains the point in time you want
3) print that log file using dsn1prnt and look for the closest rba to the point in time you want
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

November 2009 Recently, a question came up in the DB2 forum regarding the date format in DB2 UDB for AS/400.  Apparently in UDB LUW (Linux/Unix/Windows), the date format is a system-wide setting, and is not controlled at the session level.  I'm n…
Recursive SQL in UDB/LUW (you can use 'recursive' and 'SQL' in the same sentence) A growing number of database queries lend themselves to recursive solutions.  It's not always easy to spot when recursion is called for, especially for people una…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now