Archive

Archive for December, 2008

How to find top IO Process

December 31st, 2008 sam No comments

We can find top cpu cosumption process by prstat command in Solaris , sometimes it will be necessary for us to find which process is taking more IO or IO Waits. I had searched on the internet. i had find the script to find to top IO Waits.

1. http://www.sun.com/bigadmin/scripts/submittedScripts/psio.pl.txt
2. http://yong321.freeshell.org/freeware/pio.html#mostuseful

Categories: Uncategorized, UNIX Tags:

Configuring Send Mail in Solaris

December 31st, 2008 sam No comments

The goal of this article is to impart a basic understanding of how to make changes to Sendmail on a machine running the Solaris 9 Operating System. This article is written for engineers with a reasonably good working knowledge of the standard principles of the UNIX operating system. To utilize this article, you need to know how to edit files and run programs, and you need root access.

How Email Works (Mail Transfer Agents)

Two categories of application deal with email: Mail User Agents (MUAs) and Mail Transfer Agents (MTAs).

Mail User Agents are applications that facilitate the creation, viewing, and disposal of email messages. Examples include mail or elm in a UNIX environment, and Eudora or Outlook in the Windows world. Netscape and Explorer are Internet browsers that can also double as MUAs.

Mail Transfer Agents transport email from one machine; typically, each machine uses only one MTA. Sendmail fills this role, while other MTAs out there include Exim, Postfix, and Qmail.

Evolution of Sendmail

Sendmail is one of the oldest and mostly widely used MTAs in the world. It is the default MTA for most UNIX distributions, including HP’s HP-UX, IBM’s AIX, and Sun Microsystems’ Solaris OS. Sendmail’s long life has made it complicated to configure and maintain, but it makes up for its drawbacks with its ability to do just about anything.

First appearing over 30 years ago, Sendmail has evolved into a robust, feature-rich method for transporting electronic mail from one location to another. Originally designed at a time when hard drives the size of washing machines supplied 64 kilobytes of usable storage, Sendmail used every trick in the book to conserve space. To make everything short and to the point, the Sendmail configuration file used such cryptic parameters as “Fw” for “Domains we receive mail for” and “DH” for “Who gets all local email.” While there is a method to the madness, it is not readily apparent to the novice user. For backwards compatibility, these cryptic parameters are still present in the configuration file of today’s Sendmail versions.

Over the years, as features were added to Sendmail, the configuration process became more and more complicated. To make it more administrator-friendly, Sendmail uses a m4-based compilation and configuration model. This layer between the administrator and the build and configuration process makes Sendmail easier to set up and maintain without requiring upgrades of older programs to handle new interaction methods.

Configurations

This document couldn’t possibly cover everything there is to know about Sendmail without being hundreds of pages long, and a bore to read. Instead, we focus on three commonly seen configurations: Mail Server, Incoming Relay, and Outgoing Only.

When modifying the behavior of Sendmail, the /etc/mail/sendmail.cf file is not directly altered. Instead, a .mc file is altered and run through the m4 macro processor. Some example .mc files are in /usr/lib/mail/cf:

main.mc is the default setup system.

submit.mc configures Sendmail as an initial mail submission program.

subsidiary.mc relays all mail on this system through another machine before the mail goes to its destination.

For our examples, we will copy the main.mc file to new.mc and make our modifications like so:

cd /usr/lib/mail/cf

vi new.mc

make new.cf

cp new.cf /etc/mail/sendmail.cf

/etc/init.d/sendmail restart

To begin with, common elements are shared in all three configurations. A minimal file contains the following:

OSTYPE(`solaris8′)dnl

DOMAIN(`generic’)dnl

MAILER(`local’)dnl

MAILER(`smtp’)dnl

The OSTYPE macro defines what system this file is on.

The DOMAIN macro is used to pull in another file into the resulting sendmail.cf file.

The MAILER macros define which of the many different delivery methods this configuration file will use.

In this example, we are on a Solaris 8 or higher system, we are including the “generic” domain file, and we want to use both the local delivery system and the SMTP system.

Mail Server

The mail server is your typical server for incoming mail. It receives mail for user@domain, delivers it to the user’s local mailbox, and processes mail in its queue for delivery to the outside world.

You only need to make one change: Add each domain that is to be considered a local account into /etc/mail/local-host-names.

