Tuesday, December 7, 2010

Strange Misleading Error[XML -2018/ AC-10006] while R12 Clone

During the recent Multi Node to Single Node R12 Clone, Encountered an strange error. When doing the database portion of the clone. Below command 'adclonectx.pl' creates the Context file


$ perl adclonectx.pl contextfile=$ORACLE_HOME/appsutil/SOURCE_CONTEXT_FILE.xml template=$ORACLE_HOME/appsutil/template/adxdbctx.tmp pairsfile=$ORACLE_HOME/appsutil/clone/pairsfile.txt initialnode


When running the same command, It dumped the below error,


file:/tmp/tmpCtxClone.xml: XML-20108: (Fatal Error) Start of root element expected.

AC-10006: Exception - org.xml.sax.SAXParseException: file:/tmp/tmpCtxClone.xml: XML-20108: (Fatal Error) Start of root element expected. thrown while creating OAVars object for file: /tmp/tmpCtxClone.xml

The new database context file has been created :
/opt/oracle/product/11.1.0_
SID/appsutil/SID_HostName.xml


At first site, I suspected that the issue is with format of the source xml file. Hence compared with the working XML file. Result is clean. Below portion of the error struck me


Thrown while creating OAVars object for file: /tmp//dummy.xml


Cause :

The /tmp is 100% full.


Fix:

Either remove the old files in /tmp directory OR export TEMP=/new/location where there is plenty of free space.

Friday, December 3, 2010

R12 Patch Failed as PLL regeneration didnt succeed.

Recently we applied a patch “897561” on R12 Instance. Patch has failed to complete with failure in regeneration of following PLL's

The following Oracle Forms objects did not generate successfully:

au resource APCACHE.pll
au resource APPAYSHD.pll
au resource APPREPAY.pll
au resource APXINLIN.pll

I tried to regenerate the PLL manually using the below method,

$ORACLE_HOME/bin/frmcmp.sh module= userid=APPS_/ output_file= module_type=library batch=yes compile_all=special
OR

$ORACLE_HOME/bin/frmcmp_batch.sh userid=apps/apps module= output_file= module_type=library compile_all=special

It failed with the following errors.

exec(): 0509-036 Cannot load program /opt/oraapps/SID_NAME/tech_st/10.1.2/bin/frmcmp_batch because of the following errors:
rtld: 0712-001 Symbol deucxealert was referenced
from module /opt/oraapps/I/tech_st/10.1.2/lib32/libig.so(), but a runtime definition
of the symbol was not found.
rtld: 0712-001 Symbol deucxget was referenced
from module /opt/oraapps/SID_NAME/tech_st/10.1.2/lib32/libig.so(), but a runtime definition
of the symbol was not found.
rtld: 0712-001 Symbol depcxset was referenced
from module /opt/oraapps/SID_NAME/tech_st/10.1.2/lib32/libig.so(), but a runtime definition
of the symbol was not found.

These above errors show that the problem is not with the regenerating the PLL files instead the frmcmp.sh/frmcmp_batch.sh itself failing to execute. After failed attempts to get some useful notes from metalink,I tried adrelink.sh.still no change. Also tried to change the PATH location by first putting $ORACLE_HOME/lib instead of $ORACLE_HOME/lib32.This time it threw new error. When comparing with the similar environment everything including seems to be same.

Then finally did a 'relink all' under 10.1.2 $ORACLE_HOME to generate the executables. This is has fixed the issue. The issue could have been due to the fact that 'adcfgclone.pl' was run using wrong path set.

Saturday, August 28, 2010

HYBRID COLUMNAR COMPRESSION - OVERVIEW



I couldn't find much from Oracle Documentation.However there are very good bits and pieces on the net. Here are my takeaways from these readings.

1). HYBRID COLUMNAR COMPRESSION [HCC] is only for EXADATA.There seems to be some technical difficulties in implementing it for the traditional storage (Don't know what it is!).

2). Concept:

Compression is very effficient for a data which is quite repetetive. With repetitive values, we can replace the Values with the smaller values (eg Symbols/Special Characters) and create the metadata to map these values; this metadata can be used to decompress the data.In a nutshell ,Compression saves space at the cost of processing power (CPU Usage).

Below diagram shows a typical Oracle Data block Stores the Data.C1-5 are Columns.



Values with Lower Cardinality (more duplicated elements) are the potential candidates for the efficient compression. With this, Columns are set to have more duplicated values than the rows.

So with HCC, Columns are grouped together in a logical area called Compression Unit.Which is a logical grouping of multiple datablocks.

So the compression unit would look like.


3). There are 2 types of HCC

- Warehouse Compression - On Average, 10 Times Space Savings.

- Archive Compression - On Average, 15 Times Space Savings(70% at some customer sites)

4). Warehouse Compression

-   Syntax: 
                 CREATE TABLE X
                                        COMPRESS FOR QUERY [LOW  | HIGH]
                                        AS
                                        SELECT * FROM Y;
 
                   Where   HIGH | LOW - Specifies the Extent of Compression.
 
                - Warehouse Compression is optimized for Query Performance.

5). Archive Compression

-   Syntax: 
                 CREATE TABLE X
                                        COMPRESS FOR ARCHIVE [LOW  | HIGH]
                                        AS
                                        SELECT * FROM Y;
 
                   Where   HIGH | LOW - Specifies the Extent of Compression.
 
                 - Archive Compression is optimised for Storage savings.

6). When a session places lock in the particular row HCC locks the whole Compression Unit Resulting in multiple row lock. Hence it may not be suitable for OLTP application where frequent update/insert occurs.

7). A Partition Table can have different type of HCC based on the Partition .For example. The latest partition can have COMPRESS BY QUERY whereas the older partition which hardly being queried can create using COMPRESS BY ARCHIVE.

8). The existing table can be converted to get benefit from HCC.However only newly added rows will be compressed .To compress the existing rows you need to do ALTER TABLE MOVE ;

9). You can check the characteristics of a row using DBMS_COMPRESSION package. To know more about the package click here


10)CPU Consumption for compression and decompression of the data is offset'd by less logical reads. Archive Compression consumes relatively more CPU compared to Warehouse Compression.

Friday, August 20, 2010

Generate DML/DDL/QUERY from SQL:

Lets consider an example to generate an SQL from select query to online datafile of a database.

The actual query is

select name from v$datafile;

From the above one we need to get the datafile online sql script.

ALTER DATABASE DATAFILE '/oradb01/TEST/data/apps_ts_tx_data.306.705691421' online ;

The final script would be,

set heading off

set lines 2000

select 'ALTER DATABASE DATAFILE '''|| name || ''' online ;' from v$datafile;

Above command would give an output like

ALTER DATABASE DATAFILE '/oradb01/TEST/data/apps_ts_tx_data.306.705691421' online ;

ALTER DATABASE DATAFILE '/oradb01/TEST/data/apps_ts_tx_data.302.705691421' online ;

Two basic things to consider is

1) Whatever you need display as it is,should be given in ' ' quotes.

2) To get the value of a variable (in our case ‘NAME’ which gives Datafile file path and name) give it in Double Pipe. i.e, || ||

Taking our example, Lets break the SQL for better understanding.

SQL>select 'ALTER DATABASE DATAFILE ''' || name || ''' online ;' from v$datafile;

Here “ALTER DATABASE DATAFILE” is the text we want to display at first. Hence the query “select 'ALTER DATABASE DATAFILE ' “. Remember there is a space between datafile and the ending single quote. Next we want datafile name with full location, which the actual query gets.

To get the value of the Name Column. We need to place column name in || ||

select 'ALTER DATABASE DATAFILE ' || name ||

This would command would give an something like

ALTER DATABASE DATAFILE /oradb01/TEST/data/apps ……

However we want ' to be included for the datafile name value.

Hence it should be

select 'ALTER DATABASE DATAFILE ' '' || name || ''

To add a single quote we need to add additional single quote to print single quote Hence we need to give 2 single quotes. Now we just need to add online; word to the end of it.

Which is ' online ; ' . Note, you need to give space between the online and the starting single quote. 'online ; ' .Now adding it all would give

select 'ALTER DATABASE DATAFILE ' ''|| name || '' ' online ;' from v$datafile;

However the above need to be formatted as(remove the space between the quotes)

select 'ALTER DATABASE DATAFILE '''|| name || ''' online ;' from v$datafile;

Got the knack?

UNIX Tips

'VI' Search and Replace: -

Go to the Command Mode(By Pressing ‘Esc’)

First occurrence on current line: :s/OLD/NEW

On current line: :s/OLD/NEW/g

Between two lines #,#: :#,#s/OLD/NEW/g (example 1,10s/OLD/NEW/g)

Every occurrence in file: :%s/OLD/NEW/g

 To append the text at the end of  the line   
                     %s/$/ \>\> \/tmp\/test\/test.log/g  
Where
' \' - is a DELIMITER
Above command will add '>> /tmp/test/test.log' to end of the each line.
Eg, File having the line 
                    cat session.sql
                    ALTER SYSTEM KILL SESSION '358, 22' IMMEDIATE ; 
                    Would become
                    ALTER SYSTEM KILL SESSION '358, 22' IMMEDIATE ; >> /tmp/test/test.log  
To add the text infront of the line         
                    %s/^/SQL\> /
                    Would become
                    SQL> ALTER SYSTEM KILL SESSION '358, 22' IMMEDIATE ; >>  /tmp/test/test.log    
Remove ^M(Carriage Return) from the file:
You could face this issue when doing FTP/SFTP from Windows to Unix.
To remove ^M for say 100 files in a directory.
Just go the the directory  and run
                    perl -p -i -e 's/\r\n$/\n/g'   *
$  -  for the end 
 ^  -  for the beginning 
\  -  as a delimiter to special character (like > < $ etc) if putting special symbol..put "\" and then place the actual character you want to display. 
% - place after the command prompt to makes changes across the whole file.

Monday, August 16, 2010

PART 2 :EXADATA V2 - Overview

1).Infiband
  • Only Storage Network Supported by Exadata
  • Provides Highest Possible performance available - 40Gb/Sec each direction.
  • Uses ZDP Protocol (Zero Data Loss UDP Protocol) - Open Source Developed by Oracle Corp
  • Can also be used as RAC interconnect.
  • Each Infiband Link is able to carry the full data bandwidth of the entire Cell
2).Exadata comes to 2 DISK Type - SAS and SATA.
  • SAS - For Maximum Performance
  • SATA -For Maximum Capacity
3).Sun Database Machine doesn't include any software licence.

4).Sun Database Storage Server Details :
  • RAM - 72 GBP(18 x4 )
  • Disk Drives - 584 GB ( 4 x 2.5 146 GB)
  • Oracle Enterprise Linux
  • Oracle Database 11.2
5).A Full Rack Exadata can have 8 Database Servers,14 exadata cells,3 Infiband Switches

6).SQL Offloading is done by Database Server using iDB(Oracle Data Transfer Protocol)

7).CELLSRV component of Exadata storage server is used for Smart scan processing.CELLSERV Scans the blocks from storage and extract the relevant columns and send it back to the database server.

8).Database Server can break the SQL query and send the small portion of it to each exadata cells and upon retrieving the
results ,Database Server constructs the results and required rows are returned to clients.

9).We can use the below query to find the list of functions which can be offloaded to the Exadata.

Select * from v$sqlfn_metadata where offloadable='YES'

10).Exadata Storage server can perform Smart scans on encrypted tablespace and Columns.

11).With Performance of incremental Backup performance is significantly improved as the changes are tracked from individual block level rather than the large group of blocks.


Thursday, August 12, 2010

Database Cloning Issue in R12

Currently doing a R12 Single Instance Clone from PROD to TEST

I removed the Target ORACLE_HOME Direcories and untar'd the Source Oracle Home.I haven't touched the Oracle Inventory as it already had the Target Environment Details as its more of a refresh.

Though we know the ORACLE_HOME is already there.I tried adding it using the below command.

export ORACLE_HOME=/oracle/home/directory/11.1.0
cd $ORACLE_HOME/clone/bin
perl clone.pl ORACLE_HOME="/oracle/home/directory/11.1.0" ORACLE_HOME_NAME="11g_RDBMS_EE_" ORACLE_BASE="/opt/oracle"

It errored with the following message.

SEVERE:OUI-10197:Unable to create a new Oracle Home at /opt/oracle/product/11.1.0_IOFD. Oracle Home already exists at this location. Select another location.

Hence i went ahead and start doing the RMAN Restoration.While logging into 'sqlplus'.it throwed the bizzare error.

Enter user-name:
exec(): 0509-036 Cannot load program oracleIOFD because of the following errors:
0509-150 Dependent module libskgxp11.so could not be loaded.
0509-022 Cannot load module libskgxp11.so.
0509-026 System error: A file or directory in the path name does not exist.
ERROR:
ORA-12547: TNS:lost contact

Action Taken:

Did a relink.using relink all. After that i was able to login to sqlplus without any issue.However there were many errors with the relink .

Hence dettached the ORACLE_HOME from the Inventory and re-added as follow.

To De-attach Oracle Home from Inventory :
cd /oracle/home/directory/11.1.0/oui/bin
./runInstaller -silent -detachHome ORACLE_HOME="/oracle/home/directory/11.1.0" ORACLE_HOME_NAME="11g_RDBMS_EE_"

To Attach:

export ORACLE_HOME=/oracle/home/directory/11.1.0
cd $ORACLE_HOME/clone/bin
perl clone.pl ORACLE_HOME="/oracle/home/directory/11.1.0" ORACLE_HOME_NAME="11g_RDBMS_EE_" ORACLE_BASE="/opt/oracle"

This is has fixed the issue.

Wednesday, August 11, 2010

PART 1 :EXADATA V2 - Overview

1).Based on SunFire X4275 Server.Processor is Intel Xeon E5440 Processor(64 Bit).

2).Exadata V2 requires 11G R2 (alteast 11.2.01)

3).Works with Single Instance /RAC

4).Exadata can offload some database processing to the Exadata Storage Server.This ability is known as Smart Scan.

For Example below operations can be offloaded to Exadata Storage Server.
  • Table Scan Predicate Filters.
  • Join Processing
  • CPU Intensive Decompression and Decryption.
  • File Creation Operations.

5).Exadata V2 Introduces HYBRID COLUMNAR COMPRESSION.Which mainly Reduces no of IO's

6).Uses Infiband network which has much throughput than conventional storage networks.

7).Exadata cell
  • A Computer with CPU,Memory,Bus,disks,Host Channel Adapter.
  • OS is Linux.
  • Building Block for Storage.
  • Houses Disk Storage and Exadata Storage Software Provided by Oracle.
  • Add more cells for More Storage and More I/O Capacity.
8).The Database Server and Exadata Cells Communicate using Infiband Network.

9).Cell is mainly for storing Database Files.You can use it for storing Business Files using Database File System.

10).All the software's are preinstalled.Oracle Enterprise Linux is used as OS for Database server.

Saturday, August 7, 2010

How to find what process has loaded a particular DLL. ?

You may hit this when cleaning up Oracle Installation on Windows box.Sometimes it may happen that few files (eg.OCI.DLL) may not get deleted.When you try to delete it says "Access Denied."

As we don't know the process which has loaded this DLL.First we need to find the process and kill it.

Following command can be used to find the process which loads a particular dll.

tasklist /m

Eg..,

C:\Documents and Settings>tasklist /m en-US.dll

Image Name PID Modules
========================= ======
chrome.exe 5976 en-US.dll
chrome.exe 4272 en-US.dll
chrome.exe 2932 en-US.dll
chrome.exe 2488 en-US.dll
chrome.exe 4456 en-US.dll
chrome.exe 3228 en-US.dll
chrome.exe 440 en-US.dll


This way we can find out the specific process and kill them without rebooting the server.

Alternatively,you can use tool like 'unlocker' .But may not be appropriate in production environment.

Saturday, July 31, 2010

Only One Node Starts in a 2 RAC Cluster.

Recently we had a server move from one DC to other.Posting the issue faced on the one of the system.

Configuration as below,

1).AIX Machine
2).11.1.0.7 Database
3).2 Node Cluster.

We had a clear shutdown before the move.And upon starting the Cluster & Database, only one Node comes up.Which ever starts first will have full running CRS/CSS Stack ,the other node fails to start CSS and throws following error in the crsd.log.

20xx-xx-xx xx:xx:xx.xxx: [ COMMCRS][903]clsc_connect: (600000000033e030) no listener at (ADDRESS=(PROTOCOL=ipc)(KEY=OCSSD_LL_njzdb12_crs))
20xx-xx-xx xx:xx:xx.xxx: [ CSSCLNT][1]clsssInitNative: connect failed, rc 9
20xx-xx-xx xx:xx:xx.xxx: [ CRSRTI][1] CSS is not ready. Received status 3 from CSS. Waiting for good.

Googling for the above error mostly points to the issue with /tmp/.oracle or /var/tmp/.oracle directory.The files under which has been deleted when the CRS was running.It was true that one of my colleague has deleted those log files.The easy fix told was to reboot both the machine.We tried but no luck.

Upon checking the cssd logs i could see the below error.

ocssd.log:[ CSSD]2010-03-05 17:48:21.908 [84704144] >TRACE: clssnmReadDskHeartbeat: node 3, vm-lnx-rds1173, has a disk HB, but no network HB, DHB has rcfg 0, wrtcnt, 2, LATS 1185024, lastSeqNo 2, timestamp 1267791501/1961474

Which just flashed to my brain to check the cluster interconnect.Yes.The Cluster Interconnect is not pinging between the servers.Informed to Sysadmins and got it fixed.Then it came out quite well.

Tuesday, July 20, 2010

Simple UTL_FILE Script to create & write in a file

Below PL/SQL block creates a file named 'sample.txt' with 'welcome' word in it under the Oracle Directory Named UTL_DIR [Can be created using CREATE DIRECTORY]

We can use utl_file_dir instead of CREATE DIRECTORY in that case we need to specify the whole path of the UNIX directory instead of the just the Directory name[i.e.., UTL_DIR]

Make sure you have necessary permissions.

Using utl_file_dir is not a recommended one.

Declare
file1 utl_file.file_type;
Begin
file1:= utl_file.fopen('UTL_DIR','sample.txt','w');
utl_file.put_line(file1,'Welcome' );
utl_file.fclose(file1);
end;
/

Parameters to Format the Output from DBA_SOURCE.

Set the Below Variables:

set verify off
set feedback off
set lines 132
set pages 0
set heading off
set space 0
set recsep off
column text format a79
column line noprint

select DECODE(line,1,'create or replace ','')||text, line
from dba_source where owner = upper('&&1')
and type = upper('&&2')
and name = upper('&&3')


REFER MOS NOTE:SCRIPT:REGENERATING PACKAGE and PROCEDURE CODE from DBA_SOURCE
[ID 1012473.7]

Thursday, April 22, 2010

Handy SQLs for DBA's

Find SQL from SID:

SELECT s.sid, s.serial#, st.sql_text sql_text
FROM v$session s, v$sql st, v$process p
WHERE s.sql_hash_value = st.hash_value
AND s.sql_address = st.address
AND s.paddr = p.addr
and ( s.sid='&which_sid' )

To the full SQL Text:

select x.sql_text from v$session s,v$sqltext x
where s.sql_address=x.address and s.sid = &which_sid order by sid, piece asc;


Find the Session details :

SELECT s.saddr, s.sid, s.serial#, s.username,
s.osuser, s.machine, s.program, s.logon_time, s.status,
p.program, p.spid
FROM v$session s, v$process p
WHERE s.paddr = p.addr
AND p.spid IN (&OS_PROCESS_ID);

To set the Time to in a required format:

alter session set nls_date_format='DD:MON:YYYY:HH24:MI:SS';

Then execute the required sql.

To Monitor the Progress of RMAN Backup:

SELECT sid, serial#, context, sofar, totalwork,
round(sofar/totalwork*100,2) "% Complete"
FROM v$session_longops
WHERE opname LIKE 'RMAN:%'
AND opname NOT LIKE 'RMAN: aggregate%';