Friday, August 16, 2019

How to Assign and Revoke Role/Responsibility to a User using a Standard API? (Doc ID 373369.1)

APPLIES TO:

Oracle Application Object Library - Version 11.5.10.2 to 12.2 [Release 11.5 to 12.2]
Oracle User Management - Version 11.5.10.2 to 12.2 [Release 11.5 to 12.2]
Information in this document applies to any platform.
Checked for relevance on 26-August-2016


GOAL

Using a Standard API to Assign and Revoke Role/Responsibilities to a User

SOLUTION

1. Assign role to a user using an API

To assign role to a user using APIs, use the following API wf_local_synch.PropagateUserRole.
Example:
Begin
wf_local_synch.PropagateUserRole(
     p_user_name => '&USER_NAME',
     p_role_name => '&ROLE_KEY');
commit;
end;

2. Add a responsibility to a user using API fnd_user_resp_groups_api.Insert_Assignment

To add a responsibility to a user using and API, use the following API fnd_user_resp_groups_api.Insert_Assignment:
Example:
 begin
fnd_user_resp_groups_api.Insert_Assignment (
   user_id =>&USER_ID ,
   responsibility_id => &RESP_ID,
   responsibility_application_id =>$APPL_ID ,
   start_date => &START_DATE,
   end_date => &END_DATE,
   description =>'Sample
   example' );
commit;
end; 

This shall raise an error if the responsibility is assigned to a user, but if needed to update the responsibility assignment in case of responsibility existence, use the following API:
begin
fnd_user_pkg.addresp(
     '&User_Name',
     '&Responsablity_Application_Short_Name',
     '&Responsibility_Key',
     '&Security_Group',
     '&Description',
     '&Start_Date',
     '&End_Date' );
commit;
end;

3. Revoke a responsibility assignment to a user using fnd_user_pkg.delresp

To revoke a responsibility assignment to a user using an API, use fnd_user_pkg.delresp.
Example:
Begin
fnd_user_pkg.delresp(         
     '&User_Name',
      '&Responsibility_application_short_name',
      '&Responsibility_Key',
      '&Security_Group');
commit;
End;
 This simply end date the responsibility assignment to a user by the current system date.

4. Revoke an Indirect Responsibility

To revoke an indirect responsiblity (roles assigned using UMX) assignment to a user using APIs, use the following API Wf_local_synch.PropagateUserRole.
Example:
Begin
Wf_local_synch.PropagateUserRole(
       p_user_name => '&USER_NAME',
       p_role_name => '&ROLE_KEY',
       p_start_date=>'&Start_Date',
       p_expiration_date=>'&End_Date');
commit;
End;
End date the parent Role and it shall end date the remaining Roles.

Diagnostics and Utilities Community


Diagnostics
For the latest diagnostics, please reference Document 421245.1 E-Business Suite Diagnostics References for R12.


Utilities Community
Visit the Utilities community for help from industry experts or to share knowledge.

Actions to Verify When Running Into ORA-01017 While Creating Datasource | JNDI



NOTE:974949.1 - Oracle E-Business Suite Software Development Kit for Java (includes AppsDataSource, Java Authentication and Authorization Service, session management) Readme - Patch 13882058

APPLIES TO:

Oracle Application Object Library - Version 12.1.3 to 12.1.3 [Release 12.1]
Information in this document applies to any platform.

PURPOSE

The Note:974949.1 "Oracle E-Business Suite Software Development Kit for Java (includes AppsDataSource, Java Authentication and Authorization Service, session management)" explains the steps to create a Datasource for external applications to connect to the E-Business Suite database.
An error often reported here is the ORA-01017: invalid username/password; logon denied which normally indicates that a database user passed incorrect credentials. However when it comes to creating Datasource the ORA-01017 is raised as soon as there is an issue with the connection and the actual ORA message is not reporting the actual error. 
This document will provide a number of things to verify which may assist in troubleshooting the ORA-01017 when raised in context of Datasource.

TROUBLESHOOTING STEPS

IMPORTANT: The Datasource uses a FND user for the connection. This may either be the seeded ASADMIN user or a own created user. For simplicity the examples in this document refer to ASADMIN, however this should be replaced by your own user when appropriate.


1. Verify the FND user defined in the Datasource

The user in the Datasource should be a valid FND user created in E-Business Suite. For security reasons it's recommended this user does not have any responsibilities assigned, but only has the required role: Apps Schema Connect [internal name UMX|APPS_SCHEMA_CONNECT].
When using the credentials in the AppsLocalLogin.jsp this should allow to login successfully. Another quick method to check the credentials are correct is to run the following SQL
SQL> select fnd_web_sec.validate_login('ASADMIN', '<replace with password>' ) from dual;
Result:
Y = Credentials are correct
N = Credentials are not correct. Verify the credentials passed and also take into account case-sensitivity. Resolve this problem before continuing with the steps

Also confirm the role UMX|APPS_SCHEMA_CONNECT is assigned and not expired
SQL> select user_name, role_name, start_date, expiration_date from wf_user_roles where user_name='ASADMIN';
Result:
Expected is to have 2 records. The first with the ROLE_NAME = USER_NAME and the second with ROLE_NAME = UMX|APPS_SCHEMA_CONNECT. Ensure that START_DATE is in the past and EXPIRATION_DATE is null or (far) in the future.
If the UMX|APPS_SCHEMA_CONNECT role is not assigned have this role added via User Management > Users function


2. Verify relevant profile options

There are some profile options in the E-Business Suite used to ensure connections come from trusted node
  • FND: Desktop Nodes allowed [FND_SERVER_DESKTOP_USER]
Set a USER level and has a comma separated list of trusted nodes allowed to connect. The node names here should be in uppercase and exactly match the value for NODE_NAME column in FND_NODES table. If FND_NODES has NODE_NAME = MYSERVER the value to be used is MYSERVER (and not MYSERVER.MYDOMAIN or myserver). Query the FND_NODES table to confirm the exact name to be used here.
Run the following SQL to check relevant information from the FND_NODES table
SQL> select node_name, description, server_address, server_id from FND_NODES;
  • FND: Validate IP address [FND_SERVER_IP_SEC]
Set at SITE level to one of the following
  • N - None
  • D - Desktop Only 
  • DS - Desktop and Server 
  • S - Server Only
  • FND: Validate User Type [FND_SERVER_SEC]
Set at SITE level to one of the following 
  • N - None
  • D - Desktop Only 
  • DS - Desktop and Server 
  • S - Server Only
The default value for the last 2 profile options is 'Desktop Only' which verifies the connections when coming from a Desktop node. To verify if the ORA-01017 is caused by this validation it may be useful to temporarily change the value to 'None' so the validation is disabled for one or both profile options. This should however only be considered a diagnostics action and is not a definite solution since it impacts security.
The following SQL can be used to review the current values for these profile options
SQL> select p.profile_option_name SHORT_NAME,
n.user_profile_option_name NAME,
decode(v.level_id,
      10001, 'Site',
      10002, 'Application',
      10003, 'Responsibility',
      10004, 'User',
      10005, 'Server',
      10006, 'Organization',
      10007, 'Server Resp',
      '<UnDefined>') LEVEL_SET,
      decode(v.level_id,
      10001, ' ',
      10002, app.application_short_name,
      10003, rsp.responsibility_key,
      10004, usr.user_name,
      10005, svr.node_name,
      10006, org.name,
      10007, svr2.node_name ||' / '|| rsp.responsibility_key,
      '<UnDefined>') CONTEXT,
      nvl(v.profile_option_value,' ') VALUE
from fnd_profile_options p,
     fnd_profile_option_values v,
     fnd_profile_options_tl n,
     fnd_user usr,
     fnd_application app,
     fnd_responsibility rsp,
     fnd_nodes svr,
     fnd_nodes svr2,
     hr_operating_units org
where  p.profile_option_id = v.profile_option_id (+)
and    p.profile_option_name = n.profile_option_name
and    p.profile_option_name in ('FND_SERVER_SEC','FND_SERVER_IP_SEC','FND_SERVER_DESKTOP_USER')
and    usr.user_id (+) = v.level_value
and    rsp.application_id (+) = v.level_value_application_id
and    rsp.responsibility_id (+) = v.level_value
and    app.application_id (+) = v.level_value
and    svr.node_id (+) = v.level_value
and    svr2.node_id (+) = v.level_value2
and    org.organization_id (+) = v.level_value
and    language='US'
order by short_name, level_id;


3. Small test class to verify the connection

The below java code provides a simple Datasource to test connection using the credentials and DBC file created for the desktop node. This allows to verify that DBC file and credentials are correct without the need to setup the Datasource in WLS console. The code should be run from the desktop node.
The steps to create and run the class are:
  • Create a file named Connect2.java and copy following contents
import oracle.apps.fnd.security.*;
import java.sql.Connection;
import javax.naming.Referenceable;
import javax.sql.*;
import oracle.jdbc.OracleCallableStatement;
import oracle.jdbc.pool.OracleDataSource;
import oracle.jdbc.pool.OracleDataSourceFactory;

public class Connect2
{

//apps user with umx| APPS_SCHEMA_CONNECT priviliges (default asadmin)
public static String user = "<username, e.g. ASADMIN>";
public static String pwd = "<password, e.g. ASADMIN>";
public static String dbcFile = "<location of the DBC file to be used by the Datasource>";

public static void testConnection (String dbcFile)
throws Exception
{
System.out.println("Running testConnection DBC version...");
AppsDataSource v2 = new AppsDataSource();
v2.setUser(user);
v2.setPassword(pwd);
v2.setDbcFile(dbcFile);

Object ods = new OracleDataSourceFactory().getObjectInstance(v2.getReference(), null, null, null);
DataSource ds = (DataSource) ods;
testSql(ds.getConnection());
}
public static void testSql (Connection conn)
throws Exception
{
String sql = "BEGIN fnd_profile.get(:1,:2); END;";
OracleCallableStatement cStmt = (OracleCallableStatement) conn.prepareCall(sql);
cStmt.setString(1, "APPS_WEB_AGENT");
cStmt.setString(2, null);
cStmt.registerOutParameter(2, java.sql.Types.VARCHAR, 0, 100);
cStmt.execute();
String profVal = cStmt.getString(2);
System.out.println(profVal);
}
public static void main (String j[])
throws Exception
{
System.out.println(new AppsDataSource() instanceof Referenceable);
testConnection(dbcFile);
} }
  • Review the following 3 lines in the source-code and replace provide the variables with the correct values for your environment.
public static String user = "<username, e.g. ASADMIN>";
public static String pwd = "<password, e.g. ASADMIN>";
public static String dbcFile = "<location of the DBC file to be used by the Datasource>";
  • On the desktop node the fndext.jar is available. Ensure the fndext.jar is incuded in the CLASSPATH environment setting
# export CLASSPATH=$CLASSPATH:<full path>/fndext.jar
  • Compile the class:
# javac Connect2.java
  • Ensure the location of Connect2.class is and the fndext.jar are available in the CLASSPATH environment variable
# export CLASSPATH=$CLASSPATH:<directory of Connect2.class>
  • Run the class:  
# java Connect2
When connection is made this will show the following output. 
true
Running testConnection DBC version...
http://<host.domain:port>/pls/<SID>
Note the URL is not relevant. The value of APPS_WEB_AGENT is just used as example SQL to test the connection.
When there is a problem the following will be rendered
true
Running testConnection DBC version...
Exception in thread "main" java.lang.RuntimeException: ORA-20001:
ORA-06512: at "APPS.APP_EXCEPTION", line 72
ORA-06512: at "APPS.FND_SECURITY_PKG", line 533
ORA-06512: at line 1

        at oracle.apps.fnd.security.AppsDataSource.setDbcFile(AppsDataSource.java:156)
        at Connect2.testConnection(Connect2.java:24)
        at Connect2.main(Connect2.java:46)
In this case closely review the credentials passed for the user, the profile options mentioned and DBC file used to see which is setup wrong.

Monday, August 5, 2019

Check SMTP Server Availability for ORA-29278 or ORA-29279 errors using UTL_SMTP to Send Email. (Doc ID 604763.1)

SYMPTOMS

When trying to send email using UTL_SMTP getting following error :
ORA-29278: SMTP transient error: 421 Service not available
ORA-06512: at "SYS.UTL_SMTP", line 21
ORA-06512: at "SYS.UTL_SMTP", line 97
ORA-06512: at "SYS.UTL_SMTP", line 139


Or potentially 
ORA-29279: SMTP permanent error

followed by a SMTP error code.


CAUSE

The "ORA-29278: SMTP transient error: 421 Service not available" error indicates that the problem is not with the UTL_SMTP package
but the fact that your database server's network configuration does not allow it to contact an external server.

SOLUTION

You first have to check whether you are able to contact the email server without involving ORACLE.
For example use the following telnet procedure to see whether the mail server is reachable from the Database server: 
******PERFORM THE FOLLOWING OPERATIONS FROM YOUR DATABASE SERVER MACHINE AND NOT FROM OTHER MACHINES.****** 
Note: The information presented here does not apply to TLS/SSL connections . 

a) Start a telnet session to the SMTP server's communication port. (The default port for SMTP is 25)

