Your Doorstep to the Temple of Oracle

Oracle EBS

Archive for the ‘linux’ Category

Crontab Setup In Linux

Posted by appsdba11i on May 13, 2011

Hi Folks

I am going to give some idea how do we use aronjob to setup automatic jobs in linux…

Setting up cron jobs in Linux

cron is a unix, solaris utility that allows tasks to be automatically run in the background at regular intervals by the cron daemon. These tasks are often termed as cron jobs in unix.

CronTab Setup
=============

Command :     crontab -e    

it will Edit your crontab file, or create one if it doesn’t already exist.

Format Of  Cronjob

* * * * * command to be executed
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)

Example :

I am Stting up a cronJOb which will Print a Message on screen At 11:44 Pm daily.

Steps:

  1. crontab -e
  2. add entry    44 11 * * * wall    This is crontab example
  3. save & exit

To view The Cronjobs setup for a user

Use Crontab -l command which will list the cronjobs setup for a user



Check Processing of Cronjob

Removing Cronjobs

Command : cronrab -r

Posted in linux | Tagged: , | Leave a Comment »

starting Database without Entering sqlplus in linux (aliases)

Posted by appsdba11i on May 13, 2011

Hi Folks

I am going to give some useful alias Use in Linux By Which u can start your Database in Linux with some other command
otherthan sqlplus

Steps

1) Login as oracle User
2)edit .bashrc  (will be in home directory of oracle user)

add entry

alias appsdba= sqlplus ‘/ as sysdba’

3)run . .bashrc

Let we see in Linux Box In pictures that will u give clear idea

Then We will see How it works

Hope this Will Be Helpful….

Thanx & Regards
Reddy

Posted in linux | Tagged: , | Leave a Comment »

How do I find the version of linux I am running?‎

Posted by appsdba11i on May 9, 2011

By using following files we can find the version of linux

1) cat /etc/redhat-release
2) cat /etc/enterprise-release
3) lsb_release -d

ex : cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.2 (Tikanga)

Posted in linux | Tagged: , , , , | Leave a Comment »

du command in linux

Posted by appsdba11i on May 8, 2011

du – estimate file space usage

SYNOPSIS
du [OPTION]… [FILE]…

Example
=========

du -sh filename

or
du -sh dirname

how to find size of directory size
==============================

Posted in linux | Tagged: , , , , , | Leave a Comment »

Sar Command in Linux

Posted by appsdba11i on May 8, 2011

The sar command writes to standard output the  contents  of  selected
cumulative  activity counters in the operating system. The accounting
system, based on the values in the  count  and  interval  parameters,
writes information the specified number of times spaced at the speci-
fied intervals in seconds.  If the interval parameter is set to zero,
the  sar  command  displays the average statistics for the time since
the system was started.

How it Works
The sysstat crontab invokes a shell script, sa1, which in turn calls a program named sadc (System Activity Data Collector) which gathers data samples on CPU, memory, io, and network devices, creating a snapshot of system performance for that moment in time. The data is written out, in a binary format, to /var/log/sa/saXX where the XX is the two digit day of the month. This scheme allows for the files to be overwritten as the month rolls over, so if they need to be archived, set up a shell script to rotate them elsewhere. Also, be aware that, on Red Hat at least, the /usr/lib/sa/sa2 script which creates the daily summaries each night, also removes any sar data files older than 7 days. This is configurable in /etc/sysconfig/sysstat.

Basic Usage
The sar program is invoked by the user. When called without the -f (file) option, it reads the file in /var/log/sa for today. When called with no options or arguments, sar gives us a nice little summary of CPU activity.

Simple points

=========

+  It will store 30 days of files(like cpu,i/o,swap ,mem usage in files), by  which we  can see the cpu usage of parcticular  for that day(old days)

+files will be stored in /var/log/sa

Usage : sar -f filename

To find present CPU usgae


Commands
===========

sar 2 3
sar -u 2 3
sar -r 3 3
sar -u
sar -f

Posted in linux | Tagged: , , , | Leave a Comment »

df Command in linux/Unix

Posted by appsdba11i on May 4, 2011

Usage

Report how much free disk space is available for each mount you have.

Syntax :

df  [option]  Mountpoint


Genarally used options

-k        like –block-size=1K

-h,    –human-readable  print sizes in human readable format( GB’s)
-i,         inode information instead of block usage

Examples:

To Find Amount of Free Space in  All Mount points


Some of examples
==============

df -h
df -k
df -h mountpoint
df -i

Posted in linux | Tagged: , , , | Leave a Comment »

SCP Command in Linux ( Secured Copy)

Posted by appsdba11i on May 4, 2011

scp stands for secure cp (copy), which means that you can copy files across an ssh connection that will be encrypted, and therefore secured.

