Thursday, March 29, 2012

Commands to shutdown solaris10 machine

A solaris machine can be put to shutdown using the below mentioned commands .But use appropriate command that is required according to the need.


The commands are:-


1.shutdown
2.init
3.halt
4.reboot
5.poweroff
6.stop+A

1. Shutdown:- .This command is mostly used to shutdown server machines which consists of different users so that the users would be informed before shutting down the system. The default wait time for bringing the system to singler user state(root ) is 60 secs. In order to issue shutdown command one should have root priviliges.


   Syntax of Shutdown command with options.


    shutdown -i<init-state> -g<grace-period> -y


    where init-state can be 0,S,1,2,3,5,6. The default init-state  is S.


   where grace-period is to set the wait time of shutdown .The default time  is 60 secs.


  where  -y command  continues the shutdown with out prompting the meassage do you want to continue? (y or n)


2. Init :- This command is used to shutdown a single user system or change the runlevel of the system.
    
          syntax: init <run-level>




The below table describes about  different run-levels in detail



RUN LEVEL
 DESCRIPTION
0
Stops system services and daemons. Terminates all running processes. Unmounts all file systems.
S
System administatorr state. Only root is allowed to login.Only crictical file systems are monuted
1
System administatorr state. Only root is allowed to login. Local file sysytems are also mounted.
2
Normal multi-user operation state , without network file systems (NFSs)

3
Normal multiuse operation of a file server, with NFSs shared.

5
Power-down state. Shuts down the system so that it is safe to turn off power to the system.

6
Reboot state.


3.Halt:- This command shutdowns the sytem immediatley with out informing the users.


4.Reboot:- Reboots immediatley with  out informing the users .The speed of such a reboot is useful in certain circumstances, such as when you’re rebooting from the single-user run state and reconfigures the system.


example:-reboot -- -rs


5. Poweroff- Shutdowns the system with out notifying the users. If the hardware supports the power off it also turns off the power to system.


6.stop+A :Stop+A Interrupts any program currently running and puts the system at the OpenBoot prompt, ready to accept OpenBoot PROM commands.

Advantage of  shutdown and init over other commands:-


The Solaris reboot, poweroff, and halt commands stop the processor and synchronize the disks, but they perform unconditional shutdown of system processes. These commands are not recommended because they do not shut down any services and unmount any remaining file systems where as init and shutdown are the most reliable ways to shut down a system, because these commands shut down services in a clean, orderly fashion and shutdown the system with minimal data loss









Wednesday, March 14, 2012

Monitor Tuxedo Application using TXRPT utility

              txrpt utility


txrpt utility analyzes the standard error output of a Tuxedo server to provide a summary of service processing time within the server.


example1:-
cat tuxserver1.stderr.120115054310.29027 | txrpt
ili
 service summay report is printed for all the services of the tuxedo server"tuxserver1" where we can see summary is split into hourly report which contains response time of each service and number of times the service invoked.





  txrpt utility takes "std err" file of a particular tuxedo server as input where you can see each service's PID , Start Date, Start time , end time , end date (screen shot below) and analyses using some logic and converts to above output (screen shot above)








example2:-
cat tuxserver.stderr.120115054310.29027 | txrpt  -d 01/15 -s 11:00 -e 13:00

You can also take customized output from  txrpt utility  like you can specify on which date you need analysis , also you can give from which time to which time the report should be given.


Tuxedo administration - Cleaning IPC resources



                    Clean IPC resources


What are IPC resources:-Inter process communication resources are OS resources for example message queues, shared memory & semaphores. 


How tuxedo cleans IPC resources normally:-
Normally when tmshutdown command was issued to shutdown the tyxedo system it  removes all the  IPC resources from the system. 


What if tuxedo system doesnot clean IPC resources normally:-
But, if in case, shutdown was not successful , then few IPC resources will still remain in the system and this causes problem in tuxedo reboot next time.


How to clean IPC reources manually:-
tmipcrm [-y] [-n] [TUX_CONFIG_FILE]

Other methods of cleaning IPC reources manally:-

By listing the IPC resources first suing command ipcs
and then by removing them by command ipcrm


login to the tuxedo environment and fire below 3 commands ..

ipcs -s | grep $USER| awk '{printf "ipcrm -s %d\n", $2}' | sh
ipcs -m | grep $USER| awk '{printf "ipcrm -m %d\n", $2}' | sh
ipcs -q | grep $USER| awk '{printf "ipcrm -q %d\n", $2}' | sh

Monday, March 12, 2012

Service Management Facility(SMF) in Solaris10

Service Management Facility is a new feature added  to Solaris10. It has several advantages when compared with previous versions of solaris.

