Wednesday, November 23, 2011

Sell Covered calls and Secured Cash puts

Tuesday, November 22, 2011

Credit Card Offers

Need everyone to chip in on this lucrative offer. I just found out this new credit card offer from continental.com. It says apply for a new credit card and get 40,000 miles with no fee for the first year.

http://www.continental.com/web/en-US/content/products/chase/continental.aspx?v_ctrk=HBAN2$0-916-2365-1-1348&offer=OPP40K&mkid=6S2B

40,000 miles should be good enough for one-round trip within continental US. Round-trip ticket these days could be worth upto $500.

There could be similar offers out there which are as good as this one if not better.

Could anyone comment on what are downsides of taking this offer and closing the account in less than 1 year to avoid the annual credit card charges?

I would love to hear from your experience on similar offers like this one. So, keep them coming.

Friday, November 18, 2011

Peoplesoft Search Keys

I have taken a very simple topic today but yet a very important one. Whenever we create any custom objects in Peoplesoft, be mindful of the Keys and Alt Search keys you choose, since every column that has been identified as a key, will end up creating an additional index.

Every index is a lot of overhead on INSERT/UPDATE and DELETE statements. So, choose the KEYS carefully and only what is really needed. I have seen objects with 28 Keys that essentially means an index with 28 columns, which would obviously be no good as an index.

Additionally, every ALT search keys would create additional indexes on that objects. This would be even worse. You will take a big performance hit if you have more indexes than needed. 

Tuesday, November 15, 2011

PeopleSoft ReUse Statement AE


The ReUse statement setting on an Application Engine is a great way to increase performance. It’s useful when you have a SQL object that is called multiple times, for instance when you have a DoSelect that runs a SQL Step repeatedly, substituting different Bind variables in each time.
The default setting for ReUse is ‘No’, which means that each time the SQL Step is called it is recompiled and new execution plan generated, bad news if the SQL has to run a large number of times. With the default setting of 'No', a new SQL statement is generated which needs to be parsed and stored in 'Shared Pool' for every row that satisfies the DoSelect loop. This is like thrashing the shared pool literally. You should see some 'wait events' on latches in the shared pool that clearly would mean, the performance is getting degraded. If the ReUse setting is ‘Yes’ then any %Binds in the SQL statement are converted into ‘:1’, ‘:2’ etc. This means the statement can just be compiled once and the same plan used each time, resulting in really quite dramatic improvements in processing time.
This is a very simple and low hanging fruit but yet this would result in dramatic performance improvements. 

FULL Table Scan(DB file Scattered read) Vs INDEX Scan(DB file sequential read)

DBAs and Developers often look at FULL Table Scans or INDEX scans happening within their database and code respectively. It is often assumed that FULL Table Scan would make the SQL statement perform slower.

Let us try and clear this misconception. 
FULL Table Scan(DB file scattered read) is not necessarily an expensive operation as compared to INDEX scan. It all depends on what the SQL is trying to do. If the SQL statement is returning more than 10% of the total volume in the table, FULL Table Scan is actually faster than Index Scan. This is because an index is scanned one block at a time whereas in-case of FULL Table Scan, multiple blocks, as determined by 'DB_file_multiblock_read_count, are fetched and read into the memory.

In a nutshell, if the SQL statement serves more as a batch query rather than OLTP, FTS(FULL Table Scan) is actually faster than Index read.

The reverse is true in case of Online Transactions because your SQL statement is expected to return only a few rows.

Have a specific case to discuss, please leave a comment or reach me at munish07@gmail.com. I would be glad to answer. 

Sunday, November 13, 2011

SQL running long?

If you are an IT person, I am sure you know what I am talking about. You have a SQL statement or a program/job that you run every day and it completes in a few minutes but today it has been running for hours. Nothing has changed as far as you know. It is still supposed to process the similar amount of volume. No change in the code yet the SQL does not seem to be finishing.

The answer is simple. It's execution plan has changed. Your DBA should be able to confirm that or you could check it out yourself provided you know the hashvalue or the SQL_ID of the SQL in question.

Run the below SQL for the sql_id in question. Oracle optimizer generates a plan hash value for every execution plan it generates and executes. If you see different plan hash values for the same SQL hashvalue or SQL_ID, this will confirm that SQL statement plan has changed and hence it is running long.


select
inst_id,sql_id,plan_hash_value,child_number,executions,round(buffer_gets/executions,2)
"buffer_gets/exec" , cpu_time/1000000 "Cpu Time(s)",round(rows_processed/executions,2) "Rows",
elapsed_time/1000000 "Elpased Time(s)"  from gv$sql where
sql_id='&sql_id'

Once you know that SQL plan did change, you would obviously want to know, what are the new and the old execution plans.
Run the below SQL Statement from the SQL_ID in question and for each child_cursor taken from above sql.


