Thursday, January 29, 2015

Backing up your database using Oracle Database backup as Service

Oracle Database backup as service is a public cloud service from oracle to store oracle db backups.

This service is typically helpful to store your database backups at an off site location. This service helps you to access the backup over the internet and recover when required.

The backup store in the remote location is replicated across many systems which helps our customers against corruption or failed database etc.

Also with features like encryption  the data is secured too.

The basic steps to user this service is as follows.

Note: I am using Oracle DB as service as my database instance to backup. You can also follow the below steps to backup your local database.

Putty to Cloud Instance using oracle user.
1.      Copy Jar file from your local system to Oracle public cloud instance.
C:\Program Files (x86)\PuTTY>pscp.exe -i D:\Oracle_Cloud\xxxOPC.ppk d:\downloads\opc_installer\opc_install.jar oracle@x.x.x.x:/home/oracle
2.      Login/Putty into Oracle Public Cloud instance using oracle user.

3.      Confirm the environment, by executing the below commands..
a.      echo $ORACLE_HOME -> This has to be set
b.      java -jar version -> Req 1.5+ version
c.      java –jar opc_install.jar -> You can execute this command to see what are the various parameters required to execute this. We will be running this command again with necessary parameters.

4.      Execute bellow command

java -jar opc_install.jar -serviceName serviceName -identityDomain inoracleXXXXX -opcId username -opcPass cloudinstancepassword -walletDir /home/oracle/opc/wallet -libDir /home/oracle/opc/lib

If these directories /wallet or /lib is not created, please create them.

5.      On Executing of the above command, some files like libopc.so, opcSID.ora & cwallet.sso files are created. These files would be used with RMAN for backup/restore of your database. The below is output of command generated at step#4
Oracle Database Cloud Backup Module Install Tool, build 2014-09-04
Oracle Database Cloud Backup Module credentials are valid.
Oracle Database Cloud Backup Module wallet created in directory /home/oracle/opc/wallet.
Oracle Database Cloud Backup Module initialization file /u01/app/oracle/product/12.1.0/dbhome_1/dbs/opcORCL.ora created.
Downloading Oracle Database Cloud Backup Module Software Library from file opc_linux64.zip.
Downloaded 23169388 bytes in 0 seconds.
Download complete.


6.      Execute RMAN command on the console

7.      Connect to target database
RMAN> connect target /

8.      Configure RMAN using below command. 

9.      RMAN>
CONFIGURE CHANNEL DEVICE TYPE sbt PARMS='SBT_LIBRARY=/home/oracle/opc/lib/libopc.so, SBT_PARMS=(OPC_PFILE=/u01/app/oracle/product/12.1.0/dbhome_1/dbs/opcORCL.ora)';
Output of the above Command
Using target database control file instead of recovery catalog
Old RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' MAXPIECESIZE 2 G FORMAT   'cloudstorage_%d_%U' PARMS  'SBT_LIBRARY=libopc.so, ENV=(OPC_PFILE=/u01/app/oracle/product/12.1.0/dbhome_1/dbs/opcORCL.ora)';
new RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS  'SBT_LIBRARY=/home/oracle/opc/lib/libopc.so, SBT_PARMS=(OPC_PFILE=/u01/app/oracle/product/12.1.0/dbhome_1/dbs/opcORCL.ora)';
new RMAN configuration parameters are successfully stored
10.   RMAN> SET ENCRYPTION ON IDENTIFIED BY 'ppwd' Only;
11. RMAN> BACKUP DEVICE TYPE sbt DATABASE;

You should be able to see backup complete command on execution of above command.
The amount of time taken to backup a local database to cloud depends upon size/bandwidth of your database & network connection.

Hope this helps.

You can refer to Oracle Documentation for more details.

Using Putty PSCP With Private Key

To trasmit a file from your local machine to remote machine using PSCP command having a private key, the below command can we very useful