You can this way copy files from or to a remote server, you can even copy files from one remote server to another remote server, without passing through your PC.

Usage

scp [option…] source destination

where source and destination can each take the form:

[hostname:][dir-path][filespec]

or

[ip-addr:][dir-path][filespec]

Options

-p    Preserves the modification and access times, as well as the permissions of the source-file in the destination-file
-q     Do not display the progress bar
-r      Recursive, so it copies the contents of the source-file (directory in this case) recursively
-v      Displays debugging messages

Examples

scp *.txt   user@192.168.0.14:/home/user/

t his will copy all files with .txt extension to the directory /home/user in the 192.168.0.14 host

scp -r /oraAPP    192.168.0.14:/oraAPP

This is going to recursively copy all files from ” /oraAPP ” directory to ” /oraAPP ” directory in 192.168.0.14 host.

Note

To use this command you need to have open-ssh installed in the hosts.

Posted in linux | Tagged: , | Leave a Comment »

nohup Command in Linux

Posted by appsdba11i on May 4, 2011

nohup

No Hang Up. Run a command immune to hangups, runs the given command with hangup
 signals ignored, so that the command can continue running in the background 
after you log out.

SYNTAX
      nohup Command [Arg]...

If standard output is a terminal, it and standard error are redirected so that they are appended
 to the file  `nohup.out';
 if that cannot be written to, they are appended to the file `$HOME/nohup.out'. 
If that cannot be written to, the command is not run.

If `nohup' creates either `nohup.out' or `$HOME/nohup.out', it creates it with no "group" or
 "other" access permissions. 
It does not change the permissions if the output file already existed.

`nohup' does not automatically put the command it runs in the background; you must do that 
explicitly, by ending the command line with an `&'. 


Example I want to remove directory and i need to exit that window immediatly and need 
that command to  be Run in Background

I have given a command to delte some folders in /ORADB & exited

nohup usage


AFter sometime i chcked the status of /ORADB.. directories are deleted even after exiting
 that terminal because we have used nohup command

nohup af

Chk for nohup.out for the activity that has been enterd with nohup command..

nohup.out can be found wherever we have given that command...


Hope this will helpful..



Posted in linux | Tagged: , | 1 Comment »

finding size of files in linux or usage of DU command

Posted by appsdba11i on April 28, 2011

The du command displays the number of blocks used for files. If the File parameter specified is actually a directory, all files within the directory are reported on. If no File parameter is provided, the du command uses the files in the current directory.

If the File parameter is a directory, then the number of blocks reported is the sum of blocks allocated for the files in the directory and the blocks allocated for the directory itself.

Specifying the -a flag reports the number of blocks in individual files. Whether the -a flag is used or not, individual files specified by the File parameter are always listed.

Specifying the -s flag reports the total blocks for all specified files or all files in a directory.

The block count includes indirect blocks of each file. Block count is calculated in 512-byte units independent of the cluster size used by the system. Specifying the -k flag calculates the block count in 1024-byte units.

Examples

1. To summarize the disk usage of a directory tree and each of its subtrees, enter:

du /home/fran

This displays the number of disk blocks in the /home/fran directory and each of its subdirectories.
2. To summarize the disk usage of a directory tree and each of its subtrees in 1024-byte blocks, enter:

du -k /home/fran

This displays the number of 1024-byte disk blocks in the /home/fran directory and each of its subdirectories.
3. To summarize the disk usage of a directory tree and each of its subtrees in MB blocks, enter:

du -m /home/fran

This displays the number of MB disk blocks rounded off to nearest 2nd decimal digit in the /home/fran directory and each of its subdirectories.
4. To summarize the disk usage of a directory tree and each of its subtrees in GB blocks, enter:

du -g /home/fran

This displays the number of GB disk blocks rounded off to nearest 2nd decimal digit in the /home/fran directory and each of its subdirectories.
5. To display the disk usage of each file, enter:

du -a /home/fran

This displays the number of disk blocks contained in each file and subdirectory of the /home/fran directory. The number beside a directory is the disk usage of that directory tree. The number beside a regular file is the disk usage of that file alone.
6. To display only the total disk usage of a directory tree, enter:

du -s /home/fran

The -s flag instructs the du command to display only the sum total disk usage of the /home/fran directory and the files it contains. By default, the du command displays an error message if it cannot read a file or directory.
7. To display the disk usage of the files and file hierarchies referenced by all the symbolic links in addition to the normal files found during traversal of a the /home/fran directory, type:

du -L /home/fran

8. To report the disk usage of the file or file hierarchy referenced by the symbolic link mylink, type:

du -H mylink

Posted in linux | 1 Comment »

Finding files older than 30 days in Linux & find examples

Posted by appsdba11i on April 28, 2011

