Foreign key创建前提 Primay key 可以disable,但必须要有

SQL>

SQL> alter table A

2 drop constraint ABCD primary key (A)

3 disable

4 novalidate;

alter table A

drop constraint ABCD primary key (A)

disable

novalidate

ORA-01735: invalid ALTER TABLE option

SQL>

SQL> alter table A

2 drop constraint ABCD primary key (A)

3 disable

4 novalidate;

alter table A

drop constraint ABCD primary key (A)

disable

novalidate

ORA-01735: invalid ALTER TABLE option

SQL>

SQL> alter table A

2 drop constraint ABCD

3 ;

alter table A

drop constraint ABCD

ORA-02273: this unique/primary key is referenced by some foreign keys

SQL>

SQL> alter table B

2 drop constraint abc

3 ;

alter table B

add constraint abc

ORA-00931: missing identifier

SQL> alter table B drop constraint abc;

Table altered

SQL>

SQL> alter table B

2 add constraint abc foreign key (A)

3 references a (A)

4 disable

5 novalidate;

Table altered

SQL> alter table B drop constraint abc;

Table altered

SQL> alter table A drop constraint ABCD;

Table altered

SQL> alter table B add constraint abc foreign key (A) references a (A) disable novalidate;

alter table B add constraint abc foreign key (A) references a (A) disable novalidate

ORA-02270: no matching unique or primary key for this column-list

SQL>

SQL> alter table A

2 add constraint ABCD primary key (A)

3 disable

4 novalidate;

Table altered

SQL> alter table B add constraint abc foreign key (A) references a (A) disable novalidate;

Table altered

SQL>

相关推荐
lusklusklusk1 小时前
SQL Server 为什么普通 SELECT 会阻塞 UPDATE?——行级 S 锁到表级 S 锁的锁升级原理与实验验证
数据库·mysql·oracle
瑶总迷弟1 小时前
银河麒麟 V10 ARM64 安装 Oracle 19c 静默部署操作手册
数据库·oracle
lusklusklusk17 小时前
Python 巡检脚本:进程运行状态、数据库写入时效检查及邮件通知与告警
数据库·python·oracle
悟道书生1 天前
Kingbase数据库使用命令来执行init.sql(包含建库建表语句)
数据库·oracle
晴天¥1 天前
记一次Oracle 归档进程卡死怎么去有效排查
数据库·oracle
梦幻通灵1 天前
MybatisPlus使用数据库递增ID实现方案【持续更新】
数据库·oracle
海鸥-w2 天前
数据库冗余字段设计笔记
java·数据库·笔记·oracle
实泽有之,无泽虚之2 天前
ORA-12514:TNS:监听程序当前无法识别连接描述符中请求的服务问题原因及解决办法
数据库·oracle
程序员塔塔喵2 天前
【MySQL篇|第十篇】深分页问题
数据库·oracle·深分页问题
qq_452396232 天前
第八篇:《VACUUM、自动清理与膨胀治理》
jvm·数据库·oracle