Quantcast
Channel: Doyensys Allappsdba Blog..
Viewing all 1640 articles
Browse latest View live

Query to get the multiple plan for a SQL ID in database.

$
0
0
Please use the below query to get the multiple plan hash value for a SQL ID.


WITH
p AS (
SELECT plan_hash_value
  FROM gv$sql_plan
 WHERE sql_id = TRIM('&&sql_id.')
   AND other_xml IS NOT NULL
 UNION
SELECT plan_hash_value
  FROM dba_hist_sql_plan
 WHERE sql_id = TRIM('&&sql_id.')
   AND other_xml IS NOT NULL ),
m AS (
SELECT plan_hash_value,
       SUM(elapsed_time)/SUM(executions) avg_et_secs
  FROM gv$sql
 WHERE sql_id = TRIM('&&sql_id.')
   AND executions > 0
 GROUP BY
       plan_hash_value ),
a AS (
SELECT plan_hash_value,
       SUM(elapsed_time_total)/SUM(executions_total) avg_et_secs
  FROM dba_hist_sqlstat
 WHERE sql_id = TRIM('&&sql_id.')
   AND executions_total > 0
 GROUP BY
       plan_hash_value )
SELECT p.plan_hash_value,
       ROUND(NVL(m.avg_et_secs, a.avg_et_secs)/1e6, 3) avg_et_secs
  FROM p, m, a
 WHERE p.plan_hash_value = m.plan_hash_value(+)
   AND p.plan_hash_value = a.plan_hash_value(+)
 ORDER BY
       avg_et_secs NULLS LAST;


Password protection for listener

$
0
0




Summary
To avoid inadvertent stopping of your listener or to prevent unauthorized access to your listener, you may set up password protection for your listener.
There are two ways to set a password:

1. Clear text Password
2. Encrypted Password

1.Clear text Password
Lets say that in your $TNS_ADMIN/listener.ora you have a listener named LISTENER1
(i)Add PASSWORDS_LISTENER1 entry to your existing listener.ora file. e.g.PASSWORDS_LISTENER1 = (p1,p2)
(ii)Stop your listener, and restart it.

Now passwords are in effect.

To administer the listener, set password command must be used.
$lsnrctl
 LSNRCTL> set current_listener LISTENER1
 LSNRCTL> set password p1
 LSNRCTL> stop
2. Encrypted Password
Lets say that in your $TNS_ADMIN/listener.ora you have a listener named LISTENER2
run lsnrctl
LSNRCTL> set current_listener LISTENER2
LSNRCTL> set save_config_on_stop on
LSNRCTL> change_password
Old password:
New password:
Reenter new password:

Just hit 'Enter' key for old password since no previous password is set.



LSNRCTL> save_config


Stop the listener
LSNRCTL> set password
Password:
LSNRCTL> stop
LSNRCTL> set password
 Password: ****
LSNRCTL> start

Check your listener.ora file
Entries similar to the following should have been added to your listener.ora
automatically.

SAVE_CONFIG_ON_STOP_listener2 = ON
PASSWORDS_listener2 = 2D6C48144CF753AC

Redologs information

$
0
0




Redologs information