End result:

OSTYPE(`solaris8′)dnl

MAILER(`local’)dnl

MAILER(`smtp’)dnl

Incoming Relay

Incoming Relay is the common configuration for company email servers that are outside of the company firewall. Instead of storing the email, these relays pass it on to a predefined server inside the firewall that is the company’s mail server. This setup is perfect for implementing filtering, since this machine doesn’t handle the other duties of your typical mail server.

To configure Incoming Relay, we first need to add the relay server information. In this case, we are going to relay everything to relay.mydomain.com.

define(`SMART_HOST’, ‘relay.mydomain.com’)dnl

Next, we have to allow mail to be relayed through this machine. It’s best to only relay mail for domains served by the internal servers. The following option tells sendmail to use the /etc/mail/relay-domains file as a list of domains allowed to send or receive mail through this server:

FEATURE(`relay_entire_domain’)dnlWe are done. This server will now relay for any domains in the /etc/mail/relay-domains file, except for local accounts, to relay.mydomain.com.

End result:

OSTYPE(`solaris8′)dnl

DOMAIN(`solaris-antispam’)dnl

define(`SMART_HOST’, ‘relay.mydomain.com’)dnl

FEATURE(`relay_entire_domain’)dnl

MAILER(`local’)dnl

MAILER(`smtp’)dnl

Outgoing Only

For security purposes, it’s best not to set up an indiscriminate mail relay. Every machine needs to use an MTA to send email, and some programs require the ability to relay emails through an SMTP server. With these requirements, you can both relay mail for local services and secure your system from becoming an open relay by configuring Sendmail to attach only to the loop-back address.

To make Sendmail outgoing only, it needs to not accept mail from any remote hosts. To do this, we force it to use only the local loop-back address.

DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA’)No other options are required; Sendmail transports mail from the local machine to the outside world by default.

End result:

OSTYPE(`solaris8′)dnlDOMAIN(`solaris-generic’)dnlDAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA’)MAILER(`local’)dnlMAILER(`smtp’)dnl

Where to Go Next

For more information on options for a Relay server, see the sendmail.org tip Allowing controlled SMTP relaying in Sendmail 8.9 and later. Specifically, look at using the access_db option for a more robust anti-spam filtering relay server.

Now that you know how to make changes, you can decide what kinds of changes you want to make. Your first stop should be /usr/lib/mail/README as it contains a good deal of information about Sendmail configuration, the m4 macros, and so on. Once you’ve exhausted that, you can check out some of the following resources

edit manually file sendmail.cf

nano -w /etc/mail/sendmail.cf

replace line Fw/etc/mail/local-host-names with line

Fw-o /etc/mail/local-host-names

identically (if you got the same error for trusted-users)

Ft/etc/mail/trusted-users

with line Ft-o /etc/mail/trusted-users

This worked!!! Thanks.

chmod go-w /etc/mail

1. make entry /etc/hosts

2. make entry /etc/mail/locol-host

3. add entry DSevs$?m.$m$. in sendmail.cf

4. restart the sendmail

5. To send the attachement $uuencode dbbackup.log dbbackup.log | mailx -s ” Backuplog” sam@itexperts4u.com

Categories: Solaris Tags:

Automated FTP in Unix

December 31st, 2008 sam No comments
#!/bin/sh

### Sample Script and Method for FTP files from one
### Machine/Host to another Machine.
###
### If you want to ftp few file from
### Host-A (location /b002/org_files/)
### to Host-B (location /u001/b_loc),
### here is the script and methods.
###
### 1) Login into Host-B
### 2) cd /u001/b_loc
### 3) Then run the following FTP scripts as follows
###    # auto_ftp.ksh > auto_ftp.lst &
###
###
ftp  -n  host-A.com << !EOF
user unix-username  password
cd  /b002/org_files
prompt
bin

mget filename1
mget filename2
mget filename3

quit
!EOF
Script 2 

#!/usr/local/expect -f 

###############################################################################
# File Name : ftp2host.exp                                                    #
# # Purpose   : This script automates the   ftp    telnet interface             #
###############################################################################
# 1. Set the ftp prompt using a regular expression.
      set ftp_prompt "ftp>?"
      set hostname [lindex $argv 0]
      set username mbt
      set password mbt
      set ftp_prompt ftp
      set option bin
      set fname [lindex $argv 1]
## procedure for check for proper agrguments

proc testArgs {} {
global hostname
global fname

 if {$hostname == "" || $fname == ""}  {
   puts "\n#**************Invalid no of argumeters!!************#\n"
   puts " usage : expect ftp2host.exp  <hostIP> <currentDirFile> "
   puts "\n Note: given file(arg2) should be in current directory"
   puts "\n#****************************************************#\n"
   exit 0
 }

}

## main program stats here starts with calling procedure testArgs
{testArgs}
      #  Connect to the FTP server using the "spawn" command.
      spawn ftp $hostname

      # Wait for a login prompt.
      expect -re "(Name|login|Login|Username).*:.*" {

      # Login prompt received. Send user name to Unix server.
          exp_send "$username\r"
      } eof {
          #  No login prompt received. Display an error.
          exp_send_user "could not connect\n"
      }

      #  Wait for a password prompt from the Unix server.
      expect "Password:" {
      #  Password prompt received. Send the password.
          exp_send "$password\r"
      }

      #  Wait for an FTP prompt. Enter FTP commands.
      expect -re $ftp_prompt {
      # Change to the upload directory on the Unix server.
          exp_send "$option\r"
      }

       expect -re $ftp_prompt {
      # Upload the file to the Unix server.
          exp_send "put $fname\r"
      }

      expect -re "sent" {
      # Close the FTP connection to the Unix server.
          exp_send "bye\r"
        puts "\n ********$fname Transferred Successfully********"
   }
Categories: Solaris, UNIX Tags:

Troubleshooting ORA-1031 Insufficient Privilege

December 31st, 2008 sam No comments

Today I tried to login as sysdba i was given this error “ORA-01031 Insufficeint Privilege”. So I thought to write troubleshooting tips for ORA-01031

Facts About Operating System Authentication

1. The following syntax is used while OS Authentication
sqlplus / as sysdba

2. A SQLNET.AUTHENTICATION_SERVICES controls the operation system authentication.
On unix platforms setting the value of this parameter to ” ALL ” or removing this parameter from SQLNET.ORA will allow the Operating system users to authenticate to the database with out specifying the password in other case[setting the value to NONE] the authentication will fail with ORA- 1031.

eg : SQLNET.AUTHENTICATION_SERVICES=(ALL) will allow the OS authentication

SQLNET.AUTHENTICATION_SERVICES=(NONE) will fail the OS authentication

3. The Operating system user should belong to OSDBA group in order to login as sysdba and the user should belong to OSOPER in order to login a sysoper. On unix based platforms these groups by default would be DBA, OPER and in windows these would be ORA_DBA ,ORA_OPER.

1. Remote sysdba connections attempted with a user name and password uses password file authentication

2. The following syntax is used while using a password file authentication
sqlplus <sysdba user>/<password> as sysdba
The following syntax is used while using a password file authentication connecting to the database as remote user
sqlplus <sysdba user>/<password>@<NET SERVICE NAME> as sysdba

3. Password file authentication is enabled by setting the database parameter remote_login_password file to “shared” or “exclusive”.

SQL> alter system set remote_login_password file=exclusive scope=spfile;

4. On unix based platforms a password file is created by default during database installation with an entry of sys under directory $ORACLE_HOME/dbs/ and on windows the file is created under %ORACLE_HOME%\database\

5. Granting each database user a sysdba or sysoper privilege adds the user to the password file in the background.


Troubleshooting ORA-1031 with OS Authentication

1. Check whether the OS user is part of DBA group and OPER group if not add the user to these groups.

2. Check the SQLNET.AUTHENTICATION_SERVICES parameter in the SQLNET.ORA .
On unix based platforms either this parameter should not be present or should be set to ALL.
On windows this parameter should be set to NTS.

3. If the OS user is a domain user in the windows domain than check whether the database service is started with a domain user , if not start the database service with the
domain user. Check whether the domain is added to the ORA_DBA or ORA_<SID>_DBA group.

Check if a non domain[Local] user can able to login to the database. If so there could be problem with the domain settings ,contact the system administrator and the network
administrator reporting the same.

If the local user is also failing to login than follow the remaining steps specified in this troubleshooting document.

4. If a scheduled script on windows is causing the error than the user calling the script must be a privileged user.The AT command, by default, runs as the NT SYSTEM
account.The SYSTEM account is not a privileged Oracle user.

Categories: DBA Tags:

IZ046 Managing Oracle on Linux for DBA’s

December 28th, 2008 sam No comments

Today, I had cleared my IZ046 Managing Oracle on Linux for DBA’s, the exam was sechdule for 9 a.m. I was on time for the exam. The most of the questions where regarding ASM, Installation and Administrating Linux. I was little tense before the exam, how would be the paper, but it was not so much tough.

Categories: DBA, Linux Tags:

Use USB flashdrive as RAM

December 27th, 2008 ather No comments

Although memory sticks will be better the using usb flashdrive. You can only do this on a vista computer. When ever you put in a flashdrive it will bring up a menu and select speedup my computer using readyboost.

If you disabled the menu then go to my computer, right click the drive that is the usb flash drive and go to the readyboost tab.

Categories: General Tags:

Watch restricted websites

December 27th, 2008 ather No comments

http://proxy.org allows you to browse websites which are restricted in your country.

Another good anonymous proxy URL would be www.ghostingweb.com

Categories: General, Uncategorized Tags:

Public key authentication over SSH

December 27th, 2008 ather No comments

Setting up public key authentication over SSH

Generate key on local machine

ssh-keygen -t rsa

It will ask you for a password but you can leave it blank.

Note you could also pick -t dsa if you prefer.
Ensure that the remote server has a .ssh directory

Make sure the server your connecting to has a .ssh directory in your home directory. If it doesn’t exist you can run the ssh-keygen command above, and it will create one with the correct permissions.
Copy your local public key to the remote server

If your remote server doesn’t have a file called ~/.ssh/authorized_keys2 then we can create it. If that file already exists, you need to append to it instead of overwriting it, which the command below would do:

scp ~/.ssh/id_rsa.pub remote.server.com:.ssh/authorized_keys2

Now ssh to the remote server

Now you can ssh to the remote server without entering your password.
Security

Now keep in mind that all someone needs to login to the remote server, is the file on your local machine ~/.ssh/id_rsa, so make sure it is secure.

Categories: Uncategorized Tags:

Listen to Hindi Old/New Songs

December 27th, 2008 ather No comments

http://www.Dhingana.com is a very good website which offers it’s users to create smart playlists. A lot of playlists are already in place which contains a collection of very cool songs.

It’s very simple and doesn’t have any popups either.

Categories: Uncategorized Tags:

Speed up Windows XP

December 27th, 2008 ather No comments

Tips to speed up Windows XP. Needs to be done atleast once a month to tweak windows xp performance….

1. De-Fragmenting
Over time, the data on your hard drive gets scattered. Defragmenting your hard drive puts your data back into sequential order, making it easier for Windows to access it. As a result, the performance of your computer will improve.
a) Right click of C Disk.
b) Click properties.
c) Click tools tab.
d) Click “Defragment now”.
e) Click Defragment.

2. Uninstall Unneeded Programs
Removing programs that you no longer use can free up space on your computer and speed up your system’s performance. However, you need to uninstall the programs properly to see much improvement; deleting them is not enough. To do this, go to Control Panel and remove the unneeded programs from Add/Remove Programs list.

3. Stop Programs from starting on Windows boot
One way you can speed up your computer is to prevent programs from launching themselves at start-up. Not only do the unwanted programs delay the start of Windows, they also continue to slow down your computer since they use system resources.
a) Open your Start menu.
b) Click Run
c) In the command screen type “msconfig.exe”
d) In the “system configuration utility”, click either “service” or “startup” tab
e) Uncheck all programs that you are no longer using.
f) Click “OK”

4. Check for Spyware and Adware
Spyware is software that allows companies to monitor what websites you visit or even access your computer. Adware is software that displays advertisements. Both use system resources and slow your computer down. Detecting and removing the programs will improve system performance. Using Spybot and Adware can help remove spyware from the machine.

Clean your Registry
Microsoft Registry Problems = Slow Computer!
Microsoft Registry cleaner can be used to clean unwanted or obsolete registry items. It can be found at the following link: http://www.download.com/Registry-Cleaner/3000-2094_4-10471676.html?tag=dl.4

Categories: Uncategorized Tags: