Utl_recomp vs. dbms_utility.recompile_schema
Hi
what is the difference between utl_recomp and dbms_utility.recompile_schema?
I am using dbms_utility until now, which will recompile only invalid objects in the proper order for you. But I have seen many admins, using UTL_RECOMP instead.
Thanks in advance,
Xenofon
There is no difference:
quote from the documentation
>
Note That This Subprogram Is A Wrapper For RECOMP_SERIAL Procedure
Included With The UTL_RECOMP Package.
Similar Messages
-
How to use DBMS_UTILITY.GET_TIME?
I am using DBMS_UTILITY.GET_TIME to calculate the performance of my procedures.
its returning the values before and after the execution of my procedure. How to get the difference in seconds?
Currently i am dividing the difference by 1000.Is it correct?
-RamSorry to disturb you all again..
Declare
l_start number;
l_end number;
l_diff number;
Begin
l_start := DBMS_UTILITY.GET_TIME ;
For i in 1..100 loop
Dbms_output.put_line('gjksdk');
end loop;
l_end := DBMS_UTILITY.GET_TIME ;
l_diff := (l_end-l_start)/100;
Dbms_output.put_line('Elapsed Time'|| l_diff ||'secs');
END;
I tried like the above PL/SQL block.
It printed the output like
gjksdk-100times
Elapsed Time0secs
But i assume that there will be atleast some fraction of seconds to print that data.Why did it returned 0 Secs.
Anything mistake in my side? If please can u help me to get that time? -
DBMS_UTILITY.FORMAT_ERROR_BACKTRACE in 9i
Hello,
I have a procedure that calls a lot of procedures, functions, packages in 9i database.
I'm trying to send an email with the error information whenever an error prevents the procedure to execute with success.
I searched something about this and i'm using this code for trapping the possible error:
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('ERROR');
DBMS_OUTPUT.PUT_LINE ('error code ' || SQLCODE);
DBMS_OUTPUT.PUT_LINE ('error MESSAGE ' || SQLERRM);
DBMS_OUTPUT.PUT_LINE ('ERROR STACK:' ||DBMS_UTILITY.FORMAT_ERROR_STACK);
END;
But in this information is missing the exactly program (function, procedure or package) and line number.
I could do this using
DBMS_OUTPUT.PUT_LINE ('ERROR BACKTRACE:' || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE);
But i think is not available on database 9i.
How can i get this kind of result in database 9i?
Thank you.
RuteHello,
the DBMS_UTILITY.FORMAT_CALL_STACK gives me:
ERROR STACK:ORA-01407: cannot update ("DVA2"."P1ALLA"."CFASTC") to NULL
ERROR STACK:----- PL/SQL Call Stack -----
object line object
handle number
name
66D1BDD4 453 procedure DVA2.P1053FCLNV
655EEB28 2 anonymous block
That gives me the error "ORA-01407: cannot update ("DVA2"."P1ALLA"."CFASTC") to NULL", gives the name and line in the principal procedure "453 procedure DVA2.P1053FCLNV" but it does not give the name of the package where the error ocurred!
There is anything else?
Thank you. -
Cannot compile body of dbms_utility without its specification
hi there!
I just got this error on my 11g EE database
yesterday had power problems, and the backup batery did not work(but it happens very often)
today, trying to send email with a job, i realized through TOAD that sys has 304 invalid objects.
Try to compile and it seems something missing.
"cannot compile body of dbms_utility without its specification"
I cant find that specification and no forums found related to this.
need help from experts..
S.O. Oracle enterprise linux 4.7
D.B. Oracle Enterprise 11.2
thanks!Virendra, thanks for your time, this is the output
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> ALTER PACKAGE SYS.DBMS_UTILITY COMPILE;
show errors
ALTER PACKAGE SYS.DBMS_UTILITY COMPILE BODY;
show errors
Warning: Package altered with compilation errors.
SQL> Errors for PACKAGE SYS.DBMS_UTILITY:
LINE/COL ERROR
262/75 PLS-00103: Encountered the symbol "end-of-file" when expecting
one of the following:
end function pragma procedure subtype type <an identifier>
<a double-quoted delimited-identifier> current cursor delete
exists prior
SQL>
Warning: Package Body altered with compilation errors.
SQL> -
Error in execute DBMS_UTILITY.ANALYZE_SCHEMA
Hi..
i'm trying to execute this procedure in my script and got the following error:
exec DBMS_UTILITY.ANALYZE_SCHEMA(b,'COMPUTE');
ERROR at line 19:
ORA-06550: line 19, column 10:
PLS-00103: Encountered the symbol "DBMS_UTILITY" when expecting one of the
following:
:= . ( @ % ;
The symbol ":=" was substituted for "DBMS_UTILITY" to continue.
ORA-06550: line 19, column 52:
PLS-00103: Encountered the symbol "/" when expecting one of the following:
Message was edited by:
DicipuloferThe part my script that call it:
declare
TYPE lista_usuario_rec IS RECORD
usuario VARCHAR2(50)
TYPE lista_usuarios IS TABLE OF lista_usuario_rec INDEX BY BINARY_INTEGER;
cursor usr_banco is select username from dba_users where username not in ('SYS','SYSTEM','OUTLN','DBSNMP','TRACESVR','BKPORCL','PERFSTAT','PROC');
lst_usr lista_usuarios;
contador NUMBER;
b varchar2(30);
begin
contador:=0;
for usr_rec in usr_banco loop
lst_usr(contador).usuario := usr_rec.username;
contador := contador + 1;
end loop;
for i in 1 .. contador-1 loop
b:=lst_usr(i).usuario;
exec DBMS_UTILITY.ANALYZE_SCHEMA(b,'COMPUTE'); // mesma coisa
end loop;
end;
execute immediate 'UPDATE logix.path_logix_v2 SET nom_caminho = ' ||&1|| Lower (cod_sistema) || '/';
begin
if '&2' = 'hml' then
UPDATE logixexp.tb_usuarios SET dsc_caminho_fatura= 'C:\Arquivos de Programas\Logixexphml' WHERE cod_nivel_usuario = 4;
UPDATE logixexp.tb_usuarios SET dsc_caminho_fatura= '\\red\usuarios\logixexphml\' WHERE cod_nivel_usuario <> 4;
UPDATE logix.empresa SET den_empresa='ELFUSA *** BANCO DE DADOS HML ***' WHERE den_empresa LIKE 'ELFUSA GERAL DE ELETROFUSA%';
else
UPDATE logixexp.tb_usuarios SET dsc_caminho_fatura='C:\Arquivos de Programas\Logixexptst' WHERE cod_nivel_usuario = 4;
UPDATE logixexp.tb_usuarios SET dsc_caminho_fatura='\\red\usuarios\logixexptst\' WHERE cod_nivel_usuario <> 4;
UPDATE logix.empresa SET den_empresa='ELFUSA *** BANCO DE DADOS TESTE ***' WHERE den_empresa LIKE 'ELFUSA GERAL DE ELETROFUSA%';
end if;
end;
exit -
Hello Oracle-Experts,
I had to calculate hash-values for a corrorponding CLOB-field (see my post 'Buffer to small ORA-22835 error after migration from 9i to 10g' in forum 'database general').
I calculate the hash-values with the DBMS_UTILITY.GET_HASH_VALUE, e.g:
SQL> SELECT DBMS_UTILITY.GET_HASH_VALUE(LPAD('X',3998,'X'),1,POWER(2,30)) FROM dual;
DBMS_UTILITY.GET_HASH_VALUE(LPAD('X',3998,'X'),1,POWER(2,30))
1053896858
Because the calculation failed with 10g I had taken a closer look at this function and realised the following results:
VALUE DBMS_UTILITY.GET_HASH_VALUE(VALUE,1,POWER(2,30))
LPAD('X',3997,'X') 557754150
LPAD('X',3998,'X') 1053896858
LPAD('X',3999,'X') 888036750
LPAD('X',4000,'X') 162062978
LPAD('X',4001,'X') 162062978
LPAD('X',4002,'X') 162062978
LPAD('X',10000,'X') 162062978
It seems to me that I can't use this function for clob-values with a length greater than 4000 characters because of collisions. Maybe someone with experience
can give me a hint to handle this problem. Worst case i had to write my own CLOB_2_HASH function.
TIA + Best regards
MatthiasYeah, the 4000-byte limit would be a factor in working CLOBs. I if you only had 4000 bytes you would not need a CLOB in the first place.
If you don't find something better then writing your own function might be the thing to do. -
FOR loop messes up the DBMS_UTILITY.FORMAT_ERROR_BACKTRACE
Hello!
I've encountered the following problem which could be resolved for now
by eliminating FOR loop, but that's not a good solution.
The problem is that if some exception is raised inside the `for' loop
with cursor, and the outer block contains exception handler with
`format_error_backtrace' call, the last one shows not the exact line
where the exception was raised, but the loop beginning. Let me show
you.
The next block loops over some table and tries to assign one of the
field's value to local variable with intentionally low
precision. Please look at line where exception is raised:
========================================
SQL> ed
Wrote file afiedt.buf
1 declare
2 x number(1);
3 begin
4 for x_r in (select xlong from xtable)
5 loop
6 dbms_output.put_line('Processing... '|| x_r.xlong);
7 x := x_r.xlong;
8 end loop;
9* end;
SQL> /
Processing... 611911
declare
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: number precision too large
ORA-06512: at line 7========================================
Next, I'll put exception handler with `format_error_message' call in
it:
========================================
SQL> ed
Wrote file afiedt.buf
1 declare
2 x number(1);
3 begin
4 for x_r in (select xlong from xtable)
5 loop
6 dbms_output.put_line('Processing... '|| x_r.xlong);
7 x := x_r.xlong;
8 end loop;
9 exception
10 when others then
11 dbms_output.put_line(dbms_utility.format_error_backtrace);
12* end;
SQL> /
Processing... 611911
ORA-06512: at line 4========================================
Now look how line number changed; instead of 7'th line it is 4'th
now -- at the beginning of the loop.
Now, let's expand this loop into explicit open/fetch/close sequence:
========================================
SQL> ed
Wrote file afiedt.buf
1 declare
2 x number(1);
3 cursor x_c is select xlong from xtable;
4 x_r x_c%rowtype;
5 begin
6 open x_c;
7 loop
8 fetch x_c into x_r;
9 exit when x_c%notfound;
10 dbms_output.put_line('Processing... '|| x_r.xlong);
11 x := x_r.xlong;
12 end loop;
13 close x_c;
14 exception
15 when others then
16 dbms_output.put_line(dbms_utility.format_error_backtrace);
17* end;
SQL> /
Processing... 611911
ORA-06512: at line 11========================================
Here we see that line number where exception was raised is now
correct!
I suppose the problem is in some hidden exception handling behind the
`for' loop execution. Any help will be appreciated, thanks in advance!
Message was edited by:
uj2uj2,
I think the reason is probably PL/SQL optimisation. Because you are using backtrace, it means you are on 10g. This means you have an automatic PLSQL_OPTIMIZE_LEVEL of 2. At this level, the compiler will re-write your cursor-for-loop to array fetches "under the covers", so my feeling is that the internal code re-organisation might have something to do with it.
Can you try your cursor-for-loop example with these settings:
ALTER SESSION SET PLSQL_OPTIMIZE_LEVEL = 0;
ALTER SESSION SET PLSQL_OPTIMIZE_LEVEL = 1;
Neither of these levels optimise cursor-for-loops.
The reason your explicit fetch doesn't display the same behaviour is that the compiler doesn't optimise those.
Of course I could be wrong, but this is where I'd start testing.
Regards -
DBMS_UTILITY.FORMAT_CALL_STACK
Hi All,
Could you one tell me when i am running DBMS_UTILITY.FORMAT_CALL_STACK, i am getting one environment 11 alpha numeric character(0x3a135c3a8) for object handle and in another environment is giving 16 alpha numeric character(00000007A6B3ED30) for object handle.
One Enviroment:
begin
dbms_output.put_line(DBMS_UTILITY.FORMAT_CALL_STACK);
end;
----- PL/SQL Call Stack -----
object line object
handle number name
0x3a135c3a8 2 anonymous block
Another Enviroment:
----- PL/SQL Call Stack -----
object line object
handle number name
00000007A6B3ED30 2 anonymous block
Could any one explain why the difference.
Thanks11gR2 is not a version number; it is a marketing label. 11.2.0.3 is a proper version number.
Are both environments the same bitmode? Are both Oracle environments housed on the same OS version?
What difference does it make if the handle length is different since the basic format of the data returned is the same? Are you trying to parse the call stack? If so, your logic should not depend on fixed lengths but should locate value beginning and ending value locations.
HTH -- Mark D Powell -- -
Dbms_utility.get_time
Hi,
I am running a procedure, but i am not able to find out the time taking in each step of the procedure as it is taking huge time to execute..
I got a point that through dbms_utility.get_time, one can trace out, the time taking for each step inside the procedure...
But i am not aware of use of dbms_utility.get_time....Could any one help me on this...
or is there any other dbms_utility packages where i can trace out which part of the code is taking how much time to execute....
My moto is to find out, while executing the proc, i need to trace out how much time is taking in every step...I am using the trial version of toad, so i am not able go to profiler part...
Your help would make my day....
Thanks,
Haraprasad...Check how dbms_utility.get_time used.
SQL> declare
2 type rc is ref cursor;
3 l_rc rc;
4 l_dummy all_objects.object_name%type;
5 l_start number default dbms_utility.get_time;
6 begin
7 for i in 1 .. 1000
8 loop
9 open l_rc for
10 'select object_name
11 from all_objects
12 where object_id = :x'
13 using i;
14 fetch l_rc into l_dummy;
15 close l_rc;
16 end loop;
17 dbms_output.put_line
18 ( round( (dbms_utility.get_time-l_start)/100, 2 ) ||
19 ' seconds...' );
20 end;
21 /
.52 seconds...
PL/SQL procedure successfully completed.
Elapsed: 00:00:01.18
SQL> -
Error executing DBMS_UTILITY.ANALYZE_SCHEMA(b,'COMPUTE');
Hi,
I'm trying to execute this package and after some time I got this error:
ORA-12012: error on auto execute of job 41
ORA-00942: table or view does not exist
ORA-06512: at "LOGIX.TEMPTABPKG", line 112
ORA-06512: at "LOGIX.TEMPTABPKG", line 126
I'm doing an investigation to discover.. it's very strange because I did a export full and import full.
When I run DBMS_UTILITY.ANALYZE_SCHEMA by second time, this error doesn't happen.
When the error happened in the first time I run, the process's aborted and the "nexts" tables doesn't get statistics.
To solve unfairly, could I use some param in DBMS_UTILITY to continue genering statistic if some error to happen ?
Thanks.I suppose that yor second execution is succesfull because the Shared Pool has "cached" this table (this is normal). I want recommend to you tuning shared pool memory (make bigger).
But is not normal the two errors appearing the first time. Do you know this table "LOGIX.TEMPTABPKG"? -
Any alternatives for dbms_utility.format_call_stack?
For the freaks out there:
isn't there an alternative for dbms_utility.format_call_stack, since this will not work in server-side pl/sql when called from Oracle Forms. I'm searching something like a Data Dictionary View where I can retrieve this kind of information.
Regards, RoelI am having the same problem.
I need a way to trace the path, even when the code is called from Forms.
Any ideas?? -
Dbms_utility or dbms_stats
Hi All,
Database : 9.2.0.6
OS : IBM AIX 5.2
we are planning to run dbms_utility.analyze_database('COMPUTE'); to analyze the tables and indexes.
but in the below link its mentioned that some problem is there using dbms_utility.
http://momendba.blogspot.com/2008/05/becareful-when-using-dbmsutility-to.html
is it that we shouldn't use this on 9i database also? or which will be the best option among the two.
thanks in advance.dbms_stats is what You should use.
you can read this Tom explanation why:
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:5792247321358 -
Problem executing DBMS_UTILITY.ANALYZE_SCHEMA
Hi
I have a DBA schema called ASP.
in this schema i have a procedure which loops through all other client schema names to be analyzed and tries to execute as :
DBMS_UTILITY.ANALYZE_SCHEMA ( clientSchema , 'COMPUTE' )
It is giving following exception:
ORA-20000: You have insufficient privileges for an object in this schema.
what kind of privilages I have to grant to ASP schema ,so that it can call DBMS_UTILITY.ANALYZE_SCHEMA on other client schemas.
Is there any global privilage or role we can grant to ASP schema ,so that it can call DBMS_UTILITY.ANALYZE_SCHEMA on all created schemas.
Please give your input.
Thanks in advance
-Gopalgrant ANALYZE ANY to ASP;
-
Can anyone tell me, or tell me where to find information about the function dbms_utility.get_hash_value?
I've searched otn and have only found example uses, in conjunction with security programs.
What I'd like to know is how the second and third parameters affect the result. The function is of the form
dbms_utility.get_hash_value('string',number,number)
ThanksFrom the "Supplied PL/SQL Packages Reference" for 8.1.6. Sorry about the formatting (cut/paste). Looks like the 2-3rd parameters provide control over the returned value.
Syntax
DBMS_UTILITY.GET_HASH_VALUE (
name VARCHAR2,
base NUMBER,
hash_size NUMBER)
RETURN NUMBER;
Pragmas:
pragma restrict_references(get_hash_value, WNDS, RNDS, WNPS, RNPS);
Returns:
A hash value based on the input string.
For example, to get a hash value on a string where the hash value should be between 1000 and 3047, use 1000 as the base value and 2048 as the hash_size value. Using a power of 2 for the hash_size parameter works best.
Table 56–20 GET_HASH_VALUE Function Parameters
Parameter Description
name - String to be hashed.
base - Base value for the returned hash value to start
at.
hash_size - Desired size of the hash table.
Hope this helps
Ken -
Large HASH_SIZE with DBMS_UTILITY.GET_HASH_VALUE and performance
I need to set the hash_size to quite a large value (16777216) in order to ensure uniqueness for the sets of values I ma hashing.
The examples all use much smaller values (128K).
It seems unlikely to me, but do large values for hash_size affect performance, perhaps in the amount memory used in the PGA for the hashing fucntions.Hi Nijmegen
I think your problem is not related to OWB, but anyway.
If you don't change data type to char, GET_HASH_VALUE function will automatically change this data type to char in your case datetime will be changed to something like '2007.12.16' (try simple function to_char). So both values are equal '16-12-2007 13:43:55' = '2007.12.16' and '16-12-2007 16:43:55' = '2007.12.16' and you will get the same hash value. Better use POWER(2,30).
example
SELECT
DBMS_UTILITY.GET_HASH_VALUE (
TO_CHAR(TO_DATE('16-12-2007 13:43:55','dd-mm-yyyy hh24:mi:ss')),
0,
POWER(2,30)) AS x1,
DBMS_UTILITY.GET_HASH_VALUE (
TO_CHAR(TO_DATE('16-12-2007 16:43:55','dd-mm-yyyy hh24:mi:ss')),
0,
POWER(2,30)) AS x2,
DBMS_UTILITY.GET_HASH_VALUE (
'16-12-2007 13:43:55',
0,
POWER(2,30)) AS x1,
DBMS_UTILITY.GET_HASH_VALUE (
'16-12-2007 16:43:55',
0,
POWER(2,30)) AS x2,
TO_CHAR(TO_DATE('16-12-2007 13:43:55','dd-mm-yyyy hh24:mi:ss'))
FROM DUAL
Regards
Maybe you are looking for
-
Purchase order in Purchase requisition
can we get the purchase order status using the purchase requisition. Thanks Jayashree
-
Hello all, I have some query please solve it. The points are as follows: Whether TDS u/s 192 salary is covered in SAP or Not? 2.Under closing procedure whether daily option is available or not beside monthly and yearly? 3.Whether monthly tds certific
-
Can't get my CD-Rom working...
Hi, When i boot up with nothing in my CD-Rom drive i get something like this: Device sr1 not ready, perhaps insert an cd? When i do have a cd in in drive while booting up i get this: end_request: I/O error, dev sr1, sector 0 Buffer I/O error on devic
-
IWeb wont show my changes.
Hi everyone. My name is Takin, and im a graphical designer. This is my site: www.icandidesigns.com Just recently found out about iWeb and its possibilites, but now ive encountered a problem. If you see under 'portfolio' you can see that i only have t
-
Using your plasma with front row
I am currently using front row with a second display (plasma Tv). While viewing videos or photos, is it possible to turn of the Imac's display ?