select * from TABLE(dbms_xplan.display_cursor('&SQL_ID',&child_cursor,'PEEKED_BINDS'))

Have a question? Please leave a comment and I would be glad to answer.




Saturday, November 12, 2011

Should I buy an Investment Property?

Real estate does not excite now-a-days as much as it used to do a few years ago. We are hearing about so many under-water mortgages, foreclosures, sub-prime mortgages, etc that they is a huge fear among all of us to even talk about real-estate let alone buy it for an investment.

Mr. Buffet once quoted, 'Be fearful when others are greedy and be greedy when others are fearful'. The more I think about this line, the more I appreciate it. In-fact, I feel it is true in all investment vehicles and at all times. 

Let us dig more closely into it.Real-estate always goes through up-down cycle.  It simply means when everyone in the office, friends, family, news channel starts talking positive about something, it excites people into it. This creates such an artificial demand that prices start going through the roof. Still, there will be number of people who will profit from such a upswing in a very short amount of time yet no one can predict where we are in the cycle. On the other hand, when everyone in the office, friends, family, news channel starts talking negative about something, it spreads fear among us. Everyone wants to get out of that investment whether that is any stock, or real-estate. This drives down rates much faster. Fear and Greed overpower our thinking process in such times. 

If you are thinking about investing your hard-earned money into real-estate but you are fearful, sit back, relax your mind and just think logically. Plan your investment as to when you would need your money. If you are disciplined enough and can wait out the greed or fear cycle, you would definitely get a very good return on your investment. In today's real-estate market, there are tons of properties that you can buy and rent them out for no out-of-pocket expenses. I, myself, am doing that. I bought a foreclosed condo in 2009 and have since been renting it. I am earning close to $800/month(almost $10,000/year) after deducting all my expenses like real-estate tax, condo fees, Landlord insurance, and other expenses. After renting it out for just 1.5 years, I recovered all of my total investment from the rental income itself. If I sell it after say 5 years at the same price that I bought it for, I would have made a handsome return of  20% annually. Keep in mind that my initial investment was only $10,000 to buy this condo plus another $5000 towards closing and fixing some minor things in the house. There is every chance that in the next 5 years, real-estate prices will not only stabilize, but it would start going up. 

In a nutshell, when you want to invest any money, don't let fear or greed drive your thinking. Plan your investment strategy well, and stick to it. Learn to profit from others' fears. 

Would you like to share your investment experience? I would be happy to post your story on my blog for others to learn from it. 


Monday, November 7, 2011

Peoplesoft Architecture


Let us look at PeopleSoft Architecture in easy to understand terms. 





Broadly speaking, PeopleSoft has 5 main components to support it's architecture.
a) Web Server:  it is a java-enabled web server to support browser transaction requests and the application messaging technology. It is also a collection of java servlets to handle wide range of PeopleSoft transactions. It is the web server that communicates with the client requests.


      b) Application Server: It executes business logic and issues SQL statements to the database. It consists of numerous services and server processes that handle transaction requests. It is also responsible for maintaining persistent connections with the databases. It is fair to say that application server is the heart of PeopleSoft Architecture.

      c) Database Server: It houses the database engine and PeopleSoft database. Database server can service many application servers. 
    
      d) Batch Server: It is the server where PeopleSoft Process Scheduler is installed and configured. It can be located on the same physical machine as the database server or on a dedicated machine or it can also be co-located with application server. 

      e) Application Designer: It is an integrated development environment that enables you to work with the numerous definitions of a business application in a single work area. In simpler terms, Application Designer is a tool that enables you to develop custom applications in PeopleSoft. 


      I can really go in a great detail for each of the above components or the architecture in general but I would love to answer the specific questions you have. Please leave your questions by posting a comment. I would promptly answer and cover them at great length.



Tuesday, October 18, 2011

How to cut your Debt?


You are fed up with your debt and want to start all over again? Tired of collection calls and worry about what would happen tomorrow? Tired of living pay day to pay day?

You are not alone. Each and every human being takes a debt atleast once in their lifetimes in one way or the other. The key to get out of debt is self-discipline. The best part about this is that you do not have to depend on financial advisor or some wall street guru or anyone else to get your life back on track. So, let us take a look at how it can be done.

Professionals often say that we should pre-pay our mortgage or you should keep paying the minimum due to the credit card companies but not the full amount due. Their argument is that if you have extra cash, you are better off investing in the stocks, bonds, real estate, gold etc etc for a better return rather than paying off your debt. 

Well, this is true in some cases who have enough cash to pay off their debt in a flash. For others like me, I would prefer to pay off any debt I have. Investing in the market in any instrument like stocks, bonds, precious metals, real-estate etc in no guarantee to get returns. Rather, we could loose that money pretty quickly especially in this volatile market. However, what is guaranteed is that we are paying interest on our mortgage every month until that is paid off. Most importantly, having no debt on your shoulders, just changing your life. It gives you confidence to try out new ventures and in your abilities to manage your debt.