If you want to find a file that is 30 days old, use the -mtime option:

find . -mtime 30 -print

An alternate way is to specify a range of times:

find . -mtime +30 -mtime -40 -print

Finding Files of a Specific Type

You may want to perform a find operation to produce a list of files only and not include directories in the operation. The following find is similar to what we performed earlier, but this time it produces a list of files only. This is achieved by specifying that we are looking for type f for files:

# find /home -type f -print

You can search for a variety of different types such as f for a file as shown in the example, b for a block special file, l for a symbolic link, and so on.

Find Empty Files and Directories

A useful test when performing a find operation is to locate empty files. The following example searches for all empty files and directories on the system with the -empty operator that is available on some UNIX variants, including Linux. This is only a partial output because it’s so long:

# find / -empty -print

All the files and directories listed as a result of this find operation are empty. The long listing of /auto shown as part of the example, confirms this fact. Keep in mind that -empty is not available on all UNIX variants.

Finding Files By Name, Size, and Both Name and Size

Let’s perform a couple of independent finds and then combine the criteria of the finds. The finds in the following example are performed on a small, desktop system. This allows me to search the entire system for files meeting various criteria. You may be working on a much larger, more elaborate system, so use caution when searching the entire system for files. You may slow down other users for a long period of time, depending on the number of files on the system both locally and accessible over the network.

First, let’s find for all files on the system ending in.c with the command below:

# find / -name *.c -print

You can see from this find that there are many files on the system ending in.c. I included only the beginning and end of this search because the entire output would be too long.

I also ran this command and piped the output to wc, which showed 1737 files on the system ending in.c, as shown in the following example:

# find / -name *.c | wc
1737 1737 77044
#

Now we can search for all files on the system greater than 500,000 characters in size with the find command below:

# find / -size +500000c -print

I also ran this command and piped the output to wc, which showed 215 files on the system with a size greater than 500,000 characters, as shown in the following example:

# find / -size +500000c -print | wc
215 215 6281
#

Let’s now combine the two commands and see how many of the files on the system ending in.c are also greater than 500,000 characters in size:

# find / -name *.c -size +500000c -print
/usr/src/drivers/scsi/advansys.c
#

Of the 1737 files on the system ending in.c and the 215 files greater than 500,000 characters in size, only one file, advansys.c, meets both criteria. There is an implied and in the previous find command. We could have explicitly specified an and; however, it is implied in the find command. The find did indeed result in files that end in.c and are greater than 500,000 characters. The upcoming find uses the or operator, which is not implied.

What if we wanted to find both files ending in.c and.o that are greater than 500000 characters in size? We could use the -o operator which would “or” the files ending in.c and.o. The following example shows this find operation:

find / -size +500000c \( -name *.c -o -name *.a \) -print
find / -size +500000c \( -name *.c -o -name *.a \) -print | wc

# find / -size +500000c \( -name *.c -o -name *.a \) -print

The two file extensions for which we are searching are placed in parentheses. A backslash is required before the open and close parentheses because the parentheses have meaning to the shell and we want them to be used only to specify the precedence in our find command and not to be used by the shell. The result of this find shows that many files ending in.a and.c meet the criteria of greater than 500,000 characters.

Let’s now pipe the output of this commnd to wc to see precisely the number of files ending in either.c or.o and have a size greater than 500,000 characters:

# find / -size +500000c \( -name *.c -o -name *.a \) -print | wc
39 39 982
#

Of the 39 files that meet the criteria, we know that 38 ended in.a because our earlier example showed that only one file ending in.c met the criteria.

Finding Files By Owner, Type, and Permissions

You can find objects on the system owned by particular users and groups. To find all of the objects owned by user “news” on the system, we would use the following command:

# find / -user news -print

Using the -user operator we can specify either the name of the user, in this case “news”, or the user identification number. The following example shows performing the same find operation using the user identification number of “news,” in this case “9,” instead of the name “news”:

# find / -user 9 -print

This find operation produced exactly the same results using the name “news” and the user idenfication number “9.”

You can search for a variety of different types such as f for a file, as shown in the example, b for a block special file, l for a symbolic link, and so on. We could add type -d to find only directories belonging “news” as in the following command:

# find / -user news -type d -perm 775 -print

This is another example of using the implied and of find meaning that the find will print items that are both owned by “news” and are directories only.

Let’s now add a specific permission for the directories to our implied and. We’ll find only objects belonging to “news” that are directories with a permission of 775 in the following example:

# find / -user news -type d -perm 775 -print

We searched for directories belonging to “news” in which both the owner and those in the group have read-write-execute permission, and others have read-execute access. This is a common type of find operation for system administrators to perform – looking for files and directories belonging to a specific user and having specific permissions.

Posted in linux | Tagged: | 4 Comments »