Summary
In one script all the information about the redologs.
SELECT col1 REDOLOG_INFO FROM
(
SELECT 1 ID, 'Redolog groups : ' || COUNT(*) col1 FROM v$log
UNION
SELECT 2 ID, '-->Group:'||GROUP# || ' Members:'|| members || ' Size :' || BYTES/(1024*1024) || 'MB' ||
DECODE(status,'CURRENT', ' CURRENT', '') || ' Archived: ' || ARCHIVED || '' col1
FROM v$log
UNION
--Last redolog switch
SELECT 3 ID, 'Last redolog switch before : ' ||
DECODE(TRUNC(SYSDATE - FIRST_TIME), 0, NULL, TRUNC(SYSDATE - FIRST_TIME) || ' Days' || ' + ') ||
TO_CHAR(TO_DATE(TRUNC(MOD(SYSDATE-FIRST_TIME,1) * 86400), 'SSSSS'), 'HH24:MI:SS') ||
' (' || TO_CHAR(first_time, 'DD/MM/YYYY HH24:MI:SS') || ')'
col1
FROM v$loghist
WHERE switch_change# = (SELECT MAX(switch_change#) FROM v$loghist)
UNION
--Current log sequence
SELECT 4 ID, 'Current log sequence : ' || SEQUENCE# col1
FROM v$log WHERE GROUP# IN (SELECT GROUP# col1 FROM v$log WHERE status = 'CURRENT')
UNION
--Current log usage
SELECT 5 ID, 'Current log usage :' || SUBSTR(TO_CHAR(100 * cp.cpodr_bno / le.lesiz, '999.00'), 2) || '%' col1
FROM
sys.x$kcccp cp,
sys.x$kccle le
WHERE
le.inst_id = USERENV('Instance') AND
cp.inst_id = USERENV('Instance') AND
le.lesiz <> 0 AND
le.leseq = cp.cpodr_seq
UNION
--Redo log buffer
SELECT 6 ID, 'Redo log buffer : ' || VALUE/(1024*1024) || 'MB' col1
FROM v$parameter WHERE NAME = 'log_buffer'
UNION
--The average log switch interval in seconds
SELECT 7 ID, 'The average log switch interval in sec : ' || ROUND(AVG(b.first_time - a.first_time) * 1440 * 60,2) col1
FROM sys.v_$instance i, sys.v_$log_history a,
( SELECT SEQUENCE#, first_time FROM sys.v_$log WHERE status = 'CURRENT'
UNION ALL
SELECT SEQUENCE#, first_time FROM sys.v_$log_history ) b
WHERE i.startup_time < a.first_time AND a.first_time < b.first_time
AND a.SEQUENCE# + 1 = b.SEQUENCE#
)
ORDER BY ID ASC;
Output explanation
Redolog groups : 3
-->Group:7 Members:2 Size :500MB Archived: YES
-->Group:8 Members:2 Size :500MB Archived: YES
-->Group:9 Members:2 Size :500MB CURRENT Archived: NO
Last redolog switch before : 00:17:03 (12/02/2018 09:52:07)
Current log sequence : 61295
Current log usage : 45.52%
Redo log buffer : 10.00MB
The average log switch interval in sec : 1637.97

PGA usage by sessions

$
0
0




PGA usage by sessions

Summary
Every session takes something from the PGA memory

SELECT DECODE(TRUNC(SYSDATE - LOGON_TIME), 0, NULL, TRUNC(SYSDATE - LOGON_TIME) || ' Days' || ' + ') ||
TO_CHAR(TO_DATE(TRUNC(MOD(SYSDATE-LOGON_TIME,1) * 86400), 'SSSSS'), 'HH24:MI:SS') LOGON,
SID, v$session.SERIAL#, v$process.SPID , ROUND(v$process.pga_used_mem/(1024*1024), 2) PGA_MB_USED,
v$session.USERNAME, STATUS, OSUSER, MACHINE, v$session.PROGRAM, MODULE
FROM v$session, v$process
WHERE v$session.paddr = v$process.addr
--and status = 'ACTIVE'
--and v$session.sid = 97
--and v$session.username = 'SYSTEM'
--and v$process.spid = 24301
ORDER BY pga_used_mem DESC;

To find the total PGA memory used by processes

SELECT ROUND(SUM(pga_used_mem)/(1024*1024),2) PGA_USED_MB FROM v$process;

To find PGA usage for a specific session

SELECT SID, b.NAME, ROUND(a.VALUE/(1024*1024),2) MB FROM
v$sesstat a,  v$statname b
WHERE (NAME LIKE '%session uga memory%' OR NAME LIKE '%session pga memory%')
AND a.statistic# = b.statistic#
AND SID = 80;

To calculate the amount of memory that you gone need for PGA, estimate the number of maximum connected sessions and run:
SELECT :MAX_CONNECTED_SESSIONS*(2048576+P1.VALUE+P2.VALUE)/(1024*1024) YOU_NEED_PGA_MB
FROM V$PARAMETER P1, V$PARAMETER P2
WHERE P1.NAME = 'sort_area_size'
AND P2.NAME = 'hash_area_size';

To change PGA memory parameter
ALTER SYSTEM SET pga_aggregate_target = 3500M SCOPE=BOTH;

STATISTICS

$
0
0



STATISTICS

Gather stats for schema

Begin
dbms_stats.gather_schema_stats(
ownname => 'SCOTT', --- schema name 
options => 'GATHER AUTO',
estimate_percent => dbms_stats.auto_sample_size,
method_opt => 'for all columns size repeat',
degree => 24
);
END;
/


Gather stats for a table

BEGIN
DBMS_STATS.GATHER_TABLE_STATS (
ownname => 'SCOTT',
tabname => 'TEST',
cascade => true, ---- For collecting stats for respective indexes 
method_opt=>'for all indexed columns size 1',
granularity => 'ALL',
estimate_percent =>dbms_stats.auto_sample_size, 
degree => 8);
END;
/

-- For a single table partition
BEGIN
DBMS_STATS.GATHER_TABLE_STATS (
ownname => 'SCOTT',
tabname => 'TEST', --- TABLE NAME
partname => 'TEST_2018' --- PARTITOIN NAME
method_opt=>'for all indexed columns size 1',
GRANULARITY => 'APPROX_GLOBAL AND PARTITION',
degree => 8);
END;
/


Lock/unlock statistics


--- Lock  statistics

EXEC DBMS_STATS.lock_schema_stats('SCOTT');
EXEC DBMS_STATS.lock_table_stats('SCOTT', 'TEST');
EXEC DBMS_STATS.lock_partition_stats('SCOTT', 'TEST', 'TEST_2018');

-- Unlock statistics

EXEC DBMS_STATS.unlock_schema_stats('SCOTT');
EXEC DBMS_STATS.unlock_table_stats('SCOTT', 'TEST');
EXEC DBMS_STATS.unlock_partition_stats('SCOTT', 'TEST', 'TEST_2018');

--- check stats status:

SELECT stattype_locked FROM dba_tab_statistics WHERE table_name = 'TEST' and owner = 'SCOTT';

Export import statistics


--- Create staging table to store the statistics data

exec dbms_stats.create_stat_table(ownname => 'SCOTT', stattab => 'STAT_BACKUP',tblspace=>'USERS');

-- Export stats

exec dbms_stats.export_table_stats(ownname=>'SCOTT', tabname=>'EMP', stattab=>'STAT_BACKUP', cascade=>true);

-- Import stats

exec dbms_stats.import_table_stats(ownname=>'SCOTT', tabname=>'EMP', stattab=>'STAT_BACKUP', cascade=>true);


--- STALE STATS FOR TABLE
select owner,table_name,STALE_STATS from dba_tab_statistics where owner='&SCHEMA_NAME' and table_name='&TABLE_NAME';

-- FOR INDEX
select owner,INDEX_NAME,TABLE_NAME from DBA_IND_STATISTICS where owner='&SCHEMA_NAME' and index_name='&INDEX_NAME';



Table statistics history


-- For getting history of TABLE statistics
setlines 200
col owner for a12
col table_name for a21
select owner,TABLE_NAME,STATS_UPDATE_TIME from dba_tab_stats_history where table_name='&TABLE_NAME';



Space used to store stats

--- Space currently used to store statistics in SYSAUX in KBytes,

select occupant_desc, space_usage_kbytes from v$sysaux_occupants
where OCCUPANT_DESC like '%Statistics%';

Enable incremental stats collection


-- Check the status of incremental pref

select dbms_stats.get_prefs('INCREMENTAL', tabname=>'EMPLOYEE',ownname=>'SCOTT') from dual;

FALSE

-- Enable incremental stats collection

SQL> exec DBMS_STATS.SET_TABLE_PREFS('SCOTT','EMPLOYEE','INCREMENTAL','TRUE');

PL/SQL procedure successfully completed.

-- Check the pref again:

select dbms_stats.get_prefs('INCREMENTAL', tabname=>'EMPLOYEE',ownname=>'SCOTT') from dual;

TRUE





Delete statistics



-- Delete statistics of the complete database
EXEC DBMS_STATS.delete_database_stats;

-- Delete statistics of a single schema

EXEC DBMS_STATS.delete_schema_stats('DBACLASS');

-- Delete statistics of single tabale
EXEC DBMS_STATS.delete_table_stats('DBACLASS', 'DEPT');


-- Delete statistics of a column
EXEC DBMS_STATS.delete_column_stats('DBACLASS', 'DEPT', 'CLASS');

--Delete statistics of an index

EXEC DBMS_STATS.delete_index_stats('DBACLASS', 'CLASS_IDX');

--Delete dictionary statistics in db

EXEC DBMS_STATS.delete_dictionary_stats;



-- If we are importing stats table from higher version to lower version,
then before importing in the database, we need to upgrade the stats table.

EXECUTE DBMS_STATS.UPGRADE_STAT_TABLE(OWNNAME =>'TEST',STATTAB =>'STAT_TEST');


Upgrade statistics in db

-- If we are importing stats table from higher version to lower version,
then before importing in the database, we need to upgrade the stats table.

EXECUTE DBMS_STATS.UPGRADE_STAT_TABLE(OWNNAME =>'TEST',STATTAB =>'STAT_TEST');



How to set or unset a hidden parameter

$
0
0




How to set or unset a hidden parameter


Summary
Displays a list of one or all the hidden parameters.
SELECT a.ksppinm AS parameter,
       a.ksppdesc AS description,
       b.ksppstvl AS session_value,
       c.ksppstvl AS instance_value
FROM   x$ksppi a,
       x$ksppcv b,
       x$ksppsv c
WHERE  a.indx = b.indx
AND    a.indx = c.indx
AND    a.ksppinm LIKE '/_%' ESCAPE '/'
--AND    a.ksppinm = DECODE(LOWER('&1'), 'all', a.ksppinm, LOWER('&1'))
ORDER BY a.ksppinm;
The query returns 603 hidden parameters for Oracle9i

Display all the DESUPPORTED parameters
SELECT kspponm NAME,
       DECODE(ksppoflg,1,'DESUPPORTED','UNDERSCORE') SETTING
FROM   x$ksppo
WHERE ksppoflg = 1
ORDER BY NAME ASC;



To set a hidden parameter issue
ALTER SYSTEM SET "_log_io_size"= 1048576 SCOPE = SPFILE;
To unset a parameter issue
ALTER SYSTEM RESET db_block_buffers SCOPE=SPFILE SID='*';
To see which hidden parameters have been set issue
SELECT * FROM v$parameter WHERE SUBSTR(NAME, 0,1) ='_';

OPP Error Oracle.apps.xdo.XDOException: Error Creating Lock File

$
0
0
BI Publisher (formerly XML Publisher) Requests Are Failing With Error "OPP Error Oracle.apps.xdo.XDOException: Error Creating Lock File

Error

oracle.apps.xdo.XDOException: Error creating lock file
        at oracle.apps.xdo.oa.util.FontCacheManager.createLockFile(FontCacheManager.java:363)
        at oracle.apps.xdo.oa.util.FontCacheManager.getFontFromDB(FontCacheManager.java:412)
        at oracle.apps.xdo.oa.util.FontCacheManager.getFontFilePath(FontCacheManager.java:221)
        at oracle.apps.xdo.oa.util.FontHelper.createFontProperties(FontHelper.java:432)
        at oracle.apps.xdo.oa.util.ConfigHelper.getFontProperties(ConfigHelper.java:166)
        at oracle.apps.xdo.oa.schema.server.TemplateHelper.runProcessTemplate(TemplateHelper.java:5817)
        at oracle.apps.xdo.oa.schema.server.TemplateHelper.processTemplate(TemplateHelper.java:3459)
        at oracle.apps.xdo.oa.schema.server.TemplateHelper.processTemplate(TemplateHelper.java:3548)
        at oracle.apps.fnd.cp.opp.XMLPublisherProcessor.process(XMLPublisherProcessor.java:302)
        at oracle.apps.fnd.cp.opp.OPPRequestThread.run(OPPRequestThread.java:179)
        [493966:RT178323863] Output file was found but is zero sized - Deleted
        [UNEXPECTED] [493966:RT178323863] oracle.apps.xdo.XDOException: Error creating lock file
        at oracle.apps.xdo.oa.util.FontCacheManager.createLockFile(FontCacheManager.java:363)
        at oracle.apps.xdo.oa.util.FontCacheManager.getFontFromDB(FontCacheManager.java:412)
        at oracle.apps.xdo.oa.util.FontCacheManager.getFontFilePath(FontCacheManager.java:221)
        at oracle.apps.xdo.oa.util.FontHelper.createFontProperties(FontHelper.java:432)
        at oracle.apps.xdo.oa.util.ConfigHelper.getFontProperties(ConfigHelper.java:166)
        at oracle.apps.xdo.oa.schema.server.TemplateHelper.runProcessTemplate(TemplateHelper.java:5817)
        at oracle.apps.xdo.oa.schema.server.TemplateHelper.processTemplate(TemplateHelper.java:3459)
        at oracle.apps.xdo.oa.schema.server.TemplateHelper.processTemplate(TemplateHelper.java:3548)
        at oracle.apps.fnd.cp.opp.XMLPublisherProcessor.process(XMLPublisherProcessor.java:302)
        at oracle.apps.fnd.cp.opp.OPPRequestThread.run(OPPRequestThread.java:179)
 
SOLUTION:


1. Check the error in OPP logs. Log file location is

cd $APPLCSF/$APPLLOG
ls --ltr FNDOPP* | tail

Solution

1. Login to Front End, Goto XML Publisher Administrator -> Administration -> General Tab -> Temporary directory

2. Make sure the Temporary directory path is set correctly as mentioned in the above

3. Make sure that this directory can be written to by applmgr from the node that the OPP is running on. You can use the touch command to test this.

4. Set the temporary directory to it's own directory at least 20x larger than the largest data file used by XMLP. Start off with at least 5GB.

5. Try resetting the diretory to a different directory on the same mount as the OPP

6 Bounce Concurrent Manager

7. Retest the issue

ORA-09925: Unable to create audit trail file

$
0
0
$ sqlplus / as sysdba
ORA-09925: Unable to create audit trail file
Linux-x86_64 Error: 28: No space left on device
Additional information: 9925
ORA-09925: Unable to create audit trail file
Linux-x86_64 Error: 28: No space left on device
Additional information: 9925


   
$ cd /u01/app/oracle/product/11.2.0.4/dbhome_1/rdbms
$ ls -l
total 1039920
drwxr-xr-x 2 oracle oinstall      49152 Aug 22 10:33 admin
drwxr-xr-x 2 oracle oinstall 1063747584 Oct 20 19:20 audit
drwxr-xr-x 2 oracle oinstall       4096 Jun 27 14:47 demo
drwxr-xr-x 2 oracle oinstall       4096 Jun 27 14:47 doc
drwxr-xr-x 5 oracle oinstall       4096 Jun 27 14:48 install
drwxr-xr-x 2 oracle oinstall       4096 Jun 27 14:47 jlib
drwxr-xr-x 2 oracle oinstall       4096 Jul 31 11:45 lib
drwxr-xr-x 2 oracle oinstall       4096 Aug 22 18:30 log
drwxr-xr-x 2 oracle oinstall       4096 Jun 27 14:47 mesg
drwxr-xr-x 2 oracle oinstall       4096 Jun 27 14:47 public
drwxr-xr-x 5 oracle oinstall       4096 Jun 27 14:46 xml

So the solution seems easy. Just remove aud file under the audit directory. Then I run rm command. It runs for a few minutes and finally gave an error message below.

$ rm *.aud
-bash: /bin/rm: Argument list too long

Mount/dismount ASM diskgroups

$
0
0
-- For mount a diskgroup,(This is instance specific, for mounting on all nodes, run the same on all nodes)

SQL>alter diskgroup DATA mount;

or

asmcmd>mount DATA

-- For umount a diskgroup,(This is instance specific, for unmounting on all nodes, run the same on all nodes)

SQL>alter diskgroup DATA dismount;

or

asmcmd>umount DATA

-- To mount/Dismount all the diskgroups

SQL>alter diskgroup ALL mount;

SQL>alter diskgroup ALL dismount;

MSG-00102: Error Message :ORA-20100: File o0000071.tmp creation for FND_FILE failed

$
0
0
ERROR:

If a PL/SQL Concurrent Program can't write to an external file, you will receive an error message similar to:

MSG-00102: Error Message :ORA-20100: File o0000071.tmp creation for FND_FILE failed.
You will find more information on the cause of the error in request log.
ORA-06512: at "APPS.FND_FILE", line 378
ORA-06512: at "APPS.FND_FILE", line 473
ORA-06512: at "APPS.AP_TRIAL_BALANCE_PKG", line 192
REP-1419: 'beforereport': PL/SQL program aborted.

NOTE: Applications also produces temporary PL/SQL output files used in concurrent processing. These files are written to a location on the database server node specified by the APPLPTMP environment setting. The APPLPTMP directory must be the same directory as specified by the utl_file_dir parameter in your database initialization file.
.
Rapid Install sets both APPLPTMP and the utl_file_dir parameter to the same default directory. As the temporary files placed in this directory may contain context sensitive information, it should be a secure directory on the database server node with read and write access for the database server owner. In a multi-node system, the directory defined by APPLPTMP does not need to exist on the application tier servers. During an upgrade with AutoUpgrade, you must provide the utl_file_dir parameter value for the APPLPTMP environment setting.


SOLUTION:

1) Make sure that the name of the file is valid (the file name should not include characters like "^")

