Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

This document contains information about DB2 10.1 FP3 restore steps. DB2 restore has been executed from the latest snapshot of the source system. Source system is an SCM 7.0 based on NW7.01, running DB2 10.1 FP3 on Linux x86_64.

To prevent some misunderstandings and increase readibility, I prepared 3 seperate documents for DB2 restore and LiveCache MaxDB restore.

This part contains sapinst steps from the beginning until the "exit to restore DB2". Second part contains DB2 restore (from Snapshot) steps and third part contains LiveCache system copy instructions.

For the first part, that contains system copy screenshots (until restore) and information, go to link: SCM 7.0 (with LiveCache) DB2 Linux system copy-Part1/3 (Until restore)

For the third part, that contains LiveCache MaxDB restore screenshots and specific LC information, go to link : SCM 7.0 (with LiveCache) DB2 Linux system copy-Part3/3 (LiveCache restore)

Restore steps would possibly differ in your environment, since those steps change dependent to the landscape infrastructure, filesystem structure, directory structure and used softwares in backup&storage processes.

SSID, ssid : Refers to source system SID.

TSID, tsid : Refers to target system SID.

  • 1.Prepare relocation script on source system. Then copy it to target system. It is used to "relocate" source DB files copied from snapshot, to target DB.

Source system :

Su - db2<tsid>

brdb6brt -bm 5 -replace TSID=SSID,db2<ssid>=db2<tsid>

Relocation Script:  ./TSID_NODE0000.scr

  • 2.Create mount points and mount the source system snapshot filesystems under those mount points on target system.

Target system:

root-> mkdir /tmp/SNAP_sapdata

root-> mkdir /tmp/SNAP_db2<ssid>

root-> mount -t nfs XXXXX:/vol_XXX_source_dbdata/dbdata/db/db2/db2_source_sapdata /tmp/SNAP_sapdata

root-> mount -t nfs XXXXX:/vol_XXX_source_dbdata/dbdata/db/db2/db2_source_db2<ssid> /tmp/SNAP_db2<ssid>

  • 3.Copy source system files from snapshot backup to target system directories:

root-> pwd

/tmp/SNAP_sapdata/.snapshot/snap-daily_DATE_OF_LATEST_SNAP

root-> date; cp -Ppr * /db2/<TSID>/sapdata/ ; date

root-> pwd

/tmp/SNAP_sapdata/.snapshot/snap-daily_DATE_OF_LATEST_SNAP

root-> cp -pPr * /db2/<TSID>/db2<tsid>/

  • 4.Rename directories and adjust file authorizations according to the target system users:

root-> pwd

/db2/<TSID>/sapdata

root-> mv db2<ssid> db2<tsid>


root-> pwd

/db2/<TSID>/sapdata/db2<tsid>/NODE0000

root-> mv <SSID> <TSID>

root-> pwd

/db2/<TSID>/db2<tsid>

root-> chown -R db2<tsid>:db<tsid>adm NODE0000/

root-> pwd

/db2/<TSID>/sapdata

root-> chown -R db2<tsid>:db<tsid>adm db2<tsid>

  • 5.After those adjustments, we can execute the script that we've already prepared in the first step. Script initialize the target DB.

targetHost:db2<tsid> > db2inidb <TSID> as mirror relocate using <SSID>_NODE0000.scr

Relocating database...

DBT1006N  The "/db2/<TSID>/sapdata1/db2<tsid>/NODE0000/<TSID>/T0000000/C0000000.CAT" file or device could not be opened.

Unable to relocate database, cannot continue.

This error comes up, if the target and source system filesystem-directory structures differ. To overcome this, I've created symbolic links:

root-> ln -s sapdata sapdata1

root-> ....

root-> ln -s sapdata sapdata16

targetHost:db2<tsid> > db2inidb <TSID> as mirror relocate using <SSID>_NODE0000.scr

Relocating database...

Files and control structures were changed successfully.

Database was catalogued successfully.

DBT1000I  The tool completed successfully.

Database relocation was successful.

DBT1000I  The tool completed successfully.

  • 6.Copy your source system's DB2 archive logs to target system, to make rollforward your target DB. On target system preape a script (rollforward<TSID>.clp) including rollforward command. In our case we've made "end of logs" recovery but "point-in-time" recovery is also possible.

     Run the script and complete your rollforward process.

targetHost:db2<tsid> >  db2 -tvf rollforward<TSID>.clp

rollforward db <TSID> to end of logs and complete OVERFLOW LOG PATH(/tmp/Temporary_Space_for_Source_Archive_Logs/)

                                 Rollforward Status

Input database alias                   = <TSID>

Number of members have returned status = 1

Member ID                              = 0

Rollforward status                     = not pending

Next log file to be read               =

