I tried to recover a tablespace to a specific rba before unwanted delete statement, But I did not succeed.
can any one help me? This is the process that I have done:
1- After i created one segmented tablespace, i inserted a few rows in it.
2- i maked a full copy from the tablespace:
COPY TABLESPACE xxxxx.xxxxxx DSNUM ALL
OUTPUT: DB2 IMAGE COPY SUCCESSFUL FOR TABLESPACE xxxx.xxxxxx
3- I also added other records and updated some rows.
4- Its time to happen unwanted delete with clause. This delete statement removes most records.
Now is the time for recover deleted rows:
5- i fetch and keep relevant information about dbid and psid:
SELECT T.DBNAME,T.NAME,HEX(T.DBID),HEX(T.PSID) FROM
WITH UR;--DBID=0101 PSID=0034
6- i archive the log with command : -archive log
7- after the offload is finished i started running REPORT RECOVERY UTILITY on the tablespace and i found related archive logs:
REPORT RECOVERY TABLESPACE xxxxx.xxxxxx
REPORT RECOVERY TABLESPACE xxxxx.xxxxxx ARCHLOG1 BSDS VOLUMES:
8- I then run DSN1LOGP utility to get the RBAs and log ranges of the object in nearest time before the unwanted deletion:
//DSN1LOGP JOB ACCT#,BG,
//STEP1 EXEC PGM=DSN1LOGP
//STEPLIB DD DSN=xxxxxx.SDSNLOAD,DISP=SHR
//SYSPRINT DD SYSOUT=A
//SYSABEND DD SYSOUT=A
//ARCHIVE DD DSN=xxxxxx. XXXXXX.ARCHLOG1. XXXXXXXX. XXXXXXXX.A0036684,DISP=SHR
// DD DSN=xxxxxx. XXXXXX.ARCHLOG1. XXXXXXXX. XXXXXXXX.A0036685,DISP=SHR
//SYSIN DD *
DSN1212I DSN1LGRD FIRST LOG RBA ENCOUNTERED 49B500CB6000
49B58A9EA605 TYPE( UNDO REDO ) URID(49B58A9EA575)
LRSN(D3A9EEB69102) DBID(0101) OBID(0034) PAGE(00000002)
SUBTYPE(INSERT IN A DATA PAGE) CLR(NO) PROCNAME(DSNISGRT)
49B58A957BDD TYPE( REDO ) URID(49B58A957B4D)
LRSN(D3A9EEB64065) DBID(0101) OBID(0034) PAGE(00000001)
SUBTYPE(UPDATE SPACE MAP) CLR(NO) PROCNAME(DSNISGSU)
49B60DE5E245 TYPE( UNDO REDO ) URID(49B60DE5E13A) 17:12:39 17.364
LRSN(D3A9F3384E80) DBID(0101) OBID(0034) PAGE(00000002)
SUBTYPE(DELETE IN A DATA PAGE) CLR(NO) PROCNAME(DSNIDILS)
9- In the output, I found the last LRSN before the deleted records and I used it in RECOVER UTILITY:
//RECOVER EXEC DSNUPROC,SYSTEM=XXXX,
//DSNUPROC.SYSUT1 DD DSN=XXXXXXXX.SYSUT1,
//DSNUPROC.SYSIN DD *
RECOVER TABLESPACE XXXXX.XXXXXXXX DSNUM ALL
LAST FULL COPY IS PARTICIPATING IN RECOVERY OF TABLESPACE
LOG APPLY PHASE COMPLETE
Everything seems to me right, but The table was not properly recovered and existing records were also deleted!!!!???
Thank you for discovering my mistake.
ALIREZA BAGHBAN[Organization Members] @ Dec 30, 2017 - 12:38 PM (America/Eastern)