Thursday, September 4, 2014

Tips & Tricks 1 : Give debug privilege to user

Sometimes small tips and tricks may be useful for administrating db, apps etc... I would like to add related posts into my blog contains tips and tricks.

Tips & Tricks 1 : Give debug privilege to user.

Any user with whom you need debug procedure,function or package , related user must have

DEBUG CONNECT SESSION
DEBUG ANY PROCEDURE

privileges.

In order to give these ,

grant DEBUG CONNECT SESSION userx;
grant DEBUG ANY PROCEDURE userx

Thursday, August 7, 2014

UPGAST-00224:The specified database does not contain any schemas for Oracle MDS ...

From Oracle Error Message documentation,

UPGAST-00224: The specified database does not contain any schemas for {0} or the database user lacks privilege to view the schemas.

Cause: The database you have specified does not contain any schemas registered as belonging to the component you are upgrading, or else the current database user lacks privilege to query the contents of the schema version registry.

Action: Verify that the database contains schema entries in schema version registry. If it does not, specify a different database. Verify that the user has DBA privilege. Connect to the database as DBA.

Level: 1
Type: ERROR
Impact: Upgrade

While upgrading OBIEE from 11.1.1.6 to 11.1.1.7 i have encountered UPGAST-00224 error at stage of PSA for the update of MDS schema .

I was doing upgrade process at TEST enviroment and related MDS + BIPLATFORM schemas have been imported from LIVE database to TEST database by changing schema names in order to sepearate TEST and LIVE . My original schema names were OBI_MDS and OBI_BIPLATFORM  and changed to OBIUPG_MDS ,OBIUPG_BIPLATFORM After done this process system.SCHEMA_VERSION_REGISTRY$ must be updated with new schema information.

To do this , system.SCHEMA_VERSION_REGISTRY$ can be exported and imported from live into TEST , or related MDS and BIPLATFORM data can be inserted or updated  at TEST enviroment.

Thursday, July 24, 2014

Firefox Update comes with sec_error_ca_cert_invalid (Security Error)

After I have patched firefox to version 31.0 when i try to connect  Enterprise Manager 12c , browser throws an SSL error : sec_error_ca_cert_invalid 

An error occurred during a connection to https://<OMS host>:port . Issuer certificate is invalid. (Error code: sec_error_ca_cert_invalid)



Because of certificate of grid control is self generated and not signed by a  trusted Certificate Authority , browser shows an error that it does not recognise the certificate . To skip this situation there are 2 ways that can be done.

1. Third Party certificate from well know certificate authority  can be used.

Third party certificates can be obtained from a well-known Certificate Authority and imported into the OMS and Agents. 

2. Import Self-signed certificate into browsers certificate store

To recognise self-signed certificate from any browser , this certificate can be added browser store.Whenever grid control URL is called from explorer or chrome , these browsers can continue to work even if you accept risk.But firefox can not. To skip firefox issue i have used "internet explorer" to get related certificate and imported it into firefox store by using following steps,

1.Clear SSL cache from "Internet Options > Content Tab > Clear SSL State"

2.Remove any certificate entry from "Internet Options > Content Tab > Certificates" related with your Grid Console or Enterprise Manager Cloud control in following tabs

Personal
Other People
Intermediate Certification Authorities
Trusted Root Certification Authorities
Trusted Publishers
Untrusted Publishers

3. Click Ok and close the browser

4. Open browser and go to https://<OMS host>:port/em

5. Continue to this website (not recommended) is selected

6. After this login screen is opened but "Certifacate Error" link is came up beside address bar of explorer. Click this link.

7. Click "View certificates"



8. Goto "Certification Path" tab 



9. Select top or root certificate and click "View Certificate"



10. Click "Install Certificate"


11. Click "Next" and choose "Place all certificates in the following store" in the following screen.


10. Click "Browse" button and select "Trusted Root Certification Authorities"

11. Click "Next" and "Finish" button sequentially

12. Click "Yes" on Last "Security Warning" screen and "The import was successful" message comes up

13. After reopen the browser and calling OMS url https://<OMS host>:port/em certificate error does not occur again.

Now , i have imported self-signed certificate into internet explorer certificate store and i can export it to import into firefox store.

1. From internet explorer choose "Internet Options > Content Tab > Certificates" and goto "Trusted Root Certification Authorities" 

2. Select your certificate regarding your OMS host name in "Issued To" column.

3. Click export 

4. Click Next

5. Select "DER encoded binary X.509 (.CER)

6. Click next and give a name as a file name for certificate

7. Click next and finish.

8. Open firefox

9. Goto "Advanced > Certificates > View Certificates"



10. Goto "Authorities" tab and click "Import" button

11. Select your exported certification file with open file editor and click "Ok" without selecting any purposes.



12. Reopen firefox and enter OMS url again.

Login screen opened .


Saturday, July 19, 2014

Estimate size of index using explain plan

Today i have learned cool way to define after index rebuilt what will the index size be ? This method , estimating index size is based on explain plan . Not only rebuild process , additionally creation of index is  involved .

Basically ,

1. create table tbl1 as select * from dba_objects;
2. insert into tbl1 select * from tbl1 -- 2 times
3. commit;
3. call dbms_stats.gather_table_stats('USER','TBL1');
4. explain plan for create index user.tbl_idx1 on tbl1(object_name);
5. commit;

6. select * from table (dbms_xplan.display);

-----------------------------------------------------------------------------------
| Id  | Operation              | Name     | Rows  | Bytes | Cost (%CPU)| Time     |
-----------------------------------------------------------------------------------
|   0 | CREATE INDEX STATEMENT |          |   414K|  9707K|   441   (3)| 00:00:03 |
|   1 |  INDEX BUILD NON UNIQUE| TBL_IDX1 |       |       |            |          |
|   2 |   SORT CREATE INDEX    |          |   414K|  9707K|            |          |
|   3 |    TABLE ACCESS FULL   | TBL1     |   414K|  9707K|   334   (3)| 00:00:02 |
-----------------------------------------------------------------------------------

Note
-----
   - estimated index size: 16M bytes



6. create index user.tbl_idx1 on tbl1(object_name);

7. select bytes/1024 from dba_segments where segment_name='TBL_IDX1'

Size : 16384K

As a result , actual size and estimate size are so close . 

CArlos Sierra has a great article and script about this method which can be applied to whole system , schema ,table or single index . Object create DDL is used with explain plan statement to detect approximate size like this,

declare
  v_ddl clob;
begin

  select replace(dbms_metadata.get_ddl(object_type => 'INDEX',name => 'TBL_IDX1'),chr(10),' ') into v_ddl   FROM DUAL;

  execute immediate 'explain plan for '||v_ddl;
  commit;

end ;

After script execution,below sql gives segment size and estimated size

select object_name,object_owner,info estimatedSize,ds.BYTES segmentSize
  from (select p.object_name,p.object_owner,extractvalue(value(d), '/info/@type') type,
               extractvalue(value(d), '/info') info
          from plan_table p,
               table(xmlsequence(extract(xmltype(p.other_xml), '/*/info'))) d
         where p.other_xml is not null)X,dba_segments ds
 where type = 'index_size'
   and ds.owner=X.object_owner
   and ds.segment_name=X.object_name


OBJECT_NAME    OBJECT_OWNER    ESTIMATEDSIZE    SEGMENTSIZE
TBL_IDX1           USER                     16777216    16777216


This post was based on below blog posts

http://carlos-sierra.net/2014/07/18/free-script-to-very-quickly-and-cheaply-estimate-the-size-of-an-index-if-it-were-to-be-rebuilt/

http://richardfoote.wordpress.com/2014/04/24/estimate-index-size-with-explain-plan-i-cant-explain/

Wednesday, July 9, 2014

IAS_ADMIN account password reset

When you do not know ias_admin password or forget it , you can reset its password. Ias_admin is used for 
Application Server for administration. For 10.1.2.3.0 below steps can be used in order to change or reset password.

1.Shutdown Application Server console

$ORACLE_HOME/bin/emctl stop iasconsole

2.jazn-data.xml file should be backed up located in $ORACLE_HOME/sysman/j2ee/config

cd  $ORACLE_HOME/sysman/j2ee/config
cp jazn-data.xml jazn-data.xml.bak

3.With vi editor find <name>ias_admin</name>  and remove the credentials line under <name> tag

<name>ias_admin</name>
<credentials>{903}+7qAmdyLk7lsa7CxvLpFeDesddzaJWS3qEA/AvKpA+bw=</credentials>

4.Following command is used to reset ias_admin account password

$ORACLE_HOME/bin/emctl set password reset <newpassword>

5.Start Application Server console

$ORACLE_HOME/bin/emctl start iasconsole

Password can be changed from command line if you know current ias_admin account password,

$ORACLE_HOME/bin/emctl set password <oldpassword> <newpassword>

Monday, June 30, 2014

Unable to launch discoverer because of Missing Required Permissions Manifest Attribute In Main Jar & Security Exception, JVM Shared, not allowed to set security manager