2) Make sure that APPLPTMP is set to a valid directory and that BOTH the applmgr user and the database user have read and write permissions on that directory (normally, it can be set to the same directory as APPLTMP)

3) Make sure that the file does not exit on the directory pointed by APPLPTMP

4) Make sure the directory pointed by APPLPTMP is the first entry on the utl_file_dir. Also, verify that all the entries on the utl_file_dir are valid and that the applmgr has read/write permissions.

If using an spfile, verify the proper syntax to set utl_file_dir:

Eg:  ALTER SYSTEM SET UTL_FILE_DIR='directory1','directory2' scope=spfile;

5) If still having problems, check if you can write a file directly using FND_FILE, which is the package used by the Application. From sqlplus, connected as the apps user, run:

    SQL> exec FND_FILE.PUT_LINE(FND_FILE.LOG, 'THIS IS A TEST');

This should dump a file on APPLPTMP.

If this test works, it would indicate that FND_FILE is ok and the problem is possibly with the Application.

You may want to leave only one entry on utl_file_dir for this test.

6) If still having problems, check if you can write a file using UTL_FILE, which is used by FND_FILE.

Run the PL/SQL below, changing to the first entry on utl_file_dir (you may want to leave just one entry on utl_file_dir for this test).

set serveroutput on
DECLARE
  file_location VARCHAR2(256) := '';
  file_name VARCHAR2(256) := 'utlfile1.lst';
  file_text VARCHAR2(256) := 'THIS IS A TEST';
  file_id UTL_FILE.file_type;
