?
Solved

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

Posted on 2009-04-11
21
Medium Priority
?
1,526 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
  • 5
  • +1
21 Comments
 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 24123015
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
ID: 24123085
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
ID: 24123955
i need only Tablespace and Table level not for Database level
Advance thank you .
0
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
LVL 37

Expert Comment

by:momi_sabag
ID: 24124697
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 25

Expert Comment

by:Tomas Helgi Johannsson
ID: 24145789
      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 25

Expert Comment

by:Tomas Helgi Johannsson
ID: 24146462
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 25

Expert Comment

by:Tomas Helgi Johannsson
ID: 24146593
0
 

Author Comment

by:SAKETHREDDY
ID: 24199103
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 1336 total points
ID: 24201664
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
 

Author Comment

by:SAKETHREDDY
ID: 24235788
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
ID: 24239257
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
ID: 24240959
Single tablespace is good for me
Advance thank you
0
 
LVL 25

Assisted Solution

by:Tomas Helgi Johannsson
Tomas Helgi Johannsson earned 664 total points
ID: 24241300
0
 
LVL 25

Expert Comment

by:Tomas Helgi Johannsson
ID: 24241363
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 1336 total points
ID: 24241406
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
ID: 24384146
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
ID: 24405089
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
ID: 24418017
Could you tell me how to find out the rba, could you give me sample example.
0
 
LVL 37

Expert Comment

by:momi_sabag
ID: 24423331
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month10 days, 12 hours left to enroll

765 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