您好,登錄后才能下訂單哦!
1、 創建表空間
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 表空間位置(前提需創建E\data文件夾;
20g 默認的表空間大小
1g 表空間寫滿后,自動擴展的大小。
2、創建表,并對表指定分區
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 )
注釋:創建表TEMP400W; 并且為表指定4個分區;CUS_PART1 存儲0-900000的記錄;CUS_PART2存儲第900001-1800000的記錄,以此類推;
3、 查看表分區
select * from user_tab_partitions where table_name = 'TEMP400W'
注釋:查看TEMP400W的所有分區
4、 修改表操作不寫日志
alter table temp400W NOLOGGING
5、創建DBLink的授權給scott用戶
grant CREATE PUBLIC DATABASE LINK,DROP PUBLICDATABASE LINK to scott;
6、創建數據庫鏈接
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、連表查詢插入語句。
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
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。