0% found this document useful (0 votes)
23 views3 pages

Note Pad

The document discusses various SQL queries to monitor and manage Oracle database sessions and queries. It includes queries to view current sessions, inactive sessions, long-running queries, and kill long-running queries. It also provides instructions on installing Oracle Grid Infrastructure and configuring Automatic Storage Management (ASM).

Uploaded by

abhishek singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views3 pages

Note Pad

The document discusses various SQL queries to monitor and manage Oracle database sessions and queries. It includes queries to view current sessions, inactive sessions, long-running queries, and kill long-running queries. It also provides instructions on installing Oracle Grid Infrastructure and configuring Automatic Storage Management (ASM).

Uploaded by

abhishek singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

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

col RESOURCE_NAME for a30


Set lin 200 pages 200
select
resource_name,
current_utilization,
max_utilization,
limit_value
from
v$resource_limit
where
resource_name in ( 'sessions', 'processes');
---------------------------------

INACTIVE SESSION
---------------
select count(s.status) INACTIVE_SESSIONS
from gv$session s, v$process p
where
p.addr=s.paddr and
s.status='INACTIVE';

TOTAL SESSION
--------------
select count(s.status) TOTAL_SESSIONS from gv$session s;

ACTIVE SESSION
---------------
select count(s.status) ACTIVE_SESSIONS
from gv$session s, v$process p
where
p.addr=s.paddr and
s.status='ACTIVE';

select 'ALTER SYSTEM DISCONNECT SESSION '''||sid||','||serial#||'''immediate;' from


V$session where last_call_et > 10800 and status = 'ACTIVE';

KILL QUERY
-----------
select sql_text from v$sql where sql_id='7hspvruktu52b';
select SID,serial#,SQL_ID from v$session where sql_id='4z2q';
alter system kill session 'SID,SERIAL#' immediate;

https://asrblogger.com/how-to-find-long-running-sessions-in-oracle/

FIND LONG RUNNING QUERIES


--------------------------
col sid format 9999999
col serial# for 9999999
column opname format a14
column message format a41
set lines 1000
set pages 100
select
sid,serial#,sql_id,opname,message,sofar,totalwork,round((sofar/decode(totalwork,0,1
,totalwork))*100,2) work_done,
time_remaining Time_remain,ELAPSED_SECONDS ela_seconds
from v$session_longops where sofar<>totalwork ;

col opname for a22


col message for a69
select opname,message,sofar,totalwork,time_remaining,elapsed_seconds from
v$session_longops where sofar <> totalwork;

col ELAPSED for a20


col REMAINING for a20
SELECT s.SID,
s.serial#,
s.machine,
ROUND(sl.elapsed_seconds/60) || ':' ||
MOD(sl.elapsed_seconds,60) elapsed,
ROUND(sl.time_remaining/60) || ':' ||
MOD(sl.time_remaining,60) remaining,
ROUND(sl.sofar/sl.totalwork*100, 2) progress_pct
FROM v$session s,
v$session_longops sl
WHERE s.SID = sl.SID
AND s.serial# = sl.serial#
ORDER BY 4 DESC;

https://asrblogger.com/parameters-which-require-db-bounce/

12th April 2024


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

yum install -y oracle-database-preinstall-19c


yum -y install oracleasm*
yum -y install kmod-oracleasm*

Add below OS groups


##Root
groupadd -g 54327 asmdba
groupadd -g 54328 asmoper
groupadd -g 54329 asmadmin

Add asmdba as secondary group to Oracle user


usermod -a -G asmdba oracle

Create Grid User


useradd -u 54331 -g oinstall -G dba,asmdba,asmoper,asmadmin,racdba grid

===
Change the password for Oracle and Grid user
passwd oracle
passwd grid

Create the Directories for Oracle Database installation


mkdir -p /u01/app/oracle/product/19/db
chown -R oracle:oinstall /u01
chmod -R 775 /u01

Create the Directories for Oracle Grid installation


mkdir -p /u01/app/grid/product/19/grid
chown -R grid:oinstall /u01/app/grid
chmod -R 775 /u01/app/grid

[root@localhost ~]# oracleasm configure -i


Configuring the Oracle ASM library driver.

This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets ('[]'). Hitting <ENTER> without typing an
answer will keep that current value. Ctrl-C will abort.

Default user to own the driver interface []: grid


Default group to own the driver interface []: oinstall
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
[root@localhost ~]#

Load / initiate Oracle ASM


oracleasm init

Create separate ASM Disk for each partition

oracleasm createdisk GRID_DG /dev/sdb1


oracleasm createdisk SHA_DG1 /dev/sdb2
oracleasm createdisk SHA_DG_FLASH /dev/sdb3

To check asm disks:

oracleasm listdisks

ls -lrt /dev/oracleasm/disks

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy