惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
The Blog of Author Tim Ferriss
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
云风的 BLOG
云风的 BLOG
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
P
Palo Alto Networks Blog
D
Docker
H
Hackread – Cybersecurity News, Data Breaches, AI and More
S
Schneier on Security
Engineering at Meta
Engineering at Meta
I
InfoQ
L
LangChain Blog
Cyberwarzone
Cyberwarzone
T
Tenable Blog
WordPress大学
WordPress大学
P
Privacy & Cybersecurity Law Blog
罗磊的独立博客
Apple Machine Learning Research
Apple Machine Learning Research
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Jina AI
Jina AI
C
CERT Recently Published Vulnerability Notes
Scott Helme
Scott Helme
博客园 - 三生石上(FineUI控件)
酷 壳 – CoolShell
酷 壳 – CoolShell
Know Your Adversary
Know Your Adversary
D
Darknet – Hacking Tools, Hacker News & Cyber Security
The Last Watchdog
The Last Watchdog
Last Week in AI
Last Week in AI
Cloudbric
Cloudbric
S
SegmentFault 最新的问题
爱范儿
爱范儿
Application and Cybersecurity Blog
Application and Cybersecurity Blog
博客园 - 叶小钗
AI
AI
T
Tor Project blog
I
Intezer
T
Threatpost
www.infosecurity-magazine.com
www.infosecurity-magazine.com
V
Visual Studio Blog
N
News and Events Feed by Topic
Latest news
Latest news
S
Security Affairs
博客园 - Franky
Microsoft Security Blog
Microsoft Security Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
B
Blog RSS Feed
C
Cybersecurity and Infrastructure Security Agency CISA
Hugging Face - Blog
Hugging Face - Blog
小众软件
小众软件
S
Securelist

博客园 - 油纸伞

假如m是奇数,且m>=3,证明m(m² -1)能被8整除 SharpSvn操作 -- 获取Commit节点列表 GetRelativePath获取相对路径 Dictionary(支持 XML 序列化),注意C#中原生的Dictionary类是无法进行Xml序列化的 Winform中Checkbox与其他集合列表类型之间进行关联 Image(支持 XML 序列化),注意C#中原生的Image类是无法进行Xml序列化的 修复使用<code>XmlDocument</code>加载含有DOCTYPE的Xml时,加载后增加“[]”字符的错误 使用序列化来Clone对象 [转]PowerDesigner15生成Hibernate 用户自定义类型的隐式转换 Net3.5及以上版本INotifyPropertyChanged接口的友好用法 知识加油站 知识加油站 Top K算法详细解析 C#值类型和引用类型 Oracle分区技术 对Oracle表分区的一点认识 数据库大表的优化:采用蔟表(clustered tables)及蔟索引(Clustered Index) 2008年.Net编程人员工具参照
oracle创建分区表
油纸伞 · 2011-03-25 · via 博客园 - 油纸伞

在ORACLE里如果遇到特别大的表,可以使用分区的表来改变其应用程序的性能。

以system身份登陆数据库,查看 v$option视图,如果其中Partition为TRUE,则支持分区功能;否则不支持。Partition有基于范围、哈希、综和三种类型。我们用的比较多的是按范围分区的表。


在ORACLE里如果遇到特别大的表,可以使用分区的表来改变其应用程序的性能。

以system身份登陆数据库,查看 v$option视图,如果其中Partition为TRUE,则支持分区功能;否则不支持。Partition有基于范围、哈希、综和三种类型。我们用的比较多的是按范围分区的表。

我们以一个2001年开始使用的留言版做例子讲述分区表的创建和使用:

1 、以system 身份创建独立的表空间(大小可以根据数据量的多少而定)

create tablespace g_2000q4 datafile '/home/oradata/oradata/test/g_2000q4.dbf' size 50M default storage (initial 100k next 100k minextents 1 maxextents unlimited pctincrease 1);

create tablespace g_2001q1 datafile '/home/oradata/oradata/test/g_2001q1.dbf' size 50M default storage (initial 100k next 100k minextents 1 maxextents unlimited pctincrease 1);

create tablespace g_2001q2 datafile '/home/oradata/oradata/test/g_2001q2.dbf' size 50M default storage (initial 100k next 100k minextents 1 maxextents unlimited pctincrease 1);

2 、用EXPORT工具把旧数据备份在guestbook.dmp中

把原来的guestbook表改名

alter table guestbook rename to guestbookold;

以guestbook 身份创建分区的表

create table guestbook(
	id		number(16) primary key,
	username		varchar2(64),
	sex		varchar2(2),
	email		varchar2(256),
	expression	varchar2(128),
	content		varchar2(4000),
	time		date,
	ip		varchar2(64)
) 
  partition by range (time)
  (partition g_2000q4 values less than (to_date('2001-01-01','yyyy-mm-dd'))
    tablespace g_2000q4
      storage(initial 100k next 100k minextents 1 maxextents unlimited pctincrease 0), 
   partition g_2001q1 values less than (to_date('2001-04-01','yyyy-mm-dd'))
    tablespace g_2001q1
      storage(initial 100k next 100k minextents 1 maxextents unlimited pctincrease 0),
   partition g_2001q2 values less than (to_date('2001-07-01','yyyy-mm-dd'))
    tablespace g_2001q2
      storage(initial 100k next 100k minextents 1 maxextents unlimited pctincrease 0)
   );

(说明:分区的名称可以和表空间的名称不一致。这里是每个季度做一个分区,当然也可以每个月做一个分区)

3、IMPORT导入数据,参数ignore=y

4、分区表的扩容:

到了2001 年下半年,建立新的表空间:

create tablespace g_2001q3 datafile '/home/oradata/oradata/test/g_2001q3.dbf' size 50m default storage (initial 100k next 100k minextents 1 maxextents unlimited pctincrease 1);

为表添加新分区和表空间:

alter table guestbook add partition g_2001q3
values less than (to_date('2001-10-01','yyyy-mm-dd')
tablespace g_2001q3
storage(initial 100k next 100k minextents 1 maxextents unlimited pctincrease 0);

5、删除不必要的分区

将2000年的数据备份(备份方法见 6、EXPORT 分区),将2000年的分区删除。

alter table guestbook drop partion g_2000q4;

删除物理文件

%rm /home/oradata/oradata/test/g_2000q4.dbf

6、EXPORT 分区:

% exp guestbook/guestbook_password tables=guestbook:g_2000q4 rows=Y file=g_2000q4.dmp

7、IMPORT分区:

例如在2001 年,用户要查看2000 年的数据,先创建表空间

create tablespace g_2000q4 datafile '/home/oradata/oradata/test/g_2000q4.dbf' size 50m default storage (initial 100k next 100k minextents 1 maxextents unlimited pctincrease 1);

为表添加新分区和表空间:

alter table guestbook add partition g_2000q4
values less than (to_date('2001-01-01','yyyy-mm-dd')
tablespace g_2001q3
storage(initial 100k next 100k minextents 1 maxextents unlimited pctincrease 0);

导入数据

%imp guestbook/guestbook_password file=g_2000q4.dmp tables=(guestbook:g_2000q4) ignore=y

(说明:如果不指明导入的分区,imp会自动按分区定义的范围装载数据)

版权说明:文章转自http://yinchunjian.javaeye.com/blog/680063