Monday, April 12, 2021

How To Cleanup Orphaned DataPump Jobs In DBA_DATAPUMP_JOBS ?

 How To Cleanup Orphaned DataPump Jobs In DBA_DATAPUMP_JOBS ?

The jobs used in this example:
- Export job <SCHEMA>.EXPDP_20051121 is a schema level export that is running
- Export job <SCHEMA>.SYS_EXPORT_TABLE_01 is an orphaned table level export job
- Export job <SCHEMA>.SYS_EXPORT_TABLE_02 is a table level export job that was stopped
- Export job SYSTEM.SYS_EXPORT_FULL_01 is a full database export job that is temporary stopped


Step 1. Determine in SQL*Plus which Data Pump jobs exist in the database:


%sqlplus /nolog

CONNECT / as sysdba
SET lines 200
COL owner_name FORMAT a10;
COL job_name FORMAT a20
COL state FORMAT a12
COL operation LIKE state
COL job_mode LIKE state
COL owner.object for a50

-- locate Data Pump jobs:

SELECT owner_name, job_name, rtrim(operation) "OPERATION",
       rtrim(job_mode) "JOB_MODE", state, attached_sessions
  FROM dba_datapump_jobs
 WHERE job_name NOT LIKE 'BIN$%'
 ORDER BY 1,2;

OWNER_NAME JOB_NAME            OPERATION JOB_MODE  STATE       ATTACHED
---------- ------------------- --------- --------- ----------- --------
<SCHEMA>   EXPDP_20051121      EXPORT    SCHEMA    EXECUTING          1
<SCHEMA>   SYS_EXPORT_TABLE_01 EXPORT    TABLE     NOT RUNNING        0
<SCHEMA>   SYS_EXPORT_TABLE_02 EXPORT    TABLE     NOT RUNNING        0
SYSTEM     SYS_EXPORT_FULL_01  EXPORT    FULL      NOT RUNNING        0



Step 2. Ensure that the listed jobs in dba_datapump_jobs are not export/import Data Pump jobs that are active: status should be 'NOT RUNNING'.

Step 3. Check with the job owner that the job with status 'NOT RUNNING' in dba_datapump_jobs is not an export/import Data Pump job that has been temporary stopped, but is actually a job that failed. (E.g. the full database export job by SYSTEM is not a job that failed, but was deliberately paused with STOP_JOB).

Step 4. Identify orphan DataPump external tables. To do this, run the following as SYSDBA in SQL*Plus:


set linesize 200 trimspool on
set pagesize 2000
col owner form a30
col created form a25
col last_ddl_time form a25
col object_name form a30
col object_type form a25

select OWNER,OBJECT_NAME,OBJECT_TYPE, status,
to_char(CREATED,'dd-mon-yyyy hh24:mi:ss') created ,to_char(LAST_DDL_TIME , 'dd-mon-yyyy hh24:mi:ss') last_ddl_time
from dba_objects
where object_name like 'ET$%'
/

select owner, TABLE_NAME, DEFAULT_DIRECTORY_NAME, ACCESS_TYPE
from dba_external_tables
order by 1,2
/

Correlate the information from DBA_OBJECTS and DBA_EXTERNAL TABLES above to identify the temporary external tables that belong to the DataPump orphaned jobs.
Drop the temporary external tables that belong to the DataPump orphaned job. eg:

SQL> drop table system.&1 purge;
Enter value for 1: ET$00654E1E0001
old 1: drop table system.&1 purge
new 1: drop table system.ET$00654E1E0001 purge



Step 5. Determine in SQL*Plus the related master tables:

-- locate Data Pump master tables:

COL owner.object FORMAT a50

SELECT o.status, o.object_id, o.object_type, 
       o.owner||'.'||object_name "OWNER.OBJECT"
  FROM dba_objects o, dba_datapump_jobs j
 WHERE o.owner=j.owner_name AND o.object_name=j.job_name
   AND j.job_name NOT LIKE 'BIN$%' ORDER BY 4,2;


STATUS   OBJECT_ID OBJECT_TYPE  OWNER.OBJECT
------- ---------- ------------ -------------------------
VALID        85283 TABLE        <SCHEMA>.EXPDP_20051121
VALID        85215 TABLE        <SCHEMA>.SYS_EXPORT_TABLE_02
VALID        85162 TABLE        SYSTEM.SYS_EXPORT_FULL_01

select table_name, owner from dba_external_tables;


Step 6. For jobs that were stopped in the past and won't be restarted anymore, delete the master table. E.g.:

DROP TABLE <SCHEMA>.sys_export_table_02;

-- For systems with recycle bin additionally run:
purge dba_recyclebin;
Note:
=====
Following statement can be used to generate the drop table statement for the master table:

SELECT 'DROP TABLE '||o.owner||'.'||object_name||' PURGE;'
FROM dba_objects o, dba_datapump_jobs j
WHERE o.owner=j.owner_name AND o.object_name=j.job_name
AND j.job_name NOT LIKE 'BIN$%';

 

NOTE:
In case the table name is mixed case, you can get errors on the drop, e.g.:
SQL> drop table SYSTEM.impdp_schema_TEST_10202014_0;
drop table SYSTEM.impdp_schema_TEST_10202014_0
                *
ERROR at line 1:
ORA-00942: table or view does not exist
  

Because the table has a mixed case, try using these statements with double quotes around the table name, for instance:
drop table SYSTEM."impdp_SCHEMA_TEST_04102015_1";
drop table SYSTEM."impdp_schema_TEST_10202014_0";
  


Step 7. Re-run the query on dba_datapump_jobs and dba_objects (step 1 and 4). If there are still jobs listed in dba_datapump_jobs, and these jobs do not have a master table anymore, cleanup the job while connected as the job owner. E.g.:

CONNECT <USER>/<PASSWORD>

SET serveroutput on
SET lines 100
DECLARE
   h1 NUMBER;
BEGIN
   h1 := DBMS_DATAPUMP.ATTACH('SYS_EXPORT_TABLE_01','<SCHEMA>');
   DBMS_DATAPUMP.STOP_JOB (h1);
END;

/

Note that after the call to the STOP_JOB procedure, it may take some time for the job to be removed. Query the view user_datapump_jobs to check whether the job has been removed:

CONNECT <USER>/<PASSWORD>

SELECT * FROM user_datapump_jobs;



Step 8. Confirm that the job has been removed:

CONNECT / as sysdba
SET lines 200 
COL owner_name FORMAT a10; 
COL job_name FORMAT a20 
COL state FORMAT a12 
COL operation LIKE state 
COL job_mode LIKE state 
COL owner.object for a50

-- locate Data Pump jobs: 

SELECT owner_name, job_name, rtrim(operation) "OPERATION",
       rtrim(job_mode) "JOB_MODE", state, attached_sessions
  FROM dba_datapump_jobs
 WHERE job_name NOT LIKE 'BIN$%'
 ORDER BY 1,2;


OWNER_NAME JOB_NAME            OPERATION JOB_MODE  STATE       ATTACHED
---------- ------------------- --------- --------- ----------- --------
<SCHEMA>   EXPDP_20051121      EXPORT    SCHEMA    EXECUTING          1
SYSTEM     SYS_EXPORT_FULL_01  EXPORT    FULL      NOT RUNNING        0

-- locate Data Pump master tables:

SELECT o.status, o.object_id, o.object_type, 
       o.owner||'.'||object_name "OWNER.OBJECT"
  FROM dba_objects o, dba_datapump_jobs j
 WHERE o.owner=j.owner_name AND o.object_name=j.job_name
   AND j.job_name NOT LIKE 'BIN$%' ORDER BY 4,2;

STATUS   OBJECT_ID OBJECT_TYPE  OWNER.OBJECT
------- ---------- ------------ -------------------------
VALID        85283 TABLE        <SCHEMA>.EXPDP_20051121
VALID        85162 TABLE        SYSTEM.SYS_EXPORT_FULL_01


Remarks:


1. Orphaned Data Pump jobs do not have an impact on new Data Pump jobs. The view dba_datapump_jobs is a view, based on gv$datapump_job, obj$, com$, and user$. The view shows the Data Pump jobs that are still running, or jobs for which the master table was kept in the database, or in case of an abnormal end of the Data Pump job (the orphaned job). If a new Data Pump job is started, a new entry will be created, which has no relation to the old Data Pump jobs.

2. When starting the new Data Pump job and using a system generated name, we check the names of existing Data Pump jobs in the dba_datapump_job in order to obtain a unique new system generated jobname. Naturally, there needs to be enough free space for the new master table to be created in the schema that started the new Data Pump job.

3. A Data Pump job is not the same as a job that is defined with DBMS_JOBS. Jobs created with DBMS_JOBS use there own processes. Data Pump jobs use a master process and worker process(es). In case a Data Pump still is temporary stopped (STOP_JOB while in interactive command mode), the Data Pump job still exists in the database (status: NOT RUNNING), while the master and worker process(es) are stopped and do not exist anymore. The client can attach to the job at a later time, and continue the job execution (START_JOB).

4. The possibility of corruption when the master table of an active Data Pump job is deleted, depends on the Data Pump job.

4.a. If the job is an export job, corruption is unlikely as the drop of the master table will only cause the Data Pump master and worker processes to abort. This situation is similar to aborting an export of the original export client.