BEGIN
  file_id := UTL_FILE.fopen(file_Location, file_name, 'W');
  UTL_FILE.put_line(file_id, file_text);
  UTL_FILE.fclose(file_id);
EXCEPTION
  WHEN UTL_FILE.INVALID_PATH
  THEN dbms_output.put_line('Invalid path ' || SQLERRM);
    WHEN OTHERS
  THEN dbms_output.put_line('Others '|| SQLCODE || '' || SQLERRM);
END;
/

This program should dump a file on the requested directory. If the test fails, the problem is probably on the Database side.

If it works, the problem is probably on FND_FILE. In this scenario, check the versions of AFCPPIOS.pls and AFCPPIOB.pls.

How do we know how many users are connected to Oracle Applications.

$
0
0
How do we know how many users are connected to Oracle Applications.

1. Enable Profile Option "Sign-On Audit" at "Form" level.
2. Run "Purge Signon Audit" request.
3. Security:Users -> Monitor" option
4  or with the below sql query  mentioned below.

select distinct fu.user_name User_Name,fr.RESPONSIBILITY_KEY Responsibility
from fnd_user fu, fnd_responsibility fr, icx_sessions ic
where fu.user_id = ic.user_id AND
fr.responsibility_id = ic.responsibility_id AND
ic.disabled_flag='N' AND
ic.responsibility_id is not null AND
ic.last_connect like sysdate;

