Disclaimer

These scripts come without warranty of any kind. Use them at your own risk. I assume no liability for the accuracy, correctness, completeness, or usefulness of any information provided by this site nor for any sort of damages using these scripts may cause.
Showing posts with label Oracle DBA. Show all posts
Showing posts with label Oracle DBA. Show all posts

Thursday, July 20, 2017

java.sql.SQLException: ORA-28040: No matching authentication protocol


When connecting to 10g ,11g or 12c databases using a  JDBC thin driver , fails with following errors:
The Network Adapter could not establish the connection

ORA-28040: No matching authentication protocol

This happens because you are using a non compatible version of JDBC driver.

To resolve this issue, make sure that you are using the latest version of Oracle JDBC driver, if not use JDBC 12c or higher versions.


Oracle Client/Server Compatibility Matrix: 

Oracle Client
Version
Database Version
12.2.012.1.011.2.011.1.010.2.010.1.09.2.0
12.2.0YesYesYesNoNoNoNo
12.1.0YesYesYesWasMDSNoNo
11.2.0YesYesYesWasMDSNoWas
11.1.0NoWasWasWasWasWasWas
10.2.0NoMDSMDS WasMDSWasWas
10.1.0NoNoWas WasWasWasWas
9.2.0NoNoWas WasWasWasWas

Key:
YesSupported
ESSupported but fixes only possible for customers with Extended Support .
LES or MDSSupported but fixes only possible for customer with a valid Limited Extended Support or Market-Driven Support contract respectively.
WasWas a supported combination but one of the releases is no longer covered by any of Premier Support, Primary Error Correct support, Extended Support, nor Extended Maintenance Support. Fixes are no longer possible.
NoHas never been Supported
Courtesy: My Oracle Support

Saturday, October 11, 2014

OBIEE 11g Graphs Do not display after applying patch on 11.1.1.6.x

I have applied patch bundle 11.1.1.6.5 on my OBIEE 11.1.1.6.0. After applying the patch, I have noticed that none of my graphs/charts are displayed on the browser. I have deleted the browser cache and cookies, but still not displaying.

After referring the oracle support, I have did the following to resolve the issue.

We have customization for custom skins and styles in custom directory, so we did the below section first.

Section 1 Copy BIChart.swf  file to custom directory


1. Copied the BIChart.swf file from ORACLE_BI_HOME'bifoundation\web\app\res\sk_blafp\dvt directory to our custom directory

Custom directory located at <MW_HOME>/Oracle_BI/bifoundation/OracleBIPresentationServiceComponent/coreapplication_obips1/analyticsRes/<custom_dir>/dvt

2. Stop and Restart the BI Presentation Service components

cd <INSTANCE_HOME>/bin
opmnctl stopproc ias-component=coreapplication_obips1

opmnctl startproc ias-component=coreapplication_obips1

Section 2 Clear the managed server temporary files

1. Stop the Services
2. backup $DOMAIN_HOME/servers/bi_server1/tmp
3. cd $DOMAIN_HOME/servers/bi_server1/tmp
4. rm -rf * (including the hidden .internal directory)
5. Start the services

Now, open the browser and clear the cache and cookies.
Login to the analytics dashboard. If graphs/charts not visible, refresh the page by pressing ctrl+F5 (On Internet Explorer)

This should resolve the issue.

Sunday, September 1, 2013

R12 Error: Application Diagnostics is not a valid responsibility for the current user. Please contact your System Administrator.

User Must have one of the below roles to be assigned to run Oracle Diagnostics.

  • Diagnostics Super user
  • Application Super user
  • Application End User
To Assign role:


    1. Login to E-Business Suite as System Administrator
    2. Select the "User Management" responsibility
    3. Click 'Users' in the right hand side menu
    4. Enter 'User Name' and click 'Go'
    5. Click 'Update' on the correct user
    6. Click 'Assign Roles' button
    7. Enter role name (or partial with %) you want to assign. You can enter any of the seeded roles (Diagnostics Super User Role, Application Super User Role, Application End User Role), or your own one
    8. Check the box next to the appropriate role and click 'Select'
    9. Enter 'Justification' and click 'Save'
Now ask the user to logoff and login again to  E-Business Suite and try again to access Oracle Diagnostics.

Saturday, May 11, 2013

ORA-07445: exception encountered: core dump [__intel_new_memcpy()+382] [SIGILL] [ADDR:0x46F1D9E] [PC:0x46F1D9E] [Illegal operand]

Recently one of my database shows ORA-07445: exception encountered: core dump [__intel_new_memcpy()+382] [SIGILL] [ADDR:0x46F1D9E] [PC:0x46F1D9E] [Illegal operand]  while running one report.

This is how i resolved the issue.

I raised the SR and Oracle Support told me that the failing function is associated with ORA-07445 is "evadcd" , which shows that the error comes from decode.

Identify the failing  statement: Trace file generated at the time of ORA-07445 will contain the SQL caused the error. Identify all the tables used in the SQL statement and analyze the tables to ensure that there is no corruption on the tables using analyze table <owner>.<table_name> validate structure cascade;

None of the tables reported any corruption, all tables analyzed successfully, So the error must be related to invalid data in some of the colums.

So, i have to identify the record(s) which causing the error. For that, to narrow down, i have added additional condition to the query the records for a prticular time period in my case. 

For Example:

In my query on of the condition used was

where (txn_date) BETWEEN TO_DATE ('17-APR-2013  07:00:00',
                                                   'DD-MON-YYYY HH24:MI:SS')
                                      AND  TO_DATE ('18-APR-2013 08:00:00',
                                                    'DD-MON-YYYY HH24:MI:SS')

In order to narrow down to the erroring record,  i have tested the query by narrowing down to smaller date period to locate the exact row which throws the error. Once i have identified the row which gives the error, look for the colums used in the query and look for invalid value and correct it.

Monday, October 29, 2012

Shell Script to Monitor Data Guard Status

Here is a shell script that can be scheduled to monitor the status of the data guard. The best method for monitoring data guard and databases is to user Oracle Enterprise Manager Grid Control and setup  and Manage the Data Guard.

Environment Used to test the script.

OS: Enterprise Linux Server release 5.3
Database: 11.2.0.2
No of Standby DB: 1
Data guard  Type: Physical Standby

Below script will connect to primary database and query V$ARCHIVE_DEST_STATUS and V$ARCHIVED_LOG to get the data guard status and un-applied log sequence count. If the data guard status is in error or count of un-applied logs are greater than 2, a subroutine can be called to alert the DBA. Assume that DEST_ID 2 is Standby Database.


#!/usr/bin/ksh
#Script to monitor Data guard Status and  alert if there is any issue.
#=======================================================================
DG_STATUS=`sqlplus -s "/ as sysdba" <<EOF
set heading off verify off feedback off serveroutput on
declare
l_stat varchar2(30);
l_gap_stat varchar2(100);
l_stat1 varchar2(150);
l_stat2 varchar2(20);
l_gap_cnt number;
l_appld_seq number;
begin
l_stat2 :='DG_NORMAL';
SELECT STATUS, GAP_STATUS into l_stat, l_gap_stat FROM "V\\$ARCHIVE_DEST_STATUS" WHERE DEST_ID = 2;
l_stat1 := l_stat||l_gap_stat;
dbms_output.put_line(l_stat1);
if l_stat1 <> 'VALIDNO GAP' then
--      dbms_output.put_line('Datagaurd Status is in Error');
        l_stat2 := 'DG_ERRORR';
end if;
select count(1) into l_gap_cnt from "V\\$ARCHIVE_GAP";
 dbms_output.put_line('Gap count: '||l_gap_cnt);

if l_gap_cnt>0 then
        dbms_output.put_line('Datagaurd Status is in Error');
        l_stat2 := 'DG_ERRORR';
end if;

SELECT COUNT(1) into l_appld_seq FROM "V\\$ARCHIVED_LOG" WHERE APPLIED='NO' and DEST_ID=2;
 dbms_output.put_line('Unapplied log count: '||l_appld_seq);

if l_appld_seq>2 then  -- Archived log may not apply immediatly so chk for more than 2
--      dbms_output.put_line('Datagaurd: Log apply is stopped');
        l_stat2 := 'DG_ERRORR';
end if;
dbms_output.put_line(l_stat2);
end;
/
quit
EOF`

rm -rf ./DG_PREV_STAT
cp ./DG_CURR_STAT ./DG_PREV_STAT
DG_PREV_STAT=`cat ./DG_PREV_STAT`


echo $DG_STATUS
l_stat=${DG_STATUS: -9}
echo $l_stat
if [ "$l_stat" =  "DG_NORMAL" ]; then
        echo "NORMAL" > ./DG_CURR_STAT
        if [ "$DG_PREV_STAT" = "NORMAL" ]; then
                echo "No Change in Dataguard Status"
         else
                echo "Status of Dataguard changed from ERROR to NORMAL"
        fi

else
        echo "ERROR" > ./DG_CURR_STAT
  if [ "$DG_PREV_STAT" = "ERROR" ]; then
    echo "No Change in Dataguard Status"
  else
    echo "Status of Dataguard changed from NORMAL to ERROR"
    #--- Call Subroutine to Alert DBA -------

    # For Example use wget function to call a SMS gateway URL
    # or mail command to send email.
    #-----------------------------------------

EOFT
 fi

fi

Wednesday, September 19, 2012

Using TOAD for Oracle on Windows 8 64bit

Update: Please note that TOAD 64 Bit is Now available for Windows 8 64 Bit Version. You can install it along with Oracle Client 64 Bit. It will work smoothly.

Today I have installed Oracle 10gR2 32 bit Client and TOAD for Oracle 11.5.0.56 on my Windows 8 laptop and when I try to connect to database it  gave the error :

can't initialize oci.error -1

So, Followed the below workaround to resolve this issue and I am able to connect to databases.

1. Go to the folder where Toad is installed.
2. Right Click on the Toad.exe and select Compatibility Tab
3. Select the check box "Run this program in compatibility mode for"
4. Select Windows XP (Service Pack 3) in the list box below
5. Save the settings by clicking OK

Now open the Toad and I am able to connect to the databases.successfully

Note the following:

Oracle Client Installed Must be 32 bit.
Toad is running in 32 bit environment.
Windows 8 is 64 bit

 

Friday, December 2, 2011

Steps to add/increase the swap partition on Linux (Using Logical Volume).

In certain situations you may need to increase the swap space on your linux server. For example, installing new version of Oracle on an existing linux server.

Linux has two types of swap space:
1) The swap partition. The swap partition is an independent section of the hard disk used solely for swapping; no other files can exist there.

2) The swap file.  The swap file is a special file in the filesystem that exists with your other files.
Below steps are showing how to increase space swap space by adding another swap partition using logical volume.

All these steps has to be done as root user.

1. Create a logical volume
   
    Pre-req: Enough free space must be available on volume group.


 a) open logical volume manager using system-config-lvm
 b) Click on logical view
 c) Click on "Create New Logical Volum Button"
 d) Give the LV name like "swap2"
 e) Specify the size required in GBs
 f) Keep all other values unchanged and click OK to create volume
 g) Note down the new logical volume full path (ex: /dev/vgdata/swap2) from voluem properties and close the GUI.


2. Format the newly created volume with swap file system

   a) # mkswap </full/path to/new volume>
   ex: mkswap /dev/vgdata/swap2


3. Activate the new swap
     a) # swapon </full/path to/new volume>
  ex: swapon /dev/vgdata/swap2


4. Add the following line to fstab to persist swap configuration after re-boot.
   </full/path to/new volume> swap swap defaults 0 0
 ex: /dev/vgdata/swap2 swap swap defaults 0 0

5. verify the swap
  
a) free -m
 b) cat /proc/swaps



Saturday, August 13, 2011

Quick Reference on Database Characterset.

Recently i was upgrading the Oracle apps 11i to R12 and the customer want Arabic NLS. So i need to convert my database characterset form US7ASCII to a characterset that supports Arabic. I have confused which one should i use, UTF8 or AL32UTF8.  I did some reserch on oracle support and decided to use AL32UTF8.  Below given points helped me to make that decision.


The default UTF-8 (Unicode) characterset for 9i/10G is AL32UTF8, however this characterset is NOT recognized by any pre-9i clients/server systems.

Recommend that you use UTF8 instead of AL32UTF8 as database characterset if you have 8i (or older) servers and clients connecting to the 9i/10g system
until you can upgrade the older versions to 9i or higher.
UTF8 is Unicode revision 3.0 in 8.1.7 and up. AL32UTF8 is updated with newer Unicode versions in each major release

Besides the difference in Unicode version the "big difference" is that AL32UTF8 has build in support for "Surrogate Pairs", also known as "Surrogate characters"
or "Supplementary characters". Practically this means that in 99% of the cases you can use UTF8 instead of AL32UTF8 without any problem.
There is no performance difference between UTF8 and AL32UTF8. But seen UTF8 is NOT updated with newer Unicode versions we however suggest to use AL32UTF8 when possible.

Summary:
If you use 8.1 or 8.0 clients or servers or connect to 8.1 or 8.0 databases then use UTF8 as NLS_CHARACTERSET for the 9i (or up) databases, otherwise
(unless the application vendor explicit mentions UTF8 of course) use AL32UTF8.

For an Unicode database Oracle does not need "Unicode support" from the OS where the database is running on because the Oracle AL32UTF8 implementation is not depending on OS features
There is also no need to "install Unicode" or so for the Oracle database/client software, all character sets known in a database version , and this includes
Unicode character sets, are always installed. You simply cannot choose to not install them
If your current Oracle version is 8.1.7 or lower then it's best to upgrade first to a higher release, mainly because
a) you then can use AL32UTF8 (not possible in 8i)
b) Csscan has a few issues in 817 who might provoke confusion.
If your current Oracle version is 9i or up then both (before or after) are a good choice, it simply depends on your preference or needed application changes
Storage.
AL32UTF8 is a varying width characterset, which means that the code for 1 character can be 1 , 2 , 3 or 4 bytes long. This is a big difference with
character sets like WE8ISO8559P1 or WE8MSWIN1252 where 1 character is always 1 byte.

Tuesday, July 12, 2011

Processing XML files and converting to Oracle RDBMS tables.

Oracle Database has the capability to store XML files. Oracle 9i onwards, there is a a datatype called XMLTYPE. Internally, Oracle uses CLOB to store the XML data. In this blog i will demonstrate how to load XML files to XMLTYPE table in Oracle Database and how to use query to extract data in tabular form.

1. Create a table with XMLTYPE column

create table XML_FILES
(
XMLDATA    sys.XMLTYPE       NOT NULL,
  FILE_ID    NUMBER (10)   NOT NULL,
  FILE_NAME  VARCHAR2 (255)  NOT NULL)


2. Load the XML files using SQL Loader.
 a) Create a SQL Loader control file
  Open notepad and add the below entries and save file as load_xml.ctl

  load data
  infile 'xml_files.dat'
  into table XML_FILES append
  fields terminated by ','
  (
  xml_filler filler char
  ,xmldata lobfile(xml_filler) terminated by EOF
  ,file_id
  ,file_name
  )


 b) Create  data file xml_files.dat.
  This file will be used by SQL Loader control file to read the file, filename and file id. Optionally, You can use shell script or batch programs to generate .dat file by reading directory.    Structure of the file should look similar as shown below.

     XMLFILE_AA_11.xml,1,'XMLFILE_AA_11.xml'
  XMLFILE_AA_12.xml,2,'XMLFILE_AA_12.xml'
  XMLFILE_AA_13.xml,3,'XMLFILE_AA_13.xml'
  XMLFILE_AA_14.xml,4,'XMLFILE_AA_14.xml'
  XMLFILE_AA_15.xml,5,'XMLFILE_AA_15.xml'


  SAMPLE XML File content is shown below.

   <?xml version="1.0" encoding="UTF-8"?>
   <EMPDATA TIME_STAMP="2006-08-07T15:00:42"
    TRANSACTION_ID="2006-08-07T15:00:42" VERSION="1.0">
    <HEADER>
     <SENDER>
      <SENDER_NAME>XYZ Corp</SENDER_NAME>
     </SENDER>
     <RECEIVER>
      <RECEIVER_NAME>ABC Bank</RECEIVER_NAME>
     </RECEIVER>
    </HEADER>
    <BODY>
   <EMP>
         <EMPNUM>12345678</EMPNUM>
         <DEPT>07I7</DEPT>
         <LOCATION>22</LOCATION>
         <HIRE_DATE>2006-08-07 00:12:00.0</HIRE_DATE>
         <FIRST_NAME>JOHN</FIRST_NAME>
         <LAST_NAME>SMITH</LAST_NAME>
    <PHONES>
    <PHONE type="Office">5676739</PHONE>
    <PHONE type="Office">9123412432</PHONE>
    </PHONES>
     <AC_NO>12313-123123-1233</AC_NO>
     <AMOUNT>2500.00</AMOUNT>
   </EMP>
   <EMP>
         <EMPNUM>12345679</EMPNUM>
        <DEPT>07I2</DEPT>
        <LOCATION>22</LOCATION>
        <HIRE_DATE>2006-08-17 00:12:00.0</HIRE_DATE>
        <FIRST_NAME>GREG</FIRST_NAME>
        <LAST_NAME>WINTER</LAST_NAME>
     <PHONES>
    <PHONE type="Office">5676733</PHONE>
    <PHONE type="Office">9123434231</PHONE>
     </PHONES>
   <AC_NO>12313-123144_4354</AC_NO>
   <AMOUNT>2800.00</AMOUNT>
       </EMP>
   </BODY>
  </EMPDATA>


 c) Load the XML files to table using SQL Loader

  Execute the below command in the command prompt.

  sqlldr xmlstage@devl control=load_xml.ctl
  Once the command is executed successfully the XML files would have been loaded to the table. You can query the table to see the data loaded
  SQL>  select xmldata,file_id,file_name from xml_files;

  But the output will not show the XML file content entirely.

3. Querying the data in the XMLTYPE column

 a) Below query will extract emp_num, acct_num and amount from the XML
  SELECT EXTRACTVALUE (VALUE (ctba), '/EMP/EMPNUM') emp_num,
          EXTRACTVALUE (VALUE (ctba), '/EMP/AC_NO') acct_num,
          EXTRACTVALUE (VALUE (ctba), '/EMP/AMOUNT') amount
     FROM xmlstage.xml_files,
          TABLE (XMLSEQUENCE (EXTRACT (xmldata, '/EMPDATA/BODY/EMP'))) ctba


 b) Below Query will extract phone number and phone type. So it is little different as we have to extract the attribute of a node.  We have to specify attribute with "@"

  SELECT EXTRACTVALUE (VALUE (ctba), '/EMP/EMPNUM') emp_num,
          TO_TIMESTAMP (EXTRACTVALUE (VALUE (ctba), '/EMP/HIRE_DATE'),
                        'YYYY-MM-DD HH24:MI:SS.FF'
                       ) hire_date,
          EXTRACTVALUE (VALUE (ctbb),
'/PHONE/@type') phone_type,
         EXTRACTVALUE (VALUE (ctbb), '/PHONE') phone
    FROM xmlstage.xml_files,
         TABLE (XMLSEQUENCE (EXTRACT (xmldata, '/EMPDATA/BODY/EMP'))) ctba,
   TABLE (XMLSEQUENCE (EXTRACT (VALUE (ctba), '/EMP/PHONES/PHONE'))) ctbb

 c) If your XML contains xml namespace attribute, you should ad xmlns as second parameter in the EXTRACT function and as third parameter in EXTRACTVALUE function.


You can use the queries like above to extract data from XMLTYPE column and insert into Tables for further processing.

Thursday, July 7, 2011

Create Database Documentation using Oracle Grid Control

Oracle Grid control is one of the useful tools for DBAs and System administrators.
You can generate a documentation of your database using Oracle Grid Control with two click of mouse button.
You can acheive this using the report functionality in the grind control.
Grid Control management repository stores configuration and performance information of your database and provides many useful views.
The schema SYSMAN holds information of objects such as tables,tablespaces, views, triggers, packages, procedures, synonyms etc of target databases.
It also holds information of the host server including hardware and OS

Here i will share some of the SQLs used for generating report.

Grid control provides Dynamic Parameters of target and timeperiod. You can use this by including bind variable placeholders in your SQL statement.
For example; ??EMIP_BIND_TARGET_GUID?? - this variable will bind UID of the target for the report in your SQL statement.

1. To get Server Details
========================
Below SQL provides the hardare and OS details and present in a tabular format.


select
decode(d.rn,1,'Host Name', 2,'Domain',3,'Operating System',4,'System Arch',5,'Manufacturer',6,'Memory(MB)',7,'IP Address') as col1,
decode(d.rn,1,h.host_name,2,h.domain,3, h.os_summary, 4,h.system_config,5,h.ma, 6,h.MEM,7,p1.PROPERTY_VALUE) as col2
from MGMT$OS_HW_SUMMARY h , (select level as rn from dual connect by level <= 7) d, mgmt_targets t1, mgmt_target_properties p1
where h.TARGET_GUID=(select t.TARGET_GUID from MGMT$DB_DBNINSTANCEINFO_ALL i,MGMT$TARGET t
where t.target_name=i.host_name
and i.TARGET_GUID='2AE31523681AB4BD3F1BC404F83E979C')
and p1.PROPERTY_NAME='IP_address'
and p1.target_guid=t1.target_guid
and t1.TARGET_NAME=h.host_name
2. DB Instance Details
======================
select
decode(d.rn,1,'Database Name', 2,'Characterset',3,'Instance Name',4,'National Characterset',5,'Global Name',6,'Log Mode',7,'Version',8,'Default Temp Tblspce') as Property,
decode(d.rn,1,o.database_name, 2,o.characterset,3,o.instance_name,4,o.national_characterset,5,o.global_name,6,o.log_mode,7,o.banner,8,o.default_temp_tablespace) as Value
from mgmt$db_dbninstanceinfo o, (select level as rn from dual connect by level <= 8) d
where o.target_guid = ??EMIP_BIND_TARGET_GUID??
union
select 'DB Size(GB)', to_char(sum(FILE_SIZE)/1024/1024/1024) from MGMT$DB_DATAFILES
where TARGET_GUID=??EMIP_BIND_TARGET_GUID??

3. SGA Details
================
select
substr(sganame,1,length(sganame)-4) as Name,
decode(substr(sganame,length(sganame)-3,4),'(MB)',sgasize*1024,sgasize) as Value
from MGMT$DB_SGA
where TARGET_GUID=??EMIP_BIND_TARGET_GUID??
and sganame in ('Buffered Cache (MB)','Fixed SGA (KB)','Redo Buffers (KB)','Variable SGA (MB)')
4. Variable SGA details
=======================
select
substr(sganame,1,length(sganame)-4) as Name,
decode(substr(sganame,length(sganame)-3,4),'(MB)',sgasize*1024,sgasize) as Value
from MGMT$DB_SGA
where TARGET_GUID=??EMIP_BIND_TARGET_GUID??
and sganame like '%Pool%'

5. Non Default parameters
===========================
select Name,Value from MGMT$DB_INIT_PARAMS
where TARGET_GUID=??EMIP_BIND_TARGET_GUID??
and isdefault='FALSE'
6. Control File Details
=======================
select file_name as FileName,Status from MGMT$DB_CONTROLFILES
where TARGET_GUID=??EMIP_BIND_TARGET_GUID??


7. Intance Performace
======================
select column_label,value FROM SYSMAN.MGMT$METRIC_CURRENT
Where metric_name='instance_efficiency'
and target_guid=??EMIP_BIND_TARGET_GUID??
Above are some of the SQLs used to generate report. In addition to that you can get the details of the Redo Logs, Tablespaces, Datafiles, Invalid Objects, Patches applied, Users with power privileges etc.