Log files processed                    = S000xxxx.LOG - S000yyyy.LOG

Last committed transaction             = date-06.09.36.000000 Local

DB20000I  The ROLLFORWARD command completed successfully.

  • 7.Activate your target DB. This command starts to create online DB logs under your /db2/TSID/log_dir directory.

targetHost:db2<tsid> > db2 activate db <TSID>

DB20000I  The ACTIVATE DATABASE command completed successfully.

  • 8.Grant authorizations on your target database.

su - <tsid>adm

db2 grant secadm on database to user db2<tsid>

db2 grant dbadm on database to user db2<tsid>

db2 grant dbadm on database to user <schema_owner>

db2 grant dbadm on database to user <schema_owner>

su - db2<tsid>

db2 grant secadm on database to user <tsid>adm

db2 grant dbadm on database to user <tsid>adm

db2 grant dbadm on database to user <schema_owner>

db2 grant dbadm on database to user <schema_owner>

  • 9.Drop and recreate your SYSTOOLSTMPSPACE.

targetHost:db2<tsid> > db2 -tvf /tmp/SCRIPT.clp

drop tablespace "SYSTOOLSTMPSPACE"

DB20000I  The SQL command completed successfully.

drop tablespace "SYSTOOLSPACE"

DB20000I  The SQL command completed successfully.

CREATE USER TEMPORARY TABLESPACE "SYSTOOLSTMPSPACE" IN DATABASE PARTITION GROUP IBMCATGROUP PAGESIZE 16384 MANAGED BY AUTOMATIC STORAGE EXTENTSIZE 2 PREFETCHSIZE AUTOMATIC BUFFERPOOL IBMDEFAULTBP OVERHEAD 7.500000 TRANSFERRATE 0.060000 FILE SYSTEM CACHING DROPPED TABLE RECOVERY OFF

DB20000I  The SQL command completed successfully.

CREATE LARGE TABLESPACE "SYSTOOLSPACE" IN DATABASE PARTITION GROUP IBMCATGROUP PAGESIZE 16384 MANAGED BY AUTOMATIC STORAGE AUTORESIZE YES INITIALSIZE 32 M MAXSIZE NONE EXTENTSIZE 2 PREFETCHSIZE AUTOMATIC BUFFERPOOL IBMDEFAULTBP OVERHEAD 7.500000 TRANSFERRATE 0.060000 NO FILE SYSTEM CACHING DROPPED TABLE RECOVERY OFF

DB20000I  The SQL command completed successfully.

  • 10.Install DB2 licenses.

targetHost:db2<tsid> > db2licm -a db2ese_c.lic

targetHost:db2<tsid> > db2licm -l

  • 11.Restart your target DB and try to connect to it. Check R3trans connectivity.

targetHost:db2<tsid> > db2stop force

targetHost:db2<tsid> > db2start

targetHost:db2<tsid> > db2 connect to <TSID>

   Database Connection Information

Database server        = DB2/LINUXX8664 10.1.3

SQL authorization ID   = DB2<TSID>

Local database alias   = <TSID>

targetHost:<tsid>adm > R3trans -d

This is R3trans version 6.23 (release 720 - 31.10.12 - 20:12:06).

unicode enabled version

R3trans finished (0000).

TROUBLESHOOTING:


  • <SQL0727N An error occurred during implicit system action type "3". >

Under installation directory sapinst_instdir

root-> more last_command.out

SELECT 'CALL SYSPROC.ADMIN_TASK_REMOVE(''' || RTRIM(NAME) || ''',' || CASE WHEN END_TIME IS NULL THEN 'NULL' ELSE '''' || RTRIM(CAST (END_TIME AS char(40))) || '''' END || ');' FROM SYSTOOLS.ADMIN_TASK_LIST WHERE PROCEDURE_SCHEMA = 'SA

PTOOLS'

SQL0727N  An error occurred during implicit system action type "3".

Information returned for the error includes SQLCODE "-204", SQLSTATE "42704"

and message tokens "SYSTOOLS.ADMINTASKS". SQLSTATE=56098


SOLUTION

http://scn.sap.com/thread/2098004

db2 "drop view SYSTOOLS.ADMIN_TASK_LIST"

  • SQL0556N  An attempt to revoke a privilege, security label,.....

REVOKE DBADM ON DATABASE from user <TSID>ADM

DB21034E  The command was processed as an SQL statement because it was not a

valid Command Line Processor command.  During SQL processing it returned:

SQL0556N  An attempt to revoke a privilege, security label, exemption, or role

from "<TSID>ADM" was denied because "<TSID>ADM" does not hold this privilege,

security label, exemption, or role.  SQLSTATE=42504

SOLUTION

db2 grant dbadm on database to user <tsid>adm

Labels in this area