create tablespace problem in db2 HADR environment - db2

We have Db2 10.5.0.7 on centos 6.9 and TSAMP 3.2 as our high availability solution, when we create a tablespace in primary database we encounter the following errors in the standby:
2019-08-31-08.47.32.164952+270 I87056E2779 LEVEL: Error (OS)
PID : 4046 TID : 47669095425792 PROC : db2sysc 0
INSTANCE: db2inst1 NODE : 000 DB : SAMDB
APPHDL : 0-8 APPID: *LOCAL.DB2.190725231126
HOSTNAME: samdb-b EDUID : 155 EDUNAME: db2redom
(SAMDB) 0 FUNCTION: DB2 Common, OSSe, ossGetDiskInfo, probe:130
MESSAGE : ECF=0x90000001=-1879048191=ECF_ACCESS_DENIED
Access denied CALLED : OS, -, fopen OSERR: EACCES (13) DATA #1 : String, 12 bytes /proc/mounts DATA #2 :
String, 25 bytes /dbdata1/samdbTsContainer DATA #3 : unsigned integer,
8 bytes
2019-08-31-08.47.32.185625+270 E89836E494 LEVEL: Error PID
: 4046 TID : 47669095425792 PROC : db2sysc 0
INSTANCE: db2inst1 NODE : 000 DB : SAMDB
APPHDL : 0-8 APPID: *LOCAL.DB2.190725231126
HOSTNAME: samdb-b EDUID : 155 EDUNAME: db2redom
(SAMDB) 0 FUNCTION: DB2 UDB, high avail services,
sqlhaGetLocalDiskInfo, probe:9433 MESSAGE :
ECF=0x90000001=-1879048191=ECF_ACCESS_DENIED
Access denied
2019-08-31-08.47.32.186258+270 E90331E484 LEVEL: Error PID
: 4046 TID : 47669095425792 PROC : db2sysc 0
INSTANCE: db2inst1 NODE : 000 DB : SAMDB
APPHDL : 0-8 APPID: *LOCAL.DB2.190725231126
HOSTNAME: samdb-b EDUID : 155 EDUNAME: db2redom
(SAMDB) 0 FUNCTION: DB2 UDB, high avail services, sqlhaCreateMount,
probe:9746 RETCODE : ZRC=0x827300AA=-2106392406=HA_ZRC_FAILED "SQLHA
API call error"
2019-08-31-08.47.32.186910+270 I90816E658 LEVEL: Error PID
: 4046 TID : 47669095425792 PROC : db2sysc 0
INSTANCE: db2inst1 NODE : 000 DB : SAMDB
APPHDL : 0-8 APPID: *LOCAL.DB2.190725231126
HOSTNAME: samdb-b EDUID : 155 EDUNAME: db2redom
(SAMDB) 0 FUNCTION: DB2 UDB, buffer pool services,
sqlbDMSAddContainerRequest, probe:812 MESSAGE :
ZRC=0x827300AA=-2106392406=HA_ZRC_FAILED "SQLHA API call error" DATA
: String, 36 bytes Cluster add mount operation failed: DATA #2 : String, 37 bytes /dbdata1/samdbTsContainer/TSPKGCACH.1 DATA #3 :
String, 8 bytes SAMDB
2019-08-31-08.47.32.190537+270 E113909E951 LEVEL: Error PID
: 4046 TID : 47669095425792 PROC : db2sysc 0
INSTANCE: db2inst1 NODE : 000 DB : SAMDB
APPHDL : 0-8 APPID: *LOCAL.DB2.190725231126
HOSTNAME: samdb-b EDUID : 155 EDUNAME: db2redom
(SAMDB) 0 FUNCTION: DB2 UDB, buffer pool services,
sqlblog_reCreatePool, probe:3134 MESSAGE : ADM6106E Table space
"TSPKGCACH" (ID = "49") could not be created
during the rollforward operation. The most likely cause is that there
is not enough space to create the containers associated with the
table space. Connect to the database after the rollforward operation
completes and use the SET TABLESPACE CONTAINERS command to assign
containers to the table space. Then, issue another ROLLFORWARD
DATABASE command to complete recovery of this table space.
2019-08-31-08.47.32.200949+270 E114861E592 LEVEL: Error PID
: 4046 TID : 47669095425792 PROC : db2sysc 0
INSTANCE: db2inst1 NODE : 000 DB : SAMDB
APPHDL : 0-8 APPID: *LOCAL.DB2.190725231126
HOSTNAME: samdb-b EDUID : 155 EDUNAME: db2redom
(SAMDB) 0 FUNCTION: DB2 UDB, buffer pool services, sqlbIncPoolState,
probe:4628 MESSAGE : ADM12512W Log replay on the HADR standby has
stopped on table space
"TSPKGCACH" (ID "49") because it has been put into "ROLLFORWARD
PENDING" state.
There is free space available for the database and the specified path (/dbdata1/samdbTsContainer) exists on the server and we can create file manually on it .
all settings are equivalent on the primary and standby. db2inst1 is the owner of /dbdata1/samdbTsContainer and permission is drwxr-xr-x, the result of su - db2inst1 “ulimit -Hf” is unlimited and ext3 is file system type and create tablespace statement is as follows:
CREATE LARGE TABLESPACE TSPKGCACH IN DATABASE PARTITION GROUP IBMDEFAULTGROUP PAGESIZE 8 K MANAGED BY DATABASE USING (FILE '/dbdata1/samdbTsContainer/TSPKGCACH.1' 5120) ON DBPARTITIONNUM (0) EXTENTSIZE 64 PREFETCHSIZE 64 BUFFERPOOL BP8KPKGCACH OVERHEAD 10.5 TRANSFERRATE 0.14 DATA TAG NONE NO FILE SYSTEM CACHING;
SELinux is disabled and the sector size is 512 bytes. The mount options are as follws:
/dev/sdf1 /dbdata1 ext3 rw,relatime,errors=continue,barrier=1,data=ordered 0 0
We can not recreate the problem sometimes this problem occur and we don't know the reason of it, but the problem remains until server reboot.
When we restart the standby server problem solves but we need to drop the tablespace and recreate it, is there any idea for this problem?

