My Oracle Support Banner

Oracle 19C SHARDING- Generating Unique Sequence Numbers Across Shards for SHARD KEY Column (Doc ID 2468934.1)

Last updated on FEBRUARY 04, 2020

Applies to:

Oracle Database - Enterprise Edition - Version and later
Information in this document applies to any platform.


NOTE: In the images and/or the document content below, the user information and environment data used represents fictitious data from the
Oracle sample schema(s), Public Documentation delivered with an Oracle database product or other training material. Any similarity to actual
environments, actual persons, living or dead, is purely coincidental and not intended in any manner.

For the purposes of this document, the following fictitious environment is used as an example to describe the procedure:

Shard Names: SH23,SH24
Shard Groups: TEST1
Network Name: sales.sdbs1.oradbcloud
Region Name: regionora
Catalog Database: SCAT
Schema Name: TEST


Generating Shard key values using Unique Sequence Numbers Across Shards.

Before Oracle Database 19c, if you needed a unique number across shards you had to manage it yourself. In Oracle Database 19c, Oracle Sharding allows you to independently generate sequence numbers on each shard which are unique across all shards.

To support this feature, new SEQUENCE object clauses, SHARD and NOSHARD, are included in the SEQUENCE object DDL syntax, as shown in the following CREATE statement syntax.

CREATE | ALTER SEQUENCE [ schema. ]sequence
   [ { INCREMENT BY | START WITH } integer
   | { MAXVALUE integer | NOMAXVALUE }
   | { MINVALUE integer | NOMINVALUE }
   | { CYCLE | NOCYCLE }
   | { CACHE integer | NOCACHE }
   | { ORDER | NOORDER }


To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!

In this Document

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.