Load File into Database as Blob

You can find lots of procedure or steps to load file from filesystem to database.
one of the easy method is to make a function.
Sample of function:-
CREATE OR REPLACE FUNCTION FN_FILE_BLOB(V_FILENAME VARCHAR2, V_DIRECTORY VARCHAR2) RETURN BLOB
IS
src_loc BFILE;
dest_loc BLOB:=empty_blob();
BEGIN
SRC_LOC := BFILENAME(V_DIRECTORY, V_FILENAME);
DBMS_LOB.OPEN(src_loc, DBMS_LOB.LOB_READONLY);
DBMS_LOB.CREATETEMPORARY(lob_loc => dest_loc, cache => true , dur => dbms_lob.session);
DBMS_LOB.OPEN(dest_loc, DBMS_LOB.LOB_READWRITE);
DBMS_LOB.LOADFROMFILE(dest_lob => dest_loc, src_lob => src_loc , amount => DBMS_LOB.getLength(src_loc));
DBMS_LOB.CLOSE(src_loc);
DBMS_LOB.CLOSE(dest_loc);
RETURN dest_loc;
EXCEPTION
WHEN Others THEN
Dbms_Output.Put_Line(SQLERRM);
RETURN NULL;
END;
/

Usage: SELECT FN_FILE_BLOB('image1.jpg','DUMP_DIR') FROM DUAL;

Convert Blob into Insert Statment

There are many ways to copy Blob column from one server to Another like,

1. Generate file from blob in source server, and import file into destination server using Tools like SQL developer, TOAD.

2. Using DBLink,
INSERT INTO BLOB_TEST SELECT BLOB_COL1 FROM TEST_BLOB@SOURCEDB;
3.  I have recently discovered, you can make dynamic insert statement and run as normal insert statement in destination server.

Example here: sample_blob

Scripts to make dynamic script can be written as

