Monday 23 November 2015

Query to find Blocking Sessions in Oracle

select l1.sid, ' IS BLOCKING ', l2.sid
  from gv$lock l1, gv$lock l2
 where l1.block = 1
   and l2.request > 0
   and l1.id1 = l2.id1
   and l1.id2 = l2.id2;

Friday 6 November 2015

How to Renew Apache Certificate

Apache Certificate Renewal
Backup
1. Stop apache.
cd $apachehome/bin
./apachectl stop 2. Take backup of server.crt , server.key , server-ca.crt files from $apachehome/conf in binary mode
Deployment

3. Copy the attached renewed files ( server.crt , server.key , server-ca.crt) in the below mentioned location in binary mode.
$apachehome/conf

4. Search the below string pattern in httpd-ssl.conf file in $apachehome/conf/extra path SSLCertificateChainFile "$apachehome/conf/server-ca.crt"
If it is commneted please remove the comment.

5. Start apache.
cd $apachehome/bin
./apachectl start

6. Check whether apache is running or not by using the below command:
netstat -a | grep 8080
Sample Output should be:
GW85: netstat -a | grep 8080
*.8080 *.* 0 0 49152 0 LISTEN

7. Then try login using the below URL: https://mydnsname:8080/mywebapp/default.jsp

Then view the certificate and entry should be as below:
Issued to: mydnsname
Issued by: Symantec Class 3 Secure Server CA - G4
Valid from 5/1/2015 to 5/31/2016

8. If all the above details looks fine, then renewal of Apache certification done successfully.
Rollback
9. Stop Apache.
10. If it fails store the files ( server.crt , server.key , server-ca.crt) back to the path $apachehome/conf
11. Start Apache.

Thursday 27 August 2015

How to search or find text recursively in all files and folders?

Ideally this works :

 find . -name "*.*" | xargs grep "MyTextToSearch"


But when you have spaces between the file names / folders - this doesn't works in few OS where GNU find is not installed.

In such case, on one of the Solaris Machine the following worked
find . -name "*.*" -exec grep -l "MyTextToSearch" {} \;

How to find bind variables of a SQL-ID ?


SET PAUSE ON
SET PAUSE 'Press Return to Continue'
SET PAGESIZE 60
SET LINESIZE 300

COLUMN sql_text FORMAT A120
COLUMN sql_id FORMAT A13
COLUMN bind_name FORMAT A10
COLUMN bind_value FORMAT A26

SELECT
  sql_id, 
  b.name bind_name,
  b.value_string bind_value
FROM
  v$sql t
JOIN
  v$sql_bind_capture b  using (sql_id)
WHERE
  b.value_string is not null 
AND
  sql_id='&sqlid'

Friday 7 August 2015

How to check CHRON jobs set up on a server?

How to check CHRON jobs set up on a server?

>chron -l


this command will give you the list of chron jobs scheduled on the nox

Tuesday 4 August 2015

BEA-080003 RuntimeException thrown by rmi server: Security:090398 Invalid Subject: principals=[weblogic, Administrators, CrossDomainConnectors]

This error occurred when we "Enabling Trust Between WebLogic -Domains" to solve the BEA-XXX error.

This happened even after verifying / double checking the credentials. Also note that this error was thrown only in one of the managed server. Other managed severs were running fine after the password update. 
Cause:
We then found there was an issue with the managed server folder - which was probably caching the previous wrong password.

Solution:
I took a back up of the managed server folder under the 
/wls_domains/{domain-name}/servers/{managed-server-name}. I then restarted the managed server - the error disappeared and the folder that i deleted was auto created on startup.

BEA-090513 - ServerIdentity failed validation, downgrading to anonymous.>


How to resolve the following Weblogic Error ?

One day we started getting this weird error on Weblogic Managed server start up. I am not 100% sure why this came up sudden-off all  - my guess is that - one of the system that we were interacting did something on their system that caused this error coming up every minute. But the messages were still flowing through. 

<Mmm DD, YYYY HH:MM:SS PM Z> <Error> <Security> <BEA-090513> <ServerIdentity failed validation, downgrading to anonymous.>


Cause
Trust has not been properly established between two domains. If the domains are not configured properly, a hacker could make an attempt to guess the server identity for this domain.


Action
See the documentation on "Enabling Trust Between WebLogic Domains" at






Tuesday 23 June 2015

Unable to solve the JDBC error - java.lang.ArrayIndexOutOfBoundsException: 4 at oracle.jdbc.driver.T4C8TTIdty


I was facing the below error while creating a stand alone JDBC connection.

