Mobile Application Services

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Friday, 22 June 2012

Useful Unix scripts

Posted on 09:05 by Unknown

To display the details of available server CPU resources in UNIX

Display the number of CPUs in HP/UX

In HP/UX the ioscan command is used to display the number of processors available on the server.


root> ioscan -C processor | grep processor | wc -l
16

Display number of CPUs in Solaris


In Sun Solaris, the prsinfo command can be used to count the number of CPUs on the processor.

root> psrinfo -v|grep "Status of processor"|wc -l
       2
For details about the Solaris CPUs, the -v (verbose) option can be used with the psrinfo command

root> psrinfo -v

Status of processor 0 as of: 12/13/00 14:47:41
  Processor has been on-line since 11/05/00 13:26:42.
  The sparcv9 processor operates at 450 MHz,
  and has a sparcv9 floating point processor.
Status of processor 2 as of: 12/13/00 14:47:41
  Processor has been on-line since 11/05/00 13:26:43.
  The sparcv9 processor operates at 450 MHz,
  and has a sparcv9 floating point processor.

Display number of CPUs in Linux

To see the number of CPUs on a Linux server, you can cat the /proc/cpuinfo file.  In the example below we see that our Linux server has 4 CPUs.

root> cat /proc/cpuinfo|grep processor|wc -l
      4

Display number of CPUs in AIX

The lsdev command can be used to see the number of CPUs on an IBM AIX server.  Below we see that this AIX server has four CPUs:


root> lsdev -C|grep Process|wc -l


*********************************************************************************************************

To report the current CPU Activity

sar -u 1 5

sar utility can be used to provide various information about the server resources.

In the above example the parameters used and the details are as mentioned below
   -u option is for CPU related information
   1 is the frequency of execution of the command in seconds
   5 is the number of times the command should be executed.
   So the command displays the CPU information every 1 second for 5 times.


It reports the CPU related usage by the user(%usr), system(%sys), the CPU Wait for I/O(%wio) and the Idle Percentage(%idle).

Sample Output


14:08:17    %usr    %sys    %wio   %idle   physc
14:08:18      25        0          0           75       4.00
14:08:19      25        0          0           74       4.00
14:08:20      25        0          0           75       4.00
14:08:21      25        0          0           75       4.00
14:08:22      25        0          0           75       4.03
Average       25        0          0           75       4.01

Finding files in Unix based on specific criteria

FIND FILES THAT WERE MODIFIED/ACCESSED WITHIN A SPECIFIED TIME
       
   $   find  /<your path>  -mtime   1  -type   f
This command would return files modified  in the last 24 hours .
You can use -mtime option to return a list of files that were last modified N*24 hours ago. For example to find a file in last month (30 days) you would need to use -mtime +30 options.
-mtime +30   means you are looking for a file modified 30 days ago.
-mtime -30    means less than 30 days.
-mtime 30      If you skip + or - it means exactly 30 days
      -type f      searches only for files and not directories
To list the files in the directory tree that were modified within the past five minutes, type
$  find /<your path>  -mmin -5

To return a list of files that were accessed in the last 24 hours you would need to use the –atime option.
$  find  /<your path>   -atime   1  -type   f

******************************************************************
FINDING FILES WITH A SPECIFIC EXTENTION WITHIN A DIRECTORY
         $  find   /<your path>   -name  "*.cfg"
The command –name matches the file names with the specified pattern

******************************************************************
FINDING FILES BASED ON THE FILE-PERMISSIONS

Files with execute permission for group :
$ find /<your path>  -perm g=x   -type f
Files with execute permission for others:
$ find /<your path>  -perm  o=x   -type f
Where ‘g’ denotes groups and ‘o’ denotes others. x denotes execute permission.
******************************************************************
KILLING ACTIVE UNIX PROCESSES FOR SPECIFIC COMPONENTS

ps -ef |grep applmgr |grep <Component Name> |grep -v grep |awk '{print $2}' |xargs kill -9

For example to kill all active forms processes, we can use the following command:


ps -ef |grep applmgr |grep frm | grep -v grep |awk '{print $2}' |xargs kill -9
Read More
Posted in Unix for DBA's | No comments
Newer Posts Home
Subscribe to: Comments (Atom)

