Shell Script Example Oracle Export dumpfile(exp or expdp)

**Myself
 
#!/usr/bin/sh
#########   ENV ##############
backup_dir=/backup/expdump  #Dumpfile directory
blog=/backup/expdump/backup_expdump.log
orasid[0]=orcl1    #oracle sid1
orasid[1]=orcl2    #oracle sid2
orasid[2]=orcl3    #oracle sid3
orauser[0]=oraorcl1
orauser[1]=oraorcl2
orauser[2]=oraorcl1
orahome[0]=/app/oracle/orcl1/10g
orahome[1]=/app/oracle/orcl2/10g
orahome[2]=/app/oracle/orcl3/10g
############### Main ##################
export i=0
while (( i < ${#orasid[*]} ))
do
    su - ${orauser[${i}]}  << BOF >> ${blog}
        export ORACLE_SID=${orasid[${i}]}
        echo ${orasid[${i}]} >> ${blog}
        ${orahome[${i}]}/bin/exp system/system file='${backup_dir}/${orasid[${i}]}.dmp' full=y
    BOF
(( i = i + 1 ))
done

Shell Script Menu for Start up/Shutdown SAP with Oracle and other process (saposcol,sapstartsrv,hostctl for NW7.1)

** Myself
#====================================================================
#
# MAIN PROGRAM: Operator Menu
#
# PURPOSE:  Checks for system instances and
#           startup/shutdown system instances
#
#====================================================================
#====================================================================
# Environment
#====================================================================
#
#
#
# oracle user  ,Please change
orasid=dev
# sap user ,Please change
sapsid=dev
# SAP StartSRV MC Console Instant Name ,Please change ,for more instant add array
SAPINST[0]=DVEBMGS02
SAPINST[1]=ASCS00
SAPINST[2]=SCS01
#
#====================================================================
#====================================================================
# Main
#====================================================================
operation_menu=0
while [[ ! "x${operation_menu}x" = "x99x" ]] ; do
clear
echo "========================================"
echo "|--- Operation Menu (`hostname`) "
echo "========================================"
echo "(1) Start SAP"
echo "(2) Shutdown SAP"
echo "(99) Exit"
echo "Please select a number from the Operation Menu: "
read operation_menu
case ${operation_menu} in
        1)
                su - ora${orasid} -c "lsnrctl start"
                su - ${sapsid}adm -c "startsap"
                echo "SAP Startup"
                echo "Please key to Main Menu: "

SAP BASIS Install SAP Gui 7.20 with Patches [Thai] (Update)

** Myself
ขั้นตอนการติดตั้ง SAPGUI

Part I

Pre installation step SAPGUI

1) ถ้ามี SAPGui Version เก่า
ควรทำการ uninstall SAPGUI ก่อนป้องกันerror ที่จะเกิดขึ้นระหว่าง install โดยต้องปิด SAP Logon
ถ้าไม่ uninstall จะทำให้ เกิด error ต่างๆจากการ load library dll ไม่ขึ้นเช่น sapfewut.dll
“The procedure entry point sap load library could not be locate in the dynamic link library”

2) สำหรับเครื่องที่ยังไม่เคย Install SAPGui มาก่อน
ก่อน install SAPGUI ควรมีการ reboot machine ก่อนเพื่อป้องกันerror ที่จะเกิดขึ้นระหว่าง install โดยต้องปิด SAP Logon
หรือทำการปิด MS office กรณีเลือก บาง component ของSAPGui ที่มีความเกี่ยวข้องกัน

3) สำหรับเครื่องที่ Install software จาก shared drive อาจมีปัญหาในการ Install SAPGui เพราะLoad library มาได้ไม่ครบ
ควร Copy Install software จาก shared drive มาไว้ที่เครื่อง ตัวเองก่อน Install

Part II

Install Step SAPGUI

จากนั้นทำการติดตั้ง SAPGUI
1.ให้เข้าไปยัง Folder
NW_7.0_Presentation\PRES1\GUI\WINDOWS\WIN32
2. เลือก SetupAll
clip_image002
จะปรากฎขั้นตอนต่อไปดังนี้
clip_image004
กด Next
จากนั้นจะปรากฎขั้นตอนต่อไปดังนี้

SAPGui and SAPLPD Problem Thai Font solve by Substitution/Replace for Window Vista/7 [Thai]

** Myself
For SAPGUI solve by replace font Window XP for Display
For SAPLPD solve by replace font Window XP and Substitution for printing

Font Substitution
Result
Sub cordiaUPC  font win7                            
OK.


Sub cordiaUPC  font winXP  
# Copy XP font replace win7 C:\windows\fonts 
OK.

Sub cordiaNew  font win7                          
no OK. Can’t translate อ่านไม่ออก

Sub cordiaNew  font winXP
# Copy XP font replace win7 C:\windows\fonts                        
no OK. Can’t translate อ่านไม่ออก

Sub angsanaUPC font win7                         
no OK. สระลอย

Sub angsanaUPC font winXP
# Copy XP font replace win7 C:\windows\fonts                      
OK.