Let us consider a very simple example. Banks lend us money at a mere 3.5%-4% these days. Banks are guaranteed to keep collecting 3.5-4% interest on the their loans every month in the normal situation. If there are 10 such loans they are guaranteed on collect 35-40% income on their investment.
Banks have enough smart people working for them. If we were to follow the so-called financial experts, banks should not make lend money on just 4% rather they should invest in hot items like stocks, bonds and real-estate and that will generate a very high return.

Guess what! Banks followed their advice in 2008 and we all know what happened.

Again, There are no guarantees on the returns in any investment. However, any interest charges/late charges etc are guaranteed every month if there is any outstanding dues against you.

So, save some money every month and focus on reducing or eliminating your debt before we start investing. You will have more success and more favorable results.

Have a question? Please leave a comment and I would be glad to answer.







Should we worry about income taxes?

Are income taxes really too high? Should we be worried about income taxes? Should we focus on ways to reduce income taxes?

There is enough debate on personal and business income taxes these days on almost all the news channels and websites. They have now become a talk point for the upcoming elections.

Should we really be scared about our taxes and focus on findings ways to reduce our taxable earnings and thus focus on getting in on the lower tax bracket. Well, I don't think so.

We pay income taxes only if we are making a profit. That is the first principle. So, let us assume that we are making $100 in profit and we are in 20% tax bracket. That means for every $100 we generate in profit, we keep $80 and give away $20 in taxes.

So, should we focus on saving $20 somehow by findings loop holes in tax codes, manipulating our expenses and somehow lowering our tax brackets or should we focus on generating hundreds more in profits thus keeping $80 for every $100.

If I were to choose, I would certainly focus on growing my business to be able to keep $80 out of every $100 I generate in revenue. Even if my tax goes to $30, I am still keeping $70 out of every $100, I am generating in profits.

So, unless my taxes are more than 51% of profits, I would still focus on growing more earnings for my family. Simply because, controlling taxes is not in my hands but exploring ways to generate more income certainly is.


Taxable Earnings
Tax Bracket
Taxes
After Taxes
100000
20
20000
80000
110000
22
24200
85800
120000
24
28800
91200
130000
26
33800
96200
140000
28
39200
100800
150000
30
45000
105000

As we see clearly, With more earnings, the tax bracket went up and so did the taxes. When we had $100,000 as taxable earnings, we were paying $20,000 in taxes. When we jumped to $150,000, our taxes went to $45,000.
However, the key point here is that when we had $100,000 in earnings, we took home only $80,000. When our business did good or we got promoted resulting in earnings to $150,000, we took home $105,000 which is a lot more than $80,000.

To conclude, I would prey for my income tax to increase and not decrease. Because if my income tax has increased, that simply means my income has grown too. I have more money to keep now.

I know we can go on and on on this topic but I would just say it is the way we look at things in our life. Opportunity comes in difficult times. Rather than getting depressed about the rise in income tax, I think about ways to add more income and writing blogs is one way to do that :)



Tuesday, September 27, 2011

Peoplesoft: Slow data conversions

Are your data conversions running longer and longer?

There is a simple fix you can do to make it go faster. Let's discuss it here.

Let us look at the basic conversion process in any environment.

Flat Files -> Staging tables -> ERP tables.

This is how the typical conversion happens. We get the flat files from legacy the system. We load the data from the flat files to the staging tables using data loading utility like SQL Loader or any other tool.
Once the staging tables are populated, we apply business validations and business logic to make sure we have clean data. Finally, we insert the data into the ERP Tables.

In the above process, the use of the STAGING tables cannot be undermined but their use is only limited. The STAGING tables will not be used once the data is converted. The ERP application is never going to use the staging tables. So, by dropping the unnecessary indexes on these staging tables, we can easily improve the performance of the conversions by manifolds. In Peoplesoft, when we define ALT keys, Peopletools automatically create indexes on these keys that are often not needed as these staging tables are not going to be searched by the application.

Following the simple step described above, you are sure to make your conversions go faster by a factor that is dependent on the number of indexes dropped.

Have a question? Please leave a comment and I would be glad to answer.


Peoplesoft: Data conversions extremely slow

One of the most important but yet forgotten concept during data conversions is 'database statistics'. 

Object statistics give valuable information to the database optimizer to be able to generate the right execution plan for the SQL statements used in the conversions.
There are numerous ways that a given SQL statement can be executed.
For instance, you could reach nearest Starbucks or Subway from your home by taking a number of different roads/highways. Imagine, what would happen if you do not have the below critical information to get to your nearest Starbucks for your morning coffee.
  • Distance between your home and Starbucks
  • Condition of the various road
  • Traffic situation on these situations
You would not know which route to take to get there faster. You may end up taking the longest and slowest path.

Similarly, without the object level statistics, the database optimizer cannot decide how to execute the SQL statement in the most efficient manner. When we are dealing with conversions, we are dealing with millions or rows. So, the statistics become even more important.

In Peoplesoft, when we multi-thread a process, each thread works on its own instance of the base table. This instance of the table is temporary in nature meaning the data exists for the duration of the thread.
One of the first steps in the conversion is to gather statistics on the underlying objects like tables, and indexes once the initial INSERT statement is called to populate the STAGING tables.
This can be easily done in Peoplesoft by calling UPDATESTATS at the end of the INSERT statement. Another important point to remember here is to make sure to issue a COMMIT just after the INSERT and before the UPDATESTATS else, gather statistics would still run but would show 0 rows in dba_tables leading to incorrect execution path.

This simple step could save you countless hours in conversion and could save you a lot of hassles during the go-live. All the best for your go-live.

Have a question? Please leave a comment and I would be glad to answer.

Monday, September 19, 2011

Database Stats

Has it every happened to you that a given database table has thousands or millions or rows but dba_tables shows 0 rows once you generated the statistics on the table?
Does it ring a bell?

Here is a simple scenario to test.

Like it happens it most data conversions, records get inserted into a staging table from a flat file. However, if we generate statistics on this table before a commit happens, the statistics will get generated but it would show 0 rows.

Hence, we should generate database statistics only after commit has been issued on the table after massive data inserts/deletes/updates.

So, go back to your code and review the position of commit and the command to generate the statistics. Commit should happen prior to generating statistics.

Have a question? Please leave a comment and I would be glad to answer.

Monday, September 12, 2011

Peoplesoft: Mass delete the enrollment

There is a very easy way to mass delete the enrollment from a given class.

Go to Curriculum Management->Schedule of Classes->Maintain Schedule of Classes
Search for the required class
Go to Enrollment Cntrl tab.
Click on "Cancel if Students Enrolled" check box. It should be checked
Finally, change class status to "Cancelled Section".
This will delete all the enrollments for the given class.
If needed, you can make the class Active again.

This will drop all the existing enrollments of a given class. This is a quick way to drop everyone from the given class and start over.

Have a question? Please leave a comment and I would be glad to answer

Tuesday, September 6, 2011

Loadrunner Controller cannot connect to Load Generator

Loadrunner controller cannot connect to Load Generators?
Here are a few things to check.
1) All the load generators are in the same network as the controller.
2) Load generator agent service is running on all the generators
3) Very important to make sure Windows Firewall is turned off. Agent service cannot start if windows firewall is on
4) Good practice to start the agent service/process as Administrator.

You should be able to make a connection between controller and generators.
Have a question? Please leave a comment and I would be glad to answer.

Friday, September 2, 2011

PeopleSoft: PUBSUB down?

How do we find out if PUBSUB is up or down without asking Peoplesoft Admins or system admins?
Well, it is actually very simple if you have access to PeopleTools. Here is how.
PeopleTools->Integration Broker->Service Operations Monitor->Administration->Domain status
On this screen, you can see whether your PUBSUB domain is active or not, where it is configured to run and other useful information.

Have a question? Leave a comment and I would be glad to answer.

Peoplesoft HCM: Just opened a new job but not visible?

As a HCM functional reosurce, you just opened a new job in Peoplesoft but it is not visible on Find Jobs Openings? If this sounds familiar, you need to run verity search 'Build Job index' process.
This can be accessed from Recruiting->Administration->Build Job Index
Enter run control and  date when the job was opened and click Run.

Once it completes, the new job you created should be visible.
Have a question? Please leave a comment and I would be glad to answer.

Wednesday, August 31, 2011

Peoplesoft SACR security

SACR(Student Administration and Contributer Relations) security is Peoplesoft's way to implement Row Level Security. Using SACR, the Peoplesoft Admin can let the data that is visible to each user.
Though quite to set up but yet it is quite powerful. You can limit what the what students or faculty can see using simple SACR security set up.
You can limit the users to a specific Term, Institution, Acad Career, Campus and number of other parameters.
Navigation is simple enough
Home->set up SACR
Depending upon the requirement, you may secure Student Admissions or Student Financials or some faculty related data.

Have anything specific question? Leave a comment and I would be glad to answer

Tuesday, August 2, 2011

My query runs faster in SQL developer or TOAD?

As a DBA, I have heard this numerous times from my users that my SQL query runs faster in SQL developer or TOAD but it takes a long time when the same SQL query is running in the database or through an application.

There is a very simple explanation for this anomaly. These tools (SQL developer/TOAD) by default run for FIRST_ROWS. This means the goal of these tools is to simply return the first few rows as quickly as possible. Hence, these tools run with an execution plan that returns the first few rows quickly rather than all the data that the query satisfies. However, when the same SQL runs through the application, the goal is to show the complete result data which might be running with a different execution plan.

In order to get the realistic execution time, you should consider increasing the SQL Array Fetch size. Click on Tools-> Preferences-> Database->Advanced Parameters-> SQL Array Fetch Size.
Increase the array size to 1million. Now, when you run your SQL, it should take the same time as the application is taking.

Have a question? Please leave a comment and I would be glad to answer.

Monday, July 25, 2011

Watch Google to test 52Wk high

Have you looked at the Google Stock Chart lately? It is ready to test its 52Wk high of $642.96 that it set in Jan 2011. RSI is over 75 already as of 25th July, 2011. RSI indicates Google is in Overbought condition. To read more about RSI, please refer my earlier post available at http://gupta-munish.blogspot.com/2011/07/read-stock-charts-and-improve-your.html. If google does hit a new 52-wk high, consider shorting it or buying the PUT options since it would look to correct itself at any bad news. Moreover, it has created a huge gap between $590 and $560. Once the RSI goes above 80, it would be a good time to buy PUT options at a strike price of $600 for Aug 11.



Saturday, July 23, 2011

Read Stock Charts and improve your winning


There are four components that make stock a winner
  • Fundamentals of the company like company management, business model, margins etc
  • Sector performance to which the stock belongs to
  • Market conditions like investor sentiment, market outlook
  • Technical Indicators that we will discuss
Each of the above four components carry 25% weight towards making a particular stock a 'WINNER' or a 'LOSER'

Technical Indicators, in my opinion, are the easiest to read and often result in profitable trades.
While there are hundreds of technical indicators, I will discuss the most basic and the most important. So, let us start and understand more about it.



















To generate free Stock Charts for any equities, visit http://stockcharts.com/

In the  above chart, there are few indicators to understand as below
1) Relative Strength Index: It is intended to chart the current and historical strength or weakness of a stock or market based on the closing prices of a recent trading period.The RSI is classified as a momentum oscillator, measuring the velocity and magnitude of directional price movements. Momentum is the rate of the rise or fall in price.The RSI is most typically used on a 14 day time-frame, measured on a scale from 0 to 100, with high and low levels marked at 70 and 30, respectively. Definition taken from http://en.wikipedia.org/wiki/Relative_Strength_Index
The point to note here is that when RSI gets over 70, it is known as OVERBOUGHT condition whereas when the RSI falls below 30, it is known as OVERSOLD.
OVERBOUGHT and OVERSOLD are good signals to EXIT and ENTER the trade respectively as his visible in the chart.

2) MACD: It is used to spot changes in the strength, direction,momentum, and duration of a trend in a stock's price.The MACD is a computation of the difference between two exponential moving averages(EMAs) of closing prices. This difference is charted over time, alongside a moving average of the difference. The divergence between the two is shown as a histogram or bar graph.
Exponential moving averages highlight recent changes in a stock's price. By comparing EMAs of different periods, the MACD line illustrates changes in the trend of a stock. Then by comparing that difference to an average, an analyst can chart subtle shifts in the stock's trend.
Since the MACD is based on moving averages, it is inherently a lagging indicator. As a metric of price trends, the MACD is less useful for stocks that are not trending or are trading erratically.
The point to note here is that when the MACD line crosses the signal line and starts moving up, that is a good time to ENTER the trade and vice-versa when the MACD line cross the signal line on the way down, that is a good to EXIT the trade.

3) Moving Averages: Moving averages act as SUPPORT and RESISTANCE for the price as shown in the chart. As you can see in the char, GOOGLE tried to cross 50-day MA from Mar 2011 to Mid June 2011 and it failed. 50Day Moving Averages acted as a RESISTANCE. But when it finally closed above 50DMA, it literally flew

So as you can see, technical indicators give us a lot of clues as to which direction the stock is headed. You can base your ENTRY and EXIT strategies based on these indicators and end up on the winning side.

Click http://www.stocktradingtogo.com/2007/04/30/stock-charts-understanding-the-basics/  to understand all the fields in the chart.

Have a question? Please leave a comment and I would be glad to answer.
If you find it useful, please feel free to share it with your friends and family.

Friday, July 22, 2011

How to track PeopleSoft Process Scheduler Requests

Someone ran a Process Scheduler request and as a PeopleSoft administrator, you want to find how to see that running in the database.

Here is a SQL statement to track the same.
select  b.sid,b.serial#,
prcsinstance,
prcstype,prcsname,
to_char(rqstdttm,'mm-dd-yy hh24:mi:ss') Start_Date,
oprid,
decode(runstatus,1,'Cancel',
           2, 'Delete',
           3, 'Error',
           4, 'Hold',
           5, 'Queued',
           6, 'Initiated',
           7, 'Processing',
           8, 'Cancelled',
           9, 'Success',
           10,'No Success',
           11,'Posted',
           12,'Not Posted',
           13,'Resend',
           14,'Posting',
           15,'Generated') "Status",
origprcsinstance
from PSPRCSQUE a, v$session b
where runstatus='7'
and b.process=to_char(a.sessionidnum)
and b.client_info is not null

Expect the output as shown below.

    SID SERIAL# PRCSINSTANCE PRCSTYPE                      PRCSNAME     START_DATE        OPRID                Status     ORIGPRCSINSTANCE
------- ------- ------------ ------------------------------ ------------ ----------------- -------------------- ---------- ----------------
    917    8093       502333 COBOL SQL                      SFPGRPST     07-22-11 10:27:56 CNYADM               Processing           502333
   1806   60301       502320 COBOL SQL                      SFPGRPST     07-22-11 07:09:33 CNYADM               Processing           502320
   2688   33914       502324 Application Engine             CU_C_115A    07-22-11 09:55:13 CNYADM               Processing           502324
   1732    7710       502338 Application Engine             CU_C082C_TAX 07-22-11 11:07:10 CNYADM               Processing           502338
   1728    5964       502338 Application Engine             CU_C082C_TAX 07-22-11 11:07:10 CNYADM               Processing           502338

So, just in one screen, you can everything that is running along with database session to diagnose further.

Here is another SQL to check on the history for a given Application Engine request.
select
prcsinstance,
prcstype,prcsname,
to_char(begindttm,'mm-dd-yy hh24:mi:ss') Start_Date,
to_char(enddttm,'mm-dd-yy hh24:mi:ss') End_Date,
oprid,
decode(runstatus,1,'Cancel',
  2, 'Delete',
  3, 'Error',
  4, 'Hold',
  5, 'Queued',
  6, 'Initiated',
  7, 'Processing',
  8, 'Cancelled',
  9, 'Success',
  10,'No Success',
  11,'Posted',
  12,'Not Posted',
  13,'Resend',
  14,'Posting',
  15,'Generated') "Status",
origprcsinstance
from PSPRCSRQST 
where
prcsname like '&process_name%'
and begindttm > sysdate-3
order by 1 desc

You can enter the process name and also change the data(sysdate-3) to whatever you need.
This will give you the history of the process for the last three days.

Enter value for process_name: CU_INTR_THRD
PRCSINSTANCE PRCSTYPE                      PRCSNAME     START_DATE        END_DATE          OPRID                Status     ORIGPRCSINSTANCE
------------ ------------------------------ ------------ ----------------- ----------------- -------------------- ---------- ----------------
      502368 Application Engine             CU_INTR_THRD 07-22-11 13:39:52                   CNYADM               Processing           502368
      502362 Application Engine             CU_INTR_THRD 07-22-11 12:16:29 07-22-11 12:54:54 CNYADM               Success              502362

Please leave a comment if you have any specific question. I would be glad to answer that.

Thursday, July 21, 2011

Want to invest in stocks but don't know where to begin?

About eight years ago, I was asking this myself. I wanted to invest in the stock market but just did not where and how to begin. With all the buzz words around, it is easy to get puzzled. With 24*7 news channel speaking of Armageddon every day, it is easier to get scarred as well. However, stocks by far offer the best returns than any other investment considering the initial investment.

The beauty about investing in the stock market that you can begin with as little as $100. You don't have to be a PhD. in finance to make money in the stock market. Yes, the market will go up and down but if you choose your investments wisely, you should be just fine.

It was just three years ago in Oct-Nov 2008 when it looked like the 'End of World' is near. Dow Jones was down to low 6k and S&P 500 index was down to 660. 
Instead of getting scared of these time, don't you wish you had bought GOOGLE then at $250 or APPLE at $78 or CHIPOTLE at $40. There are so many great names that were trading at unbelievable discount. Don't we go shopping at such huge discounts. 

The fact is that media makes more money putting a grim picture as more people tend to watch the news. But the news channels over blow the issue by talking about it day in day out like debt ceiling and European debt fears. When we hear the same bad stories over and over again, we tend to believe in it.

So, consider stock market an investment option just like fixed deposits, investment property, gold etc.

In order to begin investing in stock market, the first thing you need to do is open a Brokerage Account. There are numerous firms that you can look at like Fidelity, Scottrade, Etrade, Bank of America etc.
Once the account is opened, start funding your brokerage account. You may choose to transfer every week, every month or every quarter or whatever frequency you like but invest only the amount you can afford to loose. In order words, if you were to loose every penny in your brokerage account that should not affect your day-to-day expenses. INVEST not GAMBLE

Options are a wonderful investing tool. You can follow the below link to learn the basics on options.
http://www.cboe.com/LearnCenter/Tutorials.aspx