After client java upgrade for EBS R12 from jre 1.6.0_33 to 1.7.0_51 we have been warned , clients getting below error whenever invoking discoverer.

Missing Required Permissions Manifest Attribute In Main Jar :

For this error we have applied 17347648 ,17303613 and 17874742 sequentially. At last below error occured ,

Security Exception, JVM Shared, not allowed to set security manager

More inclusive patch 18219024 adviced from support.But not able to patch because of this error,

Running prerequisite checks... 
Prerequisite check "CheckPatchApplicableOnCurrentPlatform" failed. 
The details are: 
Patch ( 18219024 ) is not applicable on current platform. 
Platform ID needed is : 226 
Platform IDs supported by patch are: 46 
[ Error during Prerequisite for apply Phase]. Detail: OPatch failed during prerequisite checks: Prerequisite check "CheckPatchApplicableOnCurrentPlatform" failed. 
System is intact, OPatch will not restore the system 

Despite Oracle published patch is generic platform , i could not apply patch to linux platform. Oracle support has a solution which is  changing  <platform name="" > entry to proper value in  PATCH_LOCATION/etc/config/inventory.xml file.

I have changed 
 <platform name="Linux Intel" id="46"/>
to
 <platform name="Linux Intel" id="226"/>

With this solution patch has been applied successfully and discover problem has gone.

Monday, June 23, 2014

Instant Data file growth - KTSJ - SMCO (Space Management Coordinator)

I have encountered an issue last weekend which was all datafiles in tablespace extended without reason. There was lots of wasted space approximetaly 125 GB.Firstly i have thougth that there was a procedure or job which processed big data and it caused this instant growth. But no clear point or anything like this i could not find in AWR reports in related time.

In order to detect this issue firstly i have queried exact time when this occured. Below sql helped me to find it.

select f1.snap_id,
       f1.sumts,f2.sumts2,((f1.sumts-f2.sumts2)*8)/1024/1024 diff
  from (select d1.snap_id, sum(tablespace_size) sumts
          from dba_hist_tbspc_space_usage d1, v$tablespace v1
         where d1.tablespace_id = v1.TS#
           and rtime >= '06/22/2014'
           and rtime < '06/23/2014'
         group by d1.snap_id) f1 ,       (select snap_id,sum(tablespace_size) sumts2
          from dba_hist_tbspc_space_usage d1
         group by d1.snap_id) f2   
where f2.snap_id=f1.snap_id-1  

This sql gave me issue occured between 05:00 AM - 06:00 AM. I have to find which session(s) caused this and best way to find was dba_hist_active_session_history with below sql

select d3.sample_id,
       d3.sample_time,
       d3.session_type,
       d5.USERNAME,
       d3.session_id,
       d3.session_serial#,
       d3.sql_opname,
       d3.sql_id,
       d3.event,
       d3.module,
       d3.action,
       d3.delta_read_io_requests,
       d3.delta_write_io_requests,
       d3.delta_read_io_bytes,
       d3.delta_write_io_bytes,
       d4.sql_text
  from dba_hist_active_sess_history d3, dba_hist_sqltext d4, dba_users d5
 where d3.sample_time >=
       to_date('22/06/2014 05:00:00', 'dd/mm/yyyy hh24:mi:ss')
   and d3.sample_time <
       to_date('22/06/2014 06:00:00', 'dd/mm/yyyy hh24:mi:ss')
   and d3.sql_id = d4.sql_id(+)
   and d3.user_id = d5.USER_ID(+)
 order by d3.sample_id

By ordering delta_write_io_bytes column ,interesting session  KTSJ Slave listed with highest delta_write_io_bytes . Sum of the delta_write_io_bytes of KTSJ was 119 GB and this was what i was looking for. Key word  was KTSJ or KTSJ Slave. After googling and with Oracle support , lastly i have found myself reading SMCO (Space Management Coordinator) master note :) 

Duty of this coordinator is coordinating execution of space management tasks , such as proactive space allocation and space reclamation. If datafiles have autoextend Yes property this coordinator can extend datafilesize to its max size even it has not reached maxsize. This is of course fine that sessions need not wait for space allocation that has already done. But instant growing like this may  make storage admin angry :) To be in safe disable option is available.

"Tablespace-level space (Extent) pre-allocation" feature provided by SMCO process can be disabled by setting "_enable_space_preallocation" to 0 as below,

alter system set "_enable_space_preallocation"=0;

To enable this feature, parameter can be set to 3 which is the default value,

alter system set "_enable_space_preallocation"=3;