您的位置:首页 > 编程语言 > ASP

中文VS2008 安装ASP.NET MVC框架问题(没有MVC模板)

2011-04-18 14:11 836 查看
1) Find the violate constraint rows in your Oracle DB.

As we known, "enable validate", "enable" for new values, "validate" for old values to

make constraints work. If you Oracle DB default option is enable and novalidate, then

you want to modify to enable and validate so that make all data confirm some constraints

. Unfortunatly, may you find some data real violate constraints, however, you could not

find where it is. So following method could help you.

It is not a big deal, I just write it down to a shell script.

1@@@@ Here, I write a shell scirpt to make it work

[oracle@station78 ~]$ cat ./check_violate_constraint_rows.sh

#!/bin/sh

#please intput $1 table_name, $2 constraint_name

read -p "Please input table name (like hr.employees): " tab

read -p "Please input constraint name(like chk_xxx): " cons

sqlplus / as sysdba<< EOF > violate_constraint_rows.txt

DROP TABLE exceptions PURGE;

@\$ORACLE_HOME/rdbms/admin/utlexpt1.sql

ALTER TABLE $tab ENABLE VALIDATE CONSTRAINT $cons EXCEPTIONS INTO EXCEPTIONS;

SELECT * FROM $tab WHERE ROWID IN (SELECT row_id FROM exceptions);

EOF

echo " "

echo "You could check the output file violate_constraint_rows.txt !!! "

echo "Find the violate constraint rows, and do something."

echo " "

@@@Usage Example

[oracle@station78 ~]$ ./check_violate_constraint_rows.sh

Please input table name (like hr.employees): test.t_trainsupport_executions

Please input constraint name(like chk_xxx): CHK_TRAINSUPPORT_EXEC_CUSTFAC

You could check the output file violate_constraint_rows.txt !!!

Find the violate constraint rows, and do something.

[oracle@station78 ~]$ cat violate_constraint_rows.txt

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Dec 31 15:15:05 2012

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production

With the Partitioning, OLAP and Data Mining options

SYS@ocm>

Table dropped.

SYS@ocm>

Table created.

SYS@ocm>

Table altered.

SYS@ocm>

no rows selected

SYS@ocm> Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production

With the Partitioning, OLAP and Data Mining options

2@@@@ Here I write a sql script to make it work.

SYS@ocm> !cat x.sql

DROP TABLE exceptions PURGE;

@\$ORACLE_HOME/rdbms/admin/utlexpt1.sql

ALTER TABLE &&table_name

ENABLE VALIDATE CONSTRAINT &constraint_name

EXCEPTIONS INTO EXCEPTIONS;

SELECT * FROM &table_name WHERE ROWID IN (SELECT row_id FROM exceptions);

@@@Usage Example:

SYS@ocm> @x.sql

Table dropped.

Table created.

Enter value for table_name: test.t_trainsupport_executions

old 1: ALTER TABLE &&table_name

new 1: ALTER TABLE test.t_trainsupport_executions

Enter value for constraint_name: CHK_TRAINSUPPORT_EXEC_CUSTFAC

old 2: ENABLE VALIDATE CONSTRAINT &constraint_name

new 2: ENABLE VALIDATE CONSTRAINT CHK_TRAINSUPPORT_EXEC_CUSTFAC

Table altered.

old 1: SELECT * FROM &table_name WHERE ROWID IN (SELECT row_id FROM exceptions)

new 1: SELECT * FROM test.t_trainsupport_executions WHERE ROWID IN (SELECT row_id FROM exceptions)

no rows selected

本文出自 “Oracle+Linux=>Majesty” 博客,请务必保留此出处http://majesty.blog.51cto.com/3493901/1107602
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: