BOS元資料中不小心沒有刪除外來鍵,升級後在查詢分析器中手動刪除表外來鍵
先用如下語句查詢外來鍵:
select a.table_name 外來鍵表名,a.column_name 外來鍵列名,b.table_name 主鍵表名,b.column_name 主鍵列名,a.constraint_name
from
(select a.constraint_name,b.table_name,b.column_name,a.r_constraint_name
from user_constraints a, user_cons_columns b
WHERE a.constraint_type='R'
and a.constraint_name=b.constraint_name
) a,
(select distinct a.r_constraint_name,b.table_name,b.column_name
from user_constraints a, user_cons_columns b
WHERE a.constraint_type='R'
and
a.r_constraint_name=b.constraint_name)
b
where a.r_constraint_name=b.r_constraint_name
order by a.table_name
找到相應外來鍵後,就可以用如下語句操作外來鍵:
1、刪除外來鍵約束
alter table table_name drop constraint constraint_name
2、禁用外來鍵約束
alter table table_name disable constraint constraint_name
3、啟用外來鍵約束
alter table table_name enable constraint constraint_name