Popular Posts

  • Difference Between Oracle apps 11i & R12
    Summary of Changes : Component Release 11i Release 12 Database 9.2 10.2 Developer 6i 10i Application Server 1.0 10.1 Client Plug-in Jinitiat...
  • Obtaining Forms Runtime Diagnostics (FRD) In Oracle Applications
    A. Introduction When starting a Forms-based session in Applications it is possible to pass various useful parameters like formname=xyz, or l...
  • The simplest query for checking what’s happening in a database
    When someone asks you to take a quick look into database performance and for whatever reason you can’t run your usual scripts or performance...
  • Refresh vs Clone
    Refreshing VS Cloning an e-Business Suite Environment What is Refreshing? A refresh is where the data in the target environment has been syn...
  • How To Change Look And Feel and Colors Of Oracle Applications 11i and R12
    There are two system profile options that can be used to change look and feel.  Java Look and Feel . Java Look and Feel can have two values:...
  • Workflow Scripts
    1.Check for workflow components: ================================ set pagesize 400 set linesize 120 set pagesize 50 column COMPONENT_NAME fo...
  • CMAN [ Oracle Connection Manager ]
                                         Oracle Connection Manager helps a client process with directions to a network address. The Oracle Conn...
  • Oracle 11g RAC Interview question and answers
    1. What is the major difference between 10g and 11g RAC? Well, there is not much difference between 10g and 11gR (1) RAC. But there is a sig...
  • Concurrent Manager : troubleshooting
    Concurrent Manager : troubleshooting Summary of Possible Reasons and Solutions for the Problem Where All Concurrent Requests Stuck in Pendin...
  • How to lock/unlock statistics on a table?
                   In certain cases you may want to lock statistics in a table in certain cases, for example if you want a table not be analyzed...

Categories

  • 11.2.0.3 to 12.1.0 (Oracle 12c) upgrade
  • Backup and recovery
  • Basic RAC Commands
  • Blocking Sessions
  • CMAN [ Oracle Connection Manager ]
  • Data Guard Interview Questions
  • Deadlocks
  • Difference Between Oracle apps 11i & R12
  • File Locations -R12
  • Gather stats on table in oracle
  • How To Change Look And Feel and Colors Of Oracle Applications 11i and R12
  • How to compile invalid objects in an APPS Environment
  • How to recover Applications context file if it is corrupted or deleted accidentally?
  • How to Recreate the OraInventory?
  • Important DBA Views
  • JInitiator version too low and quot Errors in EBS Environments
  • Linux interview questions for DBA
  • Log file location in Oracle Apps 11i/R12
  • Long running concurrent requests
  • MWA Services
  • Obtaining Forms Runtime Diagnostics (FRD) In Oracle Applications
  • ORA-00845: MEMORY_TARGET not supported on this system
  • Oracle 11g RAC Interview question and answers
  • Oracle Applications Idle Session Timeout
  • Oracle Apps DBA Interview Questions
  • Oracle DBA Interview Questions
  • Oracle E-Business Suite 12.2 Architecture
  • Oracle Exadata Interview Questions
  • Personalizing The Login Page
  • RAC Cheat Sheet
  • RAC Interview Questions
  • Recovery catalog for RMAN backup
  • Refresh vs Clone
  • REP-3000 Oracle Toolkit Error
  • Replacing Jinitiator with JRE
  • RMAN Backup
  • RMAN Commands List (Oracle 11g)
  • Snapshot
  • TEMP Tablespace
  • Tracing Techniques
  • Undo Tablespace
  • Unix for DBA's
  • Workflow Mailer Troubleshooting
  • Workflow Trouble Shooting

Blog Archive

  • ►  2013 (30)
    • ►  November (3)
    • ►  October (3)
    • ►  August (3)
    • ►  July (1)
    • ►  May (1)
    • ►  March (10)
    • ►  February (8)
    • ►  January (1)
  • ▼  2012 (27)
    • ►  November (1)
    • ►  October (8)
    • ►  September (5)
    • ►  August (5)
    • ►  July (7)
    • ▼  June (1)
      • Useful Unix scripts
Powered by Blogger.

About Me

Unknown
View my complete profile