Set serveroutput on
DECLARE
M BLOB;
n NUMBER:=1;
c blob;
l_limit NUMBER:=4000;
vm RAW(32767);
BEGIN
Dbms_Output.Put_Line('DECLARE
c BLOB;
BEGIN
dbms_lob.createtemporary(c,true);');
SELECT  BLOB_COL INTO M FROM TEST_BLOB;
--Dbms_Output.Put_Line(Length(M));
while (n+l_limit<=length(m)) loop
     vm:=(dbms_lob.substr(M,l_limit,n));
     Dbms_Output.Put_Line('dbms_lob.writeappend(c,'||Length(vm)/2||','''||VM||''');');
     n:=n+l_limit;
END LOOP;
vm:=(dbms_lob.substr(M,length(m)-n+999,n));
Dbms_Output.Put_Line('dbms_lob.writeappend(c,'||Length(vm)/2||','''||VM||''');');
Dbms_Output.Put_Line('INSERT INTO blob_test VALUES (c,9);
END;
/');
END;
/

Download Here

How to create a bootable Windows Vista/7/8 USB drive

Installing Windows OS via USB is always fast compared to CD/DVD.
There are lots of tool to make bootable windows USB. but it always good to know who to configure manually in case of emergency.

Below are the steps to follow to make USB bootable in windows machine.

1. Run the cmd.exe as administrator like in image

cmd.exe

2. Run diskpart in cmd.exediskpart

3. List the disk and choose the USB disk (find out by size of space) Note:- Becareful with choosing disk, cause below steps will delete everything on this. and wrong disk means cleaning all files of wrong disk.

listdisk

4. Run the command as show in picture

Bootable1 bootable2

5. You will now need your Windows Vista or 7 or 8 Installation DVD. Put the DVD in your computer’s DVD drive. Open up My Computer and note which drive letter is assigned to your DVD Drive and your USB flash drive.

6. Go back to the command prompt window and type in M: CD BOOT (substitute your DVD drive letter for “M:” if necessary) and press Enter. Type CD BOOT again and press Enter. Lastly, type BOOTSECT.EXE /NT60 E: (substitute your USB flash drive letter for “H:” if necessary) and press Enter. like in image

bootsect

7. Copy all of the files from Windows bootable CD/DVD for to the USB stick

8. Now you can install Windows OS in desired machine, just by booting computer with boot priority to USB.

श्री भैरवको १०८ नाम

श्री भैरवको १०८ नाम (108 Lord Bhairav names)
००१. ॐ ही्ं भैरवाय नम: Om hīn Bhairavāya  nama:
००२. ॐ ही्ं भूतनाथाय नम: Om hīn bhūtanāthāya nama:
००३. ॐ ही्ं भूतात्मने नम: Om hīn bhūtātmanē  nama:
००४. ॐ ही्ं भूत भावनाय नम: Om hīn bhūta bhāvanāya nama:
००५. ॐ ही्ं क्षेत्रज्ञ‍ाय नम: Om hīn kṣētrajña‍̔āya nama:
००६. ॐ ही्ं क्षेत्रपालाय नम: Om hīn kṣētrapālāya nama:
००७. ॐ ही्ं क्षेत्रपाय नम: Om hīn kṣētrapāya nama:
००८. ॐ ही्ं क्षेत्रदाय नम: Om hīn kṣētradāya nama:
००९. ॐ ही्ं विराटाय नम: Om hīn virāṭāya nama:
०१०. ॐ ही्ं श्मशानवासिने नम: Om hīn śmaśānavāsinē nama:
०११. ॐ ही्ं मांसाशीने नम: Om hīn mānsāśīnē nama:
०१२. ॐ ही्ं खर्पराशीने नम: Om hīn kharparāśīnē nama:
०१३. ॐ ही्ं मखान्तकृते Om hīn makhāntakr̥tē nama:
०१४. ॐ ही्ं रत्त पाय नम: Om hīn ratta pāya nama:
०१५. ॐ ही्ं पानपाय नम: Om hīn pānapāya nama:
०१६. ॐ ही्ं सिद्धाय नम: Om hīn sid’dhāya  nama:
०१७. ॐ ही्ं सिद्धिदाय नम: Om hīn sid’dhidāya  nama:
०१८. ॐ ही्ं सिद्धिसेविताय नम: Om hīn sid’dhisēvitāya nama:
०१९. ॐ ही्ं कंकालाय नम: Om hīn kaṅkālāya nama:
०२०. ॐ ही्ं कालसमानाय नम: Om hīn kālasamānāya nama:
०२१. ॐ ही्ं कलाकाष्ठाय नम: Om hīn kalākāṣṭhāya nama:
०२२. ॐ ही्ं तनये नम: Om hīn tanayē nama:
०२३. ॐ ही्ं कवये नम: Om hīn kavayē nama:
०२४. ॐ ही्ं त्रिनेत्राय नम: Om hīn trinētrāya nama:
०२५. ॐ ही्ं बहुनेत्राय नम: Om hīn bahunētrāya nama:
०२६. ॐ ही्ं पिङ्गल लोचनाय नम: Om hīn piṅgala lōcanāya nama:
०२७. ॐ ही्ं शूलपाणाये नम: Om hīn śūlapāṇāyē nama:
०२८. ॐ ही्ं खङ्गपाणाये नम: Om hīn khaṅgapāṇāyē nama:
०२९. ॐ ही्ं कङ्कालीने नम: Om hīn kaṅkālīnē nama:
०३०. ॐ ही्ं धूम्रलोचनाय नम: Om hīn dhūmralōcanāya  nama:
०३१. ॐ ही्ं अभिरुवे नम: Om hīn abhiruvē nama:
०३२. ॐ ही्ं भैरवीनाथाय नम: Om hīn bhairavīnāthāya nama:
०३३. ॐ ही्ं भूतपाय नम: Om hīn bhūtapāya nama:
०३४. ॐ ही्ं योगिनीपतेय नम: Om hīn yōginīpatēya nama:
०३५. ॐ ही्ं धनदाय नम: Om hīn dhanadāya nama:
०३६. ॐ ही्ं धनहारीणे नम: Om hīn dhanahārīṇē nama:
०३७. ॐ ही्ं धनव नम: Om hīn dhanava nama:
०३८. ॐ ही्ं प्रतिभावनाय नम: Om hīn pratibhāvanāya nama:
०३९. ॐ ही्ं नागहाराय नम: Om hīn nāgahārāya nama:
०४०. ॐ ही्ं नागपाशाय नम: Om hīn nāgapāśāya nama:
०४१. ॐ ही्ं व्योमकेशाय नम: Om hīn vyōmakēśāya nama:
०४२. ॐ ही्ं कपालभृते नम: Om hīn kapālabhr̥tē nama:
०४३. ॐ ही्ं कालाय नम: Om hīn kālāya nama:
०४४. ॐ ही्ं कपालमालिने नम: Om hīn kapālamālinē nama:
०४५. ॐ ही्ं कमनीयाय नम: Om hīn kamanīyāya nama:
०४६. ॐ ही्ं कलानीधये नम: Om hīn kalānīdhayē nama:
०४७. ॐ ही्ं त्रिलोचनाय नम: Om hīn trilōcanāya nama:
०४८. ॐ ही्ं ज्वलन्नेत्राय नम: Om hīn jvalannētrāya nama:
०४९. ॐ ही्ं त्रिशिखीने नम: Om hīn triśikhīnē nama:
०५०. ॐ ही्ं त्रिलोकपाय नम: Om hīn trilōkapāya nama:
०५१. ॐ ही्ं त्रिनेत्रतनयाय नम: Om hīn trinētratanayāya nama:
०५२. ॐ ही्ं डिंभाय नम: Om hīn ḍimbhāya nama:
०५३. ॐ ही्ं शांताय नम: Om hīn śāntāya nama:
०५४. ॐ ही्ं शांतजनप्रियायय नम: Om hīn śāntajanapriyāyaya nama:
०५५. ॐ ही्ं बटुकाय नम: Om hīn baṭukāya  nama:
०५६. ॐ ही्ं बहुवेषाय नम: Om hīn bahuvēṣāya  nama:
०५७. ॐ ही्ं खट्बांगधारकाय नम: Om hīn khaṭbāṅgadhārakāya  nama:
०५८. ॐ ही्ं भूताध्यक्षाय नम: Om hīn bhūtādhyakṣāya nama:
०५९. ॐ ही्ं पशुपतये नम: Om hīn paśupatayē nama:
०६०. ॐ ही्ं भिक्षुकाय नम: Om hīn bhikṣukāya  nama:
०६१. ॐ ही्ं परिचारकाय नम: Om hīn paricārakāya  nama:
०६२. ॐ ही्ं धूर्ताय नम: Om hīn dhūrtāya nama:
०६३. ॐ ही्ं दिगंबराय नम: Om hīn digambarāya  nama:
०६४. ॐ ही्ं शौरहरिणे नम: Om hīn śaurahariṇē nama:
०६५. ॐ ही्ं हरिणे नम: Om hīn hariṇē  nama:
०६६. ॐ ही्ं पाण्डुलोचनाये नम: Om hīn pāṇḍulōcanāyē nama:
०६७. ॐ ही्ं प्रशांताय नम: Om hīn praśāntāya  nama:
०६८. ॐ ही्ं शान्तिदाय नम: Om hīn śāntidāya  nama:
०६९. ॐ ही्ं शुद्धाय नम: Om hīn śud’dhāya  nama:
०७०. ॐ ही्ं शंकराय नम: Om hīn śaṅkarāya nama:
०७१. ॐ ही्ं अष्टमूर्तये नम: Om hīn aṣṭamūrtayē  nama:
०७२. ॐ ही्ं निधिशाय नम: Om hīn nidhiśāya nama:
०७३. ॐ ही्ं ज्ञानचक्षुषे नम: Om hīn jñānacakṣuṣē nama:
०७४. ॐ ही्ं तपोमयाय नम: Om hīn tapōmayāya  nama:
०७५. ॐ ही्ं अष्टाधाराय नम: Om hīn aṣṭādhārāya  nama:
०७६. ॐ ही्ं षडाधाराय नम: Om hīn ṣaḍādhārāya  nama:
०७७. ॐ ही्ं सर्पयुक्त्ताय नम: Om hīn sarpayukttāya nama:
०७८. ॐ ही्ं शिखीसखाय नम: Om hīn śikhīsakhāya  nama:
०७९. ॐ ही्ं भू-धराय नम: Om hīn bhū-dharāya nama:
०८०. ॐ ही्ं भू-धराधीशाय नम: Om hīn bhū-dharādhīśāya  nama:
०८१. ॐ ही्ं भूपतये नम: Om hīn bhūpatayē  nama:
०८२. ॐ ही्ं भू-धरात्मजाय नम: Om hīn bhū-dharātmajāya nama:
०८३. ॐ ही्ं कंकाल धारिणे नम: Om hīn kaṅkāla dhāriṇē  nama:
०८४. ॐ ही्ं मुंडीने नम: Om hīn muṇḍīnē  nama:
०८५. ॐ ही्ं नागयज्ञोपवीतिने नम: Om hīn nāgayajñōpavītinē nama:
०८६. ॐ ही्ं जृम्भणाय नम: Om hīn jr̥mbhaṇāya  nama:
०८७. ॐ ही्ं मोहनाय नम: Om hīn mōhanāya nama:
०८८. ॐ ही्ं स्तंभिने नम: Om hīn stambhinē  nama:
०८९. ॐ ही्ं मारणाय्र नम: Om hīn māraṇāyra  nama:
०९०. ॐ ही्ं क्षोभणाय नम: Om hīn kṣōbhaṇāya  nama:
०९१. ॐ ही्ं शुद्धनिलाजन प्रख्याय नम: Om hīn śud’dhanilājana prakhyāya  nama:
०९२. ॐ ही्ं दैत्यध्ने नम: Om hīn daityadhnē  nama:
०९३. ॐ ही्ं मुण्ड भूसिताय नम: Om hīn muṇḍa bhūsitāya  nama:
०९४. ॐ ही्ं बलिभुजे नम: Om hīn balibhujē  nama:
०९५. ॐ ही्ं बलीभुङ्नाथाय नम: Om hīn balībhuṅnāthāya nama:
०९६. ॐ ही्ं वालाय नम: Om hīn vālāya  nama:
०९७. ॐ ही्ं बालपराक्रमाय नम: Om hīn bālaparākramāya  nama:
०९८. ॐ ही्ं सर्वापत्तारणाय नम: Om hīn sarvāpattāraṇāya  nama:
०९९. ॐ ही्ं दुर्गाय नम: Om hīn durgāya  nama:
१००. ॐ ही्ं दुष्टभूत निसेविताय नम: Om hīn duṣṭabhūta nisēvitāya nama:
१०१. ॐ ही्ं कामिने नम: Om hīn kāminē  nama:
१०२. ॐ ही्ं कलानिधये नम: Om hīn kalānidhayē  nama:
१०३. ॐ ही्ं कान्ताय नम: Om hīn kāntāya  nama:
१०४. ॐ ही्ं कामिनी वशकृते नम: Om hīn kāminī vaśakr̥tē nama:
१०५. ॐ ही्ं सर्वसिद्धिप्रदाय नम: Om hīn sarvasid’dhipradāya  nama:
१०६. ॐ ही्ं वैद्दाय नम: Om hīn vaiddāya  nama:
१०७. ॐ ही्ं प्रभवें नम: Om hīn prabhavēṁ nama:
१०८. ॐ ही्ं विष्णवे नम: Om hīn viṣṇavē nama:

Mail Client in Oracle Database

Yes you can receive Mail and send in Oracle Database and store into Database or manipulate email to do some task.
I m always lazy to do some repetative task In my Work i was always ask to do send status of certain task from Database and send to back to them via mail. for a beginning it is fun. but when the request number is increasing it is getting boring and monotonous. so what i did is i installed Mail client in one the schema in my Database which reads emails. then i scheduled the job which reads subject of emails that has keyword [Status] and followed by Report Name. so the scheduler reads and do query and generate report in clob and sends the output to sender Mail.

Things to do in Bangkok with your Family

Its always hard to decide where to go and what to do, especially when you have parents , sisters and brother whom you respect. These are the list you can do when your family arrives in Bangkok
  • Morning
    • Temple Visit: –  Its always good and peaceful to visit Temples.
      a. Grand Palace
      b. Wat Arun
      c. Wat Phoo
      d. Wat Rakang
    • Floating Market:- You Visit Floating in early Morning
      some of them i liked are Damnoen Saduak Floating Market
    • Take rest and Sleep:- Some times Roaming around bangkok will be very tired full, due to long walk here and there or with late night party, you and your family always rest in morning.
  • Day Time
    It’s always hard to decide where to go or take. you can go outside the Bangkok or if you are planning to stay in bangkok then i always recommend to do shopping cause most of girls including your mom and sister always like to do shopping and Bangkok is a paradise for shopping. But its always hard to decide where to take them ?
    • Chatuchak: – Its always interesting to Visit amazingly big market in Asia, where you can find lots of things you want or you might need when you see or you dont want. Pros – Interesting market and worth to visit, Cons :- Had to walk a lot in hot weather and sometimes you get ripped off if you dont know the price and skill to bargain.
    • Platinum Mall :- Very Cheap market for Clothes. i think this is one of the easiest place to go for Tourist and find clothes of different style in cheap price. Pros: Cheap and different Variety. Cons: Crowdy
    • Pantip Plaza – If you are looking for electronic gadget that you like or want to see, is always worth to visit this mall. Pros: Might find cheap and variety of Gadget.
    • MBK :- if your family need different variety in short period of time? like some member need good clothes?, some electronic mobile or gadget, Makeups? bags? or whatever in their mind. its always good to visit MBK where you can find all in one place. Pros:- you can find all in one place no need to go anywhere for shopping. Cons: some shop keepers are really rude.
    • Siam (Paragon, Central and Discovery) : if you are looking for some of the branded product? its always worth to visit these malls
    • Central World :- Nice place with lots of choice, mostly i gets lost.
    • Terminal 21 :- Very unique mall with theme of each floor with different countries, like Rome, London, Japan etc.
  • In evening Visit some relax place like :- Roof top Restaurants (Nest, Long Table) enjoying the lights of Bangkok, or go for some thai massages which are really relaxing and gives you some relief from day time heat and stress. try some local thai food which you can find every corner of street in Bangkok. visit Asiatique:- cool place to hangout. great view and great food and light shopping.
  • Night Life: – Bangkok is always known for Shopping and Night life. I must say Night life is one of the amazing things in Bangkok. One thing is always boring that you cannot take your parents to some disco or pub. But you have friendly brothers and Sisters then its worth to visit some pubs and Clubs like, Q-Bar, Levels, RCA, Mixx, Bash, Demo. or hanging one some pool tables with drinking beers.

How to Download Document from docstoc.com

Sometimes viewing document in internet is not enough. sometimes we need to download and print for better looking.

But in docstoc sometimes it disallows you to download or print for free.

Here are the steps to be followed to download from docstoc.com. Lets take one example. like you need to download one document docx

whenever you tries to download or print it will redirect to paying page where you are asked to register for paying to download.

But you can bypass this by following below steps:-

Remember the id of document which can be find in address bar as shown in below picture.docx

now edit your make a url by copy pasting id into below

docx

now you view the page. where you right click the document and Print the document in PDF or print it in real paper.

docx

 

Tools to Connect Oracle Database

There is always a great debate and confusion on choosing Client tool to connect Oracle database. People have their own opinion based on their ease and feasibility. With discussion with my friends and other DBAs and my own experience here are the list of tool with their merits and demerits

Client Tool Description
Oracle SQL Developer Oracle own free client tool, very powerful with lots of featured with click option. But I don’t like this because its heavy , hangs/freezes a lot in slow network connection and main this I dislike is, it tries to be oversmart tool, like suggesting code table which makes coding slow and impatient.

Good for Newbies, bad for moderate and expert

Toad Right now my friends are using Toad 11. Great tool with lots and lots of feature. Most of the time you don’t need to write a code single click can do many thing which is good for newbies and bad also cause it will help you to forget the code. Disadvantage is it is not free and cost is high for normal use. And disk and memory consumption is really high and hangs whole toad system without any reason
SQL Tools One of my favorite tool, very very light and doesn’t have many feature like Toad or SQL developer. But still some feature are very handy like object view and list with their reference and reference child. Testing code. i recommend this especially for the Pl/SQL developer . Disadvantages: though its free it has stopped developing further version since 2011 and sometimes it doesn’t support some datatype like BLOB, XMLDATA type
DB Visualizer I like this tool just to view schema diagram, though SQL Developer plugin supports Schema diagram, but DB visualizer gives you extra feature to see schema diagram.

Personally for me SQL Tool and SQL Developer is enough to do all DBA daily task and both of them is 100% free 🙂