Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Oracle11g中进行系统分区?_Oracle_Oracle11g_Database Administration - Fatal编程技术网

如何在Oracle11g中进行系统分区?

如何在Oracle11g中进行系统分区?,oracle,oracle11g,database-administration,Oracle,Oracle11g,Database Administration,我对数据库非常陌生。我想为oracle中现有的大型数据库表进行系统分区。有人能建议吗 如何实现oracle数据库中现有表的系统分区 注意,我只查找系统分区,不查找范围、哈希或复合分区。据我所知,现有表无法分区。你必须重新创建它。 对于这个场景,有一个名为dbms_redefinition的Oracle包,详细信息请参见,但我将提供一个非常简单的示例,不使用这个包 假设您有以下非分区表: create table T_TABLE ( pkey NUMBER not null,

我对数据库非常陌生。我想为oracle中现有的大型数据库表进行系统分区。有人能建议吗 如何实现oracle数据库中现有表的系统分区


注意,我只查找系统分区,不查找范围、哈希或复合分区。

据我所知,现有表无法分区。你必须重新创建它。 对于这个场景,有一个名为dbms_redefinition的Oracle包,详细信息请参见,但我将提供一个非常简单的示例,不使用这个包

假设您有以下非分区表:

create table T_TABLE
(
  pkey         NUMBER not null,
  t_data       VARCHAR2(250) not null,
  partitionkey NUMBER not null
);
如果要对该表进行分区,第一步是重命名该表:

alter table t_table rename to old_table;
然后,创建新表

create table T_TABLE
(
  pkey         NUMBER not null,
  t_data       VARCHAR2(250) not null,
  partitionkey NUMBER not null
)
partition by system
(
   partition p1 tablespace users,
   partition p2 tablespace users,
   partition p3 tablespace users
);     
现在,您可以将旧表中的表行插入到新表中。您的应用程序/sql需要告诉服务器要插入哪个分区。 例如,像这样:

insert into t_table partition (p1) select * from old_table where partitionkey = 1;    
insert into t_table partition (p2) select * from old_table where partitionkey = 2;
insert into t_table partition (p3) select * from old_table where partitionkey = 3;        
commit;
现在你可以放下你的旧桌子了

drop table old_table;

据我所知,现有的表无法分区。你必须重新创建它。 对于这个场景,有一个名为dbms_redefinition的Oracle包,详细信息请参见,但我将提供一个非常简单的示例,不使用这个包

假设您有以下非分区表:

create table T_TABLE
(
  pkey         NUMBER not null,
  t_data       VARCHAR2(250) not null,
  partitionkey NUMBER not null
);
如果要对该表进行分区,第一步是重命名该表:

alter table t_table rename to old_table;
然后,创建新表

create table T_TABLE
(
  pkey         NUMBER not null,
  t_data       VARCHAR2(250) not null,
  partitionkey NUMBER not null
)
partition by system
(
   partition p1 tablespace users,
   partition p2 tablespace users,
   partition p3 tablespace users
);     
现在,您可以将旧表中的表行插入到新表中。您的应用程序/sql需要告诉服务器要插入哪个分区。 例如,像这样:

insert into t_table partition (p1) select * from old_table where partitionkey = 1;    
insert into t_table partition (p2) select * from old_table where partitionkey = 2;
insert into t_table partition (p3) select * from old_table where partitionkey = 3;        
commit;
现在你可以放下你的旧桌子了

drop table old_table;

什么是系统分区?这是一种Oracle数据库数据分区方法,其中应用程序逻辑控制分区结构。请参阅和。。。但不确定这是否真的有助于解释OP想在这里做什么。OP的意思是什么?需要一个示例来参考为我的现有表进行系统分区。@AnuragKumar--即您。什么是系统分区?这是一种Oracle数据库的数据分区方法,其中应用程序逻辑控制分区结构。请参阅和。。。但不确定这是否真的有助于解释OP想在这里做什么。OP的意思是什么?需要一个示例作为参考,以便为我现有的表进行系统分区。@AnuragKumar--也就是说,您。仅供参考,Oracle很酷-谢谢您的提示。虽然我可能需要几年才能使用这一新功能。是的,我也在同一条船上,我希望能得到12.2扩展到_char/to _number/etc功能!,但我认为这是值得分享的信息*{:我会把博客放在我读到它的地方,除非我记不清是谁在张贴了它。@ ToMasSturnic非常感谢你提供这个解决方案:-@ AnuragKumar。如果你喜欢这个答案,请考虑接受它,点击我左边答案的绿色按钮。FYI,Oracle很酷。谢谢你的暗示。虽然它可能会用到Y。是的,我也在同一条船上,我很想得到12.2扩展到_char/to _number/etc函数!但我认为这是值得分享的信息*{:我会把博客放在我读到的地方,除非我记不起来是谁在张贴了。@ ToMasSturnic非常感谢你提供这个解决方案:- @ AnuragKumar。如果你喜欢这个答案,请考虑接受它,点击我左边答案的绿色按钮。