Wednesday, September 5, 2012

Oracle : Database link

For example


(DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))
(CONNECT_DATA=(SID=mydb)))


1. Connect your oracle.
     > sqlplus /nolog
     > conn user/pass@mydb


2. Create db link :
     > Create database link monitordblink
connect to monitor identified by monitor123
using 'mydb';

the syntax is :

CREATE {PUBLIC} DATABASE LINK <database link name>
{CONNECT TO <oracle user id>
IDENTIFIED BY <remote oracle user's password> }
USING ' <dbstring> ';

3.  > Commit;

4. Check your db link :
    > SELECT * FROM all_db_links;


5. You can check table by using below command :
select <column list> from <table>@<dblink name>;
> select * from usertbl@monitordblink;


Source

Tuesday, September 4, 2012

Unix : Delete file or Folder


rm foo
delete the file named "foo"

rm a*
delete all files with names beginning with "a"

rm *.jpg
delete all files with names ending in ".jpg"

rm -R temp
delete the directory named "temp", and all of its contents

ClearCase

just for my reference only

> ct lsview
- see all ct view

> ct lsview *myname*
- search view contain "myname" string

> ct setview myname_view
- set view

> ct mkview yourname_view
- to create new view

Tuesday, July 24, 2012

Find File in unix

find /home/myname/ -name *myfile*

for current directory
find ./ -name *myfile*

grep "myname" listname.log

Monday, July 16, 2012

Java : Count lines in file


long lines = 1;
        try {
LineNumberReader  lnr = new LineNumberReader(new FileReader(new File("C:/testfile.txt")));
lnr.skip(Long.MAX_VALUE);
lines = lnr.getLineNumber();
} catch (FileNotFoundException e1) {
} catch (IOException e) {
}

The faster way to get total line in file...

Wednesday, June 6, 2012

UNIX : Create file using vi and cat

using vi or cat


vi command
> vi test.txt
       and press
      "ESC" button
       ":wq"

done.. type "ls" you will see the new file has been created.

cat command
> "cat > test1.txt"
     and then press "CTRL" + "D"

done.. see your directory..

Wednesday, May 16, 2012

UNIX : Find files that contain a string

Ref for me..

find . -exec grep -l "string to find" {} \;
change the "string to find" to find your string. Please include (")

also can do this..
find . -type f | xargs grep "String to find"