How to use the "kill" command in Unix Kill signals and example kill or Mass kill

Kill Process example
ps -ef | grep <process name>
kill <process id>
kill  –9 <process id>

Example id=1234
kill 1234
kill  –9 1234   # SIGKILL 

Kill Process Mass Process Example
ps -ef | grep <process name>| awk '{print $2}' | xargs kill -9
Example ftp process
ps -ef | grep ftp | awk '{print $2}' | xargs kill -9


Handling Signals
Each Unix signal has a default set of effects on a Unix program. Programmers can code their applications to respond in customized ways to most signals. These custom pieces of code are called signal handlers.
Two signals are unable to be redefined by a signal handler. SIGKILL always stops a process and SIGSTOP always moves a process from the foreground to the background. These two signals cannot be "caught" by a signal handler.


FreeBSD Signals
Signal Name Signal Number Signal Description
SIGHUP 1 Terminal line hangup
SIGINT 2 Interrupt program
SIGQUIT 3 Quit program
SIGILL 4 Illegal instruction
SIGTRAP 5 Trace trap
SIGABRT 6 Abort
SIGEMT 7 Emulate instruction executed
SIGFPE 8 Floating-point exception
SIGKILL 9 Kill program
SIGBUS 10 Bus error
SIGSEGV 11 Segmentation violation
SIGSYS 12 Bad argument to system call
SIGPIPE 13 Write on a pipe with no one to read it
SIGALRM 14 Real-time timer expired
SIGTERM 15 Software termination signal
SIGURG 16 Urgent condition on I/O channel
SIGSTOP 17 Stop signal not from terminal
SIGTSTP 18 Stop signal from terminal
SIGCONT 19 A stopped process is being continued
SIGCHLD 20 Notification to parent on child stop or exit
SIGTTIN 21 Read on terminal by background process
SIGTTOU 22 Write to terminal by background process
SIGIO 23 I/O possible on a descriptor
SIGXCPU 24 CPU time limit exceeded
SIGXFSZ 25 File-size limit exceeded
SIGVTALRM 26 Virtual timer expired
SIGPROF 27 Profiling timer expired
SIGWINCH 28 Window size changed
SIGINFO 29 Information request
SIGUSR1 30 User-defined signal 1
SIGUSR2 31 User-defined signal 2
SIGTHR 32 Thread interrupt



Sun Cluster cheat sheet and command

** Credit Web http://www.datadisk.co.uk/html_docs/sun/sun_cluster_31_cs.htm


Daemons
clexecd This is used by cluster kernel threads to execute
userland commands (such as the run_reserve and dofsck
commands). It is also used to run cluster commands remotely (like the cluster shutdown command).
This daemon registers with failfastd so that a failfast device driver will panic the kernel if this daemon is killed and not restarted in 30 seconds.
cl_ccrad This daemon provides access from userland management applications to the CCR.
It is automatically restarted if it is stopped.
cl_eventd The cluster event daemon registers and forwards cluster events (such as nodes entering and leaving the cluster). There is also a protocol whereby user applications can register themselves to receive cluster events.
The daemon is automatically respawned if it is killed.
cl_eventlogd cluster event log daemon logs cluster events into a binary log file. At the time of writing for this course, there is no published interface to this log. It is automatically restarted if it is stopped.
failfastd This daemon is the failfast proxy server.The failfast daemon allows the kernel to panic if certain essential daemons have failed
rgmd The resource group management daemon which manages the state of all cluster-unaware applications.A failfast driver panics the kernel if this daemon is killed and not restarted in 30 seconds.
rpc.fed This is the fork-and-exec daemon, which handles requests from rgmd to spawn methods for specific data services. A failfast driver panics the kernel if this daemon is killed and not restarted in 30 seconds.
rpc.pmfd This is the process monitoring facility. It is used as a general mechanism to initiate restarts and failure action scripts for some cluster framework daemons (in Solaris 9 OS), and for most application daemons and application fault monitors (in Solaris 9 and10 OS). A failfast driver panics the kernel if this daemon is stopped and not restarted in 30 seconds.
pnmd Public managment network service daemon manages network status information received from the local IPMP daemon running on each node and facilitates application failovers caused by complete public network failures on nodes. It is automatically restarted if it is stopped.
scdpmd Disk path monitoring daemon monitors the status of disk paths, so that they can be reported in the output of the cldev status command. It is automatically restarted if it is stopped.
File locations
man pages /usr/cluster/man
log files /var/cluster/logs
/var/adm/messages
sccheck logs /var/cluster/sccheck/report.<date>
CCR files /etc/cluster/ccr
Cluster infrastructure file /etc/cluster/ccr/infrastructure
SCSI Reservations
Display reservation keys scsi2:
/usr/cluster/lib/sc/pgre -c pgre_inkeys -d /dev/did/rdsk/d4s2
scsi3:
/usr/cluster/lib/sc/scsi -c inkeys -d /dev/did/rdsk/d4s2
determine the device owner scsi2:
/usr/cluster/lib/sc/pgre -c pgre_inresv -d /dev/did/rdsk/d4s2
scsi3:
/usr/cluster/lib/sc/scsi -c inresv -d /dev/did/rdsk/d4s2
Cluster information
Quorum info scstat -q
Cluster components scstat -pv
Resource/Resource group status scstat -g
IP Networking Multipathing scstat -i
Status of all nodes scstat -n
Disk device groups scstat -D
Transport info scstat -W
Detailed resource/resource group scrgadm -pv
Cluster configuration info scconf -p
Installation info (prints packages and version) scinstall -pv

