您好,登錄后才能下訂單哦!
1、 創(chuàng)建表空間
create bigfile tablespace viot_data_400w1logging datafile 'E:\data\viot_data_400w1.dbf' size 20g autoextend on next 1g;
注釋:
viot_data_400w1 表空間名稱;
E:\data\viot_data_400w1.dbf 表空間位置(前提需創(chuàng)建E\data文件夾;
20g 默認(rèn)的表空間大小
1g 表空間寫(xiě)滿后,自動(dòng)擴(kuò)展的大小。
2、創(chuàng)建表,并對(duì)表指定分區(qū)
create TABLE TEMP400W ( "RYBH" VARCHAR2(20 BYTE), "ZPBH"VARCHAR2(20 BYTE), "RXZP"BLOB, "XM"VARCHAR2(30 BYTE), "XB"CHAR(1 BYTE), "ZJHM"VARCHAR2(20 BYTE), "INCCOLUM" NUMBER NOT NULL PRIMARYKEY ) PARTITION BY RANGE (INCCOLUM) ( PARTITION CUS_PART1 VALUES LESS THAN (900000) TABLESPACEviot_data_400w1, PARTITION CUS_PART2 VALUES LESS THAN (1800000) TABLESPACEviot_data_400w2, PARTITION CUS_PART3 VALUES LESS THAN (2700000) TABLESPACEviot_data_400w3, PARTITION CUS_PART4 VALUES LESS THAN (3600000) TABLESPACEviot_data_400w4, PARTITION CUS_PART5 VALUES LESS THAN (4500000) TABLESPACEviot_data_400w5 )
注釋:創(chuàng)建表TEMP400W; 并且為表指定4個(gè)分區(qū);CUS_PART1 存儲(chǔ)0-900000的記錄;CUS_PART2存儲(chǔ)第900001-1800000的記錄,以此類推;
3、 查看表分區(qū)
select * from user_tab_partitions where table_name = 'TEMP400W'
注釋:查看TEMP400W的所有分區(qū)
4、 修改表操作不寫(xiě)日志
alter table temp400W NOLOGGING
5、創(chuàng)建DBLink的授權(quán)給scott用戶
grant CREATE PUBLIC DATABASE LINK,DROP PUBLICDATABASE LINK to scott;
6、創(chuàng)建數(shù)據(jù)庫(kù)鏈接
CREATE PUBLIC DATABASE LINK viot_dblinkCONNECT TO viot IDENTIFIED BY viot USING '(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.12.110)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = viot) ) )'
7、連表查詢插入語(yǔ)句。
insert intotemp400W(rybh,zpbh,rxzp,xm,xb,zjhm,inccolum) selectrybh,zpbh,rxzp,xm,xb,zjhm,inccolum1 from temp400W@viot_dblink
8、查看表空間的使用率
SELECT a.tablespace_name "表空間名", total "表空間大小", free "表空間剩余大小", ( total - free ) "表空間使用大小", Round(( total - free ) / total, 4) * 100 "使用率 %" FROM (SELECT tablespace_name, Sum(bytes) free FROM DBA_FREE_SPACE GROUP BY tablespace_name) a, (SELECT tablespace_name, Sum(bytes) total FROM DBA_DATA_FILES GROUP BY tablespace_name) b WHERE a.tablespace_name = b.tablespace_name
參考鏈接:
http://blog.chinaunix.net/uid-11570547-id-58989.html
http://soft.chinabyte.com/database/290/12218290.shtml
http://www.cnblogs.com/leiOOlei/archive/2012/06/08/2541306.html
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。