August 26, 2010

PL/SQL Developer Oracle Database Connectivity to access

To access our local Oracle in PL/SQL Developer, we need to add an entry in TNSNAMES.ORA file.


You can find TNSNAMES.ORA file in oracle installed folder.

 Example path:

D:\oraclexe\app\oracle\product\10.1.0\server\NETWORK\ADMIN\TNSNAMES.ORA

Add and entry in the file as follows

 HOST_XE =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.101.1)(PORT = 1521))

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = XE)

    )
  )

 If you are facing any problems, just check the following tnsping in command prompt.


TNSPING:

  • Ping your ip address as in the following example.


C:\Documents and Settings\test>tnsping 192.168.101.1


Output:


TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production on 26-AUG-2


010 09:27:37



Copyright (c) 1997, 2005, Oracle.  All rights reserved.



Used parameter files:


D:\oraclexe\app\oracle\product\10.2.0\server\network\admin\sqlnet.ora



Used HOSTNAME adapter to resolve the alias


Attempting to contact (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.101.1)(PORT=1521)))


OK (30 msec)

  • Open PL/SQL Developer and login with your username, password and give database as HOST_XE which you specified in the TNSNAMES.ORA file.


If any problem, please let me know.

August 25, 2010

Running job in regular intervals or daily in Linux to delete files or modifying files

Running scripts daily to perform some common tasks in Linux
Be in root mode, super user mode
1) Create a script with the name filename.sh or any other name whatever you like
2) Do any one of the following .. but please test it with some other file extension like .yourname or something .. create your own unique files and do the testing before executing on original files which may be important.
   
   find /folderpath -type f -iname "*.fileextension" | xargs -i '{}' rm -rf {}
   (or)
   find /folderpath -type -f -iname "*.fileextension"  -exec /bin/rm -rf {} \;
3) chmod +x filename.sh
4) crontab -e
    i) press i to go into insert mode
    ii) enter 30 20 * * 1-5 /bin/bash /fullpath        
                      //30 min 20 hour i.e 8:30pm on 1-5(mon-fri) on *(every month) on *(every year)
    iii) shift+ZZ to save the file
5) Try this and let me know if any modifications needed

For further details, contact me psrdotcom@gmail.com

SQL query : Search sub string in column value string with delimeter

Input: String with proper delimeter as table column value
    ex:- /usr/tmp, /usr/tmp/psr, /usr/psr/dir1, /usr/psr/psr/dir1, /usr/lib
Output: substring between delimeter(,)
Note:
    1) This is SQL Query not PL/SQL program, its just a query
    2) User can search for only one string at a time
    3) User can change the search occurance i.e. need first occurance of the substring or nth occurance


SQL Query:



select substr(
        concat(',',concat(value1,',')),
        (instr(concat(',',concat(value1,',')), ',' , (instr(concat(',',concat(value1,',')),'psr',1,2) - length(concat(',',concat(value1,',')))),1)+1),
        (instr(value1, ',', (instr(concat(',',concat(value1,',')),'psr',1,2)),1)+1)-
        (instr(concat(',',concat(value1,',')), ',' , (instr(concat(',',concat(value1,',')),'psr',1,2) - length(concat(',',concat(value1,',')))),1)+1)
        )
as result
from check1


 Detailed Explanation:

1. Modify original string in this ",string," format
2. Search for the substring and find index of previous delimeter of the substring
3. Find the length of the substring

select substr(                        // value1 is column name
        // 1.Concatenating delimeter(,) before and after string
        concat(',',concat(value1,',')),

        // 2. Finding substring starting index
        (instr(concat(',',concat(value1,',')), ','
            , (instr(concat(',',concat(value1,',')),'psr',1,2)   
// Finding substring 'psr' 2nd occurance, user can change value 2 from (1 to n)th occurance
            - length(concat(',',concat(value1,','))))           
// Searching in reverse direction to find previous delimeter(,) index from substring
            ,1)                                    // Delimeter(,) index will be our starting of substring
            +1)                                    // Not including delimeter(,) in substring display

         // 3. Finding length of the substring
         // Finding next delimeter(,) index from substring
         ,(instr(value1, ',', (instr(concat(',',concat(value1,',')),'psr',1,2)) ,1)+1)-
      
        // Finding length between two delimeters(,) i.e. length of substring
        (instr(concat(',',concat(value1,',')), ',' , (instr(concat(',',concat(value1,',')),'psr',1,2) - length(concat(',',concat(value1,',')))),1)+1)
        )
as result                            // Displaying column as result
from check1                            // Table name check1

May 23, 2009

My M.Tech Thesis

I am doing the project "Simulating an efficient NIDS on gigabit ethernet communication". To acheive my objectives, I installed Snort NIDS and lot of its dependencies. It took time for me to configure properly because of lack of guidance. Finally my internal review was good. I am satisfied..I will provide my abstart here.. see and give me suggestions..

Intrusion Detection for network security is a compute intensive application demanding high system performance. Objective of thesis is to simulate a testbed evaluation of an efficient Intrusion Detection System (IDS) on gigabit ethernet communication. Testbed [3] includes forming a network with the both Network Intrusion Detection System (NIDS), Snort and attacker, who will generate live traffic [1]. By writing efficient rules for the snort, it will generate alerts which can be visually displayed in browser by using plug-ins. Running the Snort in a live network and the flooding the network with a variety of traffic, both “normal” (legitimate traffic that any network would reasonable expect to occur such as e-mail, HTTP, telnet etc) and attacks, including fairly recent and more well-known network attacks [5]. The pre-design tool allows for more efficient communication and extensive reuse of modules for dramatic increases in area-time performance. We can implement this simulation part on hardware with efficient performance.

May 08, 2009

Failed in IIT Kanpur Ph.D Written Test

I applied for the Ph.D in IIT Kanpur and in written test i got failure..But here the facilities are very good..I am impressed with this facilities here..I am thinking again i will apply here in November(Winter Admissions)...Let me try my luck in IISc Bangalore..There also i applied Operating Systems Ph.D..I am interested to do in Operating Systems..I dont know how far i will go..Anyway friends thanks for giving the moral backup..Love u All..URS PSR.COM

January 06, 2009

Applied for Civil Services

I applied for civil services 2009. My dad always says to me that we have to do something good for the society. So, I decided to write Civil Services. Wish me ALL THE BEST Friends. Hope you will encourage me.

Featured Post

Java Introdcution

Please send your review and feedback to psrdotcom@gmail.com