Pages

Search This Blog

Tuesday, October 16, 2018

Find Session(SID and Serial#) details using Process ID:

Find database session details using a process id(PID).

SELECT S.CLIENT_IDENTIFIER, s.status , s.TYPE , s.username , s.osuser , s.server ,
s.machine , s.module , s.logon_time , s.process , p.spid,
p.pid, s.SID, s.audsid, SYSDATE - (s.last_call_et / 86400) 
FROM gv$session s, gv$process p
WHERE s.paddr = p.addr(+) AND s.process ='&process';


How to Check if opatch requires Downtime?

How to Check if opatch requires Downtime?

1. Download the particular patch file
2. Check the file <Patch Number>/etc/config/inventory.xml
3. If the following entry is present
<instance_shutdown>true</instance_shutdown>

If it is true, then it requires down time.


Upload files to Oracle SR

Some times large files you may need to upload to the SR, always we cannot extract those large one's from the server and upload through browser.  Below one is the easiest way to upload files to the SR irrespective of size of the file.

curl -T <Upload File path/name> -u <metalink id>  https://transport.oracle.com/upload/issue/<SR Number>/ -k

Ex:
curl -T task_check.html -u sreenivasulu.papana@********.com  https://transport.oracle.com/upload/issue/3-*********/ -k


Tablespace usage

To check tablespace total size, free space, used and free percentage:

SELECT /* + RULE */  df.tablespace_name "Tablespace",
       df.bytes / (1024 * 1024 * 1024) "Size (GB)",
       SUM(fs.bytes) / (1024 * 1024 * 1024) "Free (GB)",
       Nvl(Round(SUM(fs.bytes) * 100 / df.bytes),1) "% Free",
       Round((df.bytes - SUM(fs.bytes)) * 100 / df.bytes) "% Used"
  FROM dba_free_space fs,
       (SELECT tablespace_name,SUM(bytes) bytes
          FROM dba_data_files
         GROUP BY tablespace_name) df
 WHERE fs.tablespace_name (+)  = df.tablespace_name
 GROUP BY df.tablespace_name,df.bytes
UNION ALL
SELECT /* + RULE */ df.tablespace_name tspace,
       fs.bytes / (1024 * 1024 * 1024),
       SUM(df.bytes_free) / (1024 * 1024 * 1024),
       Nvl(Round((SUM(fs.bytes) - df.bytes_used) * 100 / fs.bytes), 1),
       Round((SUM(fs.bytes) - df.bytes_free) * 100 / fs.bytes)
  FROM dba_temp_files fs,
       (SELECT tablespace_name,bytes_free,bytes_used
          FROM v$temp_space_header
         GROUP BY tablespace_name,bytes_free,bytes_used) df
 WHERE fs.tablespace_name (+)  = df.tablespace_name
 GROUP BY df.tablespace_name,fs.bytes,df.bytes_free,df.bytes_used
 ORDER BY 4 DESC;


To check Temp tablespace total size, used and free space.

SELECT   A.tablespace_name tablespace, D.gb_total,
         SUM (A.used_blocks * D.block_size) / 1024 / 1024 /1024 gb_used,
         D.gb_total - SUM (A.used_blocks * D.block_size) / 1024 / 1024 / 1024 gb_free
FROM     v$sort_segment A,
         (
         SELECT   B.name, C.block_size, SUM (C.bytes) / 1024 / 1024 / 1024 gb_total
         FROM     v$tablespace B, v$tempfile C
         WHERE    B.ts#= C.ts#
         GROUP BY B.name, C.block_size
         ) D
WHERE    A.tablespace_name = D.name
GROUP by A.tablespace_name, D.gb_total;



Find SPID from SID and Serial#

Find SPID from SID and Serial#:

select spid from gv$process where addr in (select paddr from gv$session where sid=&sid and serial#=&serial);


Different ways to check no.of CPU cores in Linux

How to find no.of cpu cores in Linux:

Option-1
cat /proc/cpuinfo | grep -i processor | wc -l
(or)
grep -c ^processor /proc/cpuinfo

Option-2
nproc

Option-3
lscpu
(or)
lscpu | grep 'CPU(s):' | head -1 | awk '{print $2}'


Friday, October 12, 2018

Different ways to Empty or Delete a Large File Content in Linux

There are different ways to empty or delete a large file content.  Make sure, which file you are going to empty.

Option-1
> file_name

Option-2
cat /dev/null > file_name

Option-3
dd if=/dev/null of=file_name

Option-4
echo > file_name



Thursday, October 11, 2018

How to clear Cache & Persistance in 11i & R12.1.3


11i:

$COMMON_TOP/_pages  - take a backup and remove the folder and recreate empty folder

When we have to clear cache in R12?
1.If front end page is showing blank.
2.If apacheserver is not coming up.
3.When ever we bounce middle tier services best practice is to clear cache.

R12:

Note: Clearing _pages directory is no longer a recommended solution.  Clearing the _pages in R12 creates blank login page issue, as in R12 the jsp files does not get compiled automatically.

$COMMON_TOP/_pages  - take a backup and remove the folder and recreate empty folder

- Stop adopmnctl.sh stopall

rm -fr $INST_TOP/ora/10.1.3/j2ee/oacore/persistence/*
rm -fr $INST_TOP/ora/10.1.3/j2ee/oafm/persistence/*
rm -fr $INST_TOP/ora/10.1.3/j2ee/forms/persistence/*
rm -rf $INST_TOP/ora/10.1.3/opmn/logs/states/.opmndat (this is optional)

If you want clear _pages in R12, you need to compile all your jsps shown below:

cd $FND_TOP/patch/115/bin
ojspCompile.pl --compile --flush -p 10

## -p 10, will run 10 parallel sessions.

- Start adopmnctl.sh startall.

From front end:

-Navigate to Functional Administrator Responsibility
-Choose the 'Core Services' Tab
-Choose 'Caching Framework'
-Click on 'Global Configuration'
-Click on 'Clear All Cache'
-The Click on yes on the display which will appear.


Tuesday, October 9, 2018

How to increase oacore/jvm processes in R12.1.3

Below are the steps to increase oacore process:

1)Take a backup of context file and opmn.xml file. a. /u01/inst/apps/<CONTEXT_NAME>/ora/10.1.3/opmn/conf/opmn.xml
b.$CONTEXT_FILE

2)Modify $CONTEXT_FILE as follows
From
<oacore_nprocs oa_var="s_oacore_nprocs">8</oacore_nprocs>
To
<oacore_nprocs oa_var="s_oacore_nprocs">16</oacore_nprocs>

3) Modify /u01/inst/apps/<CONTEXT_NAME>/ora/10.1.3/opmn/conf/opmn.xml file under oacore section as follows:
(<process-type id="oacore" module-id="OC4J" status="enabled"
working-dir="$ORACLE_HOME/j2ee/home">)
From
<process-set id="default_group" numprocs="8"/>
To
<process-set id="default_group" numprocs="16"/>

4) Just bounce Apache services, no need of autoconfig.  If your application services are already running, just reload the ocaore processes using adopmnctl.sh reaload command.


Sunday, October 7, 2018

Create User and Group in Unix

Group Add:

/usr/sbin/groupadd -g 503 dba
/usr/sbin/groupadd -g 510 dev

Oracle User creation:

/usr/sbin/groupadd -g 501 oracle
/usr/sbin/useradd -u 501 -g oracle -G oracle -c "Oracle Application or Database" oracle
/usr/bin/passwd oracle
/usr/sbin/usermod -U oracle
/usr/sbin/usermod -g dba -G dba,oracle oracle

Applmgr User creation:

/usr/sbin/groupadd -g 508 applmgr
/usr/sbin/useradd -u 508 -g applmgr -G applmgr -c "Oracle Applications Manager" applmgr
/usr/bin/passwd applmgr
/usr/sbin/usermod -U applmgr
/usr/sbin/usermod -g dba -G dba,applmgr applmgr


Thursday, October 4, 2018

Crontab Entries

Crontab Add Timestamp to the logfile:

If you want append date to the crontab logfile use below format:

45 09 * * * "/u01/scripts/test_date.sh" >/u01/scripts/test_date.log\_`date +\%Y\%m\%d\%H\%M` 2>&1



Concurrent Manager Startup Issue

Issue Details:

While starting up concurrent managers with adstrtal.sh or adcmctl.sh start apps/apps_password, managers did not come up.  Verified the logfile in $APPLCSF/log/<SID_MMDD>.mgr and found below issue.


Coutine &ROUTINE has attempted to start the internal concurrent manager.  The ICM is already running.  Contact you system administrator for further assistance.afpdlrq received an unsuccessful result from PL/SQL procedure or function FND_DCP.Request_Session_Lock.
Routine FND_DCP.REQUEST_SESSION_LOCK received a result code of 1 from the call to DBMS_LOCK.Request.
Possible DBMS_LOCK.Request resultCall to establish_icm failed
The Internal Concurrent Manager has encountered an error.

Solution:

Check for any locks on concurrent managers using below query:

SELECT v$access.sid, v$session.serial# FROM v$session,v$access
WHERE v$access.sid = v$session.sid and v$access.object = 'FND_CP_FNDSM' GROUP BY v$access.sid, v$session.serial#;

Once you see the session details from the above query and kill the session.

alter system kill session 'SID,Seerial#';

After session kill, restart your concurrent managers.



NetApp SMO Useful Commands

SMO Server start/stop/restart:

smo_server start
smo_server stop
smo_server restart

snapdrive start/stop/restart:

snapdrived start
snapdrived [-force] stop
snapdrived [-force] restart

smo backup list command:

smo backup list -profile <profile name>
smo backup list -profile <profile name> -verbose


Backup copy id:

smo backup show -profile $SOURCEPROFILE -label $BACKUPNAME

Ex:-
smo backup show -profile VIS -label D_A_20181004131216CDT


Backup Delete:

smo backup delete
-profile profile_name
[-label label [-data | -archivelogs] | [-id guid | -all]
-force
[-dump][-quiet | -verbose]

Ex:-
smo backup delete -profile SALES1 -label full_backup_sales_May
/usr/bin/smo backup delete -profile VIS -all -force