Some of the advantages are listed below.

1.SMF provides flexibility to root user to  view and manage services.
2. The system administrator can  also enable, disable , restart  and modify the system   services.
3. The dependency of  a service on other services are also maintained by SMF.
4. SMF  starts the services in correct order of their dependency.
5. SMF also starts the services in parallel according to the dependency so that the boot time is quicker than the previous versions of solaris.

Two important commands used in SMF are svcs and svcadm.

svcs :- Used to display information about all the services.

Common options used with svcs are :-

svcs  -a :-  Shows all the services
 example:-
legacy_run     Feb_28   lrc:/etc/rc2_d/S47pppd
legacy_run     Feb_28   lrc:/etc/rc2_d/S70uucp

disabled 15:48:41 svc:/network/shell:kshell
disabled 15:48:41 svc:/network/talk:default
disabled 15:48:42 svc:/network/apocd/udp:default
online 15:47:44 svc:/system/svc/restarter:default
online 15:47:47 svc:/network/pfil:default
online 15:47:48 svc:/network/loopback:default
online 15:47:50 svc:/system/filesystem/root:default


svcs  -d :- shows the dependent services.
 example:-
svcs -d svc:/network/ssh:default
STATE       STIME      FMRI
online         Feb_28    svc:/network/loopback:default
online         Feb_28    svc:/network/physical:default
online         Feb_28   svc:/system/cryptosvc:default
online         Feb_28   svc:/system/filesystem/local:default
online         Feb_28   svc:/system/utmp:default
online         Feb_28   svc:/system/filesystem/autofs:default

svcs -x :- Describes the state of the service.
   example:-
   svcs -x svc:/network/ssh:default
   svc:/network/ssh:default (SSH server)
   State: online since Tue Feb 28 16:01:46 2012
   See: sshd(1M)
   See: /var/svc/log/network-ssh:default.log
   Impact: None.



 svcs -l :- Displays detailed information about the service.
 example:-
svcs -l svc:/network/ssh:default
fmri         svc:/network/ssh:default
name         SSH server
enabled      true
state        online
next_state   none
state_time   Tue Feb 28 16:01:46 2012
logfile      /var/svc/log/network-ssh:default.log
restarter    svc:/system/svc/restarter:default
contract_id  61
dependency   require_all/none svc:/system/filesystem/local (online)
dependency   optional_all/none svc:/system/filesystem/autofs (online)
dependency   require_all/none svc:/network/loopback (online)
dependency   require_all/none svc:/network/physical (online)
dependency   require_all/none svc:/system/cryptosvc (online)
dependency   require_all/none svc:/system/utmp (online)
dependency   require_all/restart file://localhost/etc/ssh/sshd_config (online)

The state of each service can be one of the following

 disabled: The service instance is not enabled and is not running.
 legacy_run: The legacy service is not managed by the SMF, but the service can be
observed. This state is only used by legacy services that are started with RC scripts.
 maintenance: The service instance has encountered an error that must be resolved by
the administrator.
 offline: The service instance is enabled, but the service is not yet running or available
to run.
online: The service instance is enabled and has successfully started.
uninitialized: This state is the initial state for all services before their configuration
has been read.

svcadm is  Used to perform common service management tasks such as enabling, disabling, or restarting service instances.

The svcadm command allows the following sub commands

enable: Enables the service instances.
 example:-
 svcadm enable  svc:/network/swat/tcp:default

disable: Disables the service instances.
 example:-
svcadm disable svc:/network/swat/tcp:default

restart: Restarts the service instance
example:-
svcadm restart svc:/network/swat/tcp:default
 
 refresh: Refresh the service instance
 example :-
svcadm refresh  svc:/network/swat/tcp:default





Friday, March 9, 2012

Find out DB locks in a DB account or Instance and kill the process





 To find out the DB  lock on a particular DB account  




 To find out the DB  locks on all the Databases of a DB instance  




 To  create commands to kill the DB locked sessions  - fire below alter commands to kill 
respective DB sessions& locks       






Tuesday, March 6, 2012

Monday, March 5, 2012

MQ administration Commands



                               Useful Commands for MQ administration

