db2 "select * from sysibmadm.snaplock where tabname='DT_ASSET_DIM' fetch first 2 rows only"
1. If the table status is unavailable , take the ddl of the table by db2look among with all privileges given on the table into a file
2. Change the table name in the file with ‘_NEW’. (E.g. actual table name: "MISSTG “."BT_FT_ASST_CNSMPTN_BKT”, new table name: "MISSTG “."BT_FT_ASST_CNSMPTN_BKT_NEW”). Change all index and keys name according.
3. Create the new table (i.e."MISSTG “."BT_FT_ASST_CNSMPTN_BKT_NEW” )
4. Extract the data of the actual table using “db2dart”. A file with ‘.DEL” with be created. (For ‘no of pages’ give some really large infinite value )
5. Go to the path where the file has been created
6. Import the data into the new table with ‘_NEW’
7. Check the new table status
8. Rename the actual table as ‘_OLD’
9. Rename the new table as actual table
10. Check the status of newly created table after renaming.
Below is an example of the whole procedure mentioned above .
Problem:
[db2inst1@xxxxxxxxxx backupdrill]$ db2 "select count (*) from "MISSTG “."BT_FT_ASST_CNSMPTN_BKT" "
Error Message:
DB2 reported: SQLSTATE = 55019: Native Error Code = -1,477: Msg = [IBM][CLI Driver][DB2/LINUXX8664] SQL1477N For table "MISSTG.STG_SA_INTMDT_1" an object "14081" in table space "2" cannot be accessed. SQLSTATE=55019
[db2inst1@xxxxxxxxxx DART0000]$ db2 load query table MISSTG.BT_FT_ASST_CNSMPTN_BKT
Tablestate:
Unavailable
Solution :
[db2inst1@xxxxxxxxxx ~]$ db2look -d MISPRD1 -e -x -z MISSTG -t BT_FT_ASST_CNSMPTN_BKT -o aa
-- No userid was specified, db2look tries to use Environment variable USER
-- USER is: DB2INST1
-- Specified SCHEMA is: MISSTG
-- The db2look utility will consider only the specified tables
-- Creating DDL for table(s)
-- Schema name is ignored for the Federated Section
-- Output is sent to file: aa.sql
[db2inst1@xxxxxxxxxx ~]$ cat aa.sql
-- This CLP file was created using DB2LOOK Version "9.7"
-- Timestamp: Fri 24 Apr 2015 01:50:58 PM IST
-- Database Name: MISPRD1
-- Database Manager Version: DB2/LINUXX8664 Version 9.7.6
-- Database Codepage: 1208
-- Database Collating Sequence is: IDENTITY
CONNECT TO MISPRD1;
------------------------------------------------
-- DDL Statements for table "MISSTG "."BT_FT_ASST_CNSMPTN_BKT"
------------------------------------------------
CREATE TABLE "MISSTG "."BT_FT_ASST_CNSMPTN_BKT" (
"TRANSACTION_MONTH" DATE ,
"SCTN_CD" VARCHAR(50) ,
"INITAL_READING" DECIMAL(30,10) ,
"FINAL_READING" DECIMAL(30,10) ,
"METER_MULTIPLIER" DECIMAL(30,0) ,
"CONSUMPTION" DECIMAL(30,0) ,
"ENERGY_EXPORT" DECIMAL(30,0) ,
"ENERGY_IMPORT" DECIMAL(30,0) ,
"CHILD_CONSUMPTION" DECIMAL(30,0) ,
"ASST_CD" VARCHAR(50) ,
"UNIT_OF_MEASURE" VARCHAR(18) ,
"AUXILLARY_CONSUMPTION" DECIMAL(30,0) ,
"COMPLETION_FLAG" CHAR(1) ,
"EXPORTED_FLAG" CHAR(1) ,
"CHILD_CONSUMPTION_FLAG" CHAR(1) ,
"IRON_LOSS" VARCHAR(50) ,
"COPPER_LOSS" VARCHAR(50) ,
"EST_TECH_LOSS" VARCHAR(50) ,
"ROW_NUM" INTEGER ,
"TIM_ID" INTEGER NOT NULL ,
"IMP_OR_EXP_FLAG" VARCHAR(3) )
IN "TBSP4K" ;
--------------------------------------------
-- Authorization Statements on Tables/Views
--------------------------------------------
GRANT CONTROL ON TABLE "MISSTG "."BT_FT_ASST_CNSMPTN_BKT" TO USER "DB2INST1" ;
COMMIT WORK;
CONNECT RESET;
TERMINATE;
[db2inst1@chnpmisdb102 ~]$ cat > aaaa
-- This CLP file was created using DB2LOOK Version "9.7"
-- Timestamp: Fri 24 Apr 2015 01:50:58 PM IST
-- Database Name: MISPRD1
-- Database Manager Version: DB2/LINUXX8664 Version 9.7.6
-- Database Codepage: 1208
-- Database Collating Sequence is: IDENTITY
CONNECT TO MISPRD1;
------------------------------------------------
-- DDL Statements for table "MISSTG "."BT_FT_ASST_CNSMPTN_BKT_NEW"
------------------------------------------------
CREATE TABLE "MISSTG "."BT_FT_ASST_CNSMPTN_BKT_NEW" (
"TRANSACTION_MONTH" DATE ,
"SCTN_CD" VARCHAR(50) ,
"INITAL_READING" DECIMAL(30,10) ,
"FINAL_READING" DECIMAL(30,10) ,
"METER_MULTIPLIER" DECIMAL(30,0) ,
"CONSUMPTION" DECIMAL(30,0) ,
"ENERGY_EXPORT" DECIMAL(30,0) ,
"ENERGY_IMPORT" DECIMAL(30,0) ,
"CHILD_CONSUMPTION" DECIMAL(30,0) ,
"ASST_CD" VARCHAR(50) ,
"UNIT_OF_MEASURE" VARCHAR(18) ,
"AUXILLARY_CONSUMPTION" DECIMAL(30,0) ,
"COMPLETION_FLAG" CHAR(1) ,
"EXPORTED_FLAG" CHAR(1) ,
"CHILD_CONSUMPTION_FLAG" CHAR(1) ,
"IRON_LOSS" VARCHAR(50) ,
"COPPER_LOSS" VARCHAR(50) ,
"EST_TECH_LOSS" VARCHAR(50) ,
"ROW_NUM" INTEGER ,
"TIM_ID" INTEGER NOT NULL ,
"IMP_OR_EXP_FLAG" VARCHAR(3) )
IN "TBSP4K" ;
--------------------------------------------
-- Authorization Statements on Tables/Views
--------------------------------------------
GRANT CONTROL ON TABLE "MISSTG "."BT_FT_ASST_CNSMPTN_BKT_NEW" TO USER "DB2INST1" ;
COMMIT WORK;
CONNECT RESET;
TERMINATE;
[db2inst1@chnpmisdb102 ~]$
[db2inst1@xxxxxxxxxx backupdrill]$ db2 -tvf aaaa
CONNECT TO MISPRD1
Database Connection Information
Database server = DB2/LINUXX8664 9.7.6
SQL authorization ID = DB2INST1
Local database alias = MISPRD1
CREATE TABLE "MISSTG "."BT_FT_ASST_CNSMPTN_BKT_NEW" ( "TRANSACTION_MONTH" DATE , "SCTN_CD" VARCHAR(50) , "INITAL_READING" DECIMAL(30,10) , "FINAL_READING" DECIMAL(30,10) , "METER_MULTIPLIER" DECIMAL(30,0) , "CONSUMPTION" DECIMAL(30,0) , "ENERGY_EXPORT" DECIMAL(30,0) , "ENERGY_IMPORT" DECIMAL(30,0) , "CHILD_CONSUMPTION" DECIMAL(30,0) , "ASST_CD" VARCHAR(50) , "UNIT_OF_MEASURE" VARCHAR(18) , "AUXILLARY_CONSUMPTION" DECIMAL(30,0) , "COMPLETION_FLAG" CHAR(1) , "EXPORTED_FLAG" CHAR(1) , "CHILD_CONSUMPTION_FLAG" CHAR(1) , "IRON_LOSS" VARCHAR(50) , "COPPER_LOSS" VARCHAR(50) , "EST_TECH_LOSS" VARCHAR(50) , "ROW_NUM" INTEGER , "TIM_ID" INTEGER NOT NULL , "IMP_OR_EXP_FLAG" VARCHAR(3) ) IN "TBSP4K"
DB20000I The SQL command completed successfully.
GRANT CONTROL ON TABLE "MISSTG "."BT_FT_ASST_CNSMPTN_BKT_NEW" TO USER "DB2INST1"
DB20000I The SQL command completed successfully.
COMMIT WORK
DB20000I The SQL command completed successfully.
CONNECT RESET
DB20000I The SQL command completed successfully.
TERMINATE
DB20000I The TERMINATE command completed successfully.
[db2inst1@xxxxxxxxxx backupdrill]$ db2dart misprd1 /DDEL
Warning: The database state is not consistent.
Warning: Errors reported about reorg rows may be due to the inconsistent state of the database.
Table object data formatting start.
Please enter
Table ID or name, tablespace ID, first page, num of pages:
MISSTG.BT_FT_ASST_CNSMPTN_BKT,2,0,999999999
21 of 21 columns in the table will be dumped.
Column numbers and datatypes of the columns dumped:
0 DATE
1 VARCHAR() -VARIABLE LENGTH CHARACTER STRING
2 DECIMAL
3 DECIMAL
4 DECIMAL
5 DECIMAL
6 DECIMAL
7 DECIMAL
8 DECIMAL
9 VARCHAR() -VARIABLE LENGTH CHARACTER STRING
10 VARCHAR() -VARIABLE LENGTH CHARACTER STRING
11 DECIMAL
12 CHAR() -FIXED LENGTH CHARACTER STRING
13 CHAR() -FIXED LENGTH CHARACTER STRING
14 CHAR() -FIXED LENGTH CHARACTER STRING
15 VARCHAR() -VARIABLE LENGTH CHARACTER STRING
16 VARCHAR() -VARIABLE LENGTH CHARACTER STRING
17 VARCHAR() -VARIABLE LENGTH CHARACTER STRING
18 INTEGER
19 INTEGER
20 VARCHAR() -VARIABLE LENGTH CHARACTER STRING
Default filename for output data file is MISPRD1.DEL,
do you wish to change filename used? y/n
n
Filename used for output data file is MISPRD1.DEL. If existing file, data will be appended to it.
Formatted data being dumped ...
Dumping Page 0 ....
Dumping Page 1 ....
Dumping Page 2 ....
Dumping Page 3 ....
Dumping Page 4 ....
Dumping Page 5 ....
Dumping Page 6 ....
Dumping Page 7 ....
Dumping Page 8 ....
Dumping Page 9 ....
Dumping Page 10 ....
Dumping Page 11 ....
Dumping Page 12 ....
Dumping Page 13 ....
Dumping Page 14 ....
Dumping Page 15 ....
Dumping Page 16 ....
Dumping Page 17 ....
Dumping Page 18 ....
Dumping Page 19 ....
Dumping Page 20 ....
Dumping Page 21 ....
Dumping Page 22 ....
Dumping Page 23 ....
Dumping Page 24 ....
Dumping Page 25 ....
Dumping Page 26 ....
Dumping Page 27 ....
Dumping Page 28 ....
Dumping Page 29 ....
Dumping Page 30 ....
Dumping Page 31 ....
Dumping Page 32 ....
Dumping Page 33 ....
Dumping Page 34 ....
Dumping Page 35 ....
Dumping Page 36 ....
Dumping Page 37 ....
Dumping Page 38 ....
Dumping Page 39 ....
Dumping Page 40 ....
Dumping Page 41 ....
Dumping Page 42 ....
Dumping Page 43 ....
Dumping Page 44 ....
Dumping Page 45 ....
Dumping Page 46 ....
Dumping Page 47 ....
Dumping Page 48 ....
Dumping Page 49 ....
Dumping Page 50 ....
Dumping Page 51 ....
Dumping Page 52 ....
Dumping Page 53 ....
Dumping Page 54 ....
Dumping Page 55 ....
Dumping Page 56 ....
Dumping Page 57 ....
Dumping Page 58 ....
Dumping Page 59 ....
Dumping Page 60 ....
Dumping Page 61 ....
Dumping Page 62 ....
Dumping Page 63 ....
Dumping Page 64 ....
Dumping Page 65 ....
Dumping Page 66 ....
Dumping Page 67 ....
Dumping Page 68 ....
Dumping Page 69 ....
Dumping Page 70 ....
Dumping Page 71 ....
Dumping Page 72 ....
Dumping Page 73 ....
Dumping Page 74 ....
Dumping Page 75 ....
Dumping Page 76 ....
Dumping Page 77 ....
Dumping Page 78 ....
Dumping Page 79 ....
Dumping Page 80 ....
Dumping Page 81 ....
Dumping Page 82 ....
Dumping Page 83 ....
Dumping Page 84 ....
Dumping Page 85 ....
Dumping Page 86 ....
Dumping Page 87 ....
Dumping Page 88 ....
Dumping Page 89 ....
Dumping Page 90 ....
Dumping Page 91 ....
Dumping Page 92 ....
Dumping Page 93 ....
Dumping Page 94 ....
Dumping Page 95 ....
Dumping Page 96 ....
Dumping Page 97 ....
Dumping Page 98 ....
Dumping Page 99 ....
Dumping Page 100 ....
Dumping Page 101 ....
Dumping Page 102 ....
Dumping Page 103 ....
Dumping Page 104 ....
Dumping Page 105 ....
Dumping Page 106 ....
Dumping Page 107 ....
Dumping Page 108 ....
Dumping Page 109 ....
Dumping Page 110 ....
Dumping Page 111 ....
Dumping Page 112 ....
Dumping Page 113 ....
Dumping Page 114 ....
Dumping Page 115 ....
Dumping Page 116 ....
Dumping Page 117 ....
Dumping Page 118 ....
Dumping Page 119 ....
Dumping Page 120 ....
Dumping Page 121 ....
Dumping Page 122 ....
Dumping Page 123 ....
Dumping Page 124 ....
Dumping Page 125 ....
Dumping Page 126 ....
Dumping Page 127 ....
Dumping Page 128 ....
Dumping Page 129 ....
Dumping Page 130 ....
Dumping Page 131 ....
Dumping Page 132 ....
Dumping Page 133 ....
Dumping Page 134 ....
Dumping Page 135 ....
Dumping Page 136 ....
Dumping Page 137 ....
Dumping Page 138 ....
Dumping Page 139 ....
Dumping Page 140 ....
Dumping Page 141 ....
Dumping Page 142 ....
Dumping Page 143 ....
Dumping Page 144 ....
Dumping Page 145 ....
Dumping Page 146 ....
Dumping Page 147 ....
Dumping Page 148 ....
Dumping Page 149 ....
Dumping Page 150 ....
Dumping Page 151 ....
Dumping Page 152 ....
Dumping Page 153 ....
Dumping Page 154 ....
Dumping Page 155 ....
Dumping Page 156 ....
Dumping Page 157 ....
Dumping Page 158 ....
Dumping Page 159 ....
Dumping Page 160 ....
Dumping Page 161 ....
Dumping Page 162 ....
Dumping Page 163 ....
Dumping Page 164 ....
Dumping Page 165 ....
Dumping Page 166 ....
Dumping Page 167 ....
Dumping Page 168 ....
Dumping Page 169 ....
Dumping Page 170 ....
Dumping Page 171 ....
Dumping Page 172 ....
Dumping Page 173 ....
Dumping Page 174 ....
Dumping Page 175 ....
Dumping Page 176 ....
Dumping Page 177 ....
Dumping Page 178 ....
Dumping Page 179 ....
Dumping Page 180 ....
Dumping Page 181 ....
Dumping Page 182 ....
Dumping Page 183 ....
Dumping Page 184 ....
Dumping Page 185 ....
Dumping Page 186 ....
Dumping Page 187 ....
Dumping Page 188 ....
Dumping Page 189 ....
Dumping Page 190 ....
Dumping Page 191 ....
Dumping Page 192 ....
Dumping Page 193 ....
Dumping Page 194 ....
Dumping Page 195 ....
Dumping Page 196 ....
Dumping Page 197 ....
Dumping Page 198 ....
Dumping Page 199 ....
Dumping Page 200 ....
Dumping Page 201 ....
Dumping Page 202 ....
Dumping Page 203 ....
Dumping Page 204 ....
Dumping Page 205 ....
Dumping Page 206 ....
Dumping Page 207 ....
Dumping Page 208 ....
Dumping Page 209 ....
Dumping Page 210 ....
Dumping Page 211 ....
Dumping Page 212 ....
Dumping Page 213 ....
Dumping Page 214 ....
Dumping Page 215 ....
Dumping Page 216 ....
Dumping Page 217 ....
Dumping Page 218 ....
Dumping Page 219 ....
Dumping Page 220 ....
Dumping Page 221 ....
Dumping Page 222 ....
Dumping Page 223 ....
Dumping Page 224 ....
Dumping Page 225 ....
Dumping Page 226 ....
Dumping Page 227 ....
Dumping Page 228 ....
Dumping Page 229 ....
Dumping Page 230 ....
Dumping Page 231 ....
Dumping Page 232 ....
Dumping Page 233 ....
Dumping Page 234 ....
Dumping Page 235 ....
Dumping Page 236 ....
Dumping Page 237 ....
Dumping Page 238 ....
Dumping Page 239 ....
Dumping Page 240 ....
Dumping Page 241 ....
Dumping Page 242 ....
Dumping Page 243 ....
Dumping Page 244 ....
Dumping Page 245 ....
Dumping Page 246 ....
Dumping Page 247 ....
Dumping Page 248 ....
Dumping Page 249 ....
Dumping Page 250 ....
Dumping Page 251 ....
Dumping Page 252 ....
Dumping Page 253 ....
Dumping Page 254 ....
Dumping Page 255 ....
Dumping Page 256 ....
Dumping Page 257 ....
Dumping Page 258 ....
Dumping Page 259 ....
Dumping Page 260 ....
Dumping Page 261 ....
Dumping Page 262 ....
Dumping Page 263 ....
Dumping Page 264 ....
Dumping Page 265 ....
Dumping Page 266 ....
Dumping Page 267 ....
Dumping Page 268 ....
Dumping Page 269 ....
Dumping Page 270 ....
Dumping Page 271 ....
Dumping Page 272 ....
Dumping Page 273 ....
Dumping Page 274 ....
Dumping Page 275 ....
Dumping Page 276 ....
Dumping Page 277 ....
Dumping Page 278 ....
Dumping Page 279 ....
Dumping Page 280 ....
Dumping Page 281 ....
Dumping Page 282 ....
Dumping Page 283 ....
Dumping Page 284 ....
Dumping Page 285 ....
Dumping Page 286 ....
Dumping Page 287 ....
Dumping Page 288 ....
Dumping Page 289 ....
Dumping Page 290 ....
Dumping Page 291 ....
Dumping Page 292 ....
Dumping Page 293 ....
Dumping Page 294 ....
Dumping Page 295 ....
Dumping Page 296 ....
Dumping Page 297 ....
Dumping Page 298 ....
Dumping Page 299 ....
Dumping Page 300 ....
Dumping Page 301 ....
Dumping Page 302 ....
Dumping Page 303 ....
Dumping Page 304 ....
Dumping Page 305 ....
Dumping Page 306 ....
Dumping Page 307 ....
Dumping Page 308 ....
Dumping Page 309 ....
Dumping Page 310 ....
Dumping Page 311 ....
Dumping Page 312 ....
Dumping Page 313 ....
Dumping Page 314 ....
Dumping Page 315 ....
Dumping Page 316 ....
Dumping Page 317 ....
Dumping Page 318 ....
Dumping Page 319 ....
Dumping Page 320 ....
Dumping Page 321 ....
Dumping Page 322 ....
Dumping Page 323 ....
Dumping Page 324 ....
Dumping Page 325 ....
Dumping Page 326 ....
Dumping Page 327 ....
Dumping Page 328 ....
Dumping Page 329 ....
Dumping Page 330 ....
Dumping Page 331 ....
Dumping Page 332 ....
Dumping Page 333 ....
Dumping Page 334 ....
Dumping Page 335 ....
Dumping Page 336 ....
Dumping Page 337 ....
Dumping Page 338 ....
Dumping Page 339 ....
Dumping Page 340 ....
Dumping Page 341 ....
Dumping Page 342 ....
Dumping Page 343 ....
Dumping Page 344 ....
Dumping Page 345 ....
Dumping Page 346 ....
Dumping Page 347 ....
Dumping Page 348 ....
Dumping Page 349 ....
Dumping Page 350 ....
Dumping Page 351 ....
Dumping Page 352 ....
Dumping Page 353 ....
Dumping Page 354 ....
Dumping Page 355 ....
Dumping Page 356 ....
Dumping Page 357 ....
Dumping Page 358 ....
Dumping Page 359 ....
Dumping Page 360 ....
Dumping Page 361 ....
Dumping Page 362 ....
Dumping Page 363 ....
Dumping Page 364 ....
Dumping Page 365 ....
Dumping Page 366 ....
Dumping Page 367 ....
Dumping Page 368 ....
Dumping Page 369 ....
Dumping Page 370 ....
Dumping Page 371 ....
Dumping Page 372 ....
Dumping Page 373 ....
Dumping Page 374 ....
Dumping Page 375 ....
Dumping Page 376 ....
Dumping Page 377 ....
Dumping Page 378 ....
Dumping Page 379 ....
Dumping Page 380 ....
Dumping Page 381 ....
Dumping Page 382 ....
Dumping Page 383 ....
Dumping Page 384 ....
Dumping Page 385 ....
Dumping Page 386 ....
Dumping Page 387 ....
Dumping Page 388 ....
Dumping Page 389 ....
Dumping Page 390 ....
Dumping Page 391 ....
Dumping Page 392 ....
Dumping Page 393 ....
Dumping Page 394 ....
Dumping Page 395 ....
Dumping Page 396 ....
Dumping Page 397 ....
Dumping Page 398 ....
Dumping Page 399 ....
Dumping Page 400 ....
Dumping Page 401 ....
Dumping Page 402 ....
Dumping Page 403 ....
Dumping Page 404 ....
Dumping Page 405 ....
Dumping Page 406 ....
Dumping Page 407 ....
Dumping Page 408 ....
Dumping Page 409 ....
Dumping Page 410 ....
Dumping Page 411 ....
Dumping Page 412 ....
Dumping Page 413 ....
Dumping Page 414 ....
Dumping Page 415 ....
Dumping Page 416 ....
Dumping Page 417 ....
Dumping Page 418 ....
Dumping Page 419 ....
Dumping Page 420 ....
Dumping Page 421 ....
Dumping Page 422 ....
Dumping Page 423 ....
Dumping Page 424 ....
Dumping Page 425 ....
Dumping Page 426 ....
Dumping Page 427 ....
Dumping Page 428 ....
Dumping Page 429 ....
Dumping Page 430 ....
Dumping Page 431 ....
Dumping Page 432 ....
Dumping Page 433 ....
Dumping Page 434 ....
Dumping Page 435 ....
Dumping Page 436 ....
Dumping Page 437 ....
Dumping Page 438 ....
Dumping Page 439 ....
Dumping Page 440 ....
Dumping Page 441 ....
Dumping Page 442 ....
Dumping Page 443 ....
Dumping Page 444 ....
Dumping Page 445 ....
Dumping Page 446 ....
Dumping Page 447 ....
Dumping Page 448 ....
Dumping Page 449 ....
Dumping Page 450 ....
Dumping Page 451 ....
Dumping Page 452 ....
Dumping Page 453 ....
Dumping Page 454 ....
Dumping Page 455 ....
Dumping Page 456 ....
Dumping Page 457 ....
Dumping Page 458 ....
Dumping Page 459 ....
Dumping Page 460 ....
Dumping Page 461 ....
Dumping Page 462 ....
Dumping Page 463 ....
Dumping Page 464 ....
Dumping Page 465 ....
Dumping Page 466 ....
Dumping Page 467 ....
Dumping Page 468 ....
Dumping Page 469 ....
Dumping Page 470 ....
Dumping Page 471 ....
Dumping Page 472 ....
Dumping Page 473 ....
Dumping Page 474 ....
Dumping Page 475 ....
Dumping Page 476 ....
Dumping Page 477 ....
Dumping Page 478 ....
Dumping Page 479 ....
Dumping Page 480 ....
Dumping Page 481 ....
Dumping Page 482 ....
Dumping Page 483 ....
Dumping Page 484 ....
Dumping Page 485 ....
Dumping Page 486 ....
Dumping Page 487 ....
Dumping Page 488 ....
Dumping Page 489 ....
Dumping Page 490 ....
Dumping Page 491 ....
Dumping Page 492 ....
Dumping Page 493 ....
Dumping Page 494 ....
Dumping Page 495 ....
Dumping Page 496 ....
Dumping Page 497 ....
Dumping Page 498 ....
Dumping Page 499 ....
Dumping Page 500 ....
Dumping Page 501 ....
Dumping Page 502 ....
Dumping Page 503 ....
Dumping Page 504 ....
Dumping Page 505 ....
Dumping Page 506 ....
Dumping Page 507 ....
Dumping Page 508 ....
Dumping Page 509 ....
Dumping Page 510 ....
Dumping Page 511 ....
Dumping Page 512 ....
Dumping Page 513 ....
Dumping Page 514 ....
Dumping Page 515 ....
Dumping Page 516 ....
Dumping Page 517 ....
Dumping Page 518 ....
Dumping Page 519 ....
Dumping Page 520 ....
Dumping Page 521 ....
Dumping Page 522 ....
Dumping Page 523 ....
Dumping Page 524 ....
Dumping Page 525 ....
Dumping Page 526 ....
Dumping Page 527 ....
Dumping Page 528 ....
Dumping Page 529 ....
Dumping Page 530 ....
Dumping Page 531 ....
Dumping Page 532 ....
Dumping Page 533 ....
Dumping Page 534 ....
Dumping Page 535 ....
Dumping Page 536 ....
Dumping Page 537 ....
Dumping Page 538 ....
Dumping Page 539 ....
Dumping Page 540 ....
Dumping Page 541 ....
Dumping Page 542 ....
Dumping Page 543 ....
Dumping Page 544 ....
Dumping Page 545 ....
Dumping Page 546 ....
Dumping Page 547 ....
Dumping Page 548 ....
Dumping Page 549 ....
Dumping Page 550 ....
Dumping Page 551 ....
Dumping Page 552 ....
Dumping Page 553 ....
Dumping Page 554 ....
Dumping Page 555 ....
Dumping Page 556 ....
Dumping Page 557 ....
Dumping Page 558 ....
Dumping Page 559 ....
Dumping Page 560 ....
Dumping Page 561 ....
Dumping Page 562 ....
Dumping Page 563 ....
Dumping Page 564 ....
Dumping Page 565 ....
Dumping Page 566 ....
Dumping Page 567 ....
Dumping Page 568 ....
Dumping Page 569 ....
Dumping Page 570 ....
Dumping Page 571 ....
Dumping Page 572 ....
Dumping Page 573 ....
Dumping Page 574 ....
Dumping Page 575 ....
Dumping Page 576 ....
Dumping Page 577 ....
Dumping Page 578 ....
Dumping Page 579 ....
Dumping Page 580 ....
Dumping Page 581 ....
Dumping Page 582 ....
Dumping Page 583 ....
Dumping Page 584 ....
Dumping Page 585 ....
Dumping Page 586 ....
Dumping Page 587 ....
Dumping Page 588 ....
Dumping Page 589 ....
Dumping Page 590 ....
Dumping Page 591 ....
Dumping Page 592 ....
Dumping Page 593 ....
Dumping Page 594 ....
Dumping Page 595 ....
Dumping Page 596 ....
Dumping Page 597 ....
Dumping Page 598 ....
Dumping Page 599 ....
Dumping Page 600 ....
Dumping Page 601 ....
Dumping Page 602 ....
Dumping Page 603 ....
Dumping Page 604 ....
Dumping Page 605 ....
Dumping Page 606 ....
Dumping Page 607 ....
Dumping Page 608 ....
Dumping Page 609 ....
Dumping Page 610 ....
Dumping Page 611 ....
Dumping Page 612 ....
Dumping Page 613 ....
Dumping Page 614 ....
Dumping Page 615 ....
Dumping Page 616 ....
Dumping Page 617 ....
Dumping Page 618 ....
Dumping Page 619 ....
Dumping Page 620 ....
Dumping Page 621 ....
Dumping Page 622 ....
Dumping Page 623 ....
Dumping Page 624 ....
Dumping Page 625 ....
Dumping Page 626 ....
Dumping Page 627 ....
Dumping Page 628 ....
Dumping Page 629 ....
Dumping Page 630 ....
Dumping Page 631 ....
Table object data formatting end.
DB2DART Processing completed with warning(s)!
Complete DB2DART report found in:
/home/db2inst1/sqllib/db2dump/DART0000/MISPRD1.RPT
[db2inst1@xxxxxxxxxx DART0000]$ ls -lrt
total 154224
-rw-r----- 1 db2inst1 db2iadm1 2785 Jun 18 2013 TS2T1031.DEL
-rw-r----- 1 db2inst1 db2iadm1 2785 Jun 18 2013 Bkt.del
-rw-r----- 1 db2inst1 db2iadm1 4492 Jun 18 2013 Bkt_New.del
-rw-r----- 1 db2inst1 db2iadm1 4606 Apr 9 12:16 TS2T6919.DEL
-rw-r----- 1 db2inst1 db2iadm1 73205552 Apr 10 11:43 TS2T8723.DEL
-rw-r----- 1 db2inst1 db2iadm1 73205552 Apr 10 12:06 BT_FT_COMPONENT_LOG_BKT_Apr10.DEL
-rw-r----- 1 db2inst1 db2iadm1 18268 Aug 1 13:10 MISPRD1.BAK
-rw-r--r-- 1 db2inst1 db2iadm1 1595 Aug 1 13:12 DART.INF
-rw-r----- 1 db2inst1 db2iadm1 18267 Aug 1 13:12 MISPRD1.RPT
-rw-r----- 1 db2inst1 db2iadm1 7508322 Aug 1 13:12 MISPRD1.DEL
[db2inst1@xxxxxxxxxx DART0000]$ db2 IMPORT FROM MISPRD1.DEL OF DEL commitcount 10000 INSERT INTO MISSTG.BT_FT_ASST_CNSMPTN_BKT_NEW
SQL3109N The utility is beginning to load data from file "MISPRD1.DEL".
SQL3221W ...Begin COMMIT WORK. Input Record Count = "10000".
SQL3222W ...COMMIT of any database changes was successful.
SQL3221W ...Begin COMMIT WORK. Input Record Count = "20000".
SQL3222W ...COMMIT of any database changes was successful.
SQL3110N The utility has completed processing. "22136" rows were read from
the input file.
SQL3221W ...Begin COMMIT WORK. Input Record Count = "22136".
SQL3222W ...COMMIT of any database changes was successful.
SQL3149N "22136" rows were processed from the input file. "22136" rows were
successfully inserted into the table. "0" rows were rejected.
Number of rows read = 22136
Number of rows skipped = 0
Number of rows inserted = 22136
Number of rows updated = 0
Number of rows rejected = 0
Number of rows committed = 22136
[db2inst1@xxxxxxxxxx DART0000]$ db2 "select count(*) from MISSTG.BT_FT_ASST_CNSMPTN_BKT_NEW "
1
-----------
22136
1 record(s) selected.
[db2inst1@xxxxxxxxxx DART0000]$ db2 load query table MISSTG.BT_FT_ASST_CNSMPTN_BKT_NEW
Tablestate:
Normal
[db2inst1@xxxxxxxxxx DART0000]$ db2 rename table MISSTG.BT_FT_ASST_CNSMPTN_BKT to BT_FT_ASST_CNSMPTN_BKT_OLD
DB20000I The SQL command completed successfully.
[db2inst1@xxxxxxxxxx DART0000]$ db2 rename table MISSTG.BT_FT_ASST_CNSMPTN_BKT_NEW to BT_FT_ASST_CNSMPTN_BKT
DB20000I The SQL command completed successfully.
[db2inst1@xxxxxxxxxx DART0000]$ db2 "select count(*) from MISSTG.BT_FT_ASST_CNSMPTN_BKT"
1
-----------
22136
1 record(s) selected.
[db2inst1@xxxxxxxxxx DART0000]$ db2 load query table MISSTG.BT_FT_ASST_CNSMPTN_BKT
Tablestate:
Normal
[db2inst1@xxxxxxxxxx DART0000]$
HADR Setup
For example please consider the below
DC IP: <DC SERVER IP>
DR IP: <DR SERVER IP>
User name: db2inst1
Database name: MISPRD1
======== TAKEN AN ONLINE BACKUP IN DC - PRIMARY
1. sh /home/db2inst1/BACKUP/ONLINE_FULL/Full_Online_Backup.sh -> Backup image : MISPRD1.0.db2inst1.NODE0000.CATN0000.20150409170003.001 (Full Backup Image)
2. sh /home/db2inst1/BACKUP/ONLINE_FULL/Incremental_Online_Backup.sh -> Backup image :
MISPRD1.0.db2inst1.NODE0000.CATN0000.20150410215932.001 (Incremental Backup Image)
======= COPY THE BACKUP FILES TO DR
1. scp <backup_image> db2inst1@<DR SERVER IP>:< DR_Backup_Image_path >
======= RESTORE THE DB IMAGE IN DR
1. Go to the path where all the backup image present in DR
2. db2 RESTORE DATABASE MISPRD1 incremental FROM <DR_Backup_Image_path> TAKEN AT 20150410215932 on /db2fs1 , /db2fs2 , /db2fs3 , /db2fs4 dbpath on /db2path parallelism 6 without prompting
3. db2 RESTORE DATABASE MISPRD1 incremental FROM <Backup_Image_path> TAKEN AT 20150409170003 parallelism 6 without prompting"
4. db2 RESTORE DATABASE MISPRD1 incremental FROM <Backup_Image_path> TAKEN AT 20150410215932 parallelism 6 without prompting"
Note: Do not rollforward any logs, directly enable HADR
======= DC: UPDATE HADR CONFIGURATION PARAMETERS ON PRIMARY DATABASE -
db2 UPDATE DB CFG FOR MISPRD1 USING HADR_LOCAL_HOST <SOURCE DC SERVER IP>
db2 UPDATE DB CFG FOR MISPRD1 USING HADR_LOCAL_SVC DB2_HADR_MISPRD_1
db2 UPDATE DB CFG FOR MISPRD1 USING HADR_REMOTE_HOST <DESTINATION DR SERVER IP>
db2 UPDATE DB CFG FOR MISPRD1 USING HADR_REMOTE_SVC DB2_HADR_MISPRD_2
db2 UPDATE DB CFG FOR MISPRD1 USING HADR_REMOTE_INST db2inst1
db2 UPDATE DB CFG FOR MISPRD1 USING HADR_SYNCMODE ASYNC
db2 UPDATE DB CFG FOR MISPRD1 USING HADR_TIMEOUT 200
db2 CONNECT TO MISPRD1
db2 QUIESCE DATABASE IMMEDIATE FORCE CONNECTIONS
db2 UNQUIESCE DATABASE
db2 CONNECT RESET
====== DR : UPDATE HADR CONFIGURATION PARAMETERS ON STANDBY DATABASE -
db2 UPDATE DB CFG FOR MISPRD1 USING HADR_LOCAL_HOST <DR SERVER IP>
db2 UPDATE DB CFG FOR MISPRD1 USING HADR_LOCAL_SVC DB2_HADR_MISPRD_2
db2 UPDATE DB CFG FOR MISPRD1 USING HADR_REMOTE_HOST <DC SERVER IP>
db2 UPDATE DB CFG FOR MISPRD1 USING HADR_REMOTE_SVC DB2_HADR_MISPRD_1
db2 UPDATE DB CFG FOR MISPRD1 USING HADR_REMOTE_INST db2inst1
db2 UPDATE DB CFG FOR MISPRD1 USING HADR_SYNCMODE ASYNC
db2 UPDATE DB CFG FOR MISPRD1 USING HADR_TIMEOUT 200
====== DR :START HADR ON STANDBY DATABASE - - SB_INST (DB2HADR)
db2 DEACTIVATE DATABASE MISPRD1
db2 START HADR ON DATABASE MISPRD1 AS STANDBY
====== DC : START HADR ON PRIMARY DATABASE - SAM_PR (MISPRD1)--
db2 DEACTIVATE DATABASE MISPRD1
db2 START HADR ON DATABASE MISPRD1 AS PRIMARY;
-- MONITOR HADR:-
db2pd -d misprd1 -hadr
db2pd -db misprd1 –hadr
STOPPING HADR :-
db2 stop hadr on database misprd1;
HADR CHECK LIST
Check1> Check at both DC & DR (Primary & Standby)
Command: db2pd -d <DB_NAME> -hadr |
grep -i connect
Output:
“ConnectStatus” should be “Connected”