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

Req help on DB2 V9.1 Z/OS Backup and Point in time Recovery JCLs, steps , Recomendations
SAKETHREDDYAsked:
Who is Participating?
 
momi_sabagConnect With a Mentor Commented:
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
 
Raja Jegan RSQL Server DBA & ArchitectCommented:
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
 
SAKETHREDDYAuthor Commented:
Could you give me on Z/os , and for full Database , i need to setup for tablespace and table level
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
SAKETHREDDYAuthor Commented:
i need only Tablespace and Table level not for Database level
Advance thank you .
0
 
momi_sabagCommented:
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
 
Tomas Helgi JohannssonCommented:
      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
 
Tomas Helgi JohannssonCommented:
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
 
Tomas Helgi JohannssonCommented:
0
 
SAKETHREDDYAuthor Commented:
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
 
SAKETHREDDYAuthor Commented:
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
 
momi_sabagCommented:
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
 
SAKETHREDDYAuthor Commented:
Single tablespace is good for me
Advance thank you
0
 
Tomas Helgi JohannssonCommented:
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
 
momi_sabagConnect With a Mentor Commented:
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
 
SAKETHREDDYAuthor Commented:
Thanks you very much ..

In above JCL on
torba  <rba comes here>   --> could you give me more details ..                          
0
 
momi_sabagCommented:
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
 
SAKETHREDDYAuthor Commented:
Could you tell me how to find out the rba, could you give me sample example.
0
 
momi_sabagCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.