dspmqver :- to display MQ series version
dspmq :- to view all queue managers of MQ series.
crtmqm :- to create a queue manager
strmqm :- to start queue manager
runmqsc :- to enter in to particular queue manager
endmqm :- to end a queue manager
dltmqm :- to delete a queue manager
dspmqcsv :- to display command server
endmqcsv :- to end command server
strmqcsv :- to start command server
runmqlsr :- to run listener service
endmqlsr :- to end listener service
runmqchl :- to run a channel out of queue manager
runmqdlq :- to execute dead letter handle with the help of rule table
setmqaut :- to set authorizations for particular objects like queuemanager,queue’s channels, listeners to user or group
dspmqaut :- to display authorization for particular user
dmpmqaut :- to dump authorization for particular user
runmqchi :- to run a channel initiator for particular queue manager
runmqtrm :- to run trigger monitor on initiation queue for particular queue manager
rcdmqimg :- to take objects (or) record image of a particular queue manager objects
rcrmqobj :- to recreate the mq objects which are already recorded


                  Useful syntax of RUNMQSC utility for hadling QueueManager

DEFINE :- To define/create MQ manager objects like queue, Channels, process, and listener.
ALTER :- to update or modify the existing objects
DISPLAY :- to view all the properties of a particular object or to Display all objects
DELETE :- to delete created objects
CLEAR :- to clear the message from the queue
END :- to come out of the queue manager
PING :- to check whether other side channel / queue manager is ready to accept our request.
START :- to start the particular channel or listener
STOP :- to stop particular channel or listener
REFRESH :- used to refresh the security every time after giving or executing, set mgr or command for queue manager or object
RESET :- used to reset channel,cluster,queue manager
RESOLVE :- to resolve the channel which is in indoubt state
SUSPEND :- to suspend a queue manager from a cluster environment
RESUME :- to remove a queue manager from a cluster environment

Adding a new device to Solaris Machine



Steps to be followed while adding a new device to solaris machine


1. Connect a tape drive, disk drive, or CD-ROM to the system and perform a reconfiguration reboot.

2. Reconfiguration reboot is done by using the commands boot -r or reboot -- -r . On rebooting the system it displays a login prompt.

3.  Log in and issue the dmesg command to verify that the device has been installed. You should see an entry something like this if you’re adding an SCSI disk drive:
sd3 is /pci@1c,600000/scsi@2/sd@0,0

dmesg command :  Displays system diagnostic messages as well as a list of devices attached to the system
since the most recent restart.
 
4. Check to see that a driver is attached by issuing the prtconf command. The message driver not attached next to instance name of the device should be gone and the device now should be available for use.

prtconf  command  :   prtconf  displays system configuration information, including the total amount of memory and the   device configuration, as described by the system’s hierarchy. This useful tool verifies whether a device has been seen by the system.


Solaris Default FileSystem Partition


  Slice
  File System
Description
   0
root
Root (/) is the top of the hierarchical file tree. It holds files and directories that make up the operating system. The root directory contains the directories and files critical for system operation, such as the kernel, the device drivers, and the programs used to boot the system.The root (/) file system is always in slice 0.
1
swap
Provides virtual memory or swap space. Swap space is used when you’re running programs too large to fit in the computer’s memory. The Solaris operating environment then “swaps” programs from memory to the disk and back, as needed. Although it is not technically required, it is common for the swap slice to be located in slice 1 unless /var is set up as a file system. If  /var is set up,the interactive installation places /var on slice 1, and it places swap on slice 3.

2
Entire Disk
Refers to the entire disk and is defined automatically by Sun’s format utility
and the Solaris installation programs. The size of this slice should not be
Changed.
3
/var
This slice is unassigned by default. In Solaris 10, if you let the Sun installation program auto layout the slices, it will place the /var directory under slice 0 with the root file system. However, if during the installation, /var is selected to have its own slice, the installation program will place /var onto slice 1 and will move swap to slice 3. The /var file system is for files and directories likely to change or grow over the life of the local system. These include system logs, vi and ex backup files, printer and email spool files, backups of OS patches, and UUCP files. On a server, it’s a good idea to have these files in a separate file system so that they cannot fill up the root slice.
4

By default, slice 4 is unassigned and available for use.
5
/opt
This slice is unassigned by default. In Solaris 10, the /opt directory is put under slice 0 by default with the root file system. However, if during the installation, /opt is selected to have its own slice, the installation program will place /opt onto slice 5. /opt holds additional Sun software packages and optional third-party software that have been added to a system. If a slice is not allocated for this file system during installation, the /opt directory is put in slice 0, the root (/) file system.
6
 /usr
This slice is unassigned by default. In Solaris 10, the /usr directory is put under slice 0 by default with the root file system. However, if during the installation, /usr is selected to have its own slice, the installation program will place /usr onto slice 6. / usr contains operating system commands also known as executable designed to be run by users.Files that can be used on all types of systems (such as man pages) are in /usr/share. If /usr is placed on slice 0, slice 6 becomes an unallocated slice.
7
/export/home
Holds files created by users. On a standard system, /home is a mount point that points to /export/home .