Thursday, December 22, 2011

Append Date & time to File name in Window Batch file


Sometimes it may be required to schedule the same task twice a days . In such cases, we have to create two batch file and scheduling them separately because the generated name may overwrites or throws errors . To overcome from this issue , we can schedule the same task with single batch file. Suppose we have to take the logical backup of a schema(say scott) twice a days . We can do this by simply appending the date and time to the dump file name .

As in case of Linux /Unix systems, shell scripting is very liberal with variables and we can define according to ourself . e.g;
expdate=`date ‘+%d%m%Y’`
dat=`date ‘+%m%d%y %H:%M:%S’`

And then go onto define in our script as

./expdp system/xxxx  dumpfile=scott_$expdate.dmp logfile=scott_log_$expdate.log schemas=scott

But on windows machine ,we use the Date and Time function. The Date and Time function are as below  :

Date:  %date:~4,2%-%date:~7,2%-%date:~12,2%
Time:  %time:~0,2%-%time:~3,2%-%time:~6,2%  

This above function can be use to generate the unique dumpfile name. Below is the Demo of this function .

c:\> exp system/ramtech@noida  owner=scott  file=c:\scott_%date:~4,2%-%date:~7,2%-%date:~12,2%-%time:~0,2%-%time:~3,2%-%time:~6,2%.dmp log=c:\scottlog_%date:~4,2%-%date:~7,2%-%date:~12,2%-%time:~3,2%-%time:~6,2%.log    

The file name generated  i.e, dump file name is 'scott_12-22-11-12-04-31.dmp'  and log file name is 'scottlog_12-22-11-04-31.log'    where date is 12-22-11(12th-dec-2011) and time is 12-04-31(12hr:4min:31sec) .


Enjoy    J J J


Tuesday, December 20, 2011

What is CLOUD computing ??


I have read a  article on Cloud Computing and decided to post it. This article is written by one of the famous s/w engineer Gagan Kundra .

Cloud computing is a marketing term for technologies that provide computation, software, data access, and storage services that do not require end-user knowledge of the physical location and configuration of the system that delivers the services. A parallel to this concept can be drawn with the electricity grid, wherein end-users consume power without needing to understand the component devices or infrastructure required to provide the service.

Apple CEO Steve Jobs whenever someone comes on stage, the world is alarmed. Who let this time show little device that will change people's lives. Why is Apple the company, who gave us a iPod, Macintosh and iPhone are such tools. Jobs done something like this again. The only difference was that he did not have any tools. Just talked about a similar service to the people on the entire data and information from different devices can. Aiclaud Apple is the name of the service. But it's not actually Apple, but shows the power of cloud computing. Service's name may be, whether the service to be Apple, or Google, or Microsoft, but cloud computing in the coming days will sputter. Tech - pundits say that it will change our lives. Companies like Infosys have been predicted that almost all the work in the coming days the world will be on clouds. Just remember that no water in these clouds, but digital data - like - is filled with such information and other associated material. And the clouds in the sky, but on a giant computer - the server is called - are found.

Cloud computing is getting to be too much nowadays, but it is not a new thing. If you are on the Internet, so that - unconsciously you will also have to use it. I can not believe the e-mail as simple as taking the example of an Internet service. Most people e-mail on your computer, do not download, but leave it on the internet to see. Who your computer's hard drive to the e-mail wants to fill? But you never thought that this e-mail that you have left over the Internet or the Web, Where saving is kept, so you whenever you want your e-mail account, going to see it. The answer is simple - to cloud. You probably do not know, but nearly every time you leave something on the web, the data contained on these clouds. Whether it be a picture on Facebook, you - a video on the tube, or a new article on your blog. If he left you on the web, you are using cloud computing. You will have noticed that you leave the stuff on the internet, on any computer or cell phone or a tablet-like device can see. After all, your e-mail or Facebook Most office and home computer or your phone may get. This is the greatest power of cloud computing and specialty. It kept you on the Internet, its content or data from anywhere, anytime viewing and gives the ability to change.

 A few years ago was meant to use any software to download it to your computer or cellphone. Then the software could only be played on computers or cell phones. Today, via cloud computing could use the same software, with nothing to download, virtually any device - phone, tablet, computer or even from television. Consider that the cloud has taken the place of your computer. Now, Google's Google Docs, which runs entirely on the internet and gives you almost the same features you get with Microsoft Office, there is no need to download. It will remain on the files and documents, you can look at any computer or cellphone. and Google Docs is just an example. Dozens of world power and benefits of cloud computing companies trying to use it are given. Amazon's cloud service to their customers, keep your favorite songs have the chance. 

Microsoft has put many products on the cloud and its famous office software is also put on some cloud. And now Apple has also stepped into cloud computing. Aiclaud service people like him - look at the software and information and to use the facility will offer many tools. Interestingly, many are free of cloud computing service. To use Google Docs and Aiclaud you do not have light pockets at all. like - like an increasing number of software will run on the web, anyway - so we will run the digital cloud. Our work on certain devices, but will depend on our Internet connection. The Internet will be able to do or where we will be able to satisfy yourself. Whether we are or tablet computer, or cell phone, or TV, or game console, or to connect to the Internet even if the clock. Your work and be entertained, where would the internet. He will not be tied to a device. 


Enjoy    J  J J


Friday, December 16, 2011

Estimate Tablespace Growth In Oracle


I have already posted the script for tracking the growth of the Database .Sometimes it may be requires to find the growth of  each tablespace  . I  have google and find the script for tracking the growth of  each tablespace with date-wise. I thanks Hasan Shaharear  for sharing such a good scripts. This scripts donot shows the growth of system and sysaux tablespace growth rate. Below is the script .