$telnet <smtp servername as used utl_smtp package> 25


A telnet session should open with a response from smtp:

For eg :

response from smtp ---> 220 ukxxx1 Sendmail SMI-8.6/SMI-SVR4 ready at
Thu, 16 Sep 1999 15:14:25 +0100


b) Now introduce the client machine to the server by typing:
helo domain
(The correct spelling is helo - not hello)


c) Tell the SMTP Gateway who the test email is coming from by typing:
-------> mail from: emailid@domain

For eg :

A response from smtp ---> 250 emailid@domain... Sender ok


d) Tell the SMTP Gateway who to send the test email to by typing:
--------> rcpt to: emailid@domain

For eg :

A response from smtp ---> 250 emailid@domain... Recipient ok

e) Tell the SMTP Gateway what type of information is being sent by typing:
-------> data

A response from smtp ---> 354 Enter mail, end with "." on a line by itself

f) Enter the test message and remember to close the email with a dot "."
Type ---> Subject: SMTP Test
Hello this is an smtp test for EM. .

A response from smtp ---> 250 PAA15913 Message accepted for delivery

g) End the SMTP connection session by typing:
--------> quit

response from smtp ---> 221 ukxxx1 closing connection
The connection has been terminated.


The email should then be delivered to the receiver via the SMTP server.


