2026-03-12 20:23:15
This commit is contained in:
27
timhall/constraints/disable_chk.sql
Normal file
27
timhall/constraints/disable_chk.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/constraints/disable_chk.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Disables all check constraints for a specified table, or all tables.
|
||||
-- Call Syntax : @disable_chk (table-name or all) (schema-name)
|
||||
-- Last Modified: 28/01/2001
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET PAGESIZE 0
|
||||
SET FEEDBACK OFF
|
||||
SET VERIFY OFF
|
||||
|
||||
SPOOL temp.sql
|
||||
|
||||
SELECT 'ALTER TABLE "' || a.table_name || '" DISABLE CONSTRAINT "' || a.constraint_name || '";'
|
||||
FROM all_constraints a
|
||||
WHERE a.constraint_type = 'C'
|
||||
AND a.owner = UPPER('&2');
|
||||
AND a.table_name = DECODE(UPPER('&1'),'ALL',a.table_name,UPPER('&1'));
|
||||
|
||||
SPOOL OFF
|
||||
|
||||
-- Comment out following line to prevent immediate run
|
||||
@temp.sql
|
||||
|
||||
SET PAGESIZE 14
|
||||
SET FEEDBACK ON
|
||||
SET VERIFY ON
|
||||
27
timhall/constraints/disable_fk.sql
Normal file
27
timhall/constraints/disable_fk.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/constraints/disable_fk.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Disables all Foreign Keys belonging to the specified table, or all tables.
|
||||
-- Call Syntax : @disable_fk (table-name or all) (schema-name)
|
||||
-- Last Modified: 28/01/2001
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET PAGESIZE 0
|
||||
SET FEEDBACK OFF
|
||||
SET VERIFY OFF
|
||||
|
||||
SPOOL temp.sql
|
||||
|
||||
SELECT 'ALTER TABLE "' || a.table_name || '" DISABLE CONSTRAINT "' || a.constraint_name || '";'
|
||||
FROM all_constraints a
|
||||
WHERE a.constraint_type = 'R'
|
||||
AND a.table_name = DECODE(Upper('&1'),'ALL',a.table_name,Upper('&1'))
|
||||
AND a.owner = Upper('&2');
|
||||
|
||||
SPOOL OFF
|
||||
|
||||
-- Comment out following line to prevent immediate run
|
||||
@temp.sql
|
||||
|
||||
SET PAGESIZE 14
|
||||
SET FEEDBACK ON
|
||||
SET VERIFY ON
|
||||
27
timhall/constraints/disable_pk.sql
Normal file
27
timhall/constraints/disable_pk.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/constraints/disable_pk.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Disables the Primary Key for the specified table, or all tables.
|
||||
-- Call Syntax : @disable_pk (table-name or all) (schema-name)
|
||||
-- Last Modified: 28/01/2001
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET PAGESIZE 0
|
||||
SET FEEDBACK OFF
|
||||
SET VERIFY OFF
|
||||
|
||||
SPOOL temp.sql
|
||||
|
||||
SELECT 'ALTER TABLE "' || a.table_name || '" DISABLE PRIMARY KEY;'
|
||||
FROM all_constraints a
|
||||
WHERE a.constraint_type = 'P'
|
||||
AND a.owner = Upper('&2')
|
||||
AND a.table_name = DECODE(Upper('&1'),'ALL',a.table_name,Upper('&1'));
|
||||
|
||||
SPOOL OFF
|
||||
|
||||
-- Comment out following line to prevent immediate run
|
||||
@temp.sql
|
||||
|
||||
SET PAGESIZE 14
|
||||
SET FEEDBACK ON
|
||||
SET VERIFY ON
|
||||
30
timhall/constraints/disable_ref_fk.sql
Normal file
30
timhall/constraints/disable_ref_fk.sql
Normal file
@@ -0,0 +1,30 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/constraints/disable_ref_fk.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Disables all Foreign Keys referencing a specified table, or all tables.
|
||||
-- Call Syntax : @disable_ref_fk (table-name) (schema-name)
|
||||
-- Last Modified: 28/01/2001
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET PAGESIZE 0
|
||||
SET FEEDBACK OFF
|
||||
SET VERIFY OFF
|
||||
|
||||
SPOOL temp.sql
|
||||
|
||||
SELECT 'ALTER TABLE "' || a.table_name || '" DISABLE CONSTRAINT "' || a.constraint_name || '";' enable_constraints
|
||||
FROM all_constraints a
|
||||
WHERE a.owner = Upper('&2')
|
||||
AND a.constraint_type = 'R'
|
||||
AND a.r_constraint_name IN (SELECT a1.constraint_name
|
||||
FROM all_constraints a1
|
||||
WHERE a1.table_name = DECODE(Upper('&1'),'ALL',a.table_name,Upper('&1'))
|
||||
AND a1.owner = Upper('&2'));
|
||||
|
||||
SPOOL OFF
|
||||
|
||||
-- Comment out following line to prevent immediate run
|
||||
@temp.sql
|
||||
|
||||
SET PAGESIZE 14
|
||||
SET FEEDBACK ON
|
||||
SET VERIFY ON
|
||||
27
timhall/constraints/enable_chk.sql
Normal file
27
timhall/constraints/enable_chk.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/constraints/enable_chk.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Enables all check constraints for a specified table, or all tables.
|
||||
-- Call Syntax : @enable_chk (table-name or all) (schema-name)
|
||||
-- Last Modified: 28/01/2001
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET PAGESIZE 0
|
||||
SET FEEDBACK OFF
|
||||
SET VERIFY OFF
|
||||
|
||||
SPOOL temp.sql
|
||||
|
||||
SELECT 'ALTER TABLE "' || a.table_name || '" ENABLE CONSTRAINT "' || a.constraint_name || '";'
|
||||
FROM all_constraints a
|
||||
WHERE a.constraint_type = 'C'
|
||||
AND a.owner = Upper('&2');
|
||||
AND a.table_name = DECODE(Upper('&1'),'ALL',a.table_name,UPPER('&1'));
|
||||
|
||||
SPOOL OFF
|
||||
|
||||
-- Comment out following line to prevent immediate run
|
||||
@temp.sql
|
||||
|
||||
SET PAGESIZE 14
|
||||
SET FEEDBACK ON
|
||||
SET VERIFY ON
|
||||
27
timhall/constraints/enable_fk.sql
Normal file
27
timhall/constraints/enable_fk.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/constraints/enable_fk.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Enables all Foreign Keys belonging to the specified table, or all tables.
|
||||
-- Call Syntax : @enable_fk (table-name or all) (schema-name)
|
||||
-- Last Modified: 28/01/2001
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET PAGESIZE 0
|
||||
SET FEEDBACK OFF
|
||||
SET VERIFY OFF
|
||||
|
||||
SPOOL temp.sql
|
||||
|
||||
SELECT 'ALTER TABLE "' || a.table_name || '" ENABLE CONSTRAINT "' || a.constraint_name || '";'
|
||||
FROM all_constraints a
|
||||
WHERE a.constraint_type = 'R'
|
||||
AND a.table_name = DECODE(Upper('&1'),'ALL',a.table_name,Upper('&1'))
|
||||
AND a.owner = Upper('&2');
|
||||
|
||||
SPOOL OFF
|
||||
|
||||
-- Comment out following line to prevent immediate run
|
||||
@temp.sql
|
||||
|
||||
SET PAGESIZE 14
|
||||
SET FEEDBACK ON
|
||||
SET VERIFY ON
|
||||
27
timhall/constraints/enable_pk.sql
Normal file
27
timhall/constraints/enable_pk.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/constraints/enable_pk.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Enables the Primary Key for the specified table, or all tables.
|
||||
-- Call Syntax : @disable_pk (table-name or all) (schema-name)
|
||||
-- Last Modified: 28/01/2001
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET PAGESIZE 0
|
||||
SET FEEDBACK OFF
|
||||
SET VERIFY OFF
|
||||
|
||||
SPOOL temp.sql
|
||||
|
||||
SELECT 'ALTER TABLE "' || a.table_name || '" ENABLE PRIMARY KEY;'
|
||||
FROM all_constraints a
|
||||
WHERE a.constraint_type = 'P'
|
||||
AND a.owner = Upper('&2')
|
||||
AND a.table_name = DECODE(Upper('&1'),'ALL',a.table_name,Upper('&1'));
|
||||
|
||||
SPOOL OFF
|
||||
|
||||
-- Comment out following line to prevent immediate run
|
||||
@temp.sql
|
||||
|
||||
SET PAGESIZE 14
|
||||
SET FEEDBACK ON
|
||||
SET VERIFY ON
|
||||
30
timhall/constraints/enable_ref_fk.sql
Normal file
30
timhall/constraints/enable_ref_fk.sql
Normal file
@@ -0,0 +1,30 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/constraints/enable_ref_fk.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Enables all Foreign Keys referencing a specified table, or all tables.
|
||||
-- Call Syntax : @enable_ref_fk (table-name) (schema-name)
|
||||
-- Last Modified: 28/01/2001
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET PAGESIZE 0
|
||||
SET FEEDBACK OFF
|
||||
SET VERIFY OFF
|
||||
|
||||
SPOOL temp.sql
|
||||
|
||||
SELECT 'ALTER TABLE "' || a.table_name || '" ENABLE CONSTRAINT "' || a.constraint_name || '";'
|
||||
FROM all_constraints a
|
||||
WHERE a.owner = Upper('&2')
|
||||
AND a.constraint_type = 'R'
|
||||
AND a.r_constraint_name IN (SELECT a1.constraint_name
|
||||
FROM all_constraints a1
|
||||
WHERE a1.table_name = DECODE(Upper('&1'),'ALL',a.table_name,Upper('&1'))
|
||||
AND a1.owner = Upper('&2'));
|
||||
|
||||
SPOOL OFF
|
||||
|
||||
-- Comment out following line to prevent immediate run
|
||||
@temp.sql
|
||||
|
||||
SET PAGESIZE 14
|
||||
SET FEEDBACK ON
|
||||
SET VERIFY ON
|
||||
Reference in New Issue
Block a user