5. Can use this SQL statement to count concurrent_users in Oracle apps:

select count(distinct d.user_name) from apps.fnd_logins a,
v$session b, v$process c, apps.fnd_user d
where b.paddr = c.addr
and a.pid=c.pid
and a.spid = b.process
and d.user_id = a.user_id
and (d.user_name = 'USER_NAME' OR 1=1)

Get cpu memory info of db server

$
0
0
Get cpu memory info of db server


set pagesize 200
set lines 200
col name for a21
col stat_name for a25
col value for a13
col comments for a56
select STAT_NAME,to_char(VALUE) as VALUE ,COMMENTS from v$osstat where
stat_name IN ('NUM_CPUS','NUM_CPU_CORES','NUM_CPU_SOCKETS')
union
select STAT_NAME,VALUE/1024/1024/1024 || ' GB' ,COMMENTS from
v$osstat where stat_name IN ('PHYSICAL_MEMORY_BYTES');

SSL(Secure Socket Layer) Implementation With APEX.

$
0
0
Description:

To establish a secure connection over the XML DB with SSL using TCPS (Secure Socket Layer).

Requirements:

1. A wallet is required to be able to set up an SSL connection.
2. $ORACLE_HOME/network/admin --> This directory contains
a) Listener.ora
b) Sqlnet.ora
c) Tnsname.ora
We are put the wallet location entry on these three files.

IMPLEMENTATION:
1. Ensure the following files are exist in the wallet directory.
A) ewallet.p12 
B) cwallet.sso (Enable a auto login)

2. Make entry of the following control parameters in the sqlnet configuration files.
(sqlnet.ora and listener.ora files).

1. sqlnet.ora.

WALLET_LOCATION =
(SOURCE =
(METHOD = FILE)
(METHOD_DATA =
(DIRECTORY = <WALLET_LOCATION>))
)
  
SSL_CLIENT_AUTHENTICATION=FALSE

2. listener.ora.

In the listener.ora open a secure port:
eg. add address:   
(ADDRESS = (PROTOCOL = TCPS)(HOST = <HOSTNAME or IP ADDRESS)(PORT = 1988))

3. tnsnames.ora.

In the tnsnames.ora add:
   
TEST_s =
(DESCRIPTION =
  (ADDRESS = (PROTOCOL = TCPS) (Host = <HOSTNAME or IP ADDRESS) (Port = 1988) )
  (CONNECT_DATA = (SID = TEST) )
)

4. Connect through the secure port.

sqlplus sys/*****@TEST_s

Verify you are using the secure protocol by means,
select sys_context('userenv','network_protocol') from dual;

3. Set dispactchers for TCPS:

We can add a dispatchers for TCPS in two ways.

1.Add the entry in the pfile (init<SID>.ora) -- With bounce.

Example:
dispatchers='(PROTOCOL=TCP)(SERVICE=TEST)','(PROTOCOL=TCPS)(SERVICE=TEST)'

and restart the database instance.
(Or)
2.Alternatively make the change by means of the alter system command.

alter system set dispatchers = '(INDEX=0)(PROTOCOL=TCPS)(SERVICE=TEST)', '(INDEX=1)(PROTOCOL=TCP)                         (SERVICE=TEST)' scope=both;

You can set the dispatcher for TCPS only if desired.

4. Set http2-port and http2-protocol in the XDB configuration:

At this page set the HTTPS Port and the HTTPS Protocol.
eg. set 'HTTPS Port' to 1498 and 'HTTPS Protocol' to tcps.

Assume the https port no was 1498.

The following pl/sql script is use for set the https port in oracle 10g.

Pl/sql script:

set serveroutput on

DECLARE
  l_cfgxml XMLTYPE;
  l_value VARCHAR2(5) := '&secure_port'; -- Secure port#
BEGIN
  l_cfgxml := DBMS_XDB.cfg_get();

  IF l_cfgxml.existsNode('/xdbconfig/sysconfig/protocolconfig/httpconfig/http2-port') = 0 THEN
  -- Add missing elements.

 SELECT insertChildXML
 (l_cfgxml, '/xdbconfig/sysconfig/protocolconfig/httpconfig', 'http2-port',
  XMLType('<http2-port xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd">' ||
  l_value ||
  '</http2-port>'),
  'xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"'
 )
 INTO l_cfgxml
 FROM dual;

 SELECT insertChildXML
 (l_cfgxml, '/xdbconfig/sysconfig/protocolconfig/httpconfig', 'http2-protocol',
  XMLType('<http2-protocol xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd">tcps</http2-protocol>'),
  'xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"'
 )
 INTO l_cfgxml
 FROM dual;

  DBMS_OUTPUT.put_line('http2 port inserted.');
 ELSE
 -- Update existing element.
  SELECT updateXML
  (
  DBMS_XDB.cfg_get(),
  '/xdbconfig/sysconfig/protocolconfig/httpconfig/http2-port/text()',
   l_value,
   'xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"'
  )
  INTO l_cfgxml
  FROM dual;

 DBMS_OUTPUT.put_line('http2 port updated.');
 DBMS_OUTPUT.put_line('Secure port changed into '||l_value);
END IF;

  DBMS_XDB.cfg_update(l_cfgxml);
  DBMS_XDB.cfg_refresh;
END;
/

Results of execution:
SQL> @set-secure-http2-port.sql
Enter value for secure_port: 1498
old   3:   l_value VARCHAR2(5) := '&secure_port'; -- Secure port#  
new   3:   l_value VARCHAR2(5) := '1498'; -- Secure port#  
http2 port updated.  
Secure port changed into 1498

PL/SQL procedure successfully completed.

The following query is use for set the https port in oracle 11g.

In 11g release 1 and 11g release 2 you can run

call dbms_xdb.setListenerEndPoint(2, null, 1498,2);


5. Now check the status of the listener:
Lsnrctl status <LISTENER_NAME>

Eg: lsnrctl status TEST
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=<HOSTNAME>)(PORT=1523)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=<HOSTNAME>)(PORT=1988))(Presentation=HTTP)(Session=RAW))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=<HOSTNAME>)(PORT=1498)
(Presentation=HTTP)(Session=RAW)))

6. Now check and test the connection through browser.

CREATING RECOVERY CATALOG

$
0
0
CREATE RECOVERY CATALOG

TARGET DB : MACAW
CATALOG DB : ORA
CATALOG SCHEMA: CAT

CHECK LISTENER RUN FOR BOTH TARGET AND CATALOG DATABASE























































Check database conectivity using tnsping











IN CATALOG DATABASE CREATE CATALOG SCHEMA AND GRANT RECOVERY_CATALOG_OWNER ROLE














CONNECT RMAN TO CATALOG DB AND CREATE A CATLOG













CONNECT RMAN IN TARGET DB AND REGISTER THE DATABASE WITH CATALOG















ORA-01652 - ORA-01555

$
0
0

ORA-01652 UNABLE TO EXTEND TEMP SEGMENT

This error is caused because of Failing to allocate an extent of the required number of blocks for a temporary segment in the tablespace indicated.


Increasing the temp tablespace size will resolve the issue.

1)check the previous available tempfiles location.











2)Check if there is sufficient space available in the mount point before increasing temp tablespace size.

3)Once the sufficient disk space is available increase the temp tablespace size.

alter tablespace temp add tempfile '/u01/app/oracle/oradata/oradb/temp3.dbf' size 200m autoextend on next 100m maxsize 1g;


ORA-01555: snapshot too old

 ORA-01555 error occur due to a too-small undo_retention, even with a large undo tables.

Increase the undo_retention value to fix the issue.

ALTER SYSTEM SET UNDO_RETENTION = < seconds >;

Query to Find the session creating more redo

$
0
0
Query to Find the session creating more redo 

set pages 1000 lines 1000
SELECT s.sid, s.serial#, s.username, s.program,
i.block_changes
FROM v$session s, v$sess_io i
WHERE s.sid = i.sid
ORDER BY 5 desc;




RMAN Auxiliary connect fails with ORA-01031: INSUFFICIENT PRIVILEGES

$
0
0
Analysis :

There may be a mismatch in the "case" of characters between these items on the host where the auxiliary database resides:

1)  The entry in the listener.ora file for service_name for the auxiliary instance.
2)  The entry for db_name in the init<sid>.ora file for the auxiliary instance.
3)  The naming of the password file.
4)  The $ORACLE_SID for the auxiliary instance. 

If all four items have matching case characters, you may find the errors connecting remotely via the password file are resolved.


Solution :

Set the reference to service_name in the listener.ora,db_name in the init<sid>.ora,password file name itself,$ORACLE_SID to all uppercase.

Listener example:
   (DESCRIPTION=
   (ADDRESS=...)
   (ADDRESS=...)
   (CONNECT_DATA=
   (SERVICE_NAME=PROD.LOCALDOMIAN.COM)))


The init<sid>.ora file:

  db_name=PROD

The password file:
  orapwPROD.ora

The $ORACLE_SID:
  $ ORACLE_SID=PROD; export ORACLE_SID

$ORACLE_SID and password file is must be same.

opatchauto Fails With OPATCHAUTO-72050: System instance creation failed.

$
0
0
Analysis :

[root@rachost1 24917825]# /u01/app/12.1.0/grid/OPatch/opatchauto apply -analyze

OPatchauto session is initiated at Thu Jun 29 21:32:01 2017
System initialization log file is /u01/app/12.1.0/grid/cfgtoollogs/opatchautodb/systemconfig2017-06-29_09-32-04PM.log.
Failed: You must NOT be logged in as root (uid=0) when running /u01/app/12.1.0/grid/bin/cluvfy.
The result of cluvfy command does not contain OVERALL_STATUS String.
OPATCHAUTO-72050: System instance creation failed.
OPATCHAUTO-72050: Failed while retrieving system information.
OPATCHAUTO-72050: Please check log file for more details.
OPatchauto session completed at Thu Jun 29 21:32:09 2017
Time taken to complete the session 0 minute, 8 seconds
Topology creation failed.

In Node 1,

[oracle@prodrac1 ~]$ ls -lrt /u01/app/12.1.0/grid/oraInst.loc
-rw-r----- 1 root root 55 Sep 21 2018 /u01/app/12.1.0/grid/oraInst.loc


In Node 2,

[oracle@prodrac2 ~]$ ls -lrt /u01/app/12.1.0/grid/oraInst.loc
-rw-r----- 1 oracle oinstall 127 Sep 21 2018 /u01/app/12.1.0/grid/oraInst.loc


 The ownership of oraInst.loc inside <grid home> was different on both Nodes

Solution :

Ensure the ownership of <GRID HOME>/oraInst.loc is proper across each Node.If incorrect, then change the Ownership to Grid User & re-run opatchauto.

Query To Get Form Personalizations Details

$
0
0
1) Query to Get Form Personalization Details ( Oracle Applications )  from Database.

FND_FORM_CUSTOM_RULES - The Rules for the form customization's. A rule must have 1 more more FND_FORM_CUSTOM_SCOPES and a rule may have 1 or more FND_FORM_CUSTOM_ACTIONS.
FND_FORM_CUSTOM_ACTIONS - Holds the Actions for a specified Rule
FND_FORM - stores information about your registered application forms. Each row includes names (the actual SQL*Forms form name, and the Easy Form form title) and a description of the form. Each row also includes a flag that indicates whether this form is included in the Audit Trail audit set. You need one row for each form in each application. Oracle Application


Select Distinct
    A.Id,
    A.Form_Name ,
    A.Enabled,
    C.User_Form_Name,
    D.Application_Name ,
    A.Description,
    Ca.Action_Type,
    Ca.Enabled,
    Ca.Object_Type,
    ca.message_type,
    ca.message_text
from
    FND_FORM_CUSTOM_RULES a,
    FND_FORM b,
    FND_FORM_TL c,
    Fnd_Application_Tl D,
    Fnd_Form_Custom_Actions ca
where a.form_name = b.form_name
    And B.Form_Id = C.Form_Id
    And B.Application_Id = D.Application_Id
    And D.Application_Id = 230 --For Order Management
    And C.User_Form_Name Like 'Inventory%' --All the Forms that Start with Sales
    And A.Enabled ='Y'
    and a.id = ca.rule_id


SELECT
    ffv.form_id          "Form ID",
    ffv.form_name        "Form Name",
    ffv.user_form_name   "User Form Name",
    ffv.description      "Form Description",
    ffcr.sequence        "Sequence",
    ffcr.description     "Personalization Rule Name"
FROM fnd_form_vl             ffv,
       fnd_form_custom_rules   ffcr
WHERE ffv.form_name = ffcr.form_name
ORDER BY ffv.form_name, ffcr.sequence;



SELECT 
    ffcr.SEQUENCE "Seq", ffcr.description "Description",
    DECODE (ffcr.rule_type,
           'F', 'Form',
            'A', 'Function',
            'Other'
           ) "Level",
    ffcr.enabled "Enabled",
    ffcr.trigger_event "Trigger Event",
    ffcr.trigger_object "Trigger Object",
    ffcr.condition "Condition",
    DECODE (ffcr.fire_in_enter_query,
            'Y', 'Both',
            'N', 'Not in Enter-Query Mode',
            'O', 'Only in Enter-Query Mode',
            'Other'
           ) "Processing Mode"
FROM apps.fnd_form_custom_rules ffcr
WHERE ffcr.function_name = 'PO_POXPOEPO'
    AND ffcr.form_name = 'POXPOEPO'
ORDER BY ffcr.SEQUENCE;

Steps to change dbname using NID

$
0
0
SHUTDOWN IMMEDIATE
STARTUP MOUNT
Invoke the DBNEWID utility (nid) specifying the new DBNAME from the command line using a user with SYSDBA privilege
nid TARGET=sys/password@TSH1 DBNAME=TSH2
Viewing all 1640 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>