Solved

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

Posted on 2009-04-11
21
1,504 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
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
 
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 334 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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 166 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 334 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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 (it really isn't that hard to do) Recursive SQL is most often used to convert columns to rows or rows to columns.  A previous article described the process of converting rows to columns.  This article will build off of th…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

910 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

22 Experts available now in Live!

Get 1:1 Help Now