After executing CSSCAN some files are generated (.err, .out) informing about the columns that will not fit in the target charset(usually ALxUTFz)and, furthermore, in the host schema CSMIG (@csminst.sql) the same information is stored, so we can use it to generate the modifications needed:
[CAT ]Després de passar el CSSCAN, com a subproducte, i a part dels fitxerets que es generen, queda la mateixa informació a l'esquema CSMIG (s'ha de crear abans de passar el CSSCAN [@csminst.sql]). Doncs aquesta info es pot utilitzar per generar les ordres d'ampliació de les columnes que no hi cabran al nou codi de caràcters.
cat prova.err|grep "Number of Exceptions"|grep -v ": 0"|wc –l
This select produces the instructions for the tables that can't fit in the actual column size:
set linesize 222
SELECT 'ALTER TABLE '||PROP||'.'||TAULA||' MODIFY '
||dba_tab_columns.COLUMN_NAME||' '||
dba_tab_columns.DATA_TYPE||'('||TAMANY||');' DDL
FROM
(select DISTINCT U.USERNAME PROP, O.OBJECT_NAME TAULA,
T.COLUMN_ID COL_ID, max(MAXSIZ) TAMANY
from CSM$COLUMNS C, dba_users U,
dba_objects O, dba_tab_columns T
where C.ERRCNT > 0 and
C.USR#=U.USER_ID and
C.OBJ#=O.OBJECT_ID and
C.COL#=T.COLUMN_ID
group by U.USERNAME, O.OBJECT_NAME, T.COLUMN_ID),
dba_tab_columns
WHERE PROP = dba_tab_columns.OWNER
AND TAULA = dba_tab_columns.TABLE_NAME
AND COL_ID = dba_tab_columns.COLUMN_ID
ORDER BY 1;
EXAMPLE OUTPUT:
ALTER TABLE DMBATCH.TAULA MODIFY NOM_PERSONA_TIT VARCHAR2(54);
....
Thursday, May 12, 2011
Subscribe to:
Posts (Atom)