http://goo.gl/EmKxy0

Archive

Posts Tagged ‘UNIX’

How to avoid locking on system tables in tempdb

November 24th, 2011 No comments

1. tempdb database is shared among all databases in a server, so it is heavily used. It causes lock contention on sysobjects, syscolumns and sysindexes tables. To reduce the contention try to use “select…insert” instead of “select into””, because former is fully logged operation which slow down the process and provide a solution to locking problem.

2. Try to use data only locking scheme in place of allpages.

“Pushd, popd and cd -” unix commands

November 21st, 2011 No comments

pushd:- This command acts similar to “cd” command.

popd:- This command is used to return to previous directory.

cd -:- This command is also used to return to previous directory.

NOTE Both “popd” and “cd -” works similar but they differ primarily that “cd -” acts like a loop i.e.

                                                     cd -                  cd -       cd -      cd -

Directory X ——> Directory A ——–> Directory B ——-> Directory A ——–> B ——->A —–> B

However,

                                                popd       popd

Directory X ——> Directory A —> Directory B ——-> A———> X

Categories: ASE, Developement, Start Sybase, UNIX Tags: ,

getopts unix command

November 21st, 2011 No comments

getopts is an unix command to fetch argument and argument values. OPTARG and OPTIND are two variables to hold argument values and index.

usage:

suppose we have define command usage as below

test.ksh [-s <server name>] [-d <database name>] [-u <user name>] [-p <password>]

so usage is

while getopts s:S:d:D:u:U:p:P i

do case “$i” in

        s|S) SERVER="$OPTARG";;
        d|D) DATABASE="$OPTARG";;
        u|U) USER="$OPTARG";;
        p|P) PASS="$OPTARG";;
        ?) usage;;
   esac

done

Categories: ASE, Developement, Start Sybase, UNIX Tags: ,

Essential DBA Unix

September 12th, 2011 No comments

Hi All,

I am listing the command which we are frequently used in our DBA unix enviorment. I would lile to thnx Abhay for sharing this.

============================
Essential DBA Unix
============================
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!System Administration!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

su : Acquiring super user status
su – henery : Crearting Other users (henery) environment
passwd : Changing Passowrd
date : Setting the system date
wall : Write message all users desktop , terminate
calender : display calender

Read more…

Sparc T4 will have better single-thread performance :important for large databases and ERP applications.

January 12th, 2011 No comments

Source :: http://www.pcworld.idg.com.au/article/370535/oracle_halve_core_count_next_sparc_processor/

The Sparc T4 will have better single-thread performance instead, which is important for large databases and ERP applications.

Chips with high core counts tend to be better at some workloads than others. They are good at jobs that can be broken into many smaller parts, such as processing high volumes of Web requests and online transactions, but fare worse at big databases and ERP applications, where single-thread performance is important
Categories: News Tags: , , ,

Unix – Bits & Pieces

December 31st, 2010 No comments

Escaping
========
1. Single quotes protect all special characters except single quote
e.g. $echo ‘Hi, “ life is all about making sense out of non sense – By Sybanurag’
output – Hi, “ life is all about making sense out of non sense – By Sybanurag

