4、模拟及测试DCD连接
C:\Users\robinson.cheng>sqlplus scott/tiger@ora11g --->从windows客户端发起连接
SQL*Plus: Release 11.2.0.1.0 Production on Tue Jun 25 09:57:59 2013
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
---Issued the sql to hold a lock
SQL> update emp set sal=sal*1.1 where deptno=20;
5 rows updated.
--disabled the network adapter in VM setting
SQL> select * from dual;
select * from dual
*
ERROR at line 1:
ORA-03113: end-of-file on communication channel
Process ID: 29522
Session ID: 15 Serial number: 447
--服务器端环境
SQL> select * from v$version where rownum<2;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
--在服务器端查看session的情况,SCOTT用户的session状态为INACTIVE
SQL> @comm_sess_users;
+----------------------------------------------------+
| User Sessions (All) |
+----------------------------------------------------+
Instance SID Serial ID Status Oracle User O/S User O/S PID Session Program Terminal Machine
--------- ------ --------- --------- ----------- ------------ ------- -------------------------- ---------- -------------
ora11g 15 447 INACTIVE SCOTT Robinson.Che 29522 sqlplus.exe PC39 TRADESZ\PC39
125 5 INACTIVE SYS oracle 4734 sqlplus@orasrv.com (TNS V1 pts/0 orasrv.com
139 9 ACTIVE SYS oracle 29447 sqlplus@orasrv.com (TNS V1 pts/4 orasrv.com
--Get the spid for user scott by SID
SQL> @my_spid_from_sid
Enter value for input_sid: 15
old 4: AND s.sid = &input_sid
new 4: AND s.sid = 15
SID SERIAL# SPID
------ ---------- ------------------------
15 447 29522
--To find the locked object
SQL> @lock_obj
OBJECT_NAME||''||LOCKED_MODE||''||CTIME||''||C.SID||''||SERIAL#
------------------------------------------------------------------
EMP 3 14 15 447
EMP 3 83 15 447
--The trace file exists
SQL> ho ls -hltr /u01/app/oracle/network/trace/s*29522*
-rw-r----- 1 oracle oinstall 241K Jun 25 09:59 /u01/app/oracle/network/trace/server_29522.trc
--->try to issue another sql. the sql is blocked
SQL> set time on;
10:03:46 SQL> delete scott.emp where deptno=20;
delete scott.emp where deptno=20
*
ERROR at line 1:
ORA-01013: user requested cancel of current operation
--Check the server process for scott
10:04:37 SQL> ho ps -ef | grep 29522 | grep -v grep
oracle 29522 1 0 09:58 ? 00:00:00 oracleora11g (LOCAL=NO)
--Could not reach to client from server.
10:06:51 SQL> ho ping 192.168.7.133
PING 192.168.7.133 (192.168.7.133) 56(84) bytes of data.
From 192.168.7.40 icmp_seq=2 Destination Host Unreachable
From 192.168.7.40 icmp_seq=3 Destination Host Unreachable
From 192.168.7.40 icmp_seq=4 Destination Host Unreachable
From 192.168.7.40 icmp_seq=6 Destination Host Unreachable
From 192.168.7.40 icmp_seq=7 Destination Host Unreachable
From 192.168.7.40 icmp_seq=8 Destination Host Unreachable
--此时总进程数为27个
10:15:08 SQL> select count(*) from v$process;
COUNT(*)
----------
27
--从09:58进程启动开始到10:17:59进程依旧没有被释放
10:17:59 SQL> ho ps -ef | grep 29522 | grep -v grep
oracle 29522 1 0 09:58 ? 00:00:00 oracleora11g (LOCAL=NO)
-->At this time the server process was released
10:18:08 SQL> ho ps -ef | grep 29522 | grep -v grep
--进程释放后此时进程总数变为26个
10:19:45 SQL> select count(*) from v$process;
COUNT(*)
----------
26
-->the lock was released
10:19:54 SQL> @lock_obj
no rows selected
--scott用户的session已经从v$session中被移除
10:20:03 SQL> @comm_sess_users;
+----------------------------------------------------+
| User Sessions (All) |
+----------------------------------------------------+
Instance SID Serial ID Status Oracle User O/S User O/S PID Session Program Terminal Machine
--------- ------ --------- --------- -------------- ------------ ------- -------------------------- -------- ----------
ora11g 125 5 INACTIVE SYS oracle 4734 sqlplus@orasrv.com (TNS V1 pts/0 orasrv.com
139 9 ACTIVE SYS oracle 29447 sqlplus@orasrv.com (TNS V1 pts/4 orasrv.com
