|
    
- UID
- 61170
- 帖子
- 8123
- 精华
- 1
- 积分
- 16582
- 人气值
- 12496 点
- 努力值
- 21243 点
- 推广注册人数
- 3 个人
- 阅读权限
- 200
- 性别
- 男
- 在线时间
- 692 小时
- 注册时间
- 2008-2-29
- 最后登录
- 2008-11-23
 
|
9楼
发表于 2008-8-13 10:56
| 只看该作者
##*************************************************************##
##获取user_constraints表信息
##*************************************************************##
rm -f ${lv_file_temp1}
sqlplus ${lv_loginfo} <<! >; /dev/null
set colsep ${lv_sep};
set echo off;
set feedback off;
set heading off;
set pagesize 0;
set linesize 1000;
set numwidth 12;
set termout off;
set trimout on;
set trimspool on;
spool ${lv_file_temp1};
select constraint_name,constraint_type,r_constraint_name,search_condition from user_constraints where table_name='${lv_deal_table}' and generated='USER NAME' order by constraint_type;
spool off;
exit
!
cat ${lv_file_temp1}|grep -v "^SQL>;"|grep -v "^$"|grep -v "rows selected"|sed "s/$/\|/g" |sed -e "s/ *\|/\|/g" >; ${lv_file_tab_con}
if [ -s ${lv_file_tab_con} ]
then
f_generate_tab_constraint
fi
rm -f ${lv_file_temp1}
rm -f ${lv_file_tab_con}
##*************************************************************##
##获取user_indexes表信息
##*************************************************************##
rm -f ${lv_file_temp1}
sqlplus ${lv_loginfo} <<! >; /dev/null
set colsep ${lv_sep};
set echo off;
set feedback off;
set heading off;
set pagesize 0;
set linesize 1000;
set numwidth 12;
set termout off;
set trimout on;
set trimspool on;
spool ${lv_file_temp1};
select index_name,uniqueness,tablespace_name from user_indexes where table_name='${lv_deal_table}' and index_name not in(select constraint_name from user_constraints where table_name='${lv_deal_table}');
spool off;
exit
!
cat ${lv_file_temp1}|grep -v "^SQL>;"|grep -v "^$"|grep -v "rows selected"|sed "s/$/\|/g" |sed -e "s/ *\|/\|/g" >; ${lv_file_tab_ind}
if [ -s ${lv_file_tab_ind} ]
then
f_generate_tab_index
fi
rm -f ${lv_file_temp1}
rm -f ${lv_file_temp2}
rm -f ${lv_file_temp3}
rm -f ${lv_file_tab_col}
rm -f ${lv_file_col_con}
rm -f ${lv_file_tab_ind}
rm -f ${lv_file_col_ind}
}
################################################################################ |
|