Showing posts with label Unix. Show all posts
Showing posts with label Unix. Show all posts

Command to List the Oracle Databases Running on Linux Server

Generally we use ps -ef|grep pmon command to list the databases running on the database server. 

In this post I am going to mention

Commands to Delete Old Aged Oracle Trace Files(.trc, .trm) and Audit(.aud) Files

In this post I am going to explain the command to delete old trace, Audit files. You have to periodically clean up these trace, audit file locations to avoid the file system get filled with files.

How Check Hardware type In Linux / Unix

AIX

uname -M  /   prtconf

Linux

cat /sys/devices/virtual/dmi/id/*	

How to Remove / Delete / Drop a Machine from Oracle VM Virtual Box?


Step 1.
Stop /power off the running VM by right clicking the running virtual Machine.

Linux Screen Command: re Attach an Already Attached Session

Here are some useful tips to use screen command in Linux user logins. Linux screen command is very useful command to keep the session logged in without any failure even if any kind of network failure etc.
  1. Invoke a Screen session
Login to your a/c

Unix Linux Script to Attach and Embed the HTML File in Mail Body

(
export ATTACH="/home/sthomas/xyz.html"
export MAILPART=`uuidgen` ## Generates Unique ID
export MAILPART_BODY=`uuidgen` ## Generates Unique ID
export SUBJECT=”Attach And Embed HTML”

echo "To: $MAILTO"
echo "Subject: $SUBJECT"
echo "MIME-Version: 1.0"

Putty Configuration Error: There is no disk in the drive. Please insert a disk into drive

Error Description:

After putting/accessing a DVD in the drive, while opening the putty.exe it is giving the following error message.

PuTTY Configuration: There is no disk in the drive. Please insert a disk into drive D:.

Create File or Modify the Existing UNIX/LINUX File With Old / New Timestamp

Use touch command to change the timestamp of a file to newer or older one. Also, this command can be used to copy the timestamp between files.

touch –t  [[CC]YY]MMDDhhmm [.SS] filename

where          MM - The month of the year [01-12].

           DD - The day of the month [01-31].

Unix Shell Script to Find out Files Created within x Hours Without Using mmin / cmin for Solaris

HW=3 # Modify this variable value. In this example it will find out the files created within last 3 hours.
a=$( date +%H )
if [ $a -gt $HW ]; then
    a=$(( $a - $HW ))
else if [ $a -lt $HW ]; then
    a=$(( $a + 24 - $HW ))
else
    a=00

Compress/zip Sqlplus Spool Output Automatically with Sql Execution Using UNIX Pipe

We generally use the oracle sqlplus spooling feature to log the output of the sql commands. If the output of the SQL command is too big in size, in such cases better to zip/compress the spool file. Again the available free space in the file system is too low to make the zip after creating the spool file is bit risky. Sometimes there will not be room for hold the actual and zip file during the compress process.

How Can I Get vi Editor Commands History

Option 1:
        Open vim editor and press then (colon Key) :
        Use up and down arrows to see the previous command history.
Option 2:
        Open vi editor and press then :history
        This will list around 20+ commands in the screen.
Option 3
        Open the .viminfo file in the home directory which will give you the list of commands which got executed preiously.

How to Kill or Resume [1]+ Stopped Unix Jobs

When you press ctrl-z on actively running job or command it will suspend the job and release the prompt. But the job will be stopped and remain idle in the back ground. If you try to logout the window or session you will get a message saying “There are stopped jobs.” You can stop or resume the jobs using following commands.
jobs –p command will give the process id for the suspended job.
jobs –l command will list the details of the suspended job
See examples below.

Shell Script: 3 Methods to Find Out Nth Word in a String

Here is my test string - This is a temporary change to complete the export. I wanted to find out nth word from the string.  I have specified the nth word in red color below
$ mystring="This is a temporary change to complete the export"

Method 1 – awk – 4th word

Shell Script: Different Method to Find Out Number of Characters in a String

To count total number of characters in a string
Count total number of
$ mystring="This is my test string"
$ echo "${#mystring}"
22
$ expr length "$mystring"
22

Shell Script to Print Only First / Last Words in all Lines of a Text File

I have a text file and I wanted to print only first and last words of the file.
My sample input file is with following data
$ cat dat
 MONTH YYYY WK Mo Tu We Th Fr Sa Su
01-JAN 2013 01    01 02 03 04 05 06
01-JAN 2013 02 07 08 09 10 11 12 13
01-JAN 2013 03 14 15 16 17 18 19 20

How to see / Check the Step by Step Execution of a Shell Script for Debugging?

It is very important have the step by step execution feature for debugging for any kind of programming language. Using this feature you can see the variable values which are getting assigned during the script execution. In shell script you can use the –x option to see the step by step execution. See an example here.


I have a sample program here.

How to Set / Unset Default Value for Command Line Arguments For a shell script?


While doing shell scripting you will use command line arguments to pass the values to the program. The program has to verify the value of the command line arguments whether it is having proper values assigned before further execution. Otherwise you can assign a default value for the parameter or argument if applicable.
Syntax:

Shell Script to Repeat the Execution of Command / Job Based on Time Interval Periodically


Suppose if you are copying some huge files from server to another server and you wanted to see the progress in size, number you can use these scripts. These scripts will run periodically according to the sleep commands.

Using yes Command

crontab Commands Fails in Linux: You (%s) are not allowed to use this program (crontab)


Error Description:
crontab –e, crontab –l commands are failing with following error.
$ crontab -l
You (brmsftp) are not allowed to use this program (crontab)
See crontab(1) for more information
$ crontab -e

How to Prepare awk Data Report? Example


I have a text file with following details. I wanted to create a simple report as formatted in the output. See a simple awk program to generate the report.

Labels

Oracle (629) Script (86) General (77) Unix (47) Blog (23) Technology (19) gadget (6) games (6) Business (3) OCI (3) SQL* Loader (3) Datapump (2)
 

http://shonythomas.blogspot.com.com Copyright 2011-25 All Rights Reserved | Site Map | Contact | Disclaimer