java.lang.ArrayIndexOutOfBoundsException: 4
        at oracle.jdbc.driver.T4C8TTIdty.<init>(T4C8TTIdty.java:480)
        at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1161)
        at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:320)
        at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:547)
        at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:236)
        at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
        at java.sql.DriverManager.getConnection(DriverManager.java:582)
        at java.sql.DriverManager.getConnection(DriverManager.java:185)
   


This was becasue the Target database was on oracle 8i. so we had to add the 8i compatible jar - classes_12g.jar to the pre-class path which resolved the issue.

Thursday 14 May 2015

How to restore a table from an Oracle flashback snap shot?




To just Query a snapshot:
SELECT * FROM MY_SCHEMA.MY_TABLE AS OF TIMESTAMP TO_TIMESTAMP('2015-05-11 18:00:00', 'YYYY-MM-DD HH24:MI:SS');


To Take a Snapshot and Dump to another table:
Create table MY_SCHEMA.MY_TABLE_TEMP as 
SELECT * FROM MY_SCHEMA.MY_TABLE AS OF TIMESTAMP TO_TIMESTAMP('2015-05-11 18:00:00', 'YYYY-MM-DD HH24:MI:SS');

Thursday 16 April 2015

How to check BW Archives Process Instance Ids?

Use the following command - to check the PID of the process Archives ( Works on Solaris Machine)

/usr/ucb/ps -auwwx|grep ABC-Process_Archive.tra

Wednesday 4 February 2015

Calling a Java Class from PLSQL


Step 1 - Compile your class
public class LongConvertor {

public static String toString(String i) {
return Long.toString(Long.parseLong(i), 36);
}

}

Step 2 : Load your class on to Oracle
loadjava -user scott -password tiger LongConverter.class;


Step 3: Create a wrapper function

CREATE OR REPLACE FUNCTION LONG_TO_STRING (input VARCHAR2) RETURN VARCHAR2 AS LANGUAGE JAVA NAME 'LongConverter.toString(java.lang.String) return java.lang.String';

Step 3: Use it this way :)
SELECT UPPER(LONG_TO_STRING(10106192)) FROM DUAL;  

Refer : http://docs.oracle.com...

Thursday 8 January 2015

How to downgrade a OBI RPD Version ?


....\bifoundation\server\bin>nqgenoldverrpd.exe -P <repository-password> -I <source-rpd-location> -O <target-rpd-location> -V <target-version-number>

Example:

....\bifoundation\server\bin>nqgenoldverrpd.exe -P admin123 -I C;\MySource.rpd -O C:\MyTarget.rpd -V 318

Wednesday 7 January 2015

How to start stop an Business Works Archive archive using AppManage (console) ?


To Start
./AppManage -stop -app <Archive-name> -user <usename> -pw <password> -domain <domain-name>

To Stop
./AppManage -start -app <Archive-name> -user <usename> -pw <password> -domain <domain-name>

Monday 5 January 2015

How to find the space occupied by indexes of a table in oracle ?

 SELECT idx.index_name, (SUM(bytes)/(1024*1024)) SIZE_IN_MB
  FROM user_segments seg, user_indexes idx
 WHERE idx.table_name = <my_table_name>
   AND idx.index_name = seg.segment_name
 GROUP BY idx.index_name;

Thursday 1 January 2015

How to install Tibco i-Process Palattes on Business Works?

You need to have the following installers with you

TIB_ipTechpi8402_11.2.0_w32.zip
TIB_ipTechpi9151_11.3.0_w32.zip

Step 1. 
Unzip TIB_ipTechpi8402_11.2.0_w32.zip
Go to : TIB_ipTechpi8402_11.2.0_w32\auxinstallers\windows32
you should find a installer named.,

TIB_bwpluginiprocess-simple_2.1.9_win_x86.exe

Install this.


Step 2. 
Unzip TIB_ipTechpi9151_11.3.0_w32.zip
Go to : TIB_ipTechpi9151_11.3.0_w32\2239 #9151 iProcess Technology Plug-ins 11.3.0 Win Sql RC2\auxinstallers\windows32

you should find a installer named.,

TIB_bwpluginiprocess-simple_2.1.10_win_x86.exe

Install this.



Step 3:

Open your designer, now you should be able to see your iProcess related palattes in your Designer.

Configuring IAP JMS

Summary of steps:
################################################################################ ################################
STEP 1   [Switch on IAP JMS on iProcess Server]
################################################################################ ################################
execute this command in iprocess engine:

