Monday, April 8, 2013

DB2 Backup And Restore


Backup

CONNECT TO WCDB USER user_name USING passwd
QUIESCE DATABASE IMMEDIATE FORCE CONNECTIONS
CONNECT RESET
BACKUP DATABASE WCDB USER user_name USING passwd TO "C:\backup\db" WITH 2 BUFFERS BUFFER 1024 PARALLELISM 1 WITHOUT PROMPTING
CONNECT TO WCDB USER user_name USING passwd
UNQUIESCE DATABASE
CONNECT RESET


Restore

CONNECT TO WCDB USER user_name USING passwd
QUIESCE DATABASE IMMEDIATE FORCE CONNECTIONS
CONNECT RESET
RESTORE DATABASE WCDB USER user_name SING passwd ROM "C:\backup\db" TAKEN AT 20121219113159 WITH 2 BUFFERS BUFFER 1024 PARALLELISM 1 WITHOUT PROMPTING
CONNECT TO WCDB USER user_nameUSING passwd
UNQUIESCE DATABASE
CONNECT RESET

Sample Troubleshooting Sequence From getData Tag To Search Profile


-- In ProductDescription_Data.jsp

<wcf:getData 
type="com.ibm.commerce.catalog.facade.datatypes.CatalogNavigationViewType"
var="catalogNavigationView"
expressionBuilder="getCatalogEntryViewAllWithoutAttachmentsByID"
varShowVerb="showCatalogNavigationView"
maxItems="1"
recordSetStartNumber="0">

<wcf:param name="UniqueID" value="${productId}"/>
<wcf:contextData name="storeId" data="${WCParam.storeId}" />
<wcf:contextData name="catalogId" data="${WCParam.catalogId}" />
</wcf:getData>

-- In get-data-config.xml this expression builder uses access profile IBM_Store_All
<expression-builder>
<name>getCatalogEntryViewAllWithoutAttachmentsByID</name>
<data-type-name>CatalogNavigationView</data-type-name>
<class>com.ibm.commerce.foundation.internal.client.taglib.util.UniqueIDsExpressionBuilder</class>
<method>formatExpression</method>
<param>
<name>template</name>
<value>/CatalogNavigationView[CatalogEntryView[(UniqueID=)]]</value>
</param>
<param>
<name>searchProfile</name>
<value>IBM_findCatalogEntryDetailsWithComponents</value>
</param>
<param>
<name>accessProfile</name>
<value>IBM_Store_All</value>
</param>
</expression-builder> 

-- In wc-component.xml this access profile is mapped to search profile IBM_findCatalogEntryAll (based on the logs this seems to be the search profile used, not IBM_findCatalogEntryDetailsWithComponents)

<_config:configgrouping name="AccessProfileToSearchProfileMapping">
<_config:property name="IBM_Store_Summary" value="IBM_findCatalogEntrySummary"/>
<_config:property name="IBM_Store_Details" value="IBM_findCatalogEntryDetails"/>
<_config:property name="IBM_Store_CatalogEntryAttachments" value="IBM_findCatalogEntryAttachments"/>
<_config:property name="IBM_Store_CatalogEntryDetailsWithAttachments" value="IBM_findCatalogEntryDetailsWithAttachments"/>
<_config:property name="IBM_Store_CatalogEntryDetailsWithComponentsAndAttachments" value="IBM_findCatalogEntryDetailsWithComponentsAndAttachments"/>
<_config:property name="IBM_Store_CatalogEntryDetailsWithMerchandisingAssociations" value="IBM_findCatalogEntryDetailsWithMerchandisingAssocDetails"/>
<_config:property name="IBM_Store_All" value="IBM_findCatalogEntryAll"/>
<_config:property name="IBM_Store_CatalogEntryPrice" value="IBM_findCatalogEntryPrice"/>
<_config:property name="IBM_Store_CatalogEntryPriceWithAttributes" value="IBM_findCatalogEntryPriceWithAttributes"/>
</_config:configgrouping>

-- In wc-search.xml this search profile is defined

<_config:profile extends="IBM_findCatalogEntryDetailsWithComponentsAndAttachments" name="IBM_findCatalogEntryAll">
<!--  The search profile used to fetch the details of associated catalog entries. -->
<_config:param name="catalogEntrySearchProfile" value="IBM_fetchRelatedCatalogEntryDetailedInfo"/>
<_config:result inherits="true">
<_config:filter classname="com.ibm.commerce.catalog.facade.server.services.search.metadata.SearchCatalogEntryMerchandisingAssocResultFilter"/>
</_config:result>
</_config:profile>


To use custom attribute usages customize:
com.ibm.commerce.catalog.facade.server.services.search.metadata.SearchCatalogEntryViewAttributesResultFilter

Friday, April 5, 2013

Log BOD XML For Troubleshooting

Enable logging for:
com.ibm.commerce.foundation.server.command.bod.BusinessObjectDocumentProcessor

Wednesday, April 3, 2013

Display/Retrieve store relationships involving a particular store

DB Query

select s1.identifier as store, s2.identifier as relatedstore, sr.name
from storeent s1, storeent s2, storerel s1_s2, streltyp sr
where s1.storeent_id=s1_s2.store_id
    and s2.storeent_id=s1_s2.relatedstore_id
    and (s1_s2.store_id=STORE_ID or s1_s2.relatedstore_id=STORE_ID)
    and store_id<>relatedstore_id
    and sr.streltyp_id=s1_s2.streltyp_id
;