SQL> set heading on
SQL> set linesize 5500
SQL> SELECT TO_CHAR (sp.begin_interval_time,'DD-MM-YYYY') days
  2  , ts.tsname
  3  , max(round((tsu.tablespace_size* dt.block_size )/(1024*1024),2) ) cur_size_MB
  4  , max(round((tsu.tablespace_usedsize* dt.block_size )/(1024*1024),2)) usedsize_MB
  5  FROM DBA_HIST_TBSPC_SPACE_USAGE tsu
  6  , DBA_HIST_TABLESPACE_STAT ts
  7  , DBA_HIST_SNAPSHOT sp
  8  , DBA_TABLESPACES dt
  9  WHERE tsu.tablespace_id= ts.ts#
 10  AND tsu.snap_id = sp.snap_id
 11  AND ts.tsname = dt.tablespace_name
 12  AND ts.tsname NOT IN ('SYSAUX','SYSTEM')
 13  GROUP BY TO_CHAR (sp.begin_interval_time,'DD-MM-YYYY'), ts.tsname
 14  ORDER BY ts.tsname, days;

DAYS                 TSNAME        CUR_SIZE_MB       USEDSIZE_MB
-------------      ---------       -------------     ---------------
07-12-2011         SDE                         2448              1813.94
08-12-2011         SDE                         2448              1813.94
09-12-2011         SDE                         2448              1813.94
10-12-2011         SDE                         2448              1813.94
11-12-2011         SDE                         2448              1815.94
12-12-2011         SDE                         2448              1815.94
13-12-2011         SDE                         2448              1816
14-12-2011         SDE                         2448              1816
15-12-2011         SDE                         2448              1816
16-12-2011         SDE                         2448              1816
07-12-2011         UNDOTBS1                4950              196.56
08-12-2011         UNDOTBS1                4950              302.56
09-12-2011         UNDOTBS1                4950              427.63
10-12-2011         UNDOTBS1                4950              348.56
11-12-2011         UNDOTBS1                6210              5317
12-12-2011         UNDOTBS1                6210              532.5
13-12-2011         UNDOTBS1                6210              388.56
14-12-2011         UNDOTBS1                6210              422.5
15-12-2011         UNDOTBS1                6210              585.63
16-12-2011         UNDOTBS1                6210              479.5
07-12-2011         USERS                      20480           19941.88
08-12-2011         USERS                      20480           20001.5
09-12-2011         USERS                      20480           20341.56
10-12-2011         USERS                      20480           20467.25
11-12-2011         USERS                      20480           20336.69
12-12-2011         USERS                      20480           20317.13
13-12-2011         USERS                      20480           20267.31
14-12-2011         USERS                      20480           20346.13
15-12-2011         USERS                      20480           20340.06
16-12-2011         USERS                      20480           20330.81
30 rows selected.


Enjoy    :-)




Tuesday, December 13, 2011

How to Reduce DB File Sequential Read Wait


DB File Sequential Read wait event occurs when we are trying to access data using index and oracle is waiting for the read of index block from disk to buffer cache to complete.  A sequential read is a single-block read.Single block I/Os are usually the result of using indexes. Rarely, full table scan calls could get truncated to a single block call due to extent boundaries, or buffers already present in the buffer cache.Db file sequential read wait events may also appear when undo blocks are read from disk in order to provide a consistent get(rarely).

To determine the actual object being waited can be checked by the p1, p2, p3 info in v$session_wait .  A sequential read is usually a single-block read, although it is possible to see sequential reads for more than one block (See P3). This wait may also be seen for reads from datafile headers (P2 indicates a file header read) ,where p1,p2 and p3 gives the the absolute file number ,the block being read ,and  the number of blocks (i.e, P3 should be 1) respectively. 

Block reads are fairly inevitable so the aim should be to minimise un-necessary IO. This is best achieved by good application design and efficient execution plans. Changes to execution plans can yield orders of magnitude changes in performance.Hence to reduce this wait event follow the below points .

1.) Tune Oracle - tuning SQL statements to reduce unnecessary I/O request is the only guaranteed way to reduce "db file sequential read" wait time.
2.) Tune Physical Devices - Distribute(stripe) the data on diferent disk to reduce the i/o . Logical distribution is useless. "Physical" I/O performance is only governed by "independency of devices".
3.) Faster Disk - Buy the faster disk to reduce the unnecessary I/O request .
4.) Increase db_block_buffers - A larger buffer cache can (not will, "might") help .


Reference :: From  Asktom site


Enjoy     :-) 


Cannot Load OCI.DLL : While Connecting


Sometimes the error "cannot load OCI.DLL" occur whenever we try to connect with the oracle database by using the third-party tools(i.e, toad,sqltools and others) or command prompt . This error may occur because of the following reason .

1.) The oci.dll error may occur because you have not set the correct ORACLE_HOME and path in environment variables . 
2.) It might be possible that the oci.dll file may be corrupt or may not exist on the correct path .
3.) May be possible that oci.dll may not be correct version. (e.g. 32bit s/w will load a 32bit DDL - we cannot for example use a 64bit DLL for a 32bit executable) . 

To solve this issue , consider the below points .

1.) Check the ORACLE_HOME and Path setting in the envirnoment variable.
2.) Check the correct location of the oci.dll path . The path of the oci.dll file is $ORACLE_HOME\bin\oci.dll
3.) Check the oci.dll correct version .

In my case , i am facing this issue because the $ORACLE_HOME is not correctly set in the environment variables . So setting the correct path in environment variables, we find not any error while connecting the  database .



Enjoy     :-)