c:\putty\pscp.exe -i D:\Oracle_Cloud\xx.ppk C:\Users\xx\Downloads\sample.txt opc@p    x.x.x.123:/home/xx

Tuesday, October 7, 2014

Clearing data in DataObjects with BAM 12c

I was recently facing an issue in which I was not able to delete data within dataobjects in BAM due to BAM 12c bug.

BAM 12c provides BAMCommand utility, which is just like iCommand in 11g.

To delete data in data objects in BAM 12c, we to do following steps

1. Go to FMW_HOME/soa/bam/bin/
2. Edit BAMCommandConfig.xml with your BAM Configuration
3. Set Java_Home
4. Execute the below command to delete data within data object

 ./bamcommand -cmd clear -name "DataObjectName" -type dataobject


where DataObjectName is name of your data object. 

On Executing the above command, you would be promoted to provide server credentials.

Similarly you can also export BAM objects using the below command

./bamcommand -cmd export -type all -file "home/zzz/test.zip"

Monday, August 25, 2014

Unlocking User in Oracle

SQL> connect sys as sysdba
Enter password:
Connected.
SQL> ALTER USER hr identified by hr ACCOUNT UNLOCK;
User altered.
SQL>

Tuesday, July 29, 2014

Getting Started with Arduino - Hello World





Component I used

1. Arduino Uno Board
2. Led
3. Arduino Development IDE


Every Arduino program has 2 basic functions which forms the structure of the arduino

void setup() {
} //Invoked only once

void loop() {
} //Invoked multiple times.


This program is going to blink the LED .i.e. ON-OFF-ON-OFF-ON-OFF.

Though the Arduino board has a builtin resister and led into the board. For the purpose of this blog, I am going to use external LED



1. Connect the Anode (long leg) part of Led to pin 13 & connect cathode to ground as shown in the below image.




2) Upload the below program to arduino using development kit



void setup() {
  pinMode(13, OUTPUT);
 
}

void loop() {
  digitalWrite(13, HIGH);
  delay(1000);
  digitalWrite(13, LOW);
  delay(1000);
}


You should now able to see the LED going on-off-on-off every 1 second.

Though this is not the best way to blink the LED. The current circuit is supplying 5v to LED which is too much. Ideally, you will connect the resister with 220ohms and do the blink.


Internet of Everything

I have been working with Computers since my childhood.  Have always been working on programming languages like C, C++, Java, Middleware and so on. In short, I have been on the other side of technology .i.e. Softwares!!.

Internet of Everything is all about connecting physical world to desktop computers. With resources like never before, it is now quite easy to connect your daily machines with Computers. For instance connecting your table lamp to your mobile such that mobile can control the on/off.

So finally I decided to get my hands dirty and get all necessary resources for connecting the physical world with Computers.

There are many options to start with.

1. Arduino (http://www.arduino.cc/)
2. Rasberry Pie
3. Beaglebone

All 3 are great way to get started. I choose Arudino, because it was

1) cheaper
2) has great community
3) easy to work with
4) great way to start with Prototypes.
5) Open Source

I got started by buying Arduino Starter Kit (http://arduino.cc/en/Main/ArduinoStarterKit) which costed me about 100$. I bought the kit from http://www.tannaeducation.com/

Word of Caution: You can start with Arduino with less than 100$ too. If you happen to buy individual components, I think, you can create a starter kit by yourself which is far more cheaper. But as I was not sure what components i need, i decided to go with the available starter kit.


Wednesday, July 23, 2014

Installing Oracle BPM 12c

There has been considerable changes in Oracle SOA/BPM product starting 12c. This post focuses just on the installation of BPM 12c.

Comparing it to its predecessor 11g, BPM 11g required users to install

Oracle DB or Oracle XE
Oracle Weblogic
Oracle SOA/BPM Related tables - RCU
Oracle SOA
Oracle OSB
Oracle JDeveloper.

In short to install BPM, we had to install all of the above components individually. Starting 12c the whole installation step has become very simple. The whole of the above installation can be done with single file download which is like 3.5 gb.

To Install, follow the below instructions

1. Download a copy of BPM 12c from the below location

http://www.oracle.com/technetwork/middleware/bpm/downloads/index.html?ssSourceSiteId=opn

Note: There is a simple download for SOA 12c which does not include the BPM component. Rest remains the same.


2. Go to the folder location where you downloaded the file and unzip it.

3. Run the below command from the command prompt.
java -jar fmw_12.1.3.0.0_bpm_quickstart.jar

You should extracting jar.... and the installer should open up.


4. Click Next to Continue.


5. Chose the desired location.


6. Pre-req check screen


7. Installation Summary Screen


8. Installation Progress Screen


9. Installation Success Screen.

10. Once the installation is successful, you should see JDeveloper 12c opening up.


Sunday, May 12, 2013

Getting list size in fatwire.

A cleaner way to get the size of a list in fatwire is as below.


<ics:listget listname="sortedlist" fieldname="#numRows" output="numRowsOut"/>
<ics:getvar name="numRowsOut"/>



Wednesday, April 24, 2013

Flex Filters


What is Flex Filter?

Flex filter is a post processor for an asset.  The filter is invoked whenever the asset is saved/edited.

Some common usages of flex filter are
  • Image Processing: For instance, you may have a image of a particular resolution. You can write a flex filter, which creates images of different resolutions
  • Document: For instance, you may have an article asset, and a flex filter for it, which creates corresponding txt files or PDF files.

You can get more details on the flex filter Webcenter Sites 11g Developer guide.  The idea of this writeup is to help you guys to to implement a very simple flex filter.

For the purpose of this, we are assuming that 
  • 3 fields(firstname, lastname, username) are already created for your site
  • We have a sample asset definition with 2 fields (firstName, lastName), We will be writing a simple flex filter to have 3 field named username. The filter is append "_Username" to the value of firstName field. For instance if firstname is "John", then when you save the asset, the filter will add a value of "John_Username" to username attribute.


Implementing a flex filter 4 step process
  1. Create custom flex filter class
  2. Register flex filter
  3. Create flex filter asset
  4. Assign the flex filter asset to any other asset



Create Customer Flex Filter
  1. Create a custom class that implements AbstractFlexFilter
public class DemoFilter extends AbstractFlexFilter {
}

b.      Implement the below 2 mandatory methods
public void filterAsset(IFilterEnvironment env, String identifier, FTValList fList, IFilterableAssetInstance instance) throws AssetException;

This is the main method which will have your logic. For our example, this method, will get the value of the inputfieldname(firstname in our case),  and set the username field with the updated value.


public FTValList getLegalArguments(IFilterEnvironment arg0, String arg1) throws AssetException;

This method is invoked to populate the combobox after selecting the filter or clicking getArguments


package com.demo;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

import COM.FutureTense.Interfaces.FTValList;

import com.openmarket.basic.interfaces.AssetException;
import com.openmarket.gator.flexfilters.AbstractFlexFilter;
import com.openmarket.gator.interfaces.IFilterEnvironment;
import com.openmarket.gator.interfaces.IFilterableAssetInstance;
import com.openmarket.basic.interfaces.IListBasic;

public class DemoFilter extends AbstractFlexFilter {

private String Filter_Attributes[] = {  
   "Input Attribute" 
  , "Output Attribute" 
  };

private Map<String, String> filterParameters = null;

public DemoFilter(FTValList ftvallist) {
super(ftvallist);
filterParameters = new HashMap<String, String>();
System.out.println("DemoFilter Constructor: " + ftvallist);

//If any parameter is required to be passed during filter registration, we can fetch the parameters from filter table
if ( ftvallist != null) {
System.out.println(ftvallist);
Set<String> entries = ftvallist.keySet();
for ( String key : entries ) {
filterParameters.put(key, ftvallist.getValString(key));
  }

}

@Override
public void filterAsset(IFilterEnvironment env, String identifier,
FTValList fList, IFilterableAssetInstance instance)
throws AssetException {
String value = null;
System.out.println(instance.getAssetID() + ":" + instance.getAssetID());        
        // Put some interesting information in the log. 
System.out.println(identifier+" SampleFlexFilter filterAsset :" 
+" FilterType="+env.getFilterType()
+", AttributeType="+env.getAttributeType()
+", AssetTypeName="+instance.getAssetTypeName()
+", GroupTypeName="+instance.getGroupTypeName()
);
 
//Get the attribute details... When filter asset is created, we specify the name of the inputfield & output field... In this case inputfield is set as "firstname" and output field is set as "username" 
String inputattr = getAttrID(env, fList, Filter_Attributes[0]);
System.out.println(4 + ":" + inputattr + " : " + Filter_Attributes[0]);
IListBasic ilistbasic = instance.getAttribute(inputattr);
if ( inputattr != null && ilistbasic != null && ilistbasic.hasData() ) {
try {
value = ilistbasic.getValue("value");
}
catch ( NoSuchFieldException e) {
System.out.println("SampleFlexFilter : NoSuchFieldException");
}
}
if (value == null) {
throw new AssetException("Value cannot be blank");
}
// Create the derived attribute using the attribute name and the string values 
// that were initialized above.

System.out.println("filterParameters: " + this.filterParameters);

        instance.addDerivedDataValue(identifier
        , env.getAttributeIdentifier(fList.getValString(Filter_Attributes[1]))
        , value + "_user");   

}

@Override
public FTValList getLegalArguments(IFilterEnvironment arg0, String arg1)
throws AssetException {
FTValList ftvallist = new FTValList();
ftvallist.setValString(Filter_Attributes[0], Filter_Attributes[0]);
ftvallist.setValString(Filter_Attributes[1], Filter_Attributes[1]);
return ftvallist;
}



}



Register flex filter

Once you have your flex filter implementation is in place, the next step is to create the jar and put it in /cs/web-inf/lib folder and then register the filter in your sites. To register the filter, you may use sites explorer and add a new row to the filter table as shown below.








Once you complete this step, make sure to restart your wc sites.

Create flex filter asset
On successful registration of the flex filter asset, you create a flex filter asset using WC Sites admin console for your site. For this create a new filter, and chose the filter you created from the dropdown and click on getArguments.

As you can see, this retrieves the arguments that is required for this filter. As you may have noted that "getArguments" invokes getLegalArguments method from the flex filter class that you created.

There are 2 parameters which are required for this filter. Input Attribute (which is firstname) and Output attribute(which is username). Both firstname & lastname are attributes that should have been created in your site.




Assign the flex filter asset to any other asset

Assign the filter to a asset definition. In this example, I have created a asset defnation named "Sample Asset". This is 2 attributes (Firstname & lastname), apart from this I have assigned the filter that I have created.




Test your filter
Create a new sample asset using contributor interface. Give all the required values

Name: Demo Content
firstName: John
LastName: Corner

Save the attribute.

Open the asset in read only mode, You should be able to see username field with value "John_Username".





The code for this example is also being attached with this tutorial. Please feel free to add your comments for any questions.

The jar that may be required with this project would be 
  1. gator.jar
  2. cs.jar
  3. xcelarate.jar
  4. basic.jar
  5. framework.jar
  6. cs-cache-1.2.2.jar







Wednesday, April 3, 2013

OSB SOA Direct

This sample illustrates the implementation of asynchronous communication between two BPEL processes, with an OSB in between. Though this communication can be done using SOAP messaging, but for the purpose of this sample, I will be using new SOA-Direct transport which is available in 11g. It should be noted that the SOA-Direct transport is used in cases where, it is required to propagate transaction contexts between OSB and SOA Suite.

Please download the attached PDF for the step by step tutorial.

How do I render attribute from a page on a template

The other day I was trying to use the below code to get page attributes on template

<asset:get name="theCurrentPage" field="customField" output="assetname"/>
<ics:getvar name="assetname"/>

Unfortunately, it did not work,

Then the other way to do the same stuff which I was trying to achieve was this

<assetset:setasset name="pAsset" type='<%=ics.GetVar("c")%>' id='<%=ics.GetVar("cid")%>'/>

<assetset:getattributevalues name="pAsset" typename="PageAttribute" listvarname="pageAList" attribute="pagebody" />
<ics:listget fieldname="value" listname="pageAList" output="theCurrentAssetCopy"/>

which worked.

So whats the difference in the above 2 approaches.

The approach one is used/works only for system generated fields like name. The 2nd approach works for custom defined fields too.

Monday, October 29, 2012

TOGAF 9

Today, I attempted TOGAF 9 - Combined and secured 85%..

Resources I used:

1. TOGAF Foundation 9 study guide (http://www.amazon.com/TOGAF-Version-Foundation-Study-Guide/dp/9087532318/ref=sr_1_4?ie=UTF8&qid=1351501240&sr=8-4&keywords=TOGAF+9+BOOKS) - Part 1

2. TOGAF Certified 9 Study Guide (http://www.amazon.com/TOGAF-Certified-Study-Guide-Edition/dp/9087536801/ref=sr_1_5?ie=UTF8&qid=1351501240&sr=8-5&keywords=TOGAF+9+BOOKS) - Part 2

3. TOGAF Pocket Guide (http://www.amazon.com/TOGAF-Version-9-1-Pocket-Guide/dp/908753678X/ref=sr_1_7?ie=UTF8&qid=1351501240&sr=8-7&keywords=TOGAF+9+BOOKS) - For Revision

PS: Pocket Guide is combination of 1 & 2 points

To pass part 1, the foundation 9 study is more than sufficient or the pocket guide is sufficient too. This exam for too easy. Lot easier than what I had expected.

The part2 was not so easy as I had though. The exam is definitely not straight forward and tests your understanding on TOGAF 9 concepts.

In addition to the above material, make sure you go through the Content Meta Model and Architecture Artifacts in details. You can get this material in Chapter 34 & 35 of the specification.

There are lot of mock exams available on the internet. The mock exam given at the back of the study guide, gives you good idea about the real exam. Other mocks are available at http://theopenarch.com/. The part2 mock  given in the above site, is lot easier that what you could get in your real exam.


Though I had prepared TOGAF using mixed resources, but the following are the areas that one should concentrate

1. TOGAF Artifacts like Solution Concept Diagram/Value Chain Diagram/Business Interaction matrix and so on. Chapter 35 of the spec gives all the details.

2. TOGAF Governance Process

3. TOGAF Review process

4. Content Framework

5. Skills Framework.

Though I felt, most the answers to the question was largely based on common sense. Those who of read the TOGAF material at least once, will know which answer is not TOGAFish.

Though you can use the spec in 2nd part of the exam, but I hardly did so. as there were no direct question.

Monday, October 22, 2012

Creating Content Repository connection thru J Developer

Creating Content Repository connection using jdeveloper.

 1. Make sure UCM is running.


2. Open J Jdeveloper, Click on Application Resources -> Connections -> New Connection -> Content Repository.

3. Give your content server details. By default the socket server port is 4444. It should be noted that the socket server port is different that the one which you see in admin console. 






4. Click Test Connection. This should show the content server connection as success. If not, one of the reason is that the socket port is not enabled.  I have tried this is jdeveloper PS 5. I get the below error.


5. To enable the socket, go to your servers em console. Go to WebCenter->Content-Content Server->Configuration

6. Make sure Intradoc server port has a value of 4444 or whatever port you want.



7. Save the settings and restart your content server.

8. Try "Test Connection" again from your jdeveloper, you should get a success

Happy Learning!!