From the error it looks to me that problem is not with the file access itself but rather /proc/mounts, which Db2 uses to do the mapping between containers and filesystems (to know e.g. the FS type). Hence I suggest to test whether all:
cat /proc/mounts
cat /proc/self/mounts
mount
work OK run as Db2 instance owner ID (db2inst1). If not, this implies some odd OS issue that Db2 is a victim of and we would need more OS diagnostics (e.g strace from the cat /proc/mounts command) to understand it.
Edit:
To confirm this theory I've run a quick test with Db2 11.1. Note this must be TSA-controlled environment for Db2 to follow sqlhaCreateMount code path (because if this will be a separate mount, Db2 will add it to the TSA resource model)
On both primary and standby:
mkdir /db2data
chown db2v111:db2iadm /db2data
then on standby:
chmod o-rx /proc
(couldn't find a "smarter" way to hit EACCES on mount info).
When I will run on primary:
db2 "create tablespace test managed by database using (file '/db2data/testts' 100 M)"
it completes fine on primary but standby hits exactly the error you are seeing:
2019-06-21-03.00.37.087693+120 I1774E2661 LEVEL: Error (OS)
PID : 10379 TID : 46912992438016 PROC : db2sysc 0
INSTANCE: db2v111 NODE : 000 DB : SAMPLE
APPHDL : 0-4492 APPID: *LOCAL.DB2.190621005919
HOSTNAME: rhel-hadrs.kkuduk.com
EDUID : 61 EDUNAME: db2redom (SAMPLE) 0
FUNCTION: DB2 Common, OSSe, ossGetDiskInfo, probe:130
MESSAGE : ECF=0x90000001=-1879048191=ECF_ACCESS_DENIED
Access denied
CALLED : OS, -, fopen OSERR: EACCES (13)
DATA #1 : String, 12 bytes
/proc/mounts
DATA #2 : String, 8 bytes
/db2data
DATA #3 : unsigned integer, 8 bytes
1
CALLSTCK: (Static functions may not be resolved correctly, as they are resolved to the nearest symbol)
[0] 0x00002AAAB9CFD84B /home/db2v111/sqllib/lib64/libdb2osse.so.1 + 0x23F84B
[1] 0x00002AAAB9CFED51 ossLogSysRC + 0x101
[2] 0x00002AAAB9D19647 ossGetDiskInfo + 0xF07
[3] 0x00002AAAAC52402C _Z21sqlhaGetLocalDiskInfoPKcjPcjS1_jS1_ + 0x26C
[4] 0x00002AAAAC523C5F _Z16sqlhaGetDiskInfoPKcS0_jPcjS1_jS1_ + 0x29F
[5] 0x00002AAAAC521CA0 _Z16sqlhaCreateMountPKcS0_m + 0x350
[6] 0x00002AAAACDE8D5D _Z26sqlbDMSAddContainerRequestP12SQLB_POOL_CBP16SQLB_POOLCONT_CBP12SQLB_GLOBALSP14SQLB_pfParIoCbbm + 0x90D
[7] 0x00002AAAACE14FF9 _Z29sqlbDoDMSAddContainerRequestsP12SQLB_POOL_CBP16SQLB_POOLCONT_CBjP26SQLB_AS_CONT_AND_PATH_INFOP12SQLB_GLOBALS + 0x2D9
[8] 0x00002AAAACE0C20F _Z17sqlbDMSCreatePoolP12SQLB_POOL_CBiP16SQLB_POOLCONT_CBbP12SQLB_GLOBALS + 0x103F
[9] 0x00002AAAACDB1EAC _Z13sqlbSetupPoolP12SQLB_GLOBALSP12SQLB_POOL_CBPKciiiihiP19SQLB_CONTAINER_SPECllblsib + 0xE4C
-> it is an issue with /proc/mounts access, not the target path itself, where i can write with no issues:
[db2v111#rhel-hadrs ~]$ echo "test" > /db2data/testfile
If that would be path access issue:
chmod o+rx /proc
chmod a-rw /db2data
then an error during the "CREATE TABLESPACE" redo on standby will be different:
2019-06-21-03.07.29.175486+120 I35023E592 LEVEL: Error
PID : 10379 TID : 46912992438016 PROC : db2sysc 0
INSTANCE: db2v111 NODE : 000 DB : SAMPLE
APPHDL : 0-4492 APPID: *LOCAL.DB2.190621005919
HOSTNAME: rhel-hadrs.kkuduk.com
EDUID : 61 EDUNAME: db2redom (SAMPLE) 0
FUNCTION: DB2 UDB, buffer pool services, sqlbCreateAndLockParent, probe:918
MESSAGE : ZRC=0x8402001E=-2080243682=SQLB_CONTAINER_NOT_ACCESSIBLE
"Container not accessible"
DATA #1 : <preformatted>
Failed at directory /db2data.
2019-06-21-03.07.29.175799+120 I35616E619 LEVEL: Severe
PID : 10379 TID : 46912992438016 PROC : db2sysc 0
INSTANCE: db2v111 NODE : 000 DB : SAMPLE
APPHDL : 0-4492 APPID: *LOCAL.DB2.190621005919
HOSTNAME: rhel-hadrs.kkuduk.com
EDUID : 61 EDUNAME: db2redom (SAMPLE) 0
FUNCTION: DB2 UDB, buffer pool services, sqlbCreateAndLockParent, probe:722
MESSAGE : ZRC=0x8402001E=-2080243682=SQLB_CONTAINER_NOT_ACCESSIBLE
"Container not accessible"
DATA #1 : <preformatted>
Failed to create a portion of the path /db2data/testts2
(few more errors follow pointing directly to the permissions on /db2data)
This proves it is the /proc access issue and you need to debug it with your OS team. Perhaps /proc gets completely unmounted?
In any case, the actual issue is db2sysc process hitting EACCES running fopen on /proc/mounts and you need debug it further with OS team.
Edit:
When it comes to the debugging and proving the error is returned by the OS, we would have to trace open() syscalls done by Db2. Strace can do that, but overhead is too high for a production system. If you can get SystemTap installed on the system, I suggest a script like this (this is a basic version):
probe nd_syscall.open.return
{
if ( user_string( #entry( pointer_arg(1) ) ) =~ ".*mounts")
{
printf("exec: %s pid: %d uid: %d (euid: %d) gid: %d (egid: %d) run open(%s) rc: %d\n", execname(), pid(), uid(), euid(), gid(), egid(), user_string(#entry(pointer_arg(1)), "-"), returnval() )
}
}
it uses nd_syscall probe, so it will work even without kernel debuginfo package. You can run it like this:
$ stap open.stap
exec: cat pid: 24159 uid: 0 (euid: 0) gid: 0 (egid: 0) run open(/proc/mounts) rc: 3
exec: cat pid: 24210 uid: 0 (euid: 0) gid: 0 (egid: 0) run open(/proc/mounts) rc: 3
exec: cat pid: 24669 uid: 1111 (euid: 1111) gid: 1001 (egid: 1001) run open(/proc/mounts) rc: 3
exec: cat pid: 24734 uid: 1111 (euid: 1111) gid: 1001 (egid: 1001) run open(/proc/mounts) rc: -13
exec: cat pid: 24891 uid: 1111 (euid: 1111) gid: 1001 (egid: 1001) run open(/proc/self/mounts) rc: -13
exec: ls pid: 24971 uid: 1111 (euid: 1111) gid: 1001 (egid: 1001) run open(/proc/mounts) rc: -13
-> at some point I've revoked access from /proc and open attempt failed with -13 (EACCES). You just need to enable it on the system when you see the error and see if something is logged when Db2 fails.

Related

How to read table data row by row of postgres db using shell script

How to read table data row by row of postgres db using shell script.
I tried out this:
psql -d db_name -t -c "SELECT * FROM table_name" | while read -a Record ; do
echo $Record[0]
echo $Record[1]
done
but this apporach is giving me data like:
Apple
|
Why this | is coming when I'm fetching row data only.
Actually I want to create json objects out of a db table data.
in the format:
column-name : value,
column-name : value
..... ;
Something like that
Table name -> student
Fields :
id : string
name : string
age : int
inSchool : boolean
Table data :
ID Name Age inSchool
1 Amit 18 Yes
2 Sunil 21 No
3 Anil 17 Yes
The output i want :
[
{
id : 1,
name : Amit,
age : 18,
inSchool : 1;
},
{
id : 2,
name : Sunil,
age : 21,
inSchool : 0;
},
{
id : 3,
name : Anil,
age : 17,
inSchool : 1;
}
]
If there's is any good way, please help me.
Let Postgres do the aggregation and spool the output into file after turning off header formatting:
postgres=> \t
Tuples only is on.
postgres=> \o data.json
postgres=> select jsonb_agg(to_jsonb(s)) from student s;
Or in a single line:
psql -d db_name -t -c "select jsonb_agg(to_jsonb(s)) from student s" -o data.json
After that, the file data.json will contain the entire table as a huge JSON array.

Rails PG::InvalidTextRepresentation - ERROR: invalid input syntax for type uuid

We are migrating Rails application from MySql to Postgres. Generally, the application is loading fine.
I get the following issue if I try to update a record using update_column:
irb> parent.id
=> #<UUID:0x3fd2c1a61cf0 UUID:F2CABB99AAB84BEB8C64AD23AAC775C0>
irb> child.update_column(:parent_id, parent.id)
PG::InvalidTextRepresentation - ERROR: invalid input syntax for type uuid: "--- !ruby/object:UUIDTools::UUID
time_low: 856850911
time_mid: 49931
time_hi_and_version: 17649
clock_seq_hi_and_reserved: 165
clock_seq_low: 247
nodes:
- 179
- 116
- 149
- 190
- 190
- 157
"
LINE 1: UPDATE "children" SET "parent_id" = '--- !ruby/ob...
^
It's actually dumping the UUID YAML in resulting SQL instead of the string representation of UUID.
However, it works fine if I assign attribute and then save:
irb> child.parent_id = parent.id
irb> parent.save
=> true
Since we already have used update_column in many places in the application so we can't change it to assign and save.
rails 4.2.7.1 pg 0.21.0 activeuuid 0.6.1

Unable to restore the Db2 backup

I am unable to restore the Db2 backup. Getting error while executing the following line
DB2 Version : 9.7, AIX Version 5.3
rollforward db VATAMC2 stop
SQL0752N Connecting to a database is not permitted within a logical unit of
work when the CONNECT type 1 setting is in use. SQLSTATE=0A001
Attached are the set of commands that I executed to restore the db.
I am getting Error due to the last statement only and the rest all the statements are executed successfully.
Logs attached.
Can someone help me out with the same?
Code which I executed:
restore db PRODVAT user mstadmin using password from /data/db2_backupfs taken at 20160304 into VATAMC2 redirect without prompting;
set tablespace containers for 29 using (path '/data/VAT_AMC2/tbs29/cont1');
set tablespace containers for 46 using (path '/data/VAT_AMC2/tbs46/cont1');
set tablespace containers for 47 using (path '/data/VAT_AMC2/tbs47/cont1');
set tablespace containers for 43 using (path '/data/VAT_AMC2/tbs43/cont1');
set tablespace containers for 48 using (path '/data/VAT_AMC2/tbs48/cont1');
set tablespace containers for 44 using (path '/data/VAT_AMC2/tbs44/cont1');
set tablespace containers for 34 using (file '/data/VAT_AMC2/tbs34/cont1' 589824);
set tablespace containers for 35 using (file '/data/VAT_AMC2/tbs35/cont1' 4680192, file '/data/VAT_AMC2/tbs35/cont1a' 4680192);
set tablespace containers for 36 using (file '/data/VAT_AMC2/tbs36/cont2' 3669984, file '/data/VAT_AMC2/tbs36/cont2a' 3669984);
set tablespace containers for 37 using (file '/data/VAT_AMC2/tbs37/cont1' 3898624, file '/data/VAT_AMC2/tbs37/cont1a' 3898624);
set tablespace containers for 38 using (file '/data/VAT_AMC2/tbs38/cont1' 3295788 , file '/data/VAT_AMC2/tbs38/cont1a' 1647892);
set tablespace containers for 39 using (file '/data/VAT_AMC2/tbs39/cont1' 3669976 , file '/data/VAT_AMC2/tbs39/cont12a' 3669976, file '/data/VAT_AMC2/tbs39/cont12b' 3669976, file '/data/VAT_AMC2/tbs39/cont13a' 3669976);
set tablespace containers for 40 using (file '/data/VAT_AMC2/tbs40/cont1' 5509291, file '/data/VAT_AMC2/tbs40/cont1a' 5509290, file '/data/VAT_AMC2/tbs40/cont1b' 5509290);
set tablespace containers for 41 using (file '/data/VAT_AMC2/tbs41/cont1' 2294656);
set tablespace containers for 42 using (file '/data/VAT_AMC2/tbs42/cont1' 4718592);
set tablespace containers for 45 using (file '/data/VAT_AMC2/tbs45/cont1' 1987872, file '/data/VAT_AMC2/tbs45/cont2' 1987872);
set tablespace containers for 49 using (file '/data/VAT_AMC2/tbs49/cont1' 4476974, file '/data/VAT_AMC2/tbs49/cont2' 4476973, file '/data/VAT_AMC2/tbs49/cont3' 4476973);
set tablespace containers for 50 using (file '/data/VAT_AMC2/tbs50/cont1' 3744512);
set tablespace containers for 51 using (file '/data/VAT_AMC2/tbs51/cont1' 5639424);
set tablespace containers for 52 using (file '/data/VAT_AMC2/tbs52/cont1' 4132096);
set tablespace containers for 53 using (file '/data/VAT_AMC2/tbs53/cont1' 3932160);
set tablespace containers for 54 using (file '/data/VAT_AMC2/tbs54/cont1' 4469376, file '/data/VAT_AMC2/tbs54/cont2' 4469376, file '/data/VAT_AMC2/tbs54/cont3' 4469376);
set tablespace containers for 55 using (file '/data/VAT_AMC2/tbs55/cont1' 4194304, file '/data/VAT_AMC2/tbs55/cont2a' 4194304, file '/data/VAT_AMC2/tbs55/cont2b' 4194304, file '/data/VAT_AMC2/tbs55/cont3a' 4194304);
restore db PRODVAT continue;
rollforward db VATAMC2 stop;
Db2 Log:
2016-03-10-09.06.41.911428-360 E6918736A469 LEVEL: Event
PID : 389280 TID : 2572 PROC : db2sysc 0
INSTANCE: db2inst1 NODE : 000 DB : VATAMC2
APPHDL : 0-7 APPID: *LOCAL.db2inst1.160310150641
AUTHID : MSTADMIN
EDUID : 2572 EDUNAME: db2agent (VATAMC2) 0
FUNCTION: DB2 UDB, base sys utilities, sqeLocalDatabase::FirstConnect, probe:1000
START : DATABASE: VATAMC2 : ACTIVATED: NO
2016-03-10-09.06.41.913584-360 E6919206A481 LEVEL: Info
PID : 389280 TID : 2572 PROC : db2sysc 0
INSTANCE: db2inst1 NODE : 000 DB : VATAMC2
APPHDL : 0-7 APPID: *LOCAL.db2inst1.160310150641
AUTHID : MSTADMIN
EDUID : 2572 EDUNAME: db2agent (VATAMC2) 0
FUNCTION: DB2 UDB, database utilities, sqluxGetDegreeParallelism, probe:774
DATA #1 :
Autonomic BAR - using parallelism = 2.
2016-03-10-09.06.41.915158-360 E6919688A492 LEVEL: Info
PID : 389280 TID : 2572 PROC : db2sysc 0
INSTANCE: db2inst1 NODE : 000 DB : VATAMC2
APPHDL : 0-7 APPID: *LOCAL.db2inst1.160310150641
AUTHID : MSTADMIN
EDUID : 2572 EDUNAME: db2agent (VATAMC2) 0
FUNCTION: DB2 UDB, database utilities, sqludPrintStartingMsg, probe:1338
DATA #1 :
Starting a full database restore.
Agent EDU ID: 2572
2016-03-10-09.06.41.915354-360 E6920181A554 LEVEL: Warning
PID : 389280 TID : 2572 PROC : db2sysc 0
INSTANCE: db2inst1 NODE : 000 DB : VATAMC2
APPHDL : 0-7 APPID: *LOCAL.db2inst1.160310150641
AUTHID : MSTADMIN
EDUID : 2572 EDUNAME: db2agent (VATAMC2) 0
FUNCTION: DB2 UDB, database utilities, sqluCompareDB, probe:1445
DATA #1 : Sqlcode, PD_TYPE_SQLCODE, 4 bytes
2528
DATA #2 : Hexdump, 4 bytes
0x07000000491947D8 : 0000 09E0 ....
2016-03-10-09.06.41.915502-360 E6920736A985 LEVEL: Warning
PID : 389280 TID : 2572 PROC : db2sysc 0
INSTANCE: db2inst1 NODE : 000 DB : VATAMC2
APPHDL : 0-7 APPID: *LOCAL.db2inst1.160310150641
AUTHID : MSTADMIN
EDUID : 2572 EDUNAME: db2agent (VATAMC2) 0
FUNCTION: DB2 UDB, database utilities, sqluCompareDB, probe:1445
MESSAGE : SQL2540W Restore is successful, however a warning "" was encountered
during Database Restore while processing in No Interrupt mode.
DATA #1 : SQLCA, PD_DB2_TYPE_SQLCA, 136 bytes
sqlcaid : SQLCA sqlcabc: 136 sqlcode: 2540 sqlerrml: 4
sqlerrmc: 2528
sqlerrp : sqluComp
sqlerrd : (1) 0x00000000 (2) 0x00000000 (3) 0x00000000
(4) 0x00000000 (5) 0x00000000 (6) 0x00000000
sqlwarn : (1) (2) (3) (4) (5) (6)
(7) (8) (9) (10) (11)
sqlstate:
2016-03-10-09.06.41.919710-360 E6921722A520 LEVEL: Info
PID : 389280 TID : 2572 PROC : db2sysc 0
INSTANCE: db2inst1 NODE : 000 DB : VATAMC2
APPHDL : 0-7 APPID: *LOCAL.db2inst1.160310150641
AUTHID : MSTADMIN
EDUID : 2572 EDUNAME: db2agent (VATAMC2) 0
FUNCTION: DB2 UDB, database utilities, sqluxGetAvailableHeapPages, probe:888
DATA #1 :
Autonomic BAR - heap consumption.
Targetting (90%) - 112118 of 124576 pages.
2016-03-10-09.06.41.919864-360 E6922243A508 LEVEL: Info
PID : 389280 TID : 2572 PROC : db2sysc 0
INSTANCE: db2inst1 NODE : 000 DB : VATAMC2
APPHDL : 0-7 APPID: *LOCAL.db2inst1.160310150641
AUTHID : MSTADMIN
EDUID : 2572 EDUNAME: db2agent (VATAMC2) 0
FUNCTION: DB2 UDB, database utilities, sqludTuneBuffers, probe:1139
DATA #1 :
Autonomic restore - tuning enabled.
Using buffer size = 4097, number = 4.
2016-03-10-09.06.42.976640-360 I6922752A522 LEVEL: Error
PID : 389280 TID : 13109 PROC : db2sysc 0
INSTANCE: db2inst1 NODE : 000
EDUID : 13109 EDUNAME: db2bm.2572.0 (VATAMC2) 0
FUNCTION: DB2 UDB, buffer pool services, sqlbDMSDoContainerOp, probe:810
MESSAGE : ZRC=0x8402001E=-2080243682=SQLB_CONTAINER_NOT_ACCESSIBLE
"Container not accessible"
DATA #1 :
Error checking container 0 (/dsexp11/cont/tbs60/cont1) for tbsp 56. Rc = 870F0011
2016-03-10-09.06.43.094056-360 E6923275A555 LEVEL: Warning
PID : 389280 TID : 2572 PROC : db2sysc 0
INSTANCE: db2inst1 NODE : 000 DB : VATAMC2
APPHDL : 0-7 APPID: *LOCAL.db2inst1.160310150641
AUTHID : MSTADMIN
EDUID : 2572 EDUNAME: db2agent (VATAMC2) 0
FUNCTION: DB2 UDB, database utilities, sqludBMResponse, probe:310
DATA #1 : Sqlcode, PD_TYPE_SQLCODE, 4 bytes
1277
DATA #2 : Hexdump, 4 bytes
0x07000000491947D8 : 0000 04FD ....
2016-03-10-09.06.43.094275-360 E6923831A1057 LEVEL: Warning
PID : 389280 TID : 2572 PROC : db2sysc 0
INSTANCE: db2inst1 NODE : 000 DB : VATAMC2
APPHDL : 0-7 APPID: *LOCAL.db2inst1.160310150641
AUTHID : MSTADMIN
EDUID : 2572 EDUNAME: db2agent (VATAMC2) 0
FUNCTION: DB2 UDB, database utilities, sqludBMResponse, probe:310
MESSAGE : SQL1277W A redirected restore operation is being performed. Table
space configuration can now be viewed and table spaces that do not
use automatic storage can have their containers reconfigured.
DATA #1 : SQLCA, PD_DB2_TYPE_SQLCA, 136 bytes
sqlcaid : SQLCA sqlcabc: 136 sqlcode: 1277 sqlerrml: 0
sqlerrmc:
sqlerrp : sqludBMR
sqlerrd : (1) 0x00000000 (2) 0x00000000 (3) 0x00000000
(4) 0x00000000 (5) 0x00000000 (6) 0x00000000
sqlwarn : (1) (2) (3) (4) (5) (6)
(7) (8) (9) (10) (11)
sqlstate:
2016-03-10-09.06.43.883679-360 E6924889A567 LEVEL: Warning
PID : 389280 TID : 2572 PROC : db2sysc 0
INSTANCE: db2inst1 NODE : 000 DB : VATAMC2
APPHDL : 0-7 APPID: *LOCAL.db2inst1.160310150641
AUTHID : MSTADMIN
EDUID : 2572 EDUNAME: db2agent (VATAMC2) 0
FUNCTION: DB2 UDB, database utilities, sqludCheckRedirectedStatus, probe:1065
DATA #1 : Sqlcode, PD_TYPE_SQLCODE, 4 bytes
1277
DATA #2 : Hexdump, 4 bytes
0x07000000491947D8 : 0000 04FD ....
2016-03-10-09.06.43.883857-360 E6925457A1069 LEVEL: Warning
PID : 389280 TID : 2572 PROC : db2sysc 0
INSTANCE: db2inst1 NODE : 000 DB : VATAMC2
APPHDL : 0-7 APPID: *LOCAL.db2inst1.160310150641
AUTHID : MSTADMIN
EDUID : 2572 EDUNAME: db2agent (VATAMC2) 0
FUNCTION: DB2 UDB, database utilities, sqludCheckRedirectedStatus, probe:1065
MESSAGE : SQL1277W A redirected restore operation is being performed. Table
space configuration can now be viewed and table spaces that do not
use automatic storage can have their containers reconfigured.
DATA #1 : SQLCA, PD_DB2_TYPE_SQLCA, 136 bytes
sqlcaid : SQLCA sqlcabc: 136 sqlcode: 1277 sqlerrml: 0
sqlerrmc:
sqlerrp : sqludChe
sqlerrd : (1) 0x00000000 (2) 0x00000000 (3) 0x00000000
(4) 0x00000000 (5) 0x00000000 (6) 0x00000000
sqlwarn : (1) (2) (3) (4) (5) (6)
(7) (8) (9) (10) (11)
sqlstate:
2016-03-10-09.06.43.884062-360 I6926527A840 LEVEL: Warning
PID : 389280 TID : 2572 PROC : db2sysc 0
INSTANCE: db2inst1 NODE : 000 DB : VATAMC2
APPHDL : 0-7 APPID: *LOCAL.db2inst1.160310150641
AUTHID : MSTADMIN
EDUID : 2572 EDUNAME: db2agent (VATAMC2) 0
FUNCTION: DB2 UDB, database utilities, sqludCheckRedirectedStatus, probe:1068
DATA #1 :
Insufficient space in tablespace DMS_TB6_TS; you must have at least 6402208
usable pages. (The "usable pages" total does not include pages used
internally by DB2, so the value specified on the SET TABLESPACE
CONTAINERS operation should be increased by one extent per container.
Based on the latest SET TABLESPACE CONTAINERS values specifed, the
tablespace should have 6402272 pages in total.)
2016-03-10-09.06.43.884818-360 I6927368A345 LEVEL: Severe
PID : 360608 TID : 1 PROC : db2bp
INSTANCE: db2inst1 NODE : 000 DB : VATAMC2
APPID : *LOCAL.db2inst1.160310150641
EDUID : 1
FUNCTION: DB2 UDB, base sys utilities, sqleStartUsingDatabase, probe:2
RETCODE : ZRC=0xFFFFFD10=-752
2016-03-10-09.06.43.885281-360 I6927714A376 LEVEL: Error
PID : 360608 TID : 1 PROC : db2bp
INSTANCE: db2inst1 NODE : 000 DB : VATAMC2
APPID : *LOCAL.db2inst1.160310150641
EDUID : 1
FUNCTION: DB2 UDB, data protection services, sqlpsrllf, probe:317
MESSAGE : Rollforward failed to connect to database. sqlcode -752.

SQL0903N COMMIT statement failed, transaction rolled back in db2luw

I am working on Db2 ATS jobs.
This is what I have tried. Created one procedure p1 on database d1.This procedure will update a table t1 on database d1.From the procedure p1 on a direct call i can update table t1.
And now I have created one table t2 on database d2. From database d1 I am trying to update this table t2 . This is also working fine.
From the database d1 I can update the two tables t1 & t2.
Now I tried the same with a ATS jobs.
I can submit a job to call procedure p1 to update table t1 on database d1 .The job is working fine & able to view the updated records.
tried to submit a job from d1 which will update a table t2 on database d2.
Job is running fine without any error. But the table is not updating.
Below is my procedure & logs Can some one tell me what I am missing here:
CREATE or REPLACE PROCEDURE D_JUMP12(IN text VARCHAR(32672))
p1:BEGIN
DECLARE jobno NUMBER;
execute IMMEDIATE TEXT;
COMMIT;
END p1
This is the way I am calling the procedure:
call DBMS_JOB.SUBMIT (?, 'CALL D_JUMP12(''UPDATE sample.reg.CABS SET FIRSTNAME = reg_f_fixed_char_repos(FIRSTNAME)'')',NULL);
These are my logs:
2015-03-17-18.37.10.360000+330 E110713390F554 LEVEL: Error
PID : 2460 TID : 444 PROC : db2fmp64.exe
INSTANCE: DB2 NODE : 000 DB : test1
APPID : *LOCAL.DB2.150317130717
HOSTNAME: MANGO-04
EDUID : 444
FUNCTION: DB2 UDB, Administrative Task Scheduler, AtsConnection::commit, probe:900
MESSAGE : ECF=0x82BA00E1=-2101739295
DATA #1 : String, 124 bytes
[IBM][CLI Driver][DB2/NT64] SQL0903N COMMIT statement failed, transaction rolled back. Reason code: "2". SQLSTATE=40504
2015-03-17-18.37.10.364000+330 I110713946F425 LEVEL: Error
PID : 2460 TID : 444 PROC : db2fmp64.exe
INSTANCE: DB2 NODE : 000 DB : test1
APPID : *LOCAL.DB2.150317130717
HOSTNAME: MANGO-04
EDUID : 444
FUNCTION: DB2 UDB, Administrative Task Scheduler, AtsTask::run, probe:1300
MESSAGE : ECF=0x82BA00E1=-2101739295
DATA #1 : Codepath, 8 bytes
4
Kindly let me know what I am missing here

Problems using REXX to access both Teradata output and DB2 output

I have a REXX job that needs to read from both Teradata (using BTEQ) and DB2. At present, I can get it to either read from Teradata or DB2, but not both. When I try to read from both, the Teradata one (which runs first) works fine but the DB2 read gives an error of RC(1) upon attempting to open the cursor.
Code to read from Teradata (by and large copied from http://www.teradataforum.com/teradata/20040928_131203.htm):
ADDRESS TSO "DELETE BLAH.TEMP"
"ALLOC FI(SYSPRINT) DA(BLAH.TEMP) NEW CATALOG SP(10 10) TR RELEASE",
"UNIT(SYSDA) RECFM(F B A) LRECL(133) BLKSIZE(0) REUSE"
"ATTRIB FBATTR LRECL(220)"
"ALLOC F(SYSIN) UNIT(VIO) TRACKS SPACE(10,10) USING(FBATTR)"
/* Set up BTEQ script */
QUEUE ".RUN FILE=LOGON"
QUEUE "SELECT COLUMN1 FROM TABLE1;"
/* Run BTEQ script */
"EXECIO * DISKW SYSIN (FINIS"
"CALL 'SYS3.TDP.APPLOAD(BTQMAIN)'"; bteq_rc = rc
"FREE FI(SYSPRINT SYSIN)"
/* Read and parse BTEQ output */
"EXECIO * DISKR SYSPRINT (STEM BTEQOUT. FINIS"
DO I = 1 to BTEQOUT.0
...
END
Code to read from DB2:
ADDRESS TSO "SUBCOM DSNREXX"
IF RC THEN rcDB2 = RXSUBCOM('ADD','DSNREXX','DSNREXX')
ADDRESS DSNREXX "CONNECT " subsys
sqlQuery = "SELECT COLUMN2 FROM TABLE2;"
ADDRESS DSNREXX "EXECSQL DECLARE C001 CURSOR FOR S001"
IF SQLCODE <> 0 THEN DO
SAY 'DECLARE C001 SQLCODE = ' SQLCODE
EXIT 12
END
ADDRESS DSNREXX "EXECSQL PREPARE S001 FROM :sqlQuery"
IF SQLCODE <> 0 THEN DO
SAY 'PREPARE S001 SQLCODE = ' SQLCODE SQLERROR
EXIT 12
END
ADDRESS DSNREXX "EXECSQL OPEN C001"
IF SQLCODE <> 0 THEN DO
SAY 'OPEN C001 SQLCODE = ' SQLCODE
EXIT 12
END
ADDRESS DSNREXX "EXECSQL FETCH C001 INTO :col2"
IF SQLCODE <> 0 THEN DO
SAY 'FETCH C001 SQLCODE = ' SQLCODE
EXIT 12
END
I suspect that this has something to do with my use of SYSPRINT and SYSIN. Anyone know how I can get this to work?
Thanks.
Edit
The question as stated was actually wrong. Apologies for not correcting this earlier.
What I had really done was have this:
ADDRESS TSO "SUBCOM DSNREXX"
IF RC THEN rcDB2 = RXSUBCOM('ADD','DSNREXX','DSNREXX')
ADDRESS DSNREXX "CONNECT " subsys
...followed by a small read from DB2, then followed by the code to read from Teradata, followed by more code to read from DB2. When this was changed to reading from Teradata first before having anything to do with DB2 at all, it worked.
I don't think this has anything to do with SYSPRINT or SYSIN.
I think you are getting TSO RC = 1, not SQLCODE = 1 (because there is no SQLCODE of 1.
1 is a warning, -1 is an error. You can look this up in the DB2 Application Programming
and SQL Guide
Turn on TRACE R and run it.
There are variables (shown below) that display info about the error/warning.
22 *-* ADDRESS DSNREXX "EXECSQL OPEN C1"
>>> "EXECSQL OPEN C1"
+++ RC(1) +++
23 *-* IF SQLCODE <> 0
28 *-* SAY 'SQLSTATE='sqlstate', SQLERRMC='sqlerrmc', SQLERRP='sqlerrp
SQLSTATE=00000, SQLERRMC=, SQLERRP=DSN
29 - SAY 'SQLERRD='sqlerrd.1', 'sqlerrd.2', 'sqlerrd.3', 'sqlerrd.4',',
sqlerrd.5', 'sqlerrd.6
SQLERRD=0, 0, 0, -1, 0, 0
32 - SAY 'SQLWARN='sqlwarn.0', 'sqlwarn.1', 'sqlwarn.2', 'sqlwarn.3',',
sqlwarn.4', 'sqlwarn.5', 'sqlwarn.6', 'sqlwarn.7',',
sqlwarn.8', 'sqlwarn.9', 'sqlwarn.10
SQLWARN= , N, , , , 2, , , , ,
For example, it could be that when both are used together, there is not enough memory.