Cluster Configuration

SAP BASIS Set Logical file and Path for LSMW file

** Myself
file
clip_image002


logical file path definition
new
logical file path
ZLSMW_LOGICAL_PATH

assignment of physical path to logical path
new

physical path on server


clip_image004


Logical file name definition ,cross client
new
clip_image006

we21                                                              
                                   
            Create port-->file-->ZLSMW                       
                                   
            Outbound file                       
            Dir and Function module                   
            funtion module           EDI_PATH_CREATE_POS_UNIX_DOS
            uncheck unicode                    
                                   
            Inbound file               
            Dir and Function module                   
            funtion module           EDI_PATH_CREATE_POS_UNIX_DOS
            uncheck unicode        
clip_image008

Shell Script Backup oracle database by rman full online with archive to tape (SBT agent)

** Myself
export RMAN_DIR=/oraback
export LOGDIR=${RMAN_DIR}/log
export RMAN_LOG=$LOGDIR/rman_backup_$ORACLE_SID`date +%d%h%y_%H%M`.log
export RMAN_ERR=$LOGDIR/rman_backup_$ORACLE_SID`date +%d%h%y_%H%M`.err
############# Delete old archivelog last 2 date####################
rman nocatalog LOG = $RMAN_LOG APPEND<<END_SQL
connect target;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
rman nocatalog<<END_SQL
connect target;
run {
set command id to 'rman';
crosscheck archivelog all;
allocate channel t1 type sbt;
backup filesperset 5 archivelog until time 'Sysdate-2' all delete input;
release channel t1;
}
exit
END_SQL
############# Hot Backup database #################################
rman nocatalog LOG = $RMAN_LOG APPEND<<END_SQL
connect target;
run {
set command id to 'rman';
allocate channel t1 type sby;
backup
filesperset 5
database;
release channel t1;
}
exit
END_SQL
############# Backup archive logs #################################
rman nocatalog<<END_SQL
connect target;
run {
set command id to 'rman';
allocate channel t1 type sbt;
backup filesperset 5 
archivelog all;
release channel t1;
}
exit
END_SQL

Shell Script Backup oracle database by rman full online with archive to disk

** Myself
export RMAN_DIR=/oraback
export FILE_DIR=${RMAN_DIR}/backup
export LOGDIR=${RMAN_DIR}/log
export RMAN_LOG=$LOGDIR/rman_backup_$ORACLE_SID`date +%d%h%y_%H%M`.log
export RMAN_ERR=$LOGDIR/rman_backup_$ORACLE_SID`date +%d%h%y_%H%M`.err
############# Backup config profile,and network files) ############
cp -Rp ${ORACLE_HOME}/dbs ${FILE_DIR}
cp -Rp ${ORACLE_HOME}/network/admin ${FILE_DIR}
############# Delete old archivelog last 2 date####################
rman nocatalog LOG = $RMAN_LOG APPEND<<END_SQL
connect target;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '${FILE_DIR}/%F';
crosscheck archivelog all;
allocate channel for maintenance device type disk;
delete noprompt obsolete recovery window of 2 days;
release channel;
exit
END_SQL
############# Hot Backup database #################################
rman nocatalog LOG = $RMAN_LOG APPEND<<END_SQL
connect target;
run {
set command id to 'rman';
allocate channel t1 type disk;
backup
filesperset 5
format '${FILE_DIR}/df_%t_%s_%p'
database;
release channel t1;
}
exit
END_SQL
############# Switch archive redo to archive files ################
rman nocatalog LOG = $RMAN_LOG APPEND<<END_SQL
connect target;
sql 'alter system switch logfile';
exit
END_SQL
############# Backup archive logs #################################
rman nocatalog LOG = $RMAN_LOG APPEND<<END_SQL
connect target;
run {
set command id to 'rman';
  allocate channel t1 type disk;
backup
filesperset 5
format '${FILE_DIR}/df_%t_%s_%p'
archivelog all;
release channel t1;
}
exit
END_SQL
echo "backup $ORACLE_SID finish at $(date)">>$RMAN_LOG

SAP BASIS Step configuration CUA central user admin for manage clients

** Myself
T-code
scum for user distribution field selection
scua for maintain system landscape
scul for display and processing idoc distribution log
scug for transfer/sync Users and company address
suim for display the list of all users in child systems (IDoc number, roles assigned)
bd57 for defind logical system
bd64 for display distribution model
bd87 for display ICOCS error

we20 for Partner Profiles
we21 for idoc configuration port ( transactionPorts#tRFC in IDoc Processing)
scc4 for assign logical system
sm59 for RFC Connection
sm58 for tRFC-Queue (IDoc)
pfcg for child system Text Comparison for CUA Central System
su01 for central system maintain password,users,role,profile child system with system(logical name)
/$cua for flush buffer cua after copy role from other client
 
CUA object class
spro-->
  Sap Reference IMG-->
   Sap cus-->
    SAP NetWeaver-->
      Application Server-->
        IDoc interface-->
          Modelling and Implementing Businesss process-->
            Configure Predefined ALE Business Process-->
              Cross-Application Business Processes-->
                Central User Administrator-->
                  ALE Mandatory Activites for Central User Administration-->
                        Define Logical System (bd54)
                        Assign Logical system to client (scc4)
                        Create RFC Connections         (sm59)
                 Select Model view for Central administration (scua)
                 Set Distribution Parameters for fields (bd64)
                 Transfer Users and company address from new systems (scug)
 
1. Create logical system name
Not create model view (see below) because generate by scua t-code
## Model name =TSC_CUA
## Source sender =DEVCLNT200
## Destination receiver =DEVCLNT203
bd64
clip_image002
clip_image004
Not Add bapi manual bapi (see below) because generate by scua t-code

Oracle database Kill Session by UNIX/Windows/Oracle Command

** Credit web http://psoug.org/reference/kill_session.html 
UNIX

ps -ef | grep ora to find Oracle processes. Be sure to get the process id of the session you are trying to kill
Killing sessions in the UNIX environment


kill -1 <process_id>

or

kill -9 <process_id>

kill -9 5745
All in one kill
ps -ef | grep pmon_ | awk '{print $2}' | xargs kill -9

Windows

orakill <instance_name> <spid>
Killing sessions in the Windows environment with ORAKILL
SELECT instance_name

FROM gv;



col program format a30



SELECT spid, osuser, s.program, schemaname

FROM gv p, gv s

WHERE p.addr = s.paddr;



c:\oracle\product\ora102\bin> orakill orabase spid

All

To kill sessions within the database requires the ALTER SYSTEM privilege and the sid and serial# of the session to be killed
Killing sessions from inside the database


GRANT alter system TO <schema_name>;



SELECT sid, serial#, username, schemaname, osuser

FROM gv

WHERE username = <user_name>;



ALTER SYSTEM KILL SESSION '<sid>,<serial#>';

conn / as sysdba



GRANT alter system TO aqadmin;



conn aqadmin/aqadmin



SELECT sid, serial# , username, schemaname, osuser

FROM gv

WHERE username = 'AQUSER';



SQL> ALTER SYSTEM KILL SESSION '9,177' IMMEDIATE;

Kill All Sessions

conn / as sysdba
Kill All Instance Sessions


set heading off

set termout off

set verify off

set echo off

set feedback off



ALTER SYSTEM enable restricted session;



ALTER SYSTEM checkpoint global;



spool kill_all.sql



SELECT 'execute kill_session('|| chr(39) || sid || chr(39) || ',' || chr(39) || serial# || chr(39) || ');'

FROM gv_

WHERE (username IS NOT NULL OR username <> 'SYS');



spool off



@kill_all

Session Kill Demo Procedure

CREATE OR REPLACE PROCEDURE infinite_loop IS
An infinite loop for testing


BEGIN

  LOOP

    NULL;

  END LOOP;

END infinite_loop;

/



SQL> exec infinite_loop

Query Oracle statements SAP Report

** Myself
For 4.6/4.7/ECC5 without dbacockpit
se38/sa38 -> rsoradjv



























Loading