%SWDIR%\util\swadm.exe set_attribute 0 ALL 0 IAPJMS_SYNCHRONOUS 1
%SWDIR%\util\swadm.exe set_attribute 0 ALL 0 WQDJMS_TOPICNAME WQDTOPIC
%SWDIR%\util\swadm.exe set_attribute 0 ALL 0 IAPJMS_PORTNO 9071
%SWDIR%\util\swadm.exe set_attribute 0 ALL 0 WQDJMS_PORTNO 9075
%SWDIR%\util\swadm.exe set_attribute 0 ALL 0 IAPJMS_SIMPLETOPIC 1
%SWDIR%\util\swadm.exe set_attribute 0 ALL 0 IAPJMS_TOPICNAME IAPTOPIC
%SWDIR%\util\swadm.exe set_attribute 0 ALL 0 WQDJMS_TOPICNAME WQDTOPIC
%SWDIR%\util\swadm.exe set_attribute 0 ALL 0 IAPJMS_ROLLBACK 1
%SWDIR%\util\swadm.exe set_attribute 0 ALL 0 JVMPROPS
%SWDIR%\util\swadm.exe set_attribute 0 ALL 0 IAPJMS_PUBLISH 1


################################################################################ ################################
STEP 2   [Configure your JMS Details in iProcess]
################################################################################ ###############################

if your TIBCO EMS installation is 5.1 is not necessary modify this properties files (This  was my error, described in the previous post): 

-%$SWDIR%\etc\iapjms_classpath.properties
-%$SWDIR%\etc\iapjms.properties


################################################################################ ################################
Step 3 [Create a Topic in your JMS]
################################################################################ ###############################
execute in console (CMD)--->C:\tibco\ems\6.0\bin>tibemsadmin.exe

TIBCO Enterprise Message Service Administration Tool.
Copyright 2003-2009 by TIBCO Software Inc.
All rights reserved.
Version 5.1.0 V10 2/4/2009

Type 'help' for commands help, 'exit' to exit:
> connect
Login name (admin): admin
Password:

tcp://localhost:7222> create topic IAPTOPIC
Topic 'IAPTOPIC' has been created

################################################################################ ################################
STEP 4 [Export your IAP JMS Configuration]
################################################################################ ################################

$SWDIR/bin/swutil/IMPMONITOR   #{Your-Mer-xmlFile}




Simple for / while loop in shell

#!/bin/sh a=0
while [ $a -lt 10 ]
do
echo $a
a=`expr $a + 1`
done

Tibco client Installation order

Tibco Suite
All default – Simple – Next-Next-Next Installation

1.      TRA
                                I.            TIB_tra_5.7.0_win_x86_64.zip
                              II.            TIB_tra_5.7.1_win_x86_64.zip

2.      Business Works
                                I.            TIB_bw_5.9.0_win_x86_64.zip
                              II.            TIB_ipTechpi8402_11.2.0_w32.zip
                            III.            TIB_ipTechpi9151_11.3.0_w32.zip

3.      iProcess Modeller
                                I.            TIB_ipWkspWin8994_11.1.3_w32.zip
                              II.            TIB_ipWksppi8413_11.2.0_w32.zip

                            III.            TIB_ipWksppi9154_11.3.0_w32.zip

How to execute a SQL in Shell Script

#!/bin/bash
echo "STARTED..."
echo "Connecting to SQLPLUS"
sqlplus -L -s alf_ar/alf_ar@intdev <<EOF
prompt Connected to alf_ar@intdev
set serveroutput on size 100000
set head off
set feedback off
prompt executing the sql statement: $1
$1
exit;
EOF
echo "END..."

Save the above content as "runsql.sh"

then execute the following command
nohup sh runsql.sh "select 1 from dual;" > out.txt &

How to search a file/folder in unix ?

 find . -name "bptm.jar" 2>/dev/null



2>/dev/null denotes standard errors not being shown in console

Show all arguments of a Process in Unix



ps -eaf | grep bwengine | awk '{print $2}' | pargs awk '{print $1}'


for f in `ps -eaf | grep bwengine | awk '{print $2}'`; do
  echo `pargs $f`
done

------this will grep but will not give process_id as its not in same line-------------
for f in `ps -eaf | grep bwengine | awk '{print $2}'`; do
  echo `pargs $f | grep '21CN'`
done

------------------------------

or

/usr/ucb/ps -auwwx|grep WFMT-NIMS-Process_Archive.tra

How to copy (Merge and Overwrite in destination) a folder from one Unix box to another ?

1. Log in to the Target box
2. Execute the following command

scp -rp <SOURCE_IP>:<SOURCE_FOLDER>/* <DESTINATION_FOLDER>

Example : scp -rp 10.75.105.166:/wfmtsw/vinoth/* /wfmtsw/vinoth