Add /eH (control unicode to thsapwin) & sub angsanaUPC font win7
no OK. สระลอย
Add /eH (control unicode to thsapwin) & sub angsanaUPC font winXP

# Copy XP font replace win7 C:\windows\fonts 
OK.

No Sub courierNew font win7                  
no OK. Can’t translate อ่านไม่ออก


Oracle 10g RAC Administration Simulators

Fix SAPGUI problem thai font ่ ้ ำ ี ๋ ์ ๋ ๊ for Window Vista/7 [Thai]

** Myself
่ ้ ำ ี ๋ ์ ๋ ๊
แก้ปัญหาการชดเชยสระ รวมถึงตำแหน่งของ space หรือ สระลอย เช่น ที่ถูก สีน้ำ  ที่ผิด ส ี น้ ำ

Sol1
Copy font from Window XP Replace Vista/7 to C:\Windows\Fonts
AngsanaUPC,Angsana New,Cordia New,CordiaUPC,Courier New,Courier Regular  [Regular/Bold/Italic]


Sol2
 Install New SAPGUI 720 with newer patch (after patch 8 up to 1X)

Shell Script Mass Change filename (Rename pattern file)

** Myself

#Create 10,000 file from CCC00001.JPG to CCC10000.JPG
#file name=CCC00001.JPG ,CCC00002.JPG .... 
mkdir -p /tmp/test
for i in {1..10000}
do
 touch /tmp/test/CCC`printf "%05d" $i`.JPG
done


#Rename 10,000 file from CCC00001.JPG to A00001.JPG
#Result file name=A00001.JPG ,A00002.JPG .... 

for T in *.JPG
do
U=$(printf $T | sed -e "s/CCC/A/g")
[[ $T != $U ]] && mv $T $U
done

Install Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files (SAP include)

** Myself
 
JCE IBM Product JCE SUN Product
File name: unrestricted.zip File name: jce_policy-<version>.zip
jce_policy-1_4_2.zip
Content of file
· README.txt
· COPYRIGHT.html Copyright information [No file for IBM product]
· local_policy.jar Unlimited strength local policy file
· US_export_policy.jar Unlimited strength US export policy file
 
1) Download from SUN(ORACLE) or IBM product
     unrestricted.zip or jce_policy-<version>.zip
2) Extract/Install to JRE path (check java home path)
Window Unix
<java-home>\lib\security <java home>/lib/security
D:\j2sdk1.6\jre\lib\security /usr/java/jre/lib/security # SUN Solaris
/opt/java1.4/jre/lib/security # HP-UX
/usr/lib64/jvm/java-1_4_2-ibm-1.4.2_sr10/jre/lib/security # Linux64 bit
# For SAP ,SSL protocol, will be extract during installation phase
# Example SAP unix JAVA_HOME=/opt/java1.4
# JCE install at /opt/java1.4/jre/lib/security

Oracle Clear data block (logical) corrupt from dbverify

** Myself

dbverify report  (dbv) detect corrupt blocks but no physical corrupt.
for 10g

Verify after dbv
check  v$database_block_corruption or v$backup_corruption (from rman verfity)
run {
allocate channel c1 type disk;
allocate channel c2 type disk;
backup check logical validate database;
release channel c1;
release channel c2;
}



Fix
1) run analyze object  for check  integrity and run dbv again
analyze <xxx> validate structure [ONLINE]
2) or flush db buffer cache and run dbv again
   alter system flush buffer_cache

SAP Launch Java Tools

** Myself

Config Tool

Windows launch tool Unix [by Gui] launch tool
logon <sid>adm
<Drive>:\sap\<SID>\<central instance>\j2ee\admin\go.bat /sap/<SID>/<central instance>/j2ee/admin/go

Visual Admin Tool
Windows launch tool Unix [by Gui] launch tool
logon <sid>adm
<Drive>:\sap\<SID>\<central instance>\j2ee\configtool\configtool.bat /sap/<SID>/<central instance>/j2ee/configtool/configtool
Entry for connection
#SAP instance number 2 digit=$$
Entry for connection
#SAP instance number 2 digit=$$
    Direct Connection to Dispatcher Node
    User Name: j2ee_admin
    Host: localhost
    Port:  5SS04
Direct Connection to Dispatcher Node
User Name: j2ee_admin
Host: localhost
Port: 5SS04

NetWeaver Administrator (NWA)
Browser launch tool
#SAP instance number 2 digit=$$
http://<hostname>.<suffix>:5$$00/nwa
# for Dual stack refer j2ee_admin on client001 # for Jav stack refer Administrator
logon j2ee_admin logon administrator

Java with Telnet.
Windows launch tool
#SAP instance number 2 digit=$$
Unix [by Textmode] launch tool

#SAP instance number 2 digit=$$
start->run->cmd logon <sid>adm
telnet localhost 5SS08 telnet localhost 5SS08

How to start one node Veritas cluster(VCS) other nodes failed

** Myself
Case start only one Node  (because all Heartbeat other nodes lost connection or totally other nodes failed)
# Start Group Membership and Atomic Broadcast
gabconfig -cx
# Start cluster
hastart -onenode
# Option Start resource by command
hagrp –online  <resource_name>  -sys <server_Node_name>
Loading