Topic
  • 7 replies
  • Latest Post - ‏2009-09-30T11:55:09Z by jrmmaes
jrmmaes
jrmmaes
7 Posts

Pinned topic db2relocatedb & restore redirect: both fail while trying to access old inst

‏2009-09-29T11:56:43Z |
I'm trying to copy a DB from db2inst2 to db2inst5 on the same server (db2 9.5 on linux)
I've tried both db2relocatedb & restore redirect, but both methods didn't work:
Both systems fail because they try to access the same file in thee original instance (db2inst2)
I run these processes as db2inst5-user, this user doesn't have write-access to the files of the db2inst2.
But I don't want the restore/db2relocatedb to mess with the files of the original instance
(And I presume that they don't need the original files: restore uses the backup-file & db2relocatedb uses a copy of the db2inst2)

restore redirect
Result:
SQL0970N The system attempted to write to a read-only file. SQLSTATE=55009
Logfile states that it is while trying to access this file:
/home/db2inst2/db2inst2/NODE0000/PIMDB/T0000000/C0000000.CAT

db2relocatedb
I've tried this with all possible CONT_PATH & STORAGE_PATH-values
I didn't forget to copy the db-files to the new instance.
Result:
DBT1006N The file/device "/home/db2inst2/db2inst2/NODE0000/PIMDB/T0000000/C0000000.CAT" could not be opened

What could I be missing here?
Updated on 2009-09-30T11:55:09Z at 2009-09-30T11:55:09Z by jrmmaes
  • db2girl_bella
    db2girl_bella
    20 Posts

    Re: db2relocatedb & restore redirect: both fail while trying to access old inst

    ‏2009-09-29T13:57:09Z  
    You need to check if your tablespaces on source db are using automatic storage (AS) or not (non-AS). For AS tablespaces, you need to use the "ON" parameter on the restore command. For non-AS tablespaces, you need to use the redirect/set tablespace containers. It'd help if you post the exact steps you executed to perform a redirected restore and "db2pd -d <db name> -tablespaces" output
  • jrmmaes
    jrmmaes
    7 Posts

    Re: db2relocatedb &#38; restore redirect: both fail while trying to access old inst

    ‏2009-09-29T14:11:59Z  
    You need to check if your tablespaces on source db are using automatic storage (AS) or not (non-AS). For AS tablespaces, you need to use the "ON" parameter on the restore command. For non-AS tablespaces, you need to use the redirect/set tablespace containers. It'd help if you post the exact steps you executed to perform a redirected restore and "db2pd -d <db name> -tablespaces" output
    How can I find out if my tablespaces are using AS or non-AS?

    These are my restore-steps:
    As db2inst2-user (=instance of original db):
    > db2 backup db PIMDB
    then as root:
    then I copy the PIMDB.....001- file to the /home/db2inst7
    & I make user db2inst7 owner of the file (chown)
    And finally as db2inst7-user (= the destination-instance)
    > db2 restore db PIMDB redirect
    Result:
    SQL0970N The system attempted to write to a read-only file. SQLSTATE=55009
    Results of db2pd:

    Database Partition 0 -- Database PIMDB -- Active -- Up 0 days 17:05:25

    Tablespace Configuration:
    Address Id Type Content PageSz ExtentSz Auto Prefetch BufID BufIDDisk FSC NumCntrs MaxStripe LastConsecPg Name
    0x00002B76FB06F800 0 DMS Regular 4096 4 Yes 24 1 1 Off 1 0 3 SYSCATSPACE
    0x00002B76FD110200 1 SMS SysTmp 4096 32 Yes 192 1 1 On 1 0 31 TEMPSPACE1
    0x00002B76FD114A60 2 DMS Large 4096 32 Yes 192 1 1 Off 1 0 31 USERSPACE1
    0x00002B76FD115280 3 DMS Regular 16384 32 Yes 384 2 2 Off 2 0 31 USERS
    0x00002B76FD115C00 4 DMS Regular 16384 32 Yes 384 3 3 Off 2 0 31 INDX
    0x00002B76FD1165E0 5 DMS Regular 16384 32 Yes 384 4 4 Off 2 0 31 BLOB_TBL_DATA
    0x00002B76FD116FC0 6 DMS Regular 16384 32 Yes 384 5 5 Off 2 0 31 ITA_DATA
    0x00002B76FD1179A0 7 DMS Regular 16384 32 Yes 384 9 9 Off 2 0 31 ITM_DATA
    0x00002B76FD118380 8 DMS Regular 16384 32 Yes 384 7 7 Off 2 0 31 ITD_DATA
    0x00002B76FD118D60 9 DMS Regular 16384 32 Yes 384 11 11 Off 2 0 31 ICM_DATA
    0x00002B76FD119740 10 DMS Regular 16384 32 Yes 384 13 13 Off 2 0 31 LCK_DATA
    0x00002B76FD11A120 11 DMS Regular 16384 32 Yes 384 6 6 Off 2 0 31 ITA_IX
    0x00002B76FD11AB00 12 DMS Regular 16384 32 Yes 384 10 10 Off 2 0 31 ITM_IX
    0x00002B76FD11B4E0 13 DMS Regular 16384 32 Yes 384 8 8 Off 2 0 31 ITD_IX
    0x00002B76FD11BEC0 14 DMS Regular 16384 32 Yes 384 12 12 Off 2 0 31 ICM_IX
    0x00002B76FD11C8A0 15 DMS Regular 16384 32 Yes 384 14 14 Off 2 0 31 LCK_IX
    0x00002B76FD11D280 16 SMS UsrTmp 16384 32 Yes 192 15 15 On 1 0 31 TEMP_USER
    0x00002B76FD120080 17 SMS SysTmp 16384 32 Yes 192 16 16 On 1 0 31 TEMP_SYSTEM
    0x00002B76FD124760 18 DMS Large 4096 4 Yes 24 1 1 Off 1 0 3 SYSTOOLSPACE
    0x00002B76FD124E00 19 SMS UsrTmp 4096 4 Yes 24 1 1 On 1 0 3 SYSTOOLSTMPSPACE

    Tablespace Statistics:
    Address Id TotalPgs UsablePgs UsedPgs PndFreePgs FreePgs HWM State MinRecTime NQuiescers
    0x00002B76FB06F800 0 24576 24572 16512 0 8060 16512 0x00000000 0 0
    0x00002B76FD110200 1 1 1 1 0 0 0 0x00000000 0 0
    0x00002B76FD114A60 2 8192 8160 2528 0 5632 4000 0x00000000 0 0
    0x00002B76FD115280 3 196608 196544 16544 0 180000 110048 0x00000000 0 0
    0x00002B76FD115C00 4 196608 196544 25568 0 170976 164032 0x00000000 0 0
    0x00002B76FD1165E0 5 131072 131008 608 0 130400 9408 0x00000000 0 0
    0x00002B76FD116FC0 6 131072 131008 96 0 130912 96 0x00000000 0 0
    0x00002B76FD1179A0 7 131072 131008 96 0 130912 96 0x00000000 0 0
    0x00002B76FD118380 8 131072 131008 96 0 130912 96 0x00000000 0 0
    0x00002B76FD118D60 9 131072 131008 96 0 130912 96 0x00000000 0 0
    0x00002B76FD119740 10 131072 131008 96 0 130912 96 0x00000000 0 0
    0x00002B76FD11A120 11 131072 131008 96 0 130912 96 0x00000000 0 0
    0x00002B76FD11AB00 12 131072 131008 96 0 130912 96 0x00000000 0 0
    0x00002B76FD11B4E0 13 131072 131008 96 0 130912 96 0x00000000 0 0
    0x00002B76FD11BEC0 14 131072 131008 96 0 130912 96 0x00000000 0 0
    0x00002B76FD11C8A0 15 131072 131008 96 0 130912 96 0x00000000 0 0
    0x00002B76FD11D280 16 1 1 1 0 0 0 0x00000000 0 0
    0x00002B76FD120080 17 1 1 1 0 0 0 0x00000000 0 0
    0x00002B76FD124760 18 8192 8188 184 0 8004 184 0x00000000 0 0
    0x00002B76FD124E00 19 1 1 1 0 0 0 0x00000000 0 0

    Tablespace Autoresize Statistics:
    Address Id AS AR InitSize IncSize IIP MaxSize LastResize LRF
    0x00002B76FB06F800 0 Yes Yes 33554432 -1 No None None No
    0x00002B76FD110200 1 Yes No 0 0 No 0 None No
    0x00002B76FD114A60 2 Yes Yes 33554432 -1 No None None No
    0x00002B76FD115280 3 No Yes 0 1073741824 No None None No
    0x00002B76FD115C00 4 No Yes 0 1073741824 No None None No
    0x00002B76FD1165E0 5 No Yes 0 1073741824 No None None No
    0x00002B76FD116FC0 6 No Yes 0 1073741824 No None None No
    0x00002B76FD1179A0 7 No Yes 0 1073741824 No None None No
    0x00002B76FD118380 8 No Yes 0 1073741824 No None None No
    0x00002B76FD118D60 9 No Yes 0 1073741824 No None None No
    0x00002B76FD119740 10 No Yes 0 1073741824 No None None No
    0x00002B76FD11A120 11 No Yes 0 1073741824 No None None No
    0x00002B76FD11AB00 12 No Yes 0 1073741824 No None None No
    0x00002B76FD11B4E0 13 No Yes 0 1073741824 No None None No
    0x00002B76FD11BEC0 14 No Yes 0 1073741824 No None None No
    0x00002B76FD11C8A0 15 No Yes 0 1073741824 No None None No
    0x00002B76FD11D280 16 No No 0 0 No 0 None No
    0x00002B76FD120080 17 No No 0 0 No 0 None No
    0x00002B76FD124760 18 Yes Yes 33554432 -1 No None None No
    0x00002B76FD124E00 19 Yes No 0 0 No 0 None No

    Containers:
    Address TspId ContainNum Type TotalPgs UseablePgs StripeSet Container
    0x00002B76FD110080 0 0 File 24576 24572 0 /home/db2inst2/db2inst2/NODE0000/PIMDB/T0000000/C0000000.CAT
    0x00002B76FD1108A0 1 0 Path 1 1 0 /home/db2inst2/db2inst2/NODE0000/PIMDB/T0000001/C0000000.TMP
    0x00002B76FD115100 2 0 File 8192 8160 0 /home/db2inst2/db2inst2/NODE0000/PIMDB/T0000002/C0000000.LRG
    0x00002B76FD115920 3 0 File 98304 98272 0 /home/db2inst2/PIMDB/USERS1
    0x00002B76FD115A78 3 1 File 98304 98272 0 /home/db2inst2/PIMDB/USERS2
    0x00002B76FD116300 4 0 File 98304 98272 0 /home/db2inst2/PIMDB/INDX1
    0x00002B76FD116458 4 1 File 98304 98272 0 /home/db2inst2/PIMDB/INDX2
    0x00002B76FD116CE0 5 0 File 65536 65504 0 /home/db2inst2/PIMDB/BLOB1
    0x00002B76FD116E38 5 1 File 65536 65504 0 /home/db2inst2/PIMDB/BLOB2
    0x00002B76FD1176C0 6 0 File 65536 65504 0 /home/db2inst2/PIMDB/ITA_DATA1
    0x00002B76FD117818 6 1 File 65536 65504 0 /home/db2inst2/PIMDB/ITA_DATA2
    0x00002B76FD1180A0 7 0 File 65536 65504 0 /home/db2inst2/PIMDB/ITM_DATA1
    0x00002B76FD1181F8 7 1 File 65536 65504 0 /home/db2inst2/PIMDB/ITM_DATA2
    0x00002B76FD118A80 8 0 File 65536 65504 0 /home/db2inst2/PIMDB/ITD_DATA1
    0x00002B76FD118BD8 8 1 File 65536 65504 0 /home/db2inst2/PIMDB/ITD_DATA2
    0x00002B76FD119460 9 0 File 65536 65504 0 /home/db2inst2/PIMDB/ICM_DATA1
    0x00002B76FD1195B8 9 1 File 65536 65504 0 /home/db2inst2/PIMDB/ICM_DATA2
    0x00002B76FD119E40 10 0 File 65536 65504 0 /home/db2inst2/PIMDB/LCK_DATA1
    0x00002B76FD119F98 10 1 File 65536 65504 0 /home/db2inst2/PIMDB/LCK_DATA2
    0x00002B76FD11A820 11 0 File 65536 65504 0 /home/db2inst2/PIMDB/ITA_IX1
    0x00002B76FD11A978 11 1 File 65536 65504 0 /home/db2inst2/PIMDB/ITA_IX2
    0x00002B76FD11B200 12 0 File 65536 65504 0 /home/db2inst2/PIMDB/ITM_IX1
    0x00002B76FD11B358 12 1 File 65536 65504 0 /home/db2inst2/PIMDB/ITM_IX2
    0x00002B76FD11BBE0 13 0 File 65536 65504 0 /home/db2inst2/PIMDB/ITD_IX1
    0x00002B76FD11BD38 13 1 File 65536 65504 0 /home/db2inst2/PIMDB/ITD_IX2
    0x00002B76FD11C5C0 14 0 File 65536 65504 0 /home/db2inst2/PIMDB/ICM_IX1
    0x00002B76FD11C718 14 1 File 65536 65504 0 /home/db2inst2/PIMDB/ICM_IX2
    0x00002B76FD11CFA0 15 0 File 65536 65504 0 /home/db2inst2/PIMDB/LCK_IX1
    0x00002B76FD11D0F8 15 1 File 65536 65504 0 /home/db2inst2/PIMDB/LCK_IX2
    0x00002B76FD11D920 16 0 Path 1 1 0 /home/db2inst2/PIMDB/usertemp
    0x00002B76FD11FAC0 17 0 Path 1 1 0 /home/db2inst2/PIMDB/systemtemp
    0x00002B76FD11FCA0 18 0 File 8192 8188 0 /home/db2inst2/db2inst2/NODE0000/PIMDB/T0000018/C0000000.LRG
    0x00002B76FD11FE20 19 0 Path 1 1 0 /home/db2inst2/db2inst2/NODE0000/PIMDB/T0000019/C0000000.UTM
  • jrmmaes
    jrmmaes
    7 Posts

    Re: db2relocatedb &#38; restore redirect: both fail while trying to access old inst

    ‏2009-09-29T14:20:26Z  
    You need to check if your tablespaces on source db are using automatic storage (AS) or not (non-AS). For AS tablespaces, you need to use the "ON" parameter on the restore command. For non-AS tablespaces, you need to use the redirect/set tablespace containers. It'd help if you post the exact steps you executed to perform a redirected restore and "db2pd -d <db name> -tablespaces" output
    Now I've tried with the restore ON:
    db2 restore db PIMDB on /home/db2inst7/

    Result:
    SQL2563W The restore process has completed successfully, but one or more
    table spaces from the backup were not restored.

    This did create a PIMDB-database, but the database isn't complete.
    The entire /home/db2inst_/PIMDB/ is missing.
  • db2girl_bella
    db2girl_bella
    20 Posts

    Re: db2relocatedb &#38; restore redirect: both fail while trying to access old inst

    ‏2009-09-29T14:26:32Z  
    • jrmmaes
    • ‏2009-09-29T14:11:59Z
    How can I find out if my tablespaces are using AS or non-AS?

    These are my restore-steps:
    As db2inst2-user (=instance of original db):
    > db2 backup db PIMDB
    then as root:
    then I copy the PIMDB.....001- file to the /home/db2inst7
    & I make user db2inst7 owner of the file (chown)
    And finally as db2inst7-user (= the destination-instance)
    > db2 restore db PIMDB redirect
    Result:
    SQL0970N The system attempted to write to a read-only file. SQLSTATE=55009
    Results of db2pd:

    Database Partition 0 -- Database PIMDB -- Active -- Up 0 days 17:05:25

    Tablespace Configuration:
    Address Id Type Content PageSz ExtentSz Auto Prefetch BufID BufIDDisk FSC NumCntrs MaxStripe LastConsecPg Name
    0x00002B76FB06F800 0 DMS Regular 4096 4 Yes 24 1 1 Off 1 0 3 SYSCATSPACE
    0x00002B76FD110200 1 SMS SysTmp 4096 32 Yes 192 1 1 On 1 0 31 TEMPSPACE1
    0x00002B76FD114A60 2 DMS Large 4096 32 Yes 192 1 1 Off 1 0 31 USERSPACE1
    0x00002B76FD115280 3 DMS Regular 16384 32 Yes 384 2 2 Off 2 0 31 USERS
    0x00002B76FD115C00 4 DMS Regular 16384 32 Yes 384 3 3 Off 2 0 31 INDX
    0x00002B76FD1165E0 5 DMS Regular 16384 32 Yes 384 4 4 Off 2 0 31 BLOB_TBL_DATA
    0x00002B76FD116FC0 6 DMS Regular 16384 32 Yes 384 5 5 Off 2 0 31 ITA_DATA
    0x00002B76FD1179A0 7 DMS Regular 16384 32 Yes 384 9 9 Off 2 0 31 ITM_DATA
    0x00002B76FD118380 8 DMS Regular 16384 32 Yes 384 7 7 Off 2 0 31 ITD_DATA
    0x00002B76FD118D60 9 DMS Regular 16384 32 Yes 384 11 11 Off 2 0 31 ICM_DATA
    0x00002B76FD119740 10 DMS Regular 16384 32 Yes 384 13 13 Off 2 0 31 LCK_DATA
    0x00002B76FD11A120 11 DMS Regular 16384 32 Yes 384 6 6 Off 2 0 31 ITA_IX
    0x00002B76FD11AB00 12 DMS Regular 16384 32 Yes 384 10 10 Off 2 0 31 ITM_IX
    0x00002B76FD11B4E0 13 DMS Regular 16384 32 Yes 384 8 8 Off 2 0 31 ITD_IX
    0x00002B76FD11BEC0 14 DMS Regular 16384 32 Yes 384 12 12 Off 2 0 31 ICM_IX
    0x00002B76FD11C8A0 15 DMS Regular 16384 32 Yes 384 14 14 Off 2 0 31 LCK_IX
    0x00002B76FD11D280 16 SMS UsrTmp 16384 32 Yes 192 15 15 On 1 0 31 TEMP_USER
    0x00002B76FD120080 17 SMS SysTmp 16384 32 Yes 192 16 16 On 1 0 31 TEMP_SYSTEM
    0x00002B76FD124760 18 DMS Large 4096 4 Yes 24 1 1 Off 1 0 3 SYSTOOLSPACE
    0x00002B76FD124E00 19 SMS UsrTmp 4096 4 Yes 24 1 1 On 1 0 3 SYSTOOLSTMPSPACE

    Tablespace Statistics:
    Address Id TotalPgs UsablePgs UsedPgs PndFreePgs FreePgs HWM State MinRecTime NQuiescers
    0x00002B76FB06F800 0 24576 24572 16512 0 8060 16512 0x00000000 0 0
    0x00002B76FD110200 1 1 1 1 0 0 0 0x00000000 0 0
    0x00002B76FD114A60 2 8192 8160 2528 0 5632 4000 0x00000000 0 0
    0x00002B76FD115280 3 196608 196544 16544 0 180000 110048 0x00000000 0 0
    0x00002B76FD115C00 4 196608 196544 25568 0 170976 164032 0x00000000 0 0
    0x00002B76FD1165E0 5 131072 131008 608 0 130400 9408 0x00000000 0 0
    0x00002B76FD116FC0 6 131072 131008 96 0 130912 96 0x00000000 0 0
    0x00002B76FD1179A0 7 131072 131008 96 0 130912 96 0x00000000 0 0
    0x00002B76FD118380 8 131072 131008 96 0 130912 96 0x00000000 0 0
    0x00002B76FD118D60 9 131072 131008 96 0 130912 96 0x00000000 0 0
    0x00002B76FD119740 10 131072 131008 96 0 130912 96 0x00000000 0 0
    0x00002B76FD11A120 11 131072 131008 96 0 130912 96 0x00000000 0 0
    0x00002B76FD11AB00 12 131072 131008 96 0 130912 96 0x00000000 0 0
    0x00002B76FD11B4E0 13 131072 131008 96 0 130912 96 0x00000000 0 0
    0x00002B76FD11BEC0 14 131072 131008 96 0 130912 96 0x00000000 0 0
    0x00002B76FD11C8A0 15 131072 131008 96 0 130912 96 0x00000000 0 0
    0x00002B76FD11D280 16 1 1 1 0 0 0 0x00000000 0 0
    0x00002B76FD120080 17 1 1 1 0 0 0 0x00000000 0 0
    0x00002B76FD124760 18 8192 8188 184 0 8004 184 0x00000000 0 0
    0x00002B76FD124E00 19 1 1 1 0 0 0 0x00000000 0 0

    Tablespace Autoresize Statistics:
    Address Id AS AR InitSize IncSize IIP MaxSize LastResize LRF
    0x00002B76FB06F800 0 Yes Yes 33554432 -1 No None None No
    0x00002B76FD110200 1 Yes No 0 0 No 0 None No
    0x00002B76FD114A60 2 Yes Yes 33554432 -1 No None None No
    0x00002B76FD115280 3 No Yes 0 1073741824 No None None No
    0x00002B76FD115C00 4 No Yes 0 1073741824 No None None No
    0x00002B76FD1165E0 5 No Yes 0 1073741824 No None None No
    0x00002B76FD116FC0 6 No Yes 0 1073741824 No None None No
    0x00002B76FD1179A0 7 No Yes 0 1073741824 No None None No
    0x00002B76FD118380 8 No Yes 0 1073741824 No None None No
    0x00002B76FD118D60 9 No Yes 0 1073741824 No None None No
    0x00002B76FD119740 10 No Yes 0 1073741824 No None None No
    0x00002B76FD11A120 11 No Yes 0 1073741824 No None None No
    0x00002B76FD11AB00 12 No Yes 0 1073741824 No None None No
    0x00002B76FD11B4E0 13 No Yes 0 1073741824 No None None No
    0x00002B76FD11BEC0 14 No Yes 0 1073741824 No None None No
    0x00002B76FD11C8A0 15 No Yes 0 1073741824 No None None No
    0x00002B76FD11D280 16 No No 0 0 No 0 None No
    0x00002B76FD120080 17 No No 0 0 No 0 None No
    0x00002B76FD124760 18 Yes Yes 33554432 -1 No None None No
    0x00002B76FD124E00 19 Yes No 0 0 No 0 None No

    Containers:
    Address TspId ContainNum Type TotalPgs UseablePgs StripeSet Container
    0x00002B76FD110080 0 0 File 24576 24572 0 /home/db2inst2/db2inst2/NODE0000/PIMDB/T0000000/C0000000.CAT
    0x00002B76FD1108A0 1 0 Path 1 1 0 /home/db2inst2/db2inst2/NODE0000/PIMDB/T0000001/C0000000.TMP
    0x00002B76FD115100 2 0 File 8192 8160 0 /home/db2inst2/db2inst2/NODE0000/PIMDB/T0000002/C0000000.LRG
    0x00002B76FD115920 3 0 File 98304 98272 0 /home/db2inst2/PIMDB/USERS1
    0x00002B76FD115A78 3 1 File 98304 98272 0 /home/db2inst2/PIMDB/USERS2
    0x00002B76FD116300 4 0 File 98304 98272 0 /home/db2inst2/PIMDB/INDX1
    0x00002B76FD116458 4 1 File 98304 98272 0 /home/db2inst2/PIMDB/INDX2
    0x00002B76FD116CE0 5 0 File 65536 65504 0 /home/db2inst2/PIMDB/BLOB1
    0x00002B76FD116E38 5 1 File 65536 65504 0 /home/db2inst2/PIMDB/BLOB2
    0x00002B76FD1176C0 6 0 File 65536 65504 0 /home/db2inst2/PIMDB/ITA_DATA1
    0x00002B76FD117818 6 1 File 65536 65504 0 /home/db2inst2/PIMDB/ITA_DATA2
    0x00002B76FD1180A0 7 0 File 65536 65504 0 /home/db2inst2/PIMDB/ITM_DATA1
    0x00002B76FD1181F8 7 1 File 65536 65504 0 /home/db2inst2/PIMDB/ITM_DATA2
    0x00002B76FD118A80 8 0 File 65536 65504 0 /home/db2inst2/PIMDB/ITD_DATA1
    0x00002B76FD118BD8 8 1 File 65536 65504 0 /home/db2inst2/PIMDB/ITD_DATA2
    0x00002B76FD119460 9 0 File 65536 65504 0 /home/db2inst2/PIMDB/ICM_DATA1
    0x00002B76FD1195B8 9 1 File 65536 65504 0 /home/db2inst2/PIMDB/ICM_DATA2
    0x00002B76FD119E40 10 0 File 65536 65504 0 /home/db2inst2/PIMDB/LCK_DATA1
    0x00002B76FD119F98 10 1 File 65536 65504 0 /home/db2inst2/PIMDB/LCK_DATA2
    0x00002B76FD11A820 11 0 File 65536 65504 0 /home/db2inst2/PIMDB/ITA_IX1
    0x00002B76FD11A978 11 1 File 65536 65504 0 /home/db2inst2/PIMDB/ITA_IX2
    0x00002B76FD11B200 12 0 File 65536 65504 0 /home/db2inst2/PIMDB/ITM_IX1
    0x00002B76FD11B358 12 1 File 65536 65504 0 /home/db2inst2/PIMDB/ITM_IX2
    0x00002B76FD11BBE0 13 0 File 65536 65504 0 /home/db2inst2/PIMDB/ITD_IX1
    0x00002B76FD11BD38 13 1 File 65536 65504 0 /home/db2inst2/PIMDB/ITD_IX2
    0x00002B76FD11C5C0 14 0 File 65536 65504 0 /home/db2inst2/PIMDB/ICM_IX1
    0x00002B76FD11C718 14 1 File 65536 65504 0 /home/db2inst2/PIMDB/ICM_IX2
    0x00002B76FD11CFA0 15 0 File 65536 65504 0 /home/db2inst2/PIMDB/LCK_IX1
    0x00002B76FD11D0F8 15 1 File 65536 65504 0 /home/db2inst2/PIMDB/LCK_IX2
    0x00002B76FD11D920 16 0 Path 1 1 0 /home/db2inst2/PIMDB/usertemp
    0x00002B76FD11FAC0 17 0 Path 1 1 0 /home/db2inst2/PIMDB/systemtemp
    0x00002B76FD11FCA0 18 0 File 8192 8188 0 /home/db2inst2/db2inst2/NODE0000/PIMDB/T0000018/C0000000.LRG
    0x00002B76FD11FE20 19 0 Path 1 1 0 /home/db2inst2/db2inst2/NODE0000/PIMDB/T0000019/C0000000.UTM
    You have a combination of AS (automatic storage) and non-AS (non automatic storage) tablespaces. Here is how you can tell if a tablespace is AS or non-AS (I'll cut/paste some info from your db2pd output):

    Tablespace Autoresize Statistics:
    Address Id AS AR InitSize IncSize IIP MaxSize LastResize LRF
    0x00002B76FB06F800 0 Yes Yes 33554432 -1 No None None No
    0x00002B76FD110200 1 Yes No 0 0 No 0 None No
    0x00002B76FD114A60 2 Yes Yes 33554432 -1 No None None No
    0x00002B76FD115280 3 No Yes 0 1073741824 No None None No
    0x00002B76FD115C00 4 No Yes 0 1073741824 No None None No
    0x00002B76FD1165E0 5 No Yes 0 1073741824 No None None No
    0x00002B76FD116FC0 6 No Yes 0 1073741824 No None None No
    0x00002B76FD1179A0 7 No Yes 0 1073741824 No None None No
    0x00002B76FD118380 8 No Yes 0 1073741824 No None None No
    ....

    Tablespace IDs 0-2 are using AS (column AS has "Yes") and tablespace IDs 3-8 are using non-AS (column AS has "No"). When you have a combination of AS and non-AS tablespaces, you have to use both parameters ("ON" and "redirect") on the restore command. For example:

    db2 restore db PIMDB on /home/db2inst7 redirect
    set containers for non-AS
    ... restore continue
  • jrmmaes
    jrmmaes
    7 Posts

    Re: db2relocatedb &#38; restore redirect: both fail while trying to access old inst

    ‏2009-09-29T14:32:46Z  
    • jrmmaes
    • ‏2009-09-29T14:11:59Z
    How can I find out if my tablespaces are using AS or non-AS?

    These are my restore-steps:
    As db2inst2-user (=instance of original db):
    > db2 backup db PIMDB
    then as root:
    then I copy the PIMDB.....001- file to the /home/db2inst7
    & I make user db2inst7 owner of the file (chown)
    And finally as db2inst7-user (= the destination-instance)
    > db2 restore db PIMDB redirect
    Result:
    SQL0970N The system attempted to write to a read-only file. SQLSTATE=55009
    Results of db2pd:

    Database Partition 0 -- Database PIMDB -- Active -- Up 0 days 17:05:25

    Tablespace Configuration:
    Address Id Type Content PageSz ExtentSz Auto Prefetch BufID BufIDDisk FSC NumCntrs MaxStripe LastConsecPg Name
    0x00002B76FB06F800 0 DMS Regular 4096 4 Yes 24 1 1 Off 1 0 3 SYSCATSPACE
    0x00002B76FD110200 1 SMS SysTmp 4096 32 Yes 192 1 1 On 1 0 31 TEMPSPACE1
    0x00002B76FD114A60 2 DMS Large 4096 32 Yes 192 1 1 Off 1 0 31 USERSPACE1
    0x00002B76FD115280 3 DMS Regular 16384 32 Yes 384 2 2 Off 2 0 31 USERS
    0x00002B76FD115C00 4 DMS Regular 16384 32 Yes 384 3 3 Off 2 0 31 INDX
    0x00002B76FD1165E0 5 DMS Regular 16384 32 Yes 384 4 4 Off 2 0 31 BLOB_TBL_DATA
    0x00002B76FD116FC0 6 DMS Regular 16384 32 Yes 384 5 5 Off 2 0 31 ITA_DATA
    0x00002B76FD1179A0 7 DMS Regular 16384 32 Yes 384 9 9 Off 2 0 31 ITM_DATA
    0x00002B76FD118380 8 DMS Regular 16384 32 Yes 384 7 7 Off 2 0 31 ITD_DATA
    0x00002B76FD118D60 9 DMS Regular 16384 32 Yes 384 11 11 Off 2 0 31 ICM_DATA
    0x00002B76FD119740 10 DMS Regular 16384 32 Yes 384 13 13 Off 2 0 31 LCK_DATA
    0x00002B76FD11A120 11 DMS Regular 16384 32 Yes 384 6 6 Off 2 0 31 ITA_IX
    0x00002B76FD11AB00 12 DMS Regular 16384 32 Yes 384 10 10 Off 2 0 31 ITM_IX
    0x00002B76FD11B4E0 13 DMS Regular 16384 32 Yes 384 8 8 Off 2 0 31 ITD_IX
    0x00002B76FD11BEC0 14 DMS Regular 16384 32 Yes 384 12 12 Off 2 0 31 ICM_IX
    0x00002B76FD11C8A0 15 DMS Regular 16384 32 Yes 384 14 14 Off 2 0 31 LCK_IX
    0x00002B76FD11D280 16 SMS UsrTmp 16384 32 Yes 192 15 15 On 1 0 31 TEMP_USER
    0x00002B76FD120080 17 SMS SysTmp 16384 32 Yes 192 16 16 On 1 0 31 TEMP_SYSTEM
    0x00002B76FD124760 18 DMS Large 4096 4 Yes 24 1 1 Off 1 0 3 SYSTOOLSPACE
    0x00002B76FD124E00 19 SMS UsrTmp 4096 4 Yes 24 1 1 On 1 0 3 SYSTOOLSTMPSPACE

    Tablespace Statistics:
    Address Id TotalPgs UsablePgs UsedPgs PndFreePgs FreePgs HWM State MinRecTime NQuiescers
    0x00002B76FB06F800 0 24576 24572 16512 0 8060 16512 0x00000000 0 0
    0x00002B76FD110200 1 1 1 1 0 0 0 0x00000000 0 0
    0x00002B76FD114A60 2 8192 8160 2528 0 5632 4000 0x00000000 0 0
    0x00002B76FD115280 3 196608 196544 16544 0 180000 110048 0x00000000 0 0
    0x00002B76FD115C00 4 196608 196544 25568 0 170976 164032 0x00000000 0 0
    0x00002B76FD1165E0 5 131072 131008 608 0 130400 9408 0x00000000 0 0
    0x00002B76FD116FC0 6 131072 131008 96 0 130912 96 0x00000000 0 0
    0x00002B76FD1179A0 7 131072 131008 96 0 130912 96 0x00000000 0 0
    0x00002B76FD118380 8 131072 131008 96 0 130912 96 0x00000000 0 0
    0x00002B76FD118D60 9 131072 131008 96 0 130912 96 0x00000000 0 0
    0x00002B76FD119740 10 131072 131008 96 0 130912 96 0x00000000 0 0
    0x00002B76FD11A120 11 131072 131008 96 0 130912 96 0x00000000 0 0
    0x00002B76FD11AB00 12 131072 131008 96 0 130912 96 0x00000000 0 0
    0x00002B76FD11B4E0 13 131072 131008 96 0 130912 96 0x00000000 0 0
    0x00002B76FD11BEC0 14 131072 131008 96 0 130912 96 0x00000000 0 0
    0x00002B76FD11C8A0 15 131072 131008 96 0 130912 96 0x00000000 0 0
    0x00002B76FD11D280 16 1 1 1 0 0 0 0x00000000 0 0
    0x00002B76FD120080 17 1 1 1 0 0 0 0x00000000 0 0
    0x00002B76FD124760 18 8192 8188 184 0 8004 184 0x00000000 0 0
    0x00002B76FD124E00 19 1 1 1 0 0 0 0x00000000 0 0

    Tablespace Autoresize Statistics:
    Address Id AS AR InitSize IncSize IIP MaxSize LastResize LRF
    0x00002B76FB06F800 0 Yes Yes 33554432 -1 No None None No
    0x00002B76FD110200 1 Yes No 0 0 No 0 None No
    0x00002B76FD114A60 2 Yes Yes 33554432 -1 No None None No
    0x00002B76FD115280 3 No Yes 0 1073741824 No None None No
    0x00002B76FD115C00 4 No Yes 0 1073741824 No None None No
    0x00002B76FD1165E0 5 No Yes 0 1073741824 No None None No
    0x00002B76FD116FC0 6 No Yes 0 1073741824 No None None No
    0x00002B76FD1179A0 7 No Yes 0 1073741824 No None None No
    0x00002B76FD118380 8 No Yes 0 1073741824 No None None No
    0x00002B76FD118D60 9 No Yes 0 1073741824 No None None No
    0x00002B76FD119740 10 No Yes 0 1073741824 No None None No
    0x00002B76FD11A120 11 No Yes 0 1073741824 No None None No
    0x00002B76FD11AB00 12 No Yes 0 1073741824 No None None No
    0x00002B76FD11B4E0 13 No Yes 0 1073741824 No None None No
    0x00002B76FD11BEC0 14 No Yes 0 1073741824 No None None No
    0x00002B76FD11C8A0 15 No Yes 0 1073741824 No None None No
    0x00002B76FD11D280 16 No No 0 0 No 0 None No
    0x00002B76FD120080 17 No No 0 0 No 0 None No
    0x00002B76FD124760 18 Yes Yes 33554432 -1 No None None No
    0x00002B76FD124E00 19 Yes No 0 0 No 0 None No

    Containers:
    Address TspId ContainNum Type TotalPgs UseablePgs StripeSet Container
    0x00002B76FD110080 0 0 File 24576 24572 0 /home/db2inst2/db2inst2/NODE0000/PIMDB/T0000000/C0000000.CAT
    0x00002B76FD1108A0 1 0 Path 1 1 0 /home/db2inst2/db2inst2/NODE0000/PIMDB/T0000001/C0000000.TMP
    0x00002B76FD115100 2 0 File 8192 8160 0 /home/db2inst2/db2inst2/NODE0000/PIMDB/T0000002/C0000000.LRG
    0x00002B76FD115920 3 0 File 98304 98272 0 /home/db2inst2/PIMDB/USERS1
    0x00002B76FD115A78 3 1 File 98304 98272 0 /home/db2inst2/PIMDB/USERS2
    0x00002B76FD116300 4 0 File 98304 98272 0 /home/db2inst2/PIMDB/INDX1
    0x00002B76FD116458 4 1 File 98304 98272 0 /home/db2inst2/PIMDB/INDX2
    0x00002B76FD116CE0 5 0 File 65536 65504 0 /home/db2inst2/PIMDB/BLOB1
    0x00002B76FD116E38 5 1 File 65536 65504 0 /home/db2inst2/PIMDB/BLOB2
    0x00002B76FD1176C0 6 0 File 65536 65504 0 /home/db2inst2/PIMDB/ITA_DATA1
    0x00002B76FD117818 6 1 File 65536 65504 0 /home/db2inst2/PIMDB/ITA_DATA2
    0x00002B76FD1180A0 7 0 File 65536 65504 0 /home/db2inst2/PIMDB/ITM_DATA1
    0x00002B76FD1181F8 7 1 File 65536 65504 0 /home/db2inst2/PIMDB/ITM_DATA2
    0x00002B76FD118A80 8 0 File 65536 65504 0 /home/db2inst2/PIMDB/ITD_DATA1
    0x00002B76FD118BD8 8 1 File 65536 65504 0 /home/db2inst2/PIMDB/ITD_DATA2
    0x00002B76FD119460 9 0 File 65536 65504 0 /home/db2inst2/PIMDB/ICM_DATA1
    0x00002B76FD1195B8 9 1 File 65536 65504 0 /home/db2inst2/PIMDB/ICM_DATA2
    0x00002B76FD119E40 10 0 File 65536 65504 0 /home/db2inst2/PIMDB/LCK_DATA1
    0x00002B76FD119F98 10 1 File 65536 65504 0 /home/db2inst2/PIMDB/LCK_DATA2
    0x00002B76FD11A820 11 0 File 65536 65504 0 /home/db2inst2/PIMDB/ITA_IX1
    0x00002B76FD11A978 11 1 File 65536 65504 0 /home/db2inst2/PIMDB/ITA_IX2
    0x00002B76FD11B200 12 0 File 65536 65504 0 /home/db2inst2/PIMDB/ITM_IX1
    0x00002B76FD11B358 12 1 File 65536 65504 0 /home/db2inst2/PIMDB/ITM_IX2
    0x00002B76FD11BBE0 13 0 File 65536 65504 0 /home/db2inst2/PIMDB/ITD_IX1
    0x00002B76FD11BD38 13 1 File 65536 65504 0 /home/db2inst2/PIMDB/ITD_IX2
    0x00002B76FD11C5C0 14 0 File 65536 65504 0 /home/db2inst2/PIMDB/ICM_IX1
    0x00002B76FD11C718 14 1 File 65536 65504 0 /home/db2inst2/PIMDB/ICM_IX2
    0x00002B76FD11CFA0 15 0 File 65536 65504 0 /home/db2inst2/PIMDB/LCK_IX1
    0x00002B76FD11D0F8 15 1 File 65536 65504 0 /home/db2inst2/PIMDB/LCK_IX2
    0x00002B76FD11D920 16 0 Path 1 1 0 /home/db2inst2/PIMDB/usertemp
    0x00002B76FD11FAC0 17 0 Path 1 1 0 /home/db2inst2/PIMDB/systemtemp
    0x00002B76FD11FCA0 18 0 File 8192 8188 0 /home/db2inst2/db2inst2/NODE0000/PIMDB/T0000018/C0000000.LRG
    0x00002B76FD11FE20 19 0 Path 1 1 0 /home/db2inst2/db2inst2/NODE0000/PIMDB/T0000019/C0000000.UTM
    Thanks a lot for the information.
    I will try it first thing tomorrow and let you know if it worked.
  • SystemAdmin
    SystemAdmin
    17917 Posts

    Re: db2relocatedb &#38; restore redirect: both fail while trying to access old inst

    ‏2009-09-30T03:55:12Z  
    • jrmmaes
    • ‏2009-09-29T14:32:46Z
    Thanks a lot for the information.
    I will try it first thing tomorrow and let you know if it worked.
    hi

    it looks like you have not list
    old_dbname,new_dbname
    old_inst_name,new_inst_name
    old_dbpath,new_dbpath
    in your db2relocate.conf file

    So after your relocate ,db2 try to access old automatic storage container.
    thx
  • jrmmaes
    jrmmaes
    7 Posts

    Re: db2relocatedb &#38; restore redirect: both fail while trying to access old inst

    ‏2009-09-30T11:55:09Z  
    You have a combination of AS (automatic storage) and non-AS (non automatic storage) tablespaces. Here is how you can tell if a tablespace is AS or non-AS (I'll cut/paste some info from your db2pd output):

    Tablespace Autoresize Statistics:
    Address Id AS AR InitSize IncSize IIP MaxSize LastResize LRF
    0x00002B76FB06F800 0 Yes Yes 33554432 -1 No None None No
    0x00002B76FD110200 1 Yes No 0 0 No 0 None No
    0x00002B76FD114A60 2 Yes Yes 33554432 -1 No None None No
    0x00002B76FD115280 3 No Yes 0 1073741824 No None None No
    0x00002B76FD115C00 4 No Yes 0 1073741824 No None None No
    0x00002B76FD1165E0 5 No Yes 0 1073741824 No None None No
    0x00002B76FD116FC0 6 No Yes 0 1073741824 No None None No
    0x00002B76FD1179A0 7 No Yes 0 1073741824 No None None No
    0x00002B76FD118380 8 No Yes 0 1073741824 No None None No
    ....

    Tablespace IDs 0-2 are using AS (column AS has "Yes") and tablespace IDs 3-8 are using non-AS (column AS has "No"). When you have a combination of AS and non-AS tablespaces, you have to use both parameters ("ON" and "redirect") on the restore command. For example:

    db2 restore db PIMDB on /home/db2inst7 redirect
    set containers for non-AS
    ... restore continue
    I've tried it this morning with both on and redirect and now the restore works!!!

    Thanks for your help!