![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi, I've written a quick script (below) to go through and dump the DDL for each users objects in their schema to a log file on disk. The script runs fine except for a couple of small things. First, for certain Packages I am getting this error: PACKAGE - LOAD_ZN - ORA-06502: PL/SQL: numeric or value error PACKAGE_BODY - LOAD_ZN - ORA-06502: PL/SQL: numeric or value error You'll see in the script I select the data into a CLOB data type. These packages are only like 3000 or 4000 lines, so I am not sure why I am getting this error since a CLOB should handle up to 4GB, right? |
|
Here is the actual script: DECLARE v_ddl CLOB; v_file_id UTL_FILE.FILE_TYPE; |
|
UTL_FILE.PUT_LINE(v_file_id,CHR(10)||CHR(10)||v_dd l||CHR(10)|| CHR(10)); |
#3
| |||
| |||
|
|
Hi, Am 25.10.2011 20:22, schrieb ExecMan: Hi, I've written a quick script (below) to go through and dump the DDL for each users objects in their schema to a log file on disk. *The script runs fine except for a couple of small things. First, for certain Packages I am getting this error: PACKAGE - LOAD_ZN - ORA-06502: PL/SQL: numeric or value error PACKAGE_BODY - LOAD_ZN - ORA-06502: PL/SQL: numeric or value error You'll see in the script I select the data into a CLOB data type. These packages are only like 3000 or 4000 lines, so I am not sure why I am getting this error since a CLOB should handle up to 4GB, right? [...] Here is the actual script: DECLARE v_ddl * * * * CLOB; v_file_id * * UTL_FILE.FILE_TYPE; [...] * * * * *UTL_FILE.PUT_LINE(v_file_id,CHR(10)||CHR(10)||v_d dl||CHR(10)|| CHR(10)); Your call to UTL_FILE.PUT_LINE typecasts the expression with v_ddl from CLOB to VARCHAR2; this can only hold 32767 bytes/characters (depending on your NLS_LENGTH_SEMANTICS). Most likely the code you dump is larger than 32K, no? Also, DBMS_METADATA will deliver CLOBs which already contain line breaks. UTL_FILE.PUT_LINE, otoh, will also add a (superflouos) line break after each call, which you don't want in this case. Regards Peter -- The only way to keep your health is to eat what you don't want, drink what you don't like, and do what you'd rather not. -- Mark Twain |
#4
| |||
| |||
|
|
Also, tables with Nested Tables give me this error on the actual Nested Table entry: TABLE - ANN_BAL_SHEET - ORA-31603: object "ANN_BAL_SHEET" of type TABLE not found in schema "DATA_HOLDER" |
#5
| |||
| |||
|
|
On Tue, 25 Oct 2011 11:22:38 -0700, ExecMan wrote: Also, tables with Nested Tables give me this error on the actual Nested Table entry: TABLE - ANN_BAL_SHEET - ORA-31603: object "ANN_BAL_SHEET" of type TABLE not found in schema "DATA_HOLDER" You should filter out nested tables, using something like this: SELECT DBMS_METADATA.GET_DDL('TABLE',u.table_name) * * *FROM USER_TABLES u * * *WHERE u.nested='NO' USER_TABLES view has a column which describes whether it's a nested table or not. SQL> desc user_tables *Name * * * * * * * * * * * * * * * * * * *Null? * *Type *----------------------------------------- -------- ---------------------------- *TABLE_NAME * * * * * * * * * * * * * * * *NOT NULL VARCHAR2(30) *TABLESPACE_NAME * * * * * * * * * * * * * * * * * *VARCHAR2(30) *CLUSTER_NAME * * * * * * * * * * * * * * * * * * * VARCHAR2(30) *IOT_NAME * * * * * * * * * * * * * * * * * * * * * VARCHAR2(30) *STATUS * * * * * * * * * * * * * * * * * * * * * * VARCHAR2(8) *PCT_FREE * * * * * * * * * * * * * * * * * * * * * NUMBER *PCT_USED * * * * * * * * * * * * * * * * * * * * * NUMBER *INI_TRANS * * * * * * * * * * * * * * * * * * * * *NUMBER *MAX_TRANS * * * * * * * * * * * * * * * * * * * * *NUMBER *INITIAL_EXTENT * * * * * * * * * * * * * * * * * * NUMBER *NEXT_EXTENT * * * * * * * * * * * * * * * * * * * *NUMBER *MIN_EXTENTS * * * * * * * * * * * * * * * * * * * *NUMBER *MAX_EXTENTS * * * * * * * * * * * * * * * * * * * *NUMBER *PCT_INCREASE * * * * * * * * * * * * * * * * * * * NUMBER *FREELISTS * * * * * * * * * * * * * * * * * * * * *NUMBER *FREELIST_GROUPS * * * * * * * * * * * * * * * * * *NUMBER *LOGGING * * * * * * * * * * * * * * * * * * * * * *VARCHAR2(3) *BACKED_UP * * * * * * * * * * * * * * * * * * * * *VARCHAR2(1) *NUM_ROWS * * * * * * * * * * * * * * * * * * * * * NUMBER *BLOCKS * * * * * * * * * * * * * * * * * * * * * * NUMBER *EMPTY_BLOCKS * * * * * * * * * * * * * * * * * * * NUMBER *AVG_SPACE * * * * * * * * * * * * * * * * * * * * *NUMBER *CHAIN_CNT * * * * * * * * * * * * * * * * * * * * *NUMBER *AVG_ROW_LEN * * * * * * * * * * * * * * * * * * * *NUMBER *AVG_SPACE_FREELIST_BLOCKS * * * * * * * * * * * * *NUMBER *NUM_FREELIST_BLOCKS * * * * * * * * * * * * * * * *NUMBER *DEGREE * * * * * * * * * * * * * * * * * * * * * * VARCHAR2(40) *INSTANCES * * * * * * * * * * * * * * * * * * * * *VARCHAR2(40) *CACHE * * * * * * * * * * * * * * * * * * * * * * *VARCHAR2(20) *TABLE_LOCK * * * * * * * * * * * * * * * * * * * * VARCHAR2(8) *SAMPLE_SIZE * * * * * * * * * * * * * * * * * * * *NUMBER *LAST_ANALYZED * * * * * * * * * * * * * * * * * * *DATE *PARTITIONED * * * * * * * * * * * * * * * * * * * *VARCHAR2(3) *IOT_TYPE * * * * * * * * * * * * * * * * * * * * * VARCHAR2(12) *TEMPORARY * * * * * * * * * * * * * * * * * * * * *VARCHAR2(1) *SECONDARY * * * * * * * * * * * * * * * * * * * * *VARCHAR2(1) *NESTED * * * * * * * * * * * * * * * * * * * * * * VARCHAR2(3) *BUFFER_POOL * * * * * * * * * * * * * * * * * * * *VARCHAR2(7) *FLASH_CACHE * * * * * * * * * * * * * * * * * * * *VARCHAR2(7) *CELL_FLASH_CACHE * * * * * * * * * * * * * * * * * VARCHAR2(7) *ROW_MOVEMENT * * * * * * * * * * * * * * * * * * * VARCHAR2(8) *GLOBAL_STATS * * * * * * * * * * * * * * * * * * * VARCHAR2(3) *USER_STATS * * * * * * * * * * * * * * * * * * * * VARCHAR2(3) *DURATION * * * * * * * * * * * * * * * * * * * * * VARCHAR2(15) *SKIP_CORRUPT * * * * * * * * * * * * * * * * * * * VARCHAR2(8) *MONITORING * * * * * * * * * * * * * * * * * * * * VARCHAR2(3) *CLUSTER_OWNER * * * * * * * * * * * * * * * * * * *VARCHAR2(30) *DEPENDENCIES * * * * * * * * * * * * * * * * * * * VARCHAR2(8) *COMPRESSION * * * * * * * * * * * * * * * * * * * *VARCHAR2(8) *COMPRESS_FOR * * * * * * * * * * * * * * * * * * * VARCHAR2(12) *DROPPED * * * * * * * * * * * * * * * * * * * * * *VARCHAR2(3) *READ_ONLY * * * * * * * * * * * * * * * * * * * * *VARCHAR2(3) *SEGMENT_CREATED * * * * * * * * * * * * * * * * * *VARCHAR2(3) *RESULT_CACHE * * * * * * * * * * * * * * * * * * * VARCHAR2(7) SQL --http://mgogala.byethost5.com |
#6
| |||
| |||
|
|
So, CONSENSUS_RECOMMENDATIONS appears in the data dictionary as a TABLE, but it is not a table.......it just appears in DBA_OBJECTS as a table type, but then cannot be matched to DBA_TABLES. Any easy way to ignore this? Much thanks for your time. |
#7
| |||
| |||
|
|
On Wed, 26 Oct 2011 08:39:05 -0700, ExecMan wrote: So, CONSENSUS_RECOMMENDATIONS appears in the data dictionary as a TABLE, but it is not a table.......it just appears in DBA_OBJECTS as a table type, but then cannot be matched to DBA_TABLES. Any easy way to ignore this? Much thanks for your time. There are two ways: 1) Avoid nested tables, by specifying the "NESTED" flag, as shown in * *the example query. 2) Use USER_SEGMENTS instead of the USER_TABLES and specify * *SEGMENT_TYPE='TABLE'. Nested tables do not have separate table * *segments. --http://mgogala.byethost5.com |
#8
| |||
| |||
|
|
On Wed, 26 Oct 2011 08:39:05 -0700, ExecMan wrote: So, CONSENSUS_RECOMMENDATIONS appears in the data dictionary as a TABLE, but it is not a table.......it just appears in DBA_OBJECTS as a table type, but then cannot be matched to DBA_TABLES. Any easy way to ignore this? Much thanks for your time. There are two ways: 1) Avoid nested tables, by specifying the "NESTED" flag, as shown in * *the example query. 2) Use USER_SEGMENTS instead of the USER_TABLES and specify * *SEGMENT_TYPE='TABLE'. Nested tables do not have separate table * *segments. --http://mgogala.byethost5.com |
![]() |
| Thread Tools | |
| Display Modes | |
| |