You normally upgrade the database before the SAP system. In a DB2 data sharing environment you can upgrade the DB2 version with minimal downtime for the SAP system.
The first step in a DB2 release upgrade is to run a DB2 catalog maintenance utility to upgrade the DB2 catalog structure to the new release level. This allows different releases of DB2 (for example, DB2 V5 and DB2 V6) to share the catalog in toleration mode. This step can take up to 30 minutes and the SAP system is down during this period.
You can then start the SAP system again andupgrade each member of the data sharing group separately without downtime for the SAP system. The SAP application server that is connected to this member can switch over to another member of the data sharing group. See also Data Sharing for DB2 UDB for z/OS.
SAP Database Administration Guide for SAP NetWeaver on IBM DB2 UDB for z/OS