oracle connection - Session - Process

ALTER SYSTEM SET RESOURCE_LIMIT=TRUE;
CREATE PROFILE kyc_pro LIMIT IDLE_TIME 2;
alter user kyc_acc profile kyc_pro;
select * from dba_users where profile='KYC_PRO';
show parameter resource;
select * from dba_profiles where profile like 'K%';


[oracle@cu-dbs-152 admin]$ cat sqlnet.ora
SQLNET.EXPIRE_TIME = 3


==================================
a session can react a lot of things

The same connection, if you open a non-shared sql worksheet will appear in a session table. If the connection is disconnected and connected soon, reuses sid, serial #, but will increase, not reduce
the SADDR, the SID, the SERIAL #
000000069E7C75F8 1886 231
0000000682B2FDC8 2828 191
0000000686EEB1E8 4243 189


select * from v$session
where schemaname like 'KYC%';
where osuser='ag1';
where paddr='0000000BC94696B8';


The process of the session is paddr addr, find the PID
SELECT * from V $ process
WHERE addr = '0000000685BC4730';

According session of obj # dba_objects is the object_id, which is a lookup table (the object)
the SELECT * from dba_objects
the WHERE object_id = '74120';

According to the session
SELECT * from DBA_EXTENTS
WHERE BLOCK_ID = '382 042';

select * from dba_extents
where file_id=5 and segment_name like '%TRA%';


According to port number that session of the port system is, the query process

According session of row_wait_file # query which data file
select * from v $ datafile where file # = 5;

spid is the process of pid system
PS -ef | grep spid
lsof -P -i -n | grep "20721 the Oracle"

 

 

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

Check the current session session ID has the following three methods:
desc V $ MYSTAT
SELECT * WHERE rownum MYSTAT from V $ =. 1;


select userenv('sid') from dual;


userenv ( 'sessionid') returns session audit id. audsid field corresponding to v $ session.
When the session connection to the database, obtains from a session assigned to audid SYS.AUDSES $ sequence.
select sid from v $ session where audsid  = userenv ( 'sessionid');
this returns three values, we directly view userenv ( 'sessionid') values:
SELECT userenv ( 'sessionid') from Dual;
for internal users ( '/ as sysoper 'and' / as sysdba ') and background processes, corresponding to 0. AUDID   
in Oracle 10g, if AUDID value of 0 indicates that the user is internal, if the value of 4,294,967,295 AUDID, then it is indicated that SYS users directly connected. 
We returned here three results are all SYS user's session are returned, so this method is sometimes the accuracy is not high.

 

Sid and serial # of relationship

sid will be reused, but at the same time a SID is reused, serial # will increase, will not be repeated.
For example, when you find that there is a 10:00 SID is 10, serial # for the session 100 is not normal, want to kill him, if directly kill sid 10, while the initiative to withdraw from this session, but just recently with a new session 10 the SID (this time a new session of serial # is not = 100, only more than 100 high), will take place in the case of manslaughter. So Oracle requires us to kill the session, you must specify the sid and serial # at the same time.
From the other point of view, sid in the same instance of the current session is a unique key, and sid, serial # is across the instance lifetime All session is within the unique key. (Without regard to serial # exceeds the maximum, reusable)

, for example, before I need to do alter system kill session '147, 33306 ';
After performing, I'm still the same PL / SQL DEV of SQL WINDOW re-do a query on It would then generate a SID = SESSION 147, but at this time of the SERIAL # 33308 becomes.

 

 

################################

sessions=(1.1*process+5)
show parameter processes
show parameter sessions

alter system set processes=1000 scope=spfile;
shutdown immediate;
startup;

Connections to query the database for the current process:
the SELECT COUNT (*) from v $ Process;
number of connections to check the database for the current session:
the SELECT COUNT (*) from v $ the session;
see the number of concurrent connections to the database:
the SELECT COUNT (*) from v $ session where status = 'ACTIVE' ;
session situation View the current database established:
the SELECT sid, Serial #, username, Program, Machine, Status from v $ the session;
maximum query the database to allow the number of connections:
the SELECT value from v $ the Parameter the WHERE name = 'processes';

 

Guess you like

Origin www.cnblogs.com/createyuan/p/11228004.html
Recommended