2. Double quotes don’t protect double quotes and $ and `(backquote)
e.g. $echo “Hi, “ life is all about making sense out of non sense – By Sybanurag”
output — Hi, life is all about making sense out of non sense – By Sybanurag

3. Double quotes protect single quotes, and single quotes protect double quotes.

Process Basics
===========
1. When two users run the same same program, there is one program on disk but two processes in memory.

Problem 1
——–
Can a process be orphand?

Solution 1
———
Every process has a process, you can’t have an “orphaned” process, though a process can remain in orphaned state for a small moment.

SHELL
=====
Dot Matching
————
* and ? don’t match a filename starts with a dot.
* and ? don’t match the / in a pathname.

Character Class
—————-
[] is a character class.
The expression [a-zA-Z]* matches all filenames beginning with an alphabet, irrespective of case.
*.[!co] – Matches all filenames with a single-character extension but not the .c or .o files.
[!a-zA-Z]* Matches all files names that don’t begin with an alphabetic character.

cp $HOME/prog_sources/*.{c,java} — Copy all files in a directory having extension c or java
cp $HOME/source/{project, html}/* — Copy all files from the directories project and html

Categories: UNIX Tags:

Vi Editor – Part 3

December 30th, 2010 No comments

Problem 13
————
How to perform pattern search in vi editor?

Solution 13
————
open a file in vi editor in command mode then follow below commands..
/patn — searches forward for pattern patn. For e.g. to search for pattern “execute” use /execute
?patn — searches backward for pattern patn
n — repeat search in same direction along which previous search was made
N — repeat search in direction opposite to that along which previous search was made

Problem 14
————
how to substitute?

Solution 14
———–
Use below..
:5,10s/x/y/g — Substitute every occurence of “x” by “y” from line 5 to 10
:.s/x/y/g — Substitute every occurence of “x” by “y” in the current line only
:$s/x/y/g — Substitute every occurence of “x” by “y” in the last line

If you need confirmatory substituion then use “c” with “g” like below
:2,$s/x/y/gc

Note: Significance of “g” is to substitute every occurence in a line else first occurence of “x” will be replaced by “y” in every line only.

————————————————Note—————————————————
I am closing Vi Editor here for now. Hope this will help you all. Suggestions and Criticism are cordially welcomed and highly appreciated :-)..Enjoy learning

Categories: UNIX Tags:

Vi Editor – Part 2

December 29th, 2010 No comments

Problem 6
———
How to copy range of lines from a file to another?

Solution 6
———-
Suppose i want to copy 50 lines from line number 15 to 64, then open file in vi editor in command mode then follow below command
:15,64w file2.txt

Additionally,
For single line –> :10w file2.txt
For current line where cursor is positioned –> : .w file2.txt
For last line –> :$w file2.txt
For current line to end –> : .,$w file2.txt

Problem 7
———-
What are repeat factor and how to use in navigation?

Solution 7
———
k — move cursor up
j — move cursor down
h — move cursor left
l — move cursor right

if want to move 5 lines up then use “5k” this is called repeat factor.

Problem 8
———
how to navigate among words in a line?

Solution 8
———-

Problem 9
———
How to do “copy and paste” in vi editor?

Solution 9
———-
Open a file in vi editor in command mode,
y — copy single character
yy — copy current line
15yy — copy current line and 14 lines below

p – paste text on right
P – paste text on left

NOTE: p and P paste text on right and left when delete single character of line. However, same keys paste “below” and “above” when delete complete line.

Problem 10
————
How to join lines?

Solution 10
————
Use “J” in command mode. Additionally, if want to join current line and 5 lines below current line then use “6J” (called repeat factor)

Problem 11
———–
How to discard all changes in a line before moving away from the line.

Solution 11
———–
Use “U” in command mode

Problem 12
———–
How to repeat last command?

Solution 12
———–
Use “.” in command mode. For e.g. if you have deleted 3 lines using “3dd” then you can delete 3 lines again and again by pressing “.”

Categories: UNIX Tags:

Vi Editor – Part 1

December 28th, 2010 No comments

Basic Vi Editor commands
————————
Problem 1
———
How to do the undo in Vi editor?

Solution 1
———-
Go to command mode and press “u” to undo the last action.

Problem 2
———
How to convert lines into comments?

Solution 2
———
Use “I” and “A”
“I” inserts at the beginning of line.
“A” appends at the end of line.
So press “I” and type /* then [Escape] and then press “A” and type */ then [Escape]. Due to this each line can be converted to comment.

Problem 3
———
How to insert lines above and below the current line without placing the cursor at the start and end of line?

Solution 3
———-
Use “o” and “O”
open a file in command mode and press “o” which inserts a new line below the current line.
Open a file in command mode and press “O” which inserts a new line above the current line.

Problem 4
———
What is the difference between s,S,r,R in command mode?

Solution 4
———
r –> Replaces a single character with one character.
R –> Replaces all text on the right of the cursor position.
s –> Replaces a single character with many.
S –> Replaces the entire line irrespective of cursor position.

Problem 5
———
How to save and quit in one character?

Solution 5
———
Use “:x” in command mode.

Categories: UNIX Tags:

Usage of #! /usr/bin/ksh..

August 11th, 2010 No comments

I came across with below article for the usgae of #!/usr/bin/ksh.

Just Sharing….

Source : www

Originally, we only had one shell on unix. When you asked to run a command, the shell would attempt to invoke one of the exec() system calls on it. It the command was an executable, the exec would succeed and the command would run. If the exec() failed, the shell would not give up, instead it would try to interpet the command file as if it were a shell script.
Then unix got more shells and the situation became confused. Most folks would write scripts in one shell and type commands in another. And each shell had differing rules for feeding scripts to an interpreter.
This is when the “#! /” trick was invented. The idea was to let the kernel’s exec() system calls succeed with shell scripts. When the kernel tries to exec() a file, it looks at the first 4 bytes which represent an integer called a magic number. This tells the kernel if it should try to run the file or not. So “#! /” was added to magic numbers that the kernel knows and it was extended to actually be able to run shell scripts by itself. But some people could not type “#! /”, they kept leaving the space out. So the kernel was exended a bit again to allow “#!/” to work as a special 3 byte magic number.
So
#! /usr/bin/ksh
and
#!/usr/bin/ksh
now mean the same thing. I always use the former since at least some kernels might still exist that don’t understand the latter.
And note that the first line is a signal to the kernel, and not to the shell. What happens now is that when shells try to run scripts via exec() they just succeed. And we never stumble on their various fallback schemes.

– Senior Unix SA

Categories: UNIX Tags: , , , ,