亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

oracle查詢鎖表及解鎖,修改表字段名與復(fù)制表結(jié)構(gòu)和數(shù)據(jù)的方法

 更新時(shí)間:2018年12月11日 09:43:17   作者:執(zhí)筆記憶的空白  
今天小編就為大家分享一篇關(guān)于oracle查詢鎖表及解鎖,修改表字段名與復(fù)制表結(jié)構(gòu)和數(shù)據(jù)的方法,小編覺得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來看看吧

在Oracle中查詢鎖表及解鎖:

鎖表查詢的代碼有以下的形式:

select count(*) from v$locked_object;
select * from v$locked_object;

查看哪個(gè)表被鎖:

select b.owner,b.object_name,a.session_id,a.locked_mode from v$locked_object a,dba_objects b where b.object_id = a.object_id;

查看是哪個(gè)session引起的:

select b.username,b.sid,b.serial#,logon_time from v$locked_object a,v$session b where a.session_id = b.sid order by b.logon_time; 

殺掉對(duì)應(yīng)進(jìn)程:

執(zhí)行命令:alter system kill session'32,241';其中32為sid,241為serial#.

在Oracle中修改表字段名:

假設(shè)字段有數(shù)據(jù),則改為nvarchar2(20)可以直接執(zhí)行:

alter table tb modify (name nvarchar2(20));

若不能修改則用下面

alter table sft_bfwo rename column bfwoid to wid;
alter table sft_bfwo add bfwoid char(16);
update sft_bfwo set bfwoid=trim(wid);
alter table sft_bfwo drop column wid;

在Oracle中復(fù)制表結(jié)構(gòu)和表數(shù)據(jù):

復(fù)制表結(jié)構(gòu)及其數(shù)據(jù):

create table table_name_new as select * from table_name_old

只復(fù)制表結(jié)構(gòu):

create table table_name_new as select * from table_name_old where 1=2;

或者:

create table table_name_new like table_name_old

只復(fù)制表數(shù)據(jù):

如果兩個(gè)表結(jié)構(gòu)一樣:

insert into table_name_new select * from table_name_old

如果兩個(gè)表結(jié)構(gòu)不一樣:

insert into table_name_new(column1,column2...) select column1,column2... from table_name_old

總結(jié)

以上就是這篇文章的全部內(nèi)容了,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,謝謝大家對(duì)腳本之家的支持。如果你想了解更多相關(guān)內(nèi)容請(qǐng)查看下面相關(guān)鏈接

相關(guān)文章

最新評(píng)論