Saturday, January 9, 2010

Interview DB2 3


FEDERATED SYSTEMS(or Virtual Database) :  it is type of meta data management system. where apart  of data in other environment is made available in  one environment.


Steps in federated systems:


1)Catalog remote database REM_DB2 at instance db2inst2


db2 catalog TCPIP node RMDBNODE remote 172.16.128.151 server 60134


The CATALOG TCPIP NODE command completed successfully.


Directory changes may not be effective until the directory cache is


refreshed.


 


</db2ramana/db2inst2>db2 catalog db REM_DB2 at node RMDBNODE


The CATALOG DATABASE command completed successfully.


Directory changes may not be effective until the directory cache is


refreshed.


</db2ramana/db2inst2>db2 connect to REM_DB2 user testdb2 using testdb2


2)Configure instance db2inst2 for FEDERATED supoort


</db2ramana/db2inst2>db2 update dbm cfg using federated yes


DB20000I  The UPDATE DATABASE MANAGER CONFIGURATION command completed


successfully.


</db2ramana/db2inst2>db2 get dbm cfg | grep FED


Federated Database System Support           (FEDERATED) = YES


Bypass federated authentication            (FED_NOAUTH) = NO


Maximum Asynchronous TQs per query    (FEDERATED_ASYNC) = 0


3) Create wrapper which support DB2 database


Wrappers are mechanisms by which the federated database interacts with data sources. The federated database uses routines stored in a library called a wrapper module to implement a wrapper.


</db2ramana/db2inst2>db2 " create wrapper DRDA"


DB20000I  The SQL command completed successfully.


</db2ramana/db2inst2>db2 "select * from syscat.wrappers"


4)Create server and provide credential to access remote database, make sure correct version is given for DB2.


Normally as db2 create myser1 type db2/aix version 9.1 wrapper drda…


5) Mapped the user for authentication.


db2 => create user mapping for db2inst2 server myserv1 options (remote_authid 'testdb2',remote_password 'testdb2')


DB20000I  The SQL command completed successfully


6) Create nick name from remote table.


 


HADR: High Availability Disaster Recovery.. (ModesàSynchronous(from S.log buffer) ,asynchrouns(from send() of Primary),near synchrouns(Default in HADR ,from Receive())


Advanced of High availability data replication in Informix.



  1. At primary server: Configure database for log shipping.

 


</db2inst1>db2 update db cfg for prod_Db using logretain on


The UPDATE DATABASE CONFIGURATION command completed successfully.


</db2inst1>db2 connect to prod_db


SQL1116N  A connection to or activation of database "PROD_DB" cannot be made


because of BACKUP PENDING.  SQLSTATE=57019


 


</db2inst1>db2 backup db prod_db


 


2)   Now perform the online back up for primary Database


</db2inst1>db2 connect to prod_db;;;;</db2inst1>db2 backup db prod_db online


3)Move that online backup file to the standby server. If that server is different server then use mount utilities.


4)***Restore database at secondary server and keep into roll forward pending mode****


5)Update the configuration parameters in both databases.


 


On Primary:


update db cfg for prod_db using HADR_LOCAL_HOST mcdb04


update db cfg for prod_db using HADR_REMOTE_HOST mcdb04


update db cfg for prod_db using HADR_LOCAL_SVC 18889


update db cfg for prod_db using HADR_REMOTE_SVC 18888


update db cfg for prod_db using HADR_REMOTE_INST db2inst2


update db cfg for prod_db using HADR_SYNCMODE SYNC


update db cfg for prod_db using LOGINDEXBUILD ON


On Secondary:


update db cfg for prod_db using HADR_LOCAL_HOST mcdb04


update db cfg for prod_db using HADR_REMOTE_HOST mcdb04


update db cfg for prod_db using HADR_LOCAL_SVC 18888


update db cfg for prod_db using HADR_REMOTE_SVC 18889


update db cfg for prod_db using HADR_REMOTE_INST db2inst1


update db cfg for prod_db using HADR_SYNCMODE SYNC


update db cfg for prod_db using LOGINDEXBUILD ON


 


6)***Start HADR on the standby server with the following command***


(on Secondary/Standby Server  First as Stanby)


7)Start HADR on the Primary server with the following command


</db2inst1>db2 start HADR on database PROD_DB as PRIMARY


8) For Verification you can check a db2reply application runs on Standby.


Using db2pd utility we can check the running of HADR on Primary and Seconday.


And By Using Take over command we can make the secondary/Standby into primary and vice versa


Pre Migration Tasks:


We will check whether Database is well for migration or not through db2ckmig command, and this db2ckmig gives information on Catalog Database, Inconsistent Database?, backup Pending State, Rollforward Pending state, Tablespace state Normal or not..?,



  • A catalogued database actually exists.
  • A database is not in an inconsistent state.
  • A database is not in a backup pending state.
  • A database is not in rollforward pending state. 
  • Table spaces are in a normal state.
  • A database does not contain user-defined types (UDTs) with the name XML, DATALINK, BINARY or VARBINARY.
  • A database does not have orphan rows in system catalog tables.
  • A database enabled as an HADR primary database allows successful connections.
  • A database role is not standby for an HADR primary database.
  • If SYSCATSPACE is a DMS table space and AUTORESIZE is not enabled, SYSCATSPACE has at least 50% free pages of total pages.
  • A database must pass all of these checks to succeed at the migration process.
  • The db2imigr calls the db2ckmig command. The db2imigr fails if the db2ckmig command finds any of the conditions listed above are not true, and returns the DBI1205E error code.

 



  • Prerequisite: Ensure that you have SYSADM authority.

 


And the instance should be in stop mode(db2stop),for the db2ckmig


 


db2iupdt---Used to Update the instance(Migration of instance)


After updating of instance with this command use ipclean(used for system resource cleanup)


 


 


 


 


 


 


 


 


 


 


 


 


 


0 comments: