Wednesday, 5 April 2017

How to Request to Change the password for All the Users in Oracle Apps

Ø  How to change all Applications user passwords?

In apps, there are times when we want to force all the application users to change their passwords. 

In apps 11i, we have a concurrent request under System Administrator->

CP SQL*Plus Expire FND_USER Passwords

This concurrent request basically sets the fnd_user.password_date to null for all apps users. The users are thus prompted to change their passwords on next login.

Ø  How to verify the operation of the oracle reports server for ebusiness Suites 11i?

In Oracle Applications 11i, the simplest method to check if the Oracle Reports server is functional is that we need to  "temporarily" enable the Oracle Reports Server diagnostic mode and bring up the "Environment" and "RWCGI Key Map" page via a web browser. 

o   Enable the Oracle Reports Server diagnostic mode.

We need to comment out any reference to the REPORTS60_CGINODIAG and REPORTS60_OWSNODIAG parameters from the following files:

$APACHE_TOP/Apache/conf/apps.conf
$FND_TOP/resource/appsweb.cfg
$OAD_TOP/admin/scripts//adrepctl.sh

Bounce the Oracle Reports server and the Apache (Web) server. 

o   Environment Check.

http://://rwcgi60/showenv?server= 

o   "RWCGI Key Map" Check.
http://://rwcgi60/showmap?server=



Lets take an example: 

http://erp.com:8000/dev60cgi/rwcgi60/showenv?server=REP60_VIS
Please note : The host and port is the same used for Apps login, the Web / Apache node.

If the Oracle Reports server installed with Oracle Applications 11i ,it will display the "Environment" and "RWCGI Key Map" page via a web browser, please check with the application product group who owns the troubled report for any required setup at the application level.

If the Oracle Reports server installed with Oracle Applications 11i fails to display the "Environment" and "RWCGI Key Map" page via a web browser, please open a service request with the oracle support and  upload a screen print of the error being encountered, and the following data:

1. Upload as a zip file with the following files.

a.  The Apps 8.0.6 $TNS_ADMIN/tnsnames.ora file.
b.  $APACHE_TOP/Apache/conf/apps.conf file
c.   $ORACLE_HOME/reports60/server/CGIcmd.dat
d.  $ORACLE_HOME/reports60/server/REP60_.ora
e.  $FND_TOP/resource/appsweb.cfg
f.   $OAD_TOP/admin/scripts/adrepctl.sh
(The exact adrepctl.sh file used to start the report server.)

2. Upload the report server's log files.

a.  The Apps report server startup log file. The variable REPSRV_LOG within the adrepctl.sh points to the log file.

b.  The Oracle Reports server log file.
$ORACLE_HOME/reports60/server/REP60_.log

3. Is the report server currently running; Check the output of ps -ef | grep rwmt ?


Ø Applications Framework Processing in R12.

The following are the steps to explain, how the JSP obtains the content from the Applications tables and uses information from the metadata dictionary to construct the HTML page.

1.     AOL/J validates user access to the page. 

2.     The page definition (metadata UI definition) is loaded from the metadata repository on       the database tier into the application tier.  

3.     The BC4J objects that contain the application logic and access the database are instantiated. 

4.     The Java Controller programmatically manipulates the page definition as necessary, based on dynamic UI rules. 

UIX (HTML UI Generator) interprets the page definition, creates the corresponding HTML in                            accordance with UI standards, and sends the page to the browser. 

Tuesday, 4 April 2017

Check IF Stats of the Indexes are Gathered but not Published

Using below query you can check if the stats on the indexes on you table are gathered but not Published :-

SELECT 'YES' pending
     , owner
     , table_name
     , index_name
     , partition_name
     , subpartition_name
     , num_rows
     , blevel
     , leaf_blocks
     , distinct_keys
     , avg_leaf_blocks_per_key
     , avg_data_blocks_per_key
     , clustering_factor
     , sample_size
     , last_analyzed
  FROM dba_ind_pending_stats
WHERE table_name = 'RA_CUSTOMER_TRX_LINES_ALL'
UNION ALL
SELECT 'NO' pending
     , owner
     , table_name
     , index_name
     , partition_name
     , subpartition_name
     , num_rows
     , blevel
     , leaf_blocks
     , distinct_keys
     , avg_leaf_blocks_per_key
     , avg_data_blocks_per_key
     , clustering_factor
     , sample_size
     , last_analyzed
  FROM dba_ind_statistics
WHERE table_name = 'RA_CUSTOMER_TRX_LINES_ALL'
ORDER BY 2
       , 3
       , 4
       , 1;



Please make sure if the stats are gathered then it should be published.

IF you see 'YES' in the resultset then run the below script to publish it.


exec dbms_stats.publish_pending_stats('AR','RA_CUSTOMER_TRX_LINES_ALL');


Monday, 3 April 2017

How to Unlock the Locked Table in ORACLE


Unlock the Locked tables in Oracle :- Oracle puts locks while performing any DDL or DML operation on oracle tables.When table locks is present on any tables in Oracle we cannot run DDL on those tables.


Some of the locks automatically set by oracle are RS and RX Locks.
SELECT … FOR UPDATE execution results in RS (row share) table lock. When you execute an INSERT, UPDATE or DELETE Oracle puts RX (row exclusive) table lock.

We have to kill the session which holds the lock in order to execute further operations. Follow the below steps to kill the session and forcibly unlock the table.

Let’s assume that 'EMP' table is locked,

SELECT object_id FROM dba_objects WHERE object_name='EMP';
 OBJECT_ID
----------
   7401242

If there are no locks present for the table 'EMP' this query won’t return any values.

SELECT sid FROM v$lock WHERE id1=7401242
SID
----------
   3434


SELECT sid, serial# from v$session where sid=3434

       SID    SERIAL#

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

      3434      92193

If its locked You can use the below command to kill the locked session :-

ALTER SYSTEM KILL SESSION '3434,92193' ;

Once the session is killed you will be able to carry out any DDL activities on EMP table. Also you can check in TOAD if there are any active sessions associated to the SID that we killed, to make sure that the session has been killed.

Sunday, 2 April 2017

Grant With Admin or With Grant Option

Attention:  Using "with admin" and "with grant" options are considered Oracle dangerous because if they are not managed carefully you can have unintended side effects, resulting to a security hole.


Both the 'with grant' and 'with admin' options serve to relinquish central security control, but they are for different types of privileges.

With Grant option:
  • Only for object privileges, not system privileges.
  • Only the person who granted the privilege can revoke the privilege.
  • Revoked privileges can "cascade", allowing the first grantor to revoke many subsequent grants.

With Admin option:
  • Only for system privileges, not object privileges.

Using the with admin option


Any 'global' privileges like roles and system privileges (e.g. CREATE TABLE) are granted using the WITH ADMIN OPTION. For table-specific privileges (e.g. GRANT select on emp) we use WITH GRANT OPTION syntax. Also, revoking any grant WITH GRANT will cascade and revoke any and all privileges assigned by the privileged user. On the other hand, revoking someone with the WITH ADMIN OPTION will only revoke their personal privileges, leaving intact all granted users.

When system privileges are passed to others using the WITH ADMIN OPTION, revoking the system privileges from the original user will not cascade. The system privileges granted to others must be revoked directly. In contrast, when object privileges are passed on to others using the WITH GRANT OPTION, the object privileges are revoked when the grantor's privileges are revoked.

It is important to note that only object privileges will cascade when revoked; system privileges will not.

When the WITH ADMIN OPTION or WITH GRANT OPTION has been included in a grant to another user, the privilege cannot be revoked directly. You must revoke the privilege and then issue another grant without the WITH ADMIN OPTION or WITH GRANT OPTION.
 

The "with admin" privilege


Sometime you want to grant privileges to users and have them be able to grant those privileges to other users. When this is the case, we include the WITH ADMIN OPTION keyword in the GRANT command. When this keyword is used, it will allow the user granted the privilege to grant that privilege to other users.
 
Privileges that are granted WITH ADMIN OPTION can be passed to other users. Hence, many companies prohibit this option, and others check to ensure that all user ID's are proper.  Here is an example of the usage of the with admin option keyword.

GRANT
   CREATE INDEX
TO
   Robert
WITH ADMIN OPTION;

The metadata security audit information for users having the WITH ADMIN OPTION is located in the DBA_SYS_PRIVS view.

 

The "with grant" privilege
 

The WITH GRANT option allows you to give the user you are assigning the privilege to grant this privilege to other users.  Only the schema that owns the object can grant privileges to that object unless the WITH GRANT option is included in the command.  Here is an example of the use of the with grant option:
GRANT SELECT ON
   emp
TO
   scott
WITH GRANT OPTION;

Gather stats of a table, Index or a Schema in Oracle Apps

Gather stats of an oracle table :-

EXEC DBMS_STATS.gather_table_stats('SCOTT', 'EMP');

exec DBMS_STATS.GATHER_TABLE_STATS (ownname => 'SMART' , tabname => 'AGENT',cascade => true, estimate_percent => 10,method_opt=>'for all indexed columns size 1', granularity => 'ALL', degree => 1);


When analyzing a single table, you must also remember to analyze all associated indexes using dbms_stats.gather_index_stats:

exec dbms_stats.gather_table_stats(null, 'CHANGELOG', null, DBMS_STATS.AUTO_SAMPLE_SIZE, false, 'FOR ALL COLUMNS SIZE AUTO');
exec dbms_stats.gather_index_stats(null, 'IDX_PCTREE_PARENTID', null, DBMS_STATS.AUTO_SAMPLE_SIZE);

Gather stats of an Index :-

exec dbms_stats.gather_index_stats('SCHEMA_NAME', 'TABLE_NAME');

Analyse an Index :-

ANALYZE INDEX SCHEMA_NAME.INDEX_NAME VALIDATE STRUCTURE
/

Saturday, 1 April 2017

DISABLE and ENABLE an INDEX in Oracle

Please use the below commands to Disable or Enable Index in Oracle.

Disabling an Index :-

ALTER INDEX SCHEMA_NAME.INDEX_NAME UNUSABLE
/

Enabling an Index :-

ALTER INDEX SCHEMA_NAME.INDEX_NAME REBUILD
/

APP-AR-11526: 'ORA-01502: index 'XX.XXXXX' or partition of such index is

This issue comes up because you have made a partition of an Index UNUSABLE.

To resolve the error you can follow the below steps.


1. Drop Index
OR
2. Rebuild Index
OR
3. Rebuild Partition of the Index


This Should resolve your issue.

1. To Drop:-

DROP INDEX SCHEMA_NAME.INDEX_NAME FORCE (Force only for non domain index)

DROP INDEX SCHEMA_NAME.INDEX_NAME

2. To Rebuild Index :-

ALTER INDEX SCHEMA_NAME.INDEX_NAME UNUSABLE;

3. To Rebuild Partition:-

ALTER EMPLOYEE_SUBPARTITIONS MODIFY DEFAULT ATTRIBUTES FOR PARTITION P1 TABLESPACE TS1.