Some investment strategies for beginners 
  • Invest no more than 60% of your funds at any time. For example, if you have $10,000 in your account, invest $6000. Keep the remaining $4000 for times like Oct 2008 or Mar 2009 or May 2011 when the market undergoes deep correction. 
  • Have no more than 3-4 equities in your account at any time. It is very difficult to track news on your portfolio if you have more equities.
  • Be diversified. For e.g, Technology sector, Materials, Finance etc. You should never have all the equities in your portfolio from the same sector
  • Buy the share of the best companies in their field. Even if the big names like google, apple, J P Morgan, Mastercard go down with the market, they recover quicker than others. You are less likely to incur huge losses. 
  • Set your targets with every trade. Before placing a trade, you should have a target for entering and exiting both on the up and the down side. 
I hope this will alleviate your fears. So, consider giving it a try
    Have a quick comment or a question? Please post it and I would be glad to answer.

    Wednesday, July 20, 2011

    CPU utilization at 100%; What is killing the database

    More often than not as a System Administrator or as a DBA, we run into situations where the host machine is running at 100% used CPU or 0% idle cpu.

    It is vital to find the processes rather quickly that are chewing up the CPU. On Solaris, we can use
    prstat command that is excellent to report the processes in the sorted order.
    prstat -s cpu -n 10
    The above command shows the top 10 CPU consuming processes.

    If indeed it is the memory that is running out, you can tweak the prstat command
    prstat -s size -n 10
    The above command shows the top 10 memory consuming processes.
    Once we find the top CPU or memory consuming processes, we can map those processes to the actual database session to see what really is happening in those sessions.

    select inst_id,module,status,sid,serial#,username,last_call_et
    from gv$session where paddr in ( select addr from gv$process
    where spid = &spid and inst_id=&inst_id)
    The above RAC enabled command shows what those sessions are, given the process id from prstat command.

    This is a quick method to get a handle on the processes that are killing the host machine.

    Have a question? Please leave a comment and I would be glad to answer.

    Real Estate! What's not to like?

    Afraid of buying a house in this economy? Think you will get stuck in a downward spiral?

    • Historically low Interest rates
    • Abundant of properties to choose from
    • Affordable prices
    • Ever increasing rents

    So, Think Again.

    Let's run some numbers. 
    Let's say you are buying a house for $200K with a 20%($40K ) down-payment.Your annual real estate tax may be around 1.5%($3000) and lets keep another $300/month for HOA fee.
    Let us look at your monthly expenses now
    • Mortgage expense: 160000@5%(current rate) = $860/month
    • Monthly Property tax payment: 3000/12 = $265/moth
    • HOA fees = $300/month
    Put together, you will be spending $1425/month for a place of your own.

    If you are presently renting, you can easily expect to pay $1200-$1500/month for a similar house/condo/apartment depending on the location and amenities.

    Now let us go one step further and say you are going to live in same city for 5 years.
    Can you even imagine how much rent you would have paid in those five years?
    Let's do the numbers again.
    Monthly rent(Avg rent from 1200-1500)*no. of months*no. of years
    $1350*12*5=$81000 (whopping 81 thousand dollars going down the drain)

    Had you owned your place for 5 years, you would have spent

    $1425*12*5=$85,500 (Wow! this is more than renting)
    NOT AT ALL. LET US SEE HOW!
    Out of the $85,500 you spent, $51,600 went to your lender for your mortgage.
    Further, out of $51,600, your interest payment was $38460.85 that is subject Federal Tax credit on Mortgage Interest. So, you are sure to get something back from $38460.85
    This is the PROUD PART, In those 5 years, you build yourself a NICE EQUITY of $13074.03

    Out of remaining $33,900(85,500-51,600), You paid $15,000 in your property taxes that is again subject to Federal Tax credit.

    So, all in all you paid a lot less to OWN than to RENT

    With the economy recovering, you will certainly do fine. With all the EQUITY you would have built by then, your down-payment on your next house would be ready.

    This was the WORST-CASE scenario. On the brighter side, the REAL ESTATE is bound to recover sooner or later. You can't rent forever or can't live in your parents house forever simply because you will outgrow the space and would need some space of your own.

    Who knows if you let this opportunity go by and wait for a few more years, what would be interest rate or real estate prices.

    One piece of advise is that your total housing expense(whether owning or renting) should not be more than 30%-35% of own take home pay. Look for rental property and something to buy in that range and you will do just fine.

    If you want to discuss or have a specific question, please leave a comment and I would glad to answer to the best of my ability.

    Tuesday, July 19, 2011

    Growth Stocks

    I love high flying growth stocks. They are hugely volatile and that is the beauty about growth stocks. If entered into an equity at the right time, you can get huge returns but at the same time, a wrong time can result into huge losses in no time.

    Some of the high flyers I am watching

    Google: Just went up 25% with the earning or $125 in just 3 weeks
    Apple: Went up 25% with the earning or almost $90 in just 3 weeks
    Intitutive Surgical: Bounced higher after testing 50day support. Up $40 in 2 days with earnings.
    Chipotle: From $270 to $333 in just 3 weeks.

    As you can see, you can reap huge rewards with some great names if entered at the right time relatively quickly.
    Never PANIC in down market. Never sell your position as a result of fear or panic. Best days follow up just after down days.

    Enjoy these high flyers. Lock in your gains if you did enter the trade in any of the above before the wonderful earnings. STOP LOSS is the way to go right now.

    Monday, July 18, 2011

    Why is my SQL query taking forever to run?

    All of us must have been in this situation before.
    Why is SQL taking forever to run today? Until today, it was taking minutes and today it is running forever.

    This is the worst nightmare for a DBA. In this situation, the most likely scenario is that SQL is running with a different execution plan as opposed to when it was taking minutes.
    How do we find it out?
    The below SQL will give you all the child cursor for the SQL in question. Just pass the SQL id of the problem SQL. If you see multiple PLAN_HASH_VALUE for this given SQL, that means this SQL indeed has multiple execution plans. One of them being the efficient one that it had been using. 

    select
    inst_id,sql_id,plan_hash_value,child_number,executions,round(buffer_gets/executions,2)
    "buffer_gets/exec" , cpu_time/1000000 "Cpu Time(s)",round(rows_processed/executions,2) "Rows",
    elapsed_time/1000000 "Elpased Time(s)"  from gv$sql where
    sql_id='&sql_id'
     
    Once we know all the child cursors, run the below SQL to get the execution plan for all the child cursor and see why it is taking forever for this run.

    select * from TABLE(dbms_xplan.display_cursor('&SQL_ID',&child_cursor,'PEEKED_BINDS'))

    Just Pass the SQL id and the child cursor and you will be able to the execution plan.

    What is running in my database?

    Have you ever wondered what is running in the database at any given time and how to find it?

    Simply run the below SQL command on your Oracle Database. It will give tell who is running what. Yes, this is RAC friendly. You may need to format the output. This is very handy to have for a DBA to see the snapshot of what is running in the database. It is a good first step to diagnose any Performance issue.

    select  s.inst_id "Inst",s.sid||','||s.serial# sidserial,osuser,username,
       sql_id sql_id,
       module,
       substr(s.event,1,27) event,
       s.last_call_et "Wait", s.machine
    from gv$session s
    where status = 'ACTIVE'
    and event not like 'Streams AQ: waiting%'
    and event not like 'Streams AQ:%idle%'
    and s.event not like 'LNS%'
    and (s.event not like '%idle wait%')
    and  s.event not in ('PL/SQL lock timer','SQL*Net message from client','queue messages',
    'rdbms ipc message','Streams AQ: waiting for messages in the queue','smon timer','wakeup time manager','async disk IO',
    'pipe get','pmon timer','gcs remote message','ges remote message','log file sync','jobq slave wait','slave wait')
    order by module,sql_hash_value

    Sunday, July 17, 2011

    Sure, You can live debt free

    I never thought I would write something like this on the internet. Thanks to my sister, she motivated me to go online and share my thoughts with the outside world. Here I am writing my very first post.

    Do you ever wish of having financial independence? Do ever think of living debt free? Do you enjoy the life on credit?

    Well, life is certainly beautiful and too precious to fret over financial ruins and crisis. It is entirely in our hands to write or build our financial status.

    To get our financial house in order, we need to start distinguishing between needs and wants. We all know what needs and wants are. We can easily distinguish between them. All we need is discipline and will power to stay within our needs until the debt is paid off.

    In order to get there, we need to know what we are spending on. Lets list down all our expenses on a easy to locate and reachable place.  Every time we spend any money, it should be written down with the date, amount and type of expense like food, clothing, rent, mortgage etc. Once we know where and how much we are spending, it is easy to categorize the expenses. It is really surprising at the end of this exercise to see how much we are spending on items that we don't really need.

    It is not that difficult rather you can enjoy this process and in the process you are sure to learn a lot about yourself. So, lets start writing down our expenses...

    Credit Cards are not necessarily evil elements. You can really save money with credit cards. Just remember to use them like debit card. Spend only what you can pay in full and enjoy all the perks your credit card offers. Always check all the benefits your credit card offers and keep them in mind when in need. For instance, I was very upset when my laptop got stolen in NYC. Obviously there was no scope of getting it back. Fortunately, I had bought it on my credit card. I contacted my credit card, completed the paper work like forms, the receipts, police report etc and there you go, I got the amount credited on my account. I then bought even better laptop. 
    There are tons of credit card with 'NO ANNUAL FEE'. No need to pay the hefty fees if you are not going to use those extra features. You may want to check this out for all the great credit cards on offer.
    /http://www.creditcards.org/

    So keeping our financial health in tact in really in our hands. Spend wisely and remain disciplined focusing on needs. Make of prioritized list of your wants. Set the goal for your top priority 'want' and start saving for it. I am sure you will start appreciating the process and get your financial house in order.

    In the closing, I wish you and your family good financial health and I sincerely thank you for spending your valuable time with me.

    I will be back with more....