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