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 19c Concepts(03):Indexes and Index-Organized TablesOracleIndexZed
- use azure data studio to create external table for oracleOracle
- create table,show tables,describe table,DROP TABLE,ALTER TABLE ,怎麼使用?
- 翻譯(九)——Clustered Indexes: Stairway to SQL Server Indexes Level 3IndexAISQLServer
- Oracle TablesOracle
- 【譯】A GPU Approach to Particle PhysicsGPUAPP
- [20180510]20 Indexes.txtIndex
- mysql關於FLUSH TABLES和FLUSH TABLES WITH READ LOCK的理解MySql
- PostgreSQL DBA(45) - Hypothetical Indexes in PostgreSQLSQLIndex
- 【轉載】Kano Model — Ways to use it and NOT use it
- MySQL 8 新特性之Invisible IndexesMySqlIndex
- mysqld --skip-grant-tablesMySql
- CRICOS Data Structures and AlgorithmsHash TablesStructGo
- odoo 開發入門教程系列-約束(Constraints)OdooAI
- 題解:UVA124 Following Orders
- nginx useNginx
- [20202117]Function based indexes and cursor sharing.txtFunctionIndex
- How Logs Work On MySQL With InnoDB TablesMySql
- HDU1213-How Many Tables
- The following instances are in the device manifest but not specified in framework compatibility matrix:devFramework
- Android: The following classes could not be instantiated: 解決方法Android
- create_singlethread_workqueue, create_workqueuethread
- [20220414]Function based indexes and cursor sharing2.txtFunctionIndex
- Be better to use NPMNPM
- WireGuard Use Notes
- plsql use skillsSQL
- Moving Tables(貪心演算法)演算法
- the --skip-grant-tables option so it cannot
- [iOS]The following untracked working tree files would be overwritten by mergeiOS
- CBC位元組翻轉攻擊-101ApproachAPP
- Aheadof Time Compilation(AOT) vs (JIT)Just In Time compilation approachAPP
- HV000030: No validator could be found for constraint ‘javax.validation.constraints.Pattern‘ validatiAIJava
- PostgreSQL DBA(159) - pgAdmin(Allow vacuum command to process indexes in paralleSQLIndex
- NotImplementedError: Only the following pseudo-classes are implemented: nth-of-type.Error
- Listener refused the connection with the following error:ORA-12514, TNS:listenerError
- Use PHP7PHP
- efcore This MySqlConnection is already in useMySql
- the NTP socket is in use, exiting
- [Typescript] Use Bitwise FlagsTypeScript