If the command line test doesn't work, hopefully a helpful error messages from the SMTP server will be displayed indicating a problem will be with the SMTP server setup.

If the above telnet session fails it confirms the network block . You may have to contact your network administrator to remove the block.
Once your network administrator removes the block , retry the above telnet session.
Before using UTL_SMTP , please ensure that the telnet session succeeds.



If the telnet session succeeds, then try the following sample code to test the smtp server : 
Note : Please change the smtp server name in line number 6 and 7 in procedure TESTMAIL.
Note: If the below code fails again with the same error , then use IP Address instead of Mail server name in line number 6 and 7.
 OR
Make the hostname entry in the /etc/hosts file so that it is properly resolved to an IP address


CREATE OR REPLACE PROCEDURE TESTMAIL(fromm VARCHAR2,too VARCHAR2,sub VARCHAR2,body VARCHAR2,port NUMBER)
IS
objConnection UTL_SMTP.CONNECTION;
vrData VARCHAR2(32000);
BEGIN
objConnection := UTL_SMTP.OPEN_CONNECTION('<user smtp server name or ip address>',PORT);
UTL_SMTP.HELO(objConnection, '<user smtp server name or ip address>');
UTL_SMTP.MAIL(objConnection, fromm);
UTL_SMTP.RCPT(objConnection, too);
UTL_SMTP.OPEN_DATA(objConnection);

