|
课程第14次(2016-04-27星三期):DML和锁
【上完1Z0-051的第9章】:DML
【上完1Z0-052的第9章】:锁
【1Z0-051】:共10章
【1Z0-052】:共4章
2016-04-27.sql:
- select bytes/1024, d.autoextensible , d.file_name
- from dba_data_files d
- where d.tablespace_name='UNDOTBS1';
-
- alter database datafile
- '+DATA/orcl/datafile/undotbs2.267.910129473' resize 100M;
-
- alter database datafile
- '+DATA/orcl/datafile/undotbs2.267.910129473' autoextend on maxsize 2G;
-
- alter tablespace undotbs2 rename to undotbs1;
- ---
-
-
- ---
-
-
-
- select bytes
- from dba_segments s where s.owner='HR' and s.segment_name='TBIG2';
-
- ---
-
- select s.SID ,s.SERIAL#, s.BLOCKING_SESSION
- from v_$session s where s.TERMINAL='pts/6';
-
- --140
- select * from v$lock where sid=140;
-
- select * from v$session where sid=140;
-
- alter system kill session '140,41' immediate ;
-
- ---
-
-
-
-
-
复制代码
2016-04-27. txt:
- [root@station90 桌面]# su - oracle
- [oracle@station90 ~]$ sqlplus /nolog
- SQL*Plus: Release 11.2.0.1.0 Production on Wed Apr 27 22:04:05 2016
- Copyright (c) 1982, 2009, Oracle. All rights reserved.
- SQL> conn hr/oracle_4U
- Connected.
- SQL> create table dead ( id number , salary number(8,2) , manager_id number ) ;
- Table created.
- SQL> insert into dead values (1 , 1000.00 , 100 ) ;
- 1 row created.
- SQL> insert into dead values (2 , 2000.00 , 200 ) ;
- 1 row created.
- SQL> commit;
- Commit complete.
- SQL>
- SQL>
- SQL> update dead set salary=1000.01 where id=1 ;
- 1 row updated.
- SQL> update dead set salary=2000.01 where id=2 ;
- update dead set salary=2000.01 where id=2
- *
- ERROR at line 1:
- ORA-00060: deadlock detected while waiting for resource
- SQL> select * from dead;
- ID SALARY MANAGER_ID
- ---------- ---------- ----------
- 1 1000.01 100
- 2 2000 200
- SQL> commit;
- Commit complete.
- SQL> update dead set salary=2000.01 where id=2 ;
- 1 row updated.
- SQL> commit;
- Commit complete.
- SQL> select * from dead;
- ID SALARY MANAGER_ID
- ---------- ---------- ----------
- 1 1000.01 101
- 2 2000.01 201
- SQL>
复制代码
|
|