Use the following approach to create tables with constraints and indexes:
Use the following approach to create tables with constraints and indexes:
[@more@]1.
should be created enabled and validated. All other constraints (
Create the tables with the constraints. NOT NULL constraints can be unnamed andCHECK, UNIQUE,PRIMARY KEY
, and FOREIGN KEY) should be named and created disabled.See Also:
information about the
Oracle Database SQL Language Reference for moreCREATE INDEX and ALTER INDEXstatements, as well as restrictions on rebuilding indexes
See Also:
Database Administrator's Guide
syntax for this statement
Oracle Database SQL Language Reference and Oraclefor more information about theUsing Function-based Indexes for Performance
Using Indexes and Clusters
2.
15-7Load old data into the tables.3.
Create all indexes, including indexes needed for constraints.4.
Enable novalidate all constraints. Do this to primary keys before foreign keys.5.
Allow users to query and modify data.6.
constraints. Do this to primary keys before foreign keys. For example,
With a separate ALTER TABLE statement for each constraint, validate allCREATE TABLE t (a NUMBER CONSTRAINT apk PRIMARY KEY DISABLE,
b NUMBER NOT NULL);
CREATE TABLE x (c NUMBER CONSTRAINT afk REFERENCES t DISABLE);
Now you can use Import or Fast Loader to load data into table
t.CREATE UNIQUE INDEX tai ON t (a);
CREATE INDEX tci ON x (c);
ALTER TABLE t MODIFY CONSTRAINT apk ENABLE NOVALIDATE;
ALTER TABLE x MODIFY CONSTRAINT afk ENABLE NOVALIDATE;
At this point, users can start performing
on table
INSERTs, UPDATEs, DELETEs, and SELECTst.ALTER TABLE t ENABLE CONSTRAINT apk;
ALTER TABLE x ENABLE CONSTRAINT afk;
Now the constraints are enabled and validated.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/76065/viewspace-1012310/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle - Tables/IndexesOracleIndex
- imp INDEXES=N CONSTRAINTS=NIndexAI
- Restrictions on Create Bitmap IndexesRESTIndex
- Bitmap Indexes on Partitioned Tables (225)Index
- Creating Compressed Tables and IndexesIndex
- Allocation of Temporary Segments for Temporary Tables and Indexes (28)Index
- use multiple tablespaces to perform the following tasks (47)ORM
- Create Reference-Partitioned Tables
- Validating Tables, Indexes, Clusters, and Materialized ViewsIndexZedView
- Bitmap Indexes on Index-Organized Tables (232)IndexZed
- Miscellaneous Information about Creating Indexes on Partitioned TablesORMIndex
- Use of Indexes Against Views (179)IndexAIView
- Use windows batch script to create menuWindowsBAT
- Secondary Indexes on Index-Organized Tables (231)IndexZed
- Use Windows Azure AD to create SSO projectsWindowsProject
- Oracle 19c Concepts(03):Indexes and Index-Organized TablesOracleIndexZed
- 關於分割槽表和分割槽索引(About Partitioned Tables and Indexes)索引Index
- use azure data studio to create external table for oracleOracle
- B-tree Indexes on UROWID Columns for Heap- and Index-Organized Tables (235)IndexZed
- ORA-22992 cannot use LOB locators selected from remote tablesREM
- [20130812]12c Partial Indexes For Partitioned Tables Part I.txtIndex
- [20130812]12c Partial Indexes For Partitioned Tables Part II.txtIndex
- Rebuild IndexesRebuildIndex
- ORACLE INDEXESOracleIndex
- dba_tables,dba_all_tables,user_tables,all_tables有什麼區別
- 【譯】A GPU Approach to Particle PhysicsGPUAPP
- Oracle TablesOracle
- Reverse Key IndexesIndex
- ORACLE -> NULL & INDEXESOracleNullIndex
- Overview of Partitioned IndexesViewIndex
- Local Partitioned IndexesIndex
- Global Nonpartitioned IndexesIndex
- Extents in Indexes (19)Index
- constraint=constraints?AI
- 翻譯(九)——Clustered Indexes: Stairway to SQL Server Indexes Level 3IndexAISQLServer
- SQL Server Primary Key ConstraintsSQLServerAI
- Drop table cascade constraintsAI
- Define Constraints on Views (188)AIView