oracle 快速复制一张表,并在此创建索引,日志及并行度
復(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
只復(fù)制表數(shù)據(jù)
insert into table_name_new select * from table_name_old
表結(jié)構(gòu)不一樣
insert into table_name_new(column1,column2...) select column1,column2... from table_name_old
復(fù)制表結(jié)構(gòu)及其數(shù)據(jù)不寫日志
create table table_name_new nologging as select * from table_name_old
設(shè)置并行度
create table testa2 (t1 int) parallel;
commit;
插入數(shù)據(jù)不寫日志
alter?? table?? table_name?? NOLOGGING;
再修改寫日志
alter?? table?? table_name?? LOGGING;
?
并行度:
查看dba_tables數(shù)據(jù)字典時,可以發(fā)現(xiàn)有“DEGREE”字段,這個字段表示的就是數(shù)據(jù)表的并行度。這個參數(shù)的設(shè)置,關(guān)系著數(shù)據(jù)庫的I/O,以及sql的執(zhí)行效率。當(dāng)設(shè)置表的并行度非常高的時候,sql優(yōu)化器將可能對表進行全表掃描,引起 Direct Path Read 等待 。
在使用并行查詢前需要慎重考慮, 因為并行查詢盡管能提高程序的響應(yīng)時間, 但是會
消耗比較多的資源。
alter table t parallel(degree 1);------直接指定表的并行度
alter table t parallel; ? ?----------設(shè)置表的并行度為default
創(chuàng)建索引:
create [unique] index index_name on table_name(column_name[,column_name…])
轉(zhuǎn)載于:https://www.cnblogs.com/lingbing/p/6386921.html
總結(jié)
以上是生活随笔為你收集整理的oracle 快速复制一张表,并在此创建索引,日志及并行度的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Django L6 编写你的第一个Dja
- 下一篇: 假期《JAVA技术》预备作业01