UTL_SMTP.WRITE_DATA(objConnection, 'From: '||fromm || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(objConnection, 'To: '||too || UTL_TCP.CRLF);

UTL_SMTP.WRITE_DATA(objConnection, 'Subject: ' || sub || UTL_tcp.CRLF);
UTL_SMTP.WRITE_DATA(objConnection, 'MIME-Version: ' || '1.0' || UTL_tcp.CRLF);
UTL_SMTP.WRITE_DATA(objConnection, 'Content-Type: ' || 'text/html;');

UTL_SMTP.WRITE_DATA(objConnection, 'Content-Transfer-Encoding: ' || '"8Bit"' || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(objConnection,UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(objConnection,UTL_TCP.CRLF||'<HTML>');
UTL_SMTP.WRITE_DATA(objConnection,UTL_TCP.CRLF||'<BODY>');
UTL_SMTP.WRITE_DATA(objConnection,UTL_TCP.CRLF||'<FONT COLOR="red" FACE="Courier New">'||body||'</FONT>');
UTL_SMTP.WRITE_DATA(objConnection,UTL_TCP.CRLF||'</BODY>');
UTL_SMTP.WRITE_DATA(objConnection,UTL_TCP.CRLF||'</HTML>');
UTL_SMTP.CLOSE_DATA(objConnection);
UTL_SMTP.QUIT(objConnection);
EXCEPTION
WHEN UTL_SMTP.TRANSIENT_ERROR OR UTL_SMTP.PERMANENT_ERROR THEN
UTL_SMTP.QUIT(objConnection);
DBMS_OUTPUT.PUT_LINE(SQLERRM);
WHEN OTHERS THEN
UTL_SMTP.QUIT(objconnection);
DBMS_OUTPUT.PUT_LINE(SQLERRM);
END TESTMAIL;
/

DECLARE
Vdate Varchar2(25);
BEGIN
Vdate := to_char(sysdate,'dd-mon-yyyy HH:MI:SS AM');
TESTMAIL('xxx.xxx@xxx.com', 'xxx.xxx@xxx.com', 'TESTMAIL','This is a UTL_SMTP-generated email at '|| Vdate,25);
END;
/


Master Note For PL/SQL UTL_SMTP and UTL_MAIL Packages (Doc ID 1137673.1)

APPLIES TO:

PL/SQL - Version 8.1.7.4 to 12.2.0.1 [Release 8.1.7 to 12.2]
Information in this document applies to any platform.
***Checked for relevance on 26-Dec-2018*** 


PURPOSE

Master index for UTL_SMTP / UTL_MAIL.
Provides information on the relevant articles associated with the following topics:

Frequently Asked Questions
How To
Installation and Configuration
Known Bugs
New Features
Sample Code

It's purpose it to point the reader to the most relevant articles and to aid in assist with searching within these areas.

SCOPE

The intended audience is for users of the PL/SQL API and built-in packages.
The notes listed are for novice to experienced users.

DETAILS

Frequently Asked Questions
Note 730746.1 FAQ and Known Issues While Using UTL_SMTP and UTL_MAIL
Note 413099.1 Does UTL_SMTP or UTL_MAIL Support TLS Connection?
Note 369777.1 FAQ about UTL_TCP, UTL_SMTP and UTL_MAIL

How To
Note 106513.1 Basics on How to use UTL_SMTP
Note 269375.1 How to Use the UTL_MAIL Package
Note 74269.1 How to Test an SMTP Mail Gateway From a Command Line
Note 161407.1 How To Send E-mail Containing 8-bit Characters Using UTL_SMTP 
Note 180017.1 How To Specifiy a 'Reply-To' Using UTL_SMTP 
Note 209364.1 How to Send Pager Messages to Mobile Phones using the UTL_SMTP package 
Note 270155.1 How to Programmatic With PL/SQL Send an Email Which Will Allow a Hyperlink to be Created?  
Note 302943.1 Sending Mail Using UTL_SMTP Special Chars And Attach File Problem 
Note 357385.1 How To Send Attachments Of Size Greater Than 32 KB Using UTL_SMTP Package 
Note 468749.1 How to send an Email with Disclaimer? 
Note 553542.1 How to Send Emails with UTL_SMTP containing Unicode Characters in Mail Subject and Body 
Note 745202.1 How to Notify Database Shutdown by Sending a EMAIL ? 
Note 885522.1 How to Send an Email Using UTL_SMTP with Authenticated Mail Server. ? 
Note 946811.1 How to Send Any Type of Attachment with UTL_MAIL 
Note 1323140.1 How to Send an Email Using SMTP over an SSL Connection 

Installation and Configuration
Note 453756.1 Configuring Fine-Grained Access to External Network Services
Note 402678.1 ORA-29279 Relay Errors When Using utl_smtp to Send Email 
Note 604763.1 "ORA-29278: SMTP transient error: 421 Service not available" When Using UTL_SMTP to Send Email.  
Note 754909.1 ORA-24247 Calling UTL_SMTP or UTL_HTTP or UTL_TCP in a Stored Procedure 
New Features
Note 602986.1 Ora-24248: Unable To Send Email Using UTL_SMTP After Upgrade To 11g

Sample Code
Note 414062.1 Simple Example of Sending Attachments Using UTL_SMTP 


Non-Oracle Issues
There are errors which are not Oracle related. For example, when access to a given mail server is not possible, at times this is an Oracle error especially with 11g and the new security. Other times it can be related to basic network access from the OS machine.
Other errors or issues can actually be related to the mail server itself as described in the following Note.
Note 468323.1  Mail Sent Using UTL_SMTP Not Displaying Correct SENT DATE

Collaborate with and learn from your Peers, Industry Experts and Oracle Support Product Specialists using My Oracle Support Community. Join us here:

Oracle Community - https://communities.oracle.com/

Oracle PL/SQL Community - https://community.oracle.com/community/support/oracle_database/pl_sql

REFERENCES

NOTE:180017.1 - How To Specifiy a 'Reply-To' Using UTL_SMTP
NOTE:209364.1 - How to Send Pager Messages to Mobile Phones Using the UTL_SMTP Package
NOTE:946811.1 - How to Send Any Type of Attachment with UTL_MAIL
NOTE:730746.1 - FAQ and Known Issues While Using UTL_SMTP and UTL_MAIL
NOTE:74269.1 - Enterprise Manager All Releases: How to Test an SMTP Mail Gateway From a Command Line Interface
NOTE:745202.1 - How to Notify Database Shutdown by Sending a EMAIL ?
NOTE:269375.1 - How to Use the UTL_MAIL Package
NOTE:754909.1 - ORA-24247 Calling UTL_SMTP or UTL_HTTP or UTL_TCP in a Stored Procedure when ACL Assigned to a Role
NOTE:885522.1 - How to Send an Email Using UTL_SMTP with Authenticated Mail Server.
NOTE:161407.1 - How To Send E-mail Containing 8-bit Characters Using UTL_SMTP
NOTE:604763.1 - Check SMTP Server Availability for ORA-29278 or ORA-29279 errors using UTL_SMTP to Send Email.
NOTE:553542.1 - How to Send Emails with UTL_SMTP containing Unicode Characters in Mail Subject and Body
NOTE:602986.1 - Ora-24248: Unable To Send Email Using UTL_SMTP After Upgrade To 11g
NOTE:402678.1 - ORA-29279 Relay Errors When Using UTL_SMTP to Send Email
NOTE:413099.1 - UTL_SMTP Support For SSL/TLS Connection
NOTE:414062.1 - Simple Example of Sending Attachments Using UTL_SMTP
NOTE:106513.1 - Basics on How to use UTL_SMTP
NOTE:1323140.1 - How to Send an Email Using SMTP over an SSL Connection
NOTE:453756.1 - Configuring Fine-Grained Access to External Network Services
NOTE:468323.1 - Mail Sent Using UTL_SMTP Not Displaying Correct SENT DATE
NOTE:270155.1 - How to Programmatically Send an Email Using PL/SQL With a Hyperlink?
NOTE:468749.1 - How to send an Email with Disclaimer?
NOTE:302943.1 - Sending Mail Using UTL_SMTP Special Chars And Attach File Problem
NOTE:369777.1 - FAQ about UTL_TCP, UTL_SMTP and UTL_MAIL
NOTE:357385.1 - How To Send Multiple Attachments Of Size Greater Than 32 KB Using UTL_SMTP Package

Thursday, August 1, 2019

All DBA Blogs

Find all the profile options recently changed

Find all the profile options recently changed
                                                 Last update (2012-09-19 19:51:34)
                                                                                                                   Date added (2008-02-19 12:14:26)

Summary 
For Oracle E-Busines Suite R12 execute the following sql to get all the profile options recently changed.
select p.profile_option_name SHORT_NAME, n.user_profile_option_name "PROFILE NAME",
decode(v.level_id, 10001, 'Site', 10002, 'Application',
10003, 'Responsibility', 10004, 'User', 10005, 'Server',
10007, 'SERVRESP', 'UnDef') LEVEL_SET,
decode(to_char(v.level_id), '10001', '',
'10002', app.application_short_name, '10003', rsp.responsibility_key,
'10005', svr.node_name, '10006', org.name, '10004', usr.user_name,
'10007', 'Serv/resp', 'UnDef') "CONTEXT", v.profile_option_value VALUE, v.LAST_UPDATE_DATE  
from fnd_profile_options p,
fnd_profile_option_values v,
fnd_profile_options_tl n,
fnd_user usr,
fnd_application app,
fnd_responsibility rsp,
fnd_nodes svr,
hr_operating_units org
where p.profile_option_id = v.profile_option_id (+)
and p.profile_option_name = n.profile_option_name
--and upper(n.user_profile_option_name) like upper('BNE%')
--and trunc(v.LAST_UPDATE_DATE) > trunc(sysdate-170)
and usr.user_id (+) = v.level_value
and rsp.application_id (+) = v.level_value_application_id
and rsp.responsibility_id (+) = v.level_value
and app.application_id (+) = v.level_value
and svr.node_id (+) = v.level_value
and org.organization_id (+) = v.level_value
and v.LAST_UPDATE_DATE is not null 
order by last_update_date desc, short_name, level_set;
For Oracle E-Busines Suite 11i execute the following sql to get all the profile options recently changed.
SELECT pot.user_profile_option_name "Profile"
 , DECODE( a.profile_option_value
          , '1', '1 (may be "Yes")'
          , '2', '2 (may be "No")'
          , a.profile_option_value) "Value"
 , DECODE( a.level_id
          , 10001, 'Site'
          , 10002, 'Appl'
          , 10003, 'Resp'
          , 10004, 'User'
          , '????') "Level"
 , DECODE( a.level_id
          , 10002, e.application_name
          , 10003, c.responsibility_name
          , 10004, d.user_name
          , '-') "Location", a.LAST_UPDATE_DATE  
FROM applsys.fnd_application_tl e
 , applsys.fnd_user d   , applsys.fnd_responsibility_tl c
 , applsys.fnd_profile_option_values a   , applsys.fnd_profile_options b
 , applsys.fnd_profile_options_tl pot
WHERE pot.profile_option_name = b.profile_option_name
AND UPPER(pot.user_profile_option_name) LIKE UPPER('BNE%')
 AND b.application_id = a.application_id (+)
 AND b.profile_option_id = a.profile_option_id (+)
 AND a.level_value = c.responsibility_id (+)
 AND a.level_value = d.user_id (+)   AND a.level_value = e.application_id(+)
 AND e.LAST_UPDATE_DATE is not null
 --AND( UPPER( e.application_name) LIKE UPPER( 'username%')
 --OR UPPER( c.responsibility_name) LIKE UPPER( 'username%')
 --OR UPPER( d.user_name) LIKE UPPER( '%username%'))
 ORDER BY a.LAST_UPDATE_DATE desc, "Profile", "Level", "Location", "Value";

Wednesday, July 31, 2019

Change Archive Dest

How to change Archive destination

Use similar commands to change archive destination, to change archive destination no need to bounce the database.
1. Verify existing values
SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u01/app/oracle/arch/vada <------
Oldest online log sequence     147
Next log sequence to archive   149
Current log sequence           149
SQL>
SQL> show parameter log_archive_dest_1

NAME                                 TYPE        VALUE
------------------------------------ ----------- ----------------------------------
log_archive_dest_1                   string      LOCATION=/u01/app/oracle/arch/vada

SQL>
2. Modify the archive destination
SQL> alter system set log_archive_dest_1='LOCATION=/u02/arch/vada' scope=both;

System altered.

SQL>
3. Verify the results
SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u02/arch/vada <----
Oldest online log sequence     147
Next log sequence to archive   149
Current log sequence           149
SQL>
SQL> show parameter log_archive_dest_1

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_1                   string      LOCATION=/u02/arch/vada

Note: If you set log_archive_dest_1 and log_archive_dest_2, it will store same log file in both locations.


Changing Archive Log Destination


In this article you will learn how to change the destination for archived redo log files. Sometime the location where archive redo log is full and you can not access the database.there are two way to this:

1.Temporarily Changing the Destination Using SQL*Plus

If you are automatically archiving, you can use the following command to override the destination specified by the LOG_ARCHIVE_DEST. This command does not change the value in the initialization parameter file. This change is only valid until you restart the instance.

>sqlplus / as sysdba

see current location

sql> archive log list;

Database log mode Archive Mode
Automatic archival Enabled
Archive destination /oracle/app/oracle/product/10.2.0/db_1/dbs/arch
Oldest online log sequence 9285
Next log sequence to archive 9287
Current log sequence 9287

To change the location

sql>ARCHIVE LOG START '/oracle2/arch';

To Verify your changes:

sql> archive log list;

Database log mode Archive Mode
Automatic archival Enabled
Archive destination /oracle2/arch
Oldest online log sequence 9285
Next log sequence to archive 9287
Current log sequence 9287


Permanently Changing the Destination Using SQL*Plus


To permanently change the destination, you must change the initialization parameter. You can change it dynamically with the ALTER SYSTEM command as shown below:

NoteLOG_ARCHIVE_DEST has been deprecated in favor of LOG_ARCHIVE_DEST_n for Enterprise Edition users. If you do not have Enterprise Edition or you have not specified any LOG_ARCHIVE_DEST_n parameters, LOG_ARCHIVE_DEST is valid.


> sqlplus / as sysdba

Issue the ALTER SYSTEM command to update the value of the LOG_ARCHIVE_DEST_n parameter in memory and in your SPFILE:

sql> ALTER SYSTEM SET log_archive_dest ='/oradata2/arch' scope=both;

To Verify your changes:

sql> archive log list;

Database log mode Archive Mode
Automatic archival Enabled
Archive destination /oracle2/arch
Oldest online log sequence 9285
Next log sequence to archive 9287
Current log sequence 9287

IN ORACLE 10gTo see archive log status
>sqlplus / as sysdba

SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 132
Next log sequence to archive 134
Current log sequence 134

To see the physical archive location

SQL> show parameter DB_RECOVERY_FILE_DEST

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string /backup/oracle/oradata/flash_r
ecovery_area/
db_recovery_file_dest_size big integer 2G


To change the size of archive log

SQL> alter system SET DB_RECOVERY_FILE_DEST_SIZE = 10G SCOPE=BOTH SID='orca';

System altered.

SQL> show parameter DB_RECOVERY_FILE_DEST

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string /backup/oracle/oradata/flash_r
ecovery_area/
db_recovery_file_dest_size big integer 10G
SQL>

To change the Physical Location:SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST ='/backup/oracle/flash_recovery_area/' SCOPE=spfile;

System altered.

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> startup
ORACLE instance started.

Total System Global Area 1258291200 bytes
Fixed Size 2020448 bytes
Variable Size 218106784 bytes
Database Buffers 1023410176 bytes
Redo Buffers 14753792 bytes
Database mounted.
Database opened.
SQL>
SQL> show parameter DB_RECOVERY_FILE_DEST

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string /backup/oracle/flash_recovery_
area/
db_recovery_file_dest_size big integer 10G

Thursday, April 18, 2019

Weblogic Messages and Log Files

Messages and Log Files

WebLogic Server records information about events such as configuration changes, deployment of applications, and subsystem failures in log files. The information in log files is useful for detecting and troubleshooting problems, and monitoring performance and availability.
For detailed information about log files and the WebLogic Server logging subsystem, see Logging in Administration Console Online Help.
WebLogic Server outputs status and error messages to:
  • Standard Out—By default, a WebLogic Server instance prints all messages of WARNING severity or higher to standard out—typically the command shell window in which you are running the server instance. You can control what messages a server instance writes to standard out using the Server—>Logging tab.
  • If you start a Managed Server with Node Manager, Node Manager redirects the server instance's standard out to a file. In this case, you can view the Managed Server's output using Domain—>Server—>Remote Start Output—>View Server output.
  • Standard Error—A WebLogic Server instance writes errors to standard error—typically the command shell window in which you are running the server instance.
  • If you start a Managed Server with Node Manager, Node Manager redirects the server instance's standard error to a file. In this case, you can view the Managed Server's output using Domain—>Server—>Remote Start Output—>View Server error output.
  • Node Manager Output—If you start a Managed Server with Node Manager, you can access Node Manager output using Domain—>Server—>Remote Start Output—>View Node Manager output.
  • Server Logs—Each WebLogic Server instance writes all messages from its subsystems and applications to a log file on its host machine. You can configure logging behavior using the Server—>Logging—>Server tab. You can view a server instance's log file using the View server log link on any server tabs page.
  • Domain Log—By default, each server instance in a domain forwards all messages from its subsystems and applications to the Administration Server for the domain. The Administration Server writes a subset of the messages to the Domain Log. You can control whether or not a server instance sends its messages to the Administration Server, and configure filters that control which messages it sends using the Server—>Logging—>Domain tab. You can view the Domain Log using the View domain log link on any domain tab page.
  • An incorrect timestamp might be displayed for the domain log when multiple managed servers create the log files simultaneously. A difference in timestamp might also be observed when multiple components create logs even though the same managed server creates them.
  • Node Manager Logs—Node Manager writes startup and status messages to a log file in the WL_HOME\common\nodemanager\NodeManagerLogs\NodeManagerInternal directory. Node Manager log files are named NodeManagerInternal_timestamp, where timestamp indicates the time at which Node Manager started.
  • HTTP Logs—By default, each server instance maintains a log of HTTP requests. Disable HTTP logging, or configure logging behavior using the Server—>Logging—>HTTP tab.
  • JTA Logs—Configure a server instance to maintain a JTA transaction log using the Server—>Logging—>JTA tab.
  • JDBC Logs—Configure a server instance to maintain a JDBC log using the Server—>Logging—>JDBC tab.

Database Options/Management Packs Usage Reporting for Oracle Databases 11.2 and later (Doc ID 1317265.1)

  Database Options/Management Packs Usage Report You can determine whether an option is currently in use in a database by running options_pa...