4.b. If the job is an import job then the situation is different. When dropping the master table, the Data Pump worker and master processes will abort. This will probably lead to an incomplete import: e.g. not all table data was imported, and/or table was imported incomplete, and indexes, views, etc. are missing. This situation is similar to aborting an import of the original import client.

The drop of the master table itself, does not lead to any data dictionary corruption. If you keep the master table after the job completes (using the undocumented parameter: KEEP_MASTER=Y), then a drop of the master table afterwards, will not cause any corruption.



Wednesday, April 7, 2021

Steps to decrypt the password of “Weblogic user” if the password is unknown/not working in EBS R12.2

Steps to decrypt the password of “Weblogic user” if the password is unknown/not working in EBS R12.2


 Here are the complete steps to decrypt the  password of “WebLogic user” if the password is unknown /not working in EBS R12.2

 

Step 1:

 

cd  $EBS_DOMAIN_HOME/security

vi decrypt_password.py 

 

from weblogic.security.internal import *

from weblogic.security.internal.encryption import *

encryptionService = SerializedSystemIni.getEncryptionService(".")

clearOrEncryptService = ClearOrEncryptedService(encryptionService)

 

# Take encrypt password from user

pwd = raw_input("Paste encrypted password ({AES}fk9EK...): ")

 

# Delete unnecessary escape characters

preppwd = pwd.replace("\\", "")

 

# Display password

print "Decrypted string is: " + clearOrEncryptService.decrypt(preppwd)

 

 

Step2: Source wls environment file:

 

. $FMW_HOME/wlserver_10.3/server/bin/setWLSEnv.sh

 

Step3: Get the encrypted password from boot.properties.

 

grep password $EBS_DOMAIN_HOME/servers/AdminServer/security/boot.properties | sed -e "s/^password=\(.*\)/\1/"

 

Step4 : Execute the custom script “decrypt_password.py” to decrypt the weblogic password

 

In $EBS_DOMAIN_HOME, execute the custom script created in Step1. When prompted for input while executing the script, Please provide the encrypted password retrieved in Step3.

 

java weblogic.WLST decrypt_password.py

 

output of the script will be similar to below:

 

[applmgr@XYZ security]$ java weblogic.WLST decrypt_password.py

 

Initializing WebLogic Scripting Tool (WLST) ...

 

Welcome to WebLogic Server Administration Scripting Shell

 

Type help() for help on available commands

 

Paste encrypted password ({AES}fk9EK...): {AES}PVXB/uhJyeFDjoJmFqZHg8k+vW6/hACDcP6KugEmGX4=

Decrypted string is: *******


Saturday, April 3, 2021

How To Change User Session Timeout In E-Business Suite R12

How To Change User Session Timeout In E-Business Suite R12


Perform the steps given below:


1. Edit the .xml file in $INST_TOP/appl/admin directory

2. Ensure that value of profile option "ICX: Session Timeout" and autoconfig variable "s_oc4j_sesstimeout" in context file match.
    e.g.: below are the steps to set the timeout after 45 minutes:

          In case you need the session to timeout after 45 min then the profile option "ICX: Session Timeout" and autoconfig variable "s_oc4j_sesstimeout" should be set to 45


          The "ICX: Session Timeout" is set by Autoconfig using the s_sesstimeout variable, therefore the s_sesstimeout should be set to 2700000 in the context file. ( s_sesstimeout /1000*60 >>> Autoconfig uses this to populate ICX_SEESION_TIMEOUT value)
          Update the context file on all Middle tiers.

3. Run autoconfig and retest the issue.


4. Migrate the solution as appropriate to other environments.


ICX_SESSION_TIMEOUT profile is set by Autoconfig hence we need to have e.g to get the timeout of 60 mins set correctly.
we need to have these two variables set correctly .

s_oc4j_sesstimeout  >> In Minutes


s_sesstimeout /1000*60 >>> Autoconfig uses this to populate ICX_SEESION_TIMEOUT value


so set the time out to 60 mins:
Update context file on all MT's:
s_oc4j_sesstimeout to 60

s_sesstimeout  to 3600000

Run autoconfig.


=============

Steps to Change User Session Timeout In E-Business Suite 12.2

To set the User Session Timeout, test the following steps in a development instance and then migrate accordingly:

1. In 12.2 the system profile "ICX:Session Timeout" is the only required change. Context variable "s_oc4j_sesstimeout" has been removed in release 12.2, so the setting is no longer used.

 Please login to EBS and make the autoconfig variable change on s_sessiontimeout in Oracle Applications Manager and then save the change, run autoconfig, and restart services. That will update the "ICX: Session Timeout" profile

   In some cases you may also need to follow the steps in Note 2142867.1 - ICX: Session Timeout Is Not Taking Effect (Doc ID 2142867.1)


Note 1373537.1 - "Oracle Application Framework Profile Options Release 12.2"