All_source
i need to search all the places where a particular table is being used , say table is tab1
i am running the following command to get the details
select * from all_source where upper(text) like '%TAB1%'
My concern is that i cant see views inforamtion with the above query ,i know there is a view which is using the table tab1 but when i am running the above query it is not in the list.
Please suggest.
9876564 wrote:
i need to search all the places where a particular table is being used , say table is tab1
i am running the following command to get the details
select * from all_source where upper(text) like '%TAB1%'
My concern is that i cant see views inforamtion with the above query ,i know there is a view which is using the table tab1 but when i am running the above query it is not in the list.
Please suggest.
In addition to Frank's comment about dynamic sql, you need to keep in mind that references aren't necessarily defined in the source code that is maintained by the database. What about application code that lives outside the database (java, c, cobol, sql script files being executed at an OS prompt ..... depending on the seriousness of the reason you need to know, you might want to add an audit of table usage for at least a full monthly business cycle. And then ask if the table in question might only be used quarterly or annually.
Similar Messages
-
Problem in viewing the source code of a package using all_source
I have created a package and compiled it in schema1.I have created public synonym of the package.Now I am logged in some ohter schema say schema2. If I am using TOAD, I can see the body of the package from schma2 but if I am using sqlplus and using all_source data dictionary I can get only the spec of the package.
Could you please tell me how to get the whole package body using all_source data dictionary from other schema?This is the query that I am executing from other schema
select TEXT from all_source where NAME = 'P_PACKAGE';
SQL> select OBJECT_NAME ,OBJECT_TYPE from all_objects where OBJECT_NAME = ''P_PACKAGE';
OBJECT_NAME OBJECT_TYPE
'P_PACKAGE SYNONYM
'P_PACKAGE PACKAGE -
Sql developer issue using all_source
Hello,
New policies in my company have revoked access from developers to system tables which has caused a problem using sqldeveloper. Basically when I attempt to open a stored procedure, sqldeveloper uses sys.all_source to put together the code and now it cannot. A possible solution would be to change sqldeveloper to use user_source or create a view in my development schema called all_source and point sqldeveloper to that.
Problem is i don't know how to do this - or if it is even possible.
Can anybody help ?First off I'd say that's a pretty stupid restriction, as the ALL_ views just list what you have access to. You don't get any extra DB safety restricting those views.
If your DBA doesn't reconsider, you could change all internal sqldev queries or create views, but I recon just creating synonyms will be faster and cleaner:
CREATE SYNONYM ALL_SOURCE FOR SYS.USER_SOURCE;Hope that helps,
K. -
Unable to see package body in all_source
schema owner can see package and package body in all_source
another user, which has execute any procedure privs can only see the package, not the package body in all_source
Is there another privilege necessary to see the package body? I can't find any.
thanks, ...jrbIs your package valid? OWB will not show invalid packages in the project tree. Go to the database schema and check if the package is valid. If the package is invalid, recompile and reimport it into OWB.
-
Revoke select on "all_source" view from the public ?
Fellow DBA's
There is a security audit going on at my client's site and one of the requirements is to
revoke select on "*all_source*" view from the public .
1) Can Someone point out if there are any immediate ramifications of doing this (As in will the application
get affected in any way.. I don't assume so ) I scoured metalink but couldn't find any docs which cautions agaist it .
2) Now there are over 150 databases (8i,9i,10g) with several different development teams . How do i go about ensuring that the developers are not affected by this change . DO I need to create a seperate view based on this one for seperate teams .. ?
I am kinda new to this and any pointers are much appreciated
Regards,
SVuser8636840 wrote:
Thanks for your instant response guys ...I agree with u all in thats it's not the smartest thing to do .
I will try and explain it to the them ..but these big firm auditors tend to be rather thickheaded
In the event that I am still forced to do it ....do u have any pointers on the best way to go about this .
Any pros and cons from past experiences or link to some useful material would be great.
There are a number of "security hints" type papers on the intertubes, generally they say things like:
SQL> REVOKE SELECT ON ALL_SOURCE from PUBLIC;
SQL> CREATE ROLE VIEW_CODE_ROLE;
SQL> GRANT SELECT ON ALL_SOURCE to VIEW_CODE_ROLE;
SQL> GRANT EXECUTE ANY PROCEDURE to VIEW_CODE_ROLE;
The general idea is to protect against random bad guys figuring out various things from unwrapped code. Doesn't do anything to protect against inside jobs, but there's other things the auditors care about for that. Of course, this particular solution I got from one of those papers on the intertubes gives a major security hole to newbie developers with the execute any procedure, whatcha gonna do? They gotta see their own code, right? -
Acceding to All_source with a StoredProcedure
Hallo everybody!
That is my problem:
I've the table SOURCE_HIST in the schema arc01a
create table SOURCE_HIST
CHANGE_DATE DATE not null,
NAME VARCHAR2(30) not null,
TYPE VARCHAR2(12) not null,
LINE NUMBER not null,
TEXT VARCHAR2(4000)
alter table SOURCE_HIST
add constraint PK_SH primary key (CHANGE_DATE, NAME, TYPE, LINE);
I want to use this table to versioning pl/sql code during the development.
I've the procedure sp_insert_sourcehist in the schema arc01a to insert record in to source_hist:
create or replace procedure sp_insert_sourcehist(tip in varchar2, nome in varchar2, ow in varchar2) is
begin
if tip in ('PROCEDURE', 'FUNCTION', 'PACKAGE', 'PACKAGE BODY', 'TYPE', 'TYPE BODY')
then
INSERT INTO SOURCE_HIST
SELECT sysdate, name,type,line,text
FROM all_SOURCE
WHERE TYPE = tip AND NAME = nome and OWNER=ow;
end if;
EXCEPTION
WHEN OTHERS THEN
raise_application_error(-20000, SQLERRM);
end sp_insert_sourcehist;
I'm using the procedure and it's OK!
Now I'm in the schema arc01_usr: arc01_usr can read and write in source_hist and can execute sp_insert_sourcehist. There are also synonims for arc01a.source_hist and arc01a.sp_insert_sourcehist (create synonym source_hist for arc01a.source_hist;create synonym sp_insert_sourcehist for arc01a.sp_insert_sourcehist). If I use this procedure for inserting code ownered by arc01_usr, it doesn't insert any row; if I use it for inserting code owned by arc01a it inserts the right rows!!!
What can I do to use this stored procedure without copying it in all schemas?
Thanks for your attention,
Soniait seems that the user arc01a is not allowed to see the source-code owned by arc01_usr.
If you set up all the needed grants and permissions you should also use the current_user authid:
create or replace procedure sp_insert_sourcehist(tip in varchar2, nome in varchar2, ow in varchar2)
AUTHID CURRENT_USER is
begin
...But I'm still not sure if you can achieve what you are looking for. What is your goal?
If the user arc01_usr can insert the code into this table, what will he do next? change the code? OK but then? If he will compile the code, the package is now in his schema (or he has the powerfull grant to create any procedure in any schema) and the old procedure in the arc01 schema is still there. So what are you trying to achieve here? -
How to use sub folder paths for external table location parameter?
is it possible to use one Oracle directory and address multiple files under some OS sub-directories beside that Oracle directory? Like;
host mkdir /tmp/orcl_dir
host mkdir /tmp/orcl_dir/fold1
host mkdir /tmp/orcl_dir/fold2
CREATE DIRECTORY ext_tab_dir AS '/tmp/orcl_dir';
CREATE TABLE ext_all_source
ORGANIZATION EXTERNAL (
TYPE ORACLE_DATAPUMP
DEFAULT DIRECTORY ext_tab_dir
LOCATION ( 'fold1/all_source1.dmp', 'fold2/all_source2.dmp' ) ) PARALLEL 4
AS SELECT * FROM all_source;
ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04076: file name cannot contain a path specification: fold1/all_source1.dmp
ORA-06512: at "SYS.ORACLE_DATAPUMP", line 19Thank you.
Message was edited by:
antuJustin is there a way you are aware of at operating system level to teach oracle that it has to access for example 16 different piece of files over a meta file. I saw some definition file like this but I am searching if this is the tools own mapping format;
$ cat ./CON_PUB/main/CON_xfrm_subs_status_reason_act_lk_20080302.dat
(object mfile_c_type
(path "file:OBSOLETE")
(fs "file://amanos/s01/abinitio/data/prod/mfs/mfs_16way")
(local_paths 16
"file://amanos/s01/abinitio/data/prod/mfs/parts/mfs_16way_001/mfs_16way/Applications/RDS/CON_PUB/main/CON_xfrm_subs_status_reason_act_lk_20080302.dat"
"file://amanos/s01/abinitio/data/prod/mfs/parts/mfs_16way_002/mfs_16way/Applications/RDS/CON_PUB/main/CON_xfrm_subs_status_reason_act_lk_20080302.dat"
"file://amanos/s01/abinitio/data/prod/mfs/parts/mfs_16way_003/mfs_16way/Applications/RDS/CON_PUB/main/CON_xfrm_subs_status_reason_act_lk_20080302.dat"
"file://amanos/s01/abinitio/data/prod/mfs/parts/mfs_16way_004/mfs_16way/Applications/RDS/CON_PUB/main/CON_xfrm_subs_status_reason_act_lk_20080302.dat"
"file://amanos/s01/abinitio/data/prod/mfs/parts/mfs_16way_005/mfs_16way/Applications/RDS/CON_PUB/main/CON_xfrm_subs_status_reason_act_lk_20080302.dat"
"file://amanos/s01/abinitio/data/prod/mfs/parts/mfs_16way_006/mfs_16way/Applications/RDS/CON_PUB/main/CON_xfrm_subs_status_reason_act_lk_20080302.dat"
"file://amanos/s01/abinitio/data/prod/mfs/parts/mfs_16way_007/mfs_16way/Applications/RDS/CON_PUB/main/CON_xfrm_subs_status_reason_act_lk_20080302.dat"
"file://amanos/s01/abinitio/data/prod/mfs/parts/mfs_16way_008/mfs_16way/Applications/RDS/CON_PUB/main/CON_xfrm_subs_status_reason_act_lk_20080302.dat"
"file://amanos/s01/abinitio/data/prod/mfs/parts/mfs_16way_009/mfs_16way/Applications/RDS/CON_PUB/main/CON_xfrm_subs_status_reason_act_lk_20080302.dat"
"file://amanos/s01/abinitio/data/prod/mfs/parts/mfs_16way_010/mfs_16way/Applications/RDS/CON_PUB/main/CON_xfrm_subs_status_reason_act_lk_20080302.dat"
"file://amanos/s01/abinitio/data/prod/mfs/parts/mfs_16way_011/mfs_16way/Applications/RDS/CON_PUB/main/CON_xfrm_subs_status_reason_act_lk_20080302.dat"
"file://amanos/s01/abinitio/data/prod/mfs/parts/mfs_16way_012/mfs_16way/Applications/RDS/CON_PUB/main/CON_xfrm_subs_status_reason_act_lk_20080302.dat"
"file://amanos/s01/abinitio/data/prod/mfs/parts/mfs_16way_013/mfs_16way/Applications/RDS/CON_PUB/main/CON_xfrm_subs_status_reason_act_lk_20080302.dat"
"file://amanos/s01/abinitio/data/prod/mfs/parts/mfs_16way_014/mfs_16way/Applications/RDS/CON_PUB/main/CON_xfrm_subs_status_reason_act_lk_20080302.dat"
"file://amanos/s01/abinitio/data/prod/mfs/parts/mfs_16way_015/mfs_16way/Applications/RDS/CON_PUB/main/CON_xfrm_subs_status_reason_act_lk_20080302.dat"
"file://amanos/s01/abinitio/data/prod/mfs/parts/mfs_16way_016/mfs_16way/Applications/RDS/CON_PUB/main/CON_xfrm_subs_status_reason_act_lk_20080302.dat"))or at least a symbolic linking strategy may handle this, but I couldn't figure out how and of course this will have its own costs of course to manage. -
Sql query for finding a string in a column of a table
Hi All,
I have an issue, I have gotten a string ie '1D USD PRIME' and I have access to oracle's dictionary tables and views such as (all_source, all_tab_cols etc), my requirement is to find which table' column holds my above mentioned string, so I mean both the table name and the column name, it could be that this string might exist in more than 1 table so I want all the tables that holds it.
Regards
RahulHi All,
I think you misunderstood my question, so may be I didnt ask it properly, so here it is I am explaining in detail with an example.
Suppose I have 10 users with 10 different user name's in a database and I am the 11th user as DBA, every 10 of these users have created some tables lets say 20 tables each by every user making a count of the total tables as 200, now lets say 10 of 200 tables has a column ie fname with value as 'rahul', I want to search the string 'rahul' from all the 200 tables that which of the tables contains this string along with the column name.
I hope this time my question is clear, the point is I just know of a value and I dont know the table name and column name where it may actually residing, futher I want to search tables of other users as well.
Regards
Rahul -
How can I get all the values of a String array profile property using javascript?
I am trying to build functionality into our site that records all products added to the basket against a user's profile.
I have so far been able to store the product codes against the profile as a property using Ajax:
var dataString = ":formid=addProduct&:formstart=/apps/thread/templates/page_product/jcr:content/par/produc t/formstart&:redirect=/content/thread/en/user/cart.html&productId=151515:profile="+profile ;
$.ajax({
type: "POST",
url: "/content/women/evening/dresses/l-k-bennett-davinadress.html",
data: dataString,
success: function(data) {
In this example I have hardcoded a product ID of 151515.
In order to save the property as a multi string field you simply replace &productId=151515 with &productId=151515&productId=131313&productId=141414 or as many extra values as you want to build into that string. This stores a productId property against a user profile.
The issue comes from calling that data back. Using var value = CQ_Analytics.ProfileDataMgr.getProperty("productId") I can get the first value of this array (or the single value if only one is stored).
However there does not seem to be a way to get any of the other stored values in the array using getProperty. Does anyone know how I can achieve this?Hi,
Don't think that's possible. Even if it were, you wouldn't be able to use/display BOOLEAN type in SQL.
If you just aim to see what they are, you could do something like this
select text
from all_source
where owner = 'SYS'
and name = 'DBMS_DB_VERSION'
and type = 'PACKAGE';Or even
select dbms_metadata.get_ddl('PACKAGE', 'DBMS_DB_VERSION', 'SYS') from dual;My version is:
SQL> select * from v$version where rownum = 1;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
1 row selectedIn 11g you also have [PL/SCOPE|http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10471/adfns_plscope.htm#ADFNS02203] which might help you even more.
Regards
Peter -
How Can I get all the values of a DBMS package?
Hi all
I'm using this "dbms_output.put_line(DBMS_DB_VERSION.VERSION || '.' ||DBMS_DB_VERSION.RELEASE);" to show the version. But how Can I get the all the values from DBMS_DB_VERSION ? Is there a common way ?
Thanks .
Best
LaurenceHi,
Don't think that's possible. Even if it were, you wouldn't be able to use/display BOOLEAN type in SQL.
If you just aim to see what they are, you could do something like this
select text
from all_source
where owner = 'SYS'
and name = 'DBMS_DB_VERSION'
and type = 'PACKAGE';Or even
select dbms_metadata.get_ddl('PACKAGE', 'DBMS_DB_VERSION', 'SYS') from dual;My version is:
SQL> select * from v$version where rownum = 1;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
1 row selectedIn 11g you also have [PL/SCOPE|http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10471/adfns_plscope.htm#ADFNS02203] which might help you even more.
Regards
Peter -
Hi Guys,
I dont know whether am following the correct way , I have a scenerio where I have to show in the report Blocking reasons . I have a field from DS Payment Block Key which is 0PMNT_BLOCK in BI. I have 7 Blocking reasons in one table called BSEG and I have enhanced my 0FI_AP_4 DS to include this 7 fields and mapped to 7 BI Objects 0BLCKRSN_PR for price 0BLCKRSN_QL for quality....Now bringing these fileds from BSEG effecting performance as each time the exit is calling. I do have a Text data source (0PMNT_BLOCK_TEXT) which is having same data as I need...So in order to get this Blocking reasons in to my report without enahcing from BSEG table Iam trying to read it from master data . but its not allowing me to do that....When I say read from master data for one of the info object 0BLCKRSN_PR and press F4 its showing no info object available for reading of master data....Can any one tell me why its showing this error...I do have a Master data object 0PMNT_BLOCK which is having the values A B D H M P , so I want to read the above object 0BLCKRSN_PR from this Object ...as P is for Price and so on....
Do I need to take the seven info objects as attributes of 0PMNT_BLOCK ?
If so , I didnt find a DS for attributes in ECC , I have only Text DS 0PMNT_BLOCK_TEXT....
Please advice me what I need to do for this...Also please shoot me a reply If you ahve any more questions....the join produces more rows then the sum of it's parts (e.g. 154). For example:
select owner, name
from all_source
where upper(text) like '%BINARY_INTEGER%'
633 rows selected.
select owner, type
from all_source
where upper(text) like '%PLS_INTEGER%'
926 rows selected.
select ds1.owner, ds1.name, ds2.type
from all_source ds1 inner join all_source ds2 on (ds1.owner = ds2.owner and ds1.name = ds2.name and ds1.type = ds2.type)
where upper(ds1.text) like '%BINARY_INTEGER%'
and upper(ds2.text) like '%PLS_INTEGER%'
5710 rows selected.
select owner, count(name) as name_cnt
from all_source
where upper(text) like '%BINARY_INTEGER%'
group by owner
OWNER NAME_CNT
SYS 577
WWW 56
2 rows selected.
select owner, count(type)
from all_source
where upper(text) like '%PLS_INTEGER%'
group by owner
OWNER COUNT(TYPE)
SYS 909
WWW 17
2 rows selected.
this could be a solution then:
select ds1.owner, ds1.name_cnt, ds2.type_cnt
from (select owner, count(name) as name_cnt
from all_source
where upper(text) like '%BINARY_INTEGER%'
group by owner) ds1 inner join (select owner, count(type) as type_cnt
from all_source
where upper(text) like '%PLS_INTEGER%'
group by owner) ds2 on (ds1.owner = ds2.owner)
OWNER NAME_CNT TYPE_CNT
SYS 577 909
WWW 56 17
2 rows selected. -
Need Help to see why the performance is not good
Hi,
We have an application that all process are developed in PL/SQL on Oracle 9i Database :
Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
PL/SQL Release 9.2.0.6.0 - Production
Why I have created this package. the application is a production management on chemical industries. I need to sometimes trace the Manufacturing order execution to eventually answer some incoherent data. If I analyze directly the data in the Table is not always responding because the origin of problem can be provide of some execution that perform some calculation.
In the procedure or function a use my package PAC_LOG_ERROR.PUT_LINE(xxxxxx) to save the information. This command save the information in the memory before. At the end of the procedure or function a perform the insert with the COMMIT calling PAC_LOG_ERROR.LOGS or PAC_LOG_ERROR.ERRORS on the catch exception.
This package is always call. On each routines performed I execute it. In the trace log of the database we have see a problem we the procedure GET_PROC_NAME in the package. We have identify that is called more that 800x and increase the performance. Who increase is this select command :
SELECT * INTO SOURCE_TEXT
FROM (SELECT TEXT FROM all_source
WHERE OWNER = SOURCE_OWNER AND
NAME=SOURCE_NAME AND
TYPE IN ('PROCEDURE','FUNCTION','PACKAGE BODY') AND
LINE <= SOURCE_LINE AND SUBSTR(TRIM(TEXT),1,9) IN ('PROCEDURE','FUNCTION ')
ORDER BY LINE DESC)
WHERE ROWNUM = 1;I use it to get the procedure or function name where my log proc is called. I now that I can pass in parameters, but I have think to use an automatic method, that can help to not have some problem with others developer team to make a copy/past and not update the parameters. Because the Log info is read by the Help Desk and if we have an error on the information, it not a good help.
COULD YOU PLEASE HELP ME TO OPTIMIZE OR SAID THE BETTER METHOD TO DO IT ?
Here my package :
create or replace
PACKAGE PAC_LOG_ERROR AS
-- Name : pac_log_error.sql
-- Author : Calà Salvatore - 02 July 2010
-- Description : Basic Error and Log management.
-- Usage notes : To active the Log management execute this statement
-- UPDATE PARAM_TECHNIC SET PRM_VALUE = 'Y' WHERE PRM_TYPE = 'TRC_LOG';
-- COMMIT;
-- To set the period in day before to delete tracability
-- UPDATE PARAM_TECHNIC SET PRM_VALUE = 60 WHERE PRM_TYPE = 'DEL_TRC_LOG';
-- COMMIT;
-- To set the number in day where the ERROR is save before deleted
-- UPDATE PARAM_TECHNIC SET PRM_VALUE = 60 WHERE PRM_TYPE = 'DEL_TRC_LOG';
-- COMMIT;
-- Requirements : Packages PAC_PUBLIC and OWA_UTIL
-- Revision History
-- --------+---------------+-------------+--------------------------------------
-- Version | Author | Date | Comment
-- --------+---------------+-------------+--------------------------------------
-- 1.0.0 | S. Calà | 02-Jul-2010 | Initial Version
-- --------+---------------+-------------+--------------------------------------
-- | | |
-- --------+---------------+-------------+--------------------------------------
PROCEDURE INITIALIZE;
PROCEDURE CLEAN;
PROCEDURE RESETS(IN_SOURCE IN VARCHAR2 DEFAULT NULL);
PROCEDURE PUT_LINE(TXT IN VARCHAR2);
PROCEDURE ERRORS(REF_TYPE IN VARCHAR2 DEFAULT 'SITE', REF_VALUE IN VARCHAR2 DEFAULT '99', ERR_CODE IN NUMBER DEFAULT SQLCODE, ERR_MSG IN VARCHAR2 DEFAULT SQLERRM);
PROCEDURE LOGS(REF_TYPE IN VARCHAR2 DEFAULT 'SITE', REF_VALUE IN VARCHAR2 DEFAULT '99');
END PAC_LOG_ERROR;
create or replace
PACKAGE BODY PAC_LOG_ERROR
AS
/* Private Constant */
CR CONSTANT CHAR(1) := CHR(13); -- Retour chariot
LF CONSTANT CHAR(1) := CHR(10); -- Saut de ligne
CR_LF CONSTANT CHAR(2) := LF || CR; --Saut de ligne et retour chariot
TAB CONSTANT PLS_INTEGER := 50;
sDelay CONSTANT PLS_INTEGER := 30;
/* Private Record */
TYPE REC_LOG IS RECORD(
ERR_DATE TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
ERR_TXT VARCHAR2(4000)
/* Private Type Table */
TYPE TAB_VALUE IS TABLE OF REC_LOG INDEX BY PLS_INTEGER;
TYPE TAB_POINTER IS TABLE OF TAB_VALUE INDEX BY VARCHAR2(80);
/* Private Variables Structures */
LOG_TRC PARAM_TECHNIC.PRM_VALUE%TYPE;
LIST_PARAM TAB_POINTER;
/* Private Programs */
FUNCTION GET_PROC_NAME( SOURCE_OWNER IN all_source.OWNER%TYPE
,SOURCE_NAME IN all_source.NAME%TYPE
,SOURCE_LINE IN all_source.LINE%TYPE) RETURN VARCHAR2
AS
SOURCE_TEXT all_source.TEXT%TYPE;
TYPE RECORD_TEXT IS TABLE OF all_source.TEXT%TYPE;
RETURN_TEXT RECORD_TEXT;
BEGIN
SELECT * INTO SOURCE_TEXT
FROM (SELECT TEXT FROM all_source
WHERE OWNER = SOURCE_OWNER AND
NAME=SOURCE_NAME AND
TYPE IN ('PROCEDURE','FUNCTION','PACKAGE BODY') AND
LINE <= SOURCE_LINE AND SUBSTR(TRIM(TEXT),1,9) IN ('PROCEDURE','FUNCTION ')
ORDER BY LINE DESC)
WHERE ROWNUM = 1;
IF SOURCE_TEXT IS NOT NULL OR SOURCE_TEXT != '' THEN
SOURCE_TEXT := TRIM(SUBSTR(SOURCE_TEXT,1,INSTR(SOURCE_TEXT,'(')-1));
SOURCE_TEXT := LTRIM(LTRIM(TRIM(SOURCE_TEXT),'PROCEDURE'),'FUNCTION');
SOURCE_TEXT := SOURCE_NAME||'.'|| TRIM(SOURCE_TEXT);
ELSE
SOURCE_TEXT := 'ANONYMOUS BLOCK';
END IF;
RETURN SOURCE_TEXT;
END GET_PROC_NAME;
PROCEDURE SELECT_MASTER(REF_TYPE IN VARCHAR2, PARAM_VALUE IN VARCHAR2, SITE OUT VARCHAR2, REF_MASTER OUT VARCHAR2)
AS
BEGIN
REF_MASTER := '';
SITE := '99';
CASE UPPER(REF_TYPE)
WHEN 'PO' THEN -- Process Order
SELECT SITE_CODE INTO SITE FROM PO_PROCESS_ORDER WHERE PO_NUMBER = PARAM_VALUE;
WHEN 'SO' THEN -- Shop Order
SELECT P.SITE_CODE,P.PO_NUMBER INTO SITE,REF_MASTER FROM SO_SHOP_ORDER S
INNER JOIN PO_PROCESS_ORDER P ON P.PO_NUMBER = S.PO_NUMBER
WHERE S.NUMOF = PARAM_VALUE;
WHEN 'SM' THEN -- Submixing
SELECT SITE_CODE,NUMOF INTO SITE,REF_MASTER FROM SO_SUBMIXING WHERE IDSM = PARAM_VALUE;
WHEN 'IDSM' THEN -- Submixing
SELECT SITE_CODE,NUMOF INTO SITE,REF_MASTER FROM SO_SUBMIXING WHERE IDSM = PARAM_VALUE;
WHEN 'PR' THEN -- Pourring
SELECT B.SITE_CODE,P.NUMOF INTO SITE,REF_MASTER FROM SO_POURING P
INNER JOIN SO_SUBMIXING B ON B.IDSM=P.IDSM
WHERE P.IDSM = PARAM_VALUE;
WHEN 'NUMSMP' THEN -- Pourring
SELECT SITE_CODE,NUMOF INTO SITE,REF_MASTER FROM SAMPLE WHERE NUMSMP = TO_NUMBER(PARAM_VALUE);
-- WHEN 'MSG' THEN -- Messages
-- SELECT SITE_CODE,PO_NUMBER INTO SITE,REF_MASTER FROM CMS_INTERFACE.MAP_ITF_PO WHERE MSG_ID = PARAM_VALUE;
ELSE
SITE := sys_context('usr_context', 'site_attribute');
END CASE;
EXCEPTION
WHEN OTHERS THEN
REF_MASTER := '';
SITE := sys_context('usr_context', 'site_attribute');
END SELECT_MASTER;
PROCEDURE ADD_LIST_PROC
AS
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
MERGE INTO LOG_PARAM A
USING (SELECT OWNER, TYPE
,NAME PROC
, CASE NAME WHEN SUBNAME THEN NULL
ELSE SUBNAME
END SUBPROC
FROM (
SELECT owner,TYPE,UPPER(NAME) NAME,UPPER(trim(substr(substr(trim(text),1,instr(trim(text),'(')-1),instr(substr(trim(text),1,instr(trim(text),'(')-1),' ')))) SUBNAME
FROM ALL_SOURCE where owner in ('CMS_ADM','CMS_INTERFACE')
and type in ('FUNCTION','PROCEDURE','PACKAGE BODY')
and (instr(substr(trim(text),1,instr(trim(upper(text)),'(')-1),'FUNCTION') = 1 or instr(substr(trim(text),1,instr(trim(upper(text)),'(')-1),'PROCEDURE')=1)
)-- ORDER BY OWNER,PROC,SUBPROC NULLS FIRST
) B
ON (A.OWNER = B.OWNER AND A.TYPE = B.TYPE AND A.PROC=B.PROC AND NVL(A.SUBPROC,' ') = NVL(B.SUBPROC,' '))
WHEN NOT MATCHED THEN
INSERT (OWNER,TYPE,PROC,SUBPROC) VALUES (B.OWNER,B.TYPE,B.PROC,B.SUBPROC)
WHEN MATCHED THEN
UPDATE SET ACTIVE = ACTIVE;
DELETE LOG_PARAM A
WHERE NOT EXISTS (SELECT OWNER, TYPE
,NAME PROC
, CASE NAME WHEN SUBNAME THEN NULL
ELSE SUBNAME
END SUBPROC
FROM (
SELECT owner,TYPE,NAME,upper(trim(substr(substr(trim(text),1,instr(trim(text),'(')-1),instr(substr(trim(text),1,instr(trim(text),'(')-1),' ')))) SUBNAME
FROM ALL_SOURCE where owner in ('CMS_ADM','CMS_INTERFACE')
and type in ('FUNCTION','PROCEDURE','PACKAGE BODY')
and (instr(substr(trim(text),1,instr(trim(text),'(')-1),'FUNCTION') = 1 or instr(substr(trim(text),1,instr(trim(text),'(')-1),'PROCEDURE')=1)
) WHERE A.OWNER = OWNER AND A.TYPE = TYPE AND A.PROC=PROC AND NVL(A.SUBPROC,' ') = NVL(SUBPROC,' '));
COMMIT;
EXCEPTION
WHEN OTHERS THEN
NULL;
END ADD_LIST_PROC;
PROCEDURE INITIALIZE
AS
BEGIN
LIST_PARAM.DELETE;
CLEAN;
-- ADD_LIST_PROC;
EXCEPTION
WHEN OTHERS THEN
NULL;
END INITIALIZE;
PROCEDURE CLEAN
AS
PRAGMA AUTONOMOUS_TRANSACTION;
dtTrcLog DATE;
dtTrcErr DATE;
BEGIN
BEGIN
SELECT dbdate-NUMTODSINTERVAL(to_number(PRM_VALUE),'DAY') INTO dtTrcLog
FROM PARAM_TECHNIC WHERE PRM_TYPE = 'DEL_TRC_LOG';
EXCEPTION
WHEN OTHERS THEN
dtTrcLog := dbdate -NUMTODSINTERVAL(sDelay,'DAY');
END;
BEGIN
SELECT dbdate-NUMTODSINTERVAL(to_number(PRM_VALUE),'DAY') INTO dtTrcErr
FROM PARAM_TECHNIC WHERE PRM_TYPE = 'DEL_TRC_ERR';
EXCEPTION
WHEN OTHERS THEN
dtTrcErr := dbdate -NUMTODSINTERVAL(sDelay,'DAY');
END;
DELETE FROM ERROR_LOG WHERE ERR_TYPE ='LOG' AND ERR_DATE < dtTrcLog;
DELETE FROM ERROR_LOG WHERE ERR_TYPE ='ERROR' AND ERR_DATE < dtTrcErr;
COMMIT;
EXCEPTION
WHEN OTHERS THEN
NULL; -- Do nothing if error occurs and catch exception
END CLEAN;
PROCEDURE RESETS(IN_SOURCE IN VARCHAR2 DEFAULT NULL)
AS
SOURCE_OWNER all_source.OWNER%TYPE;
SOURCE_NAME all_source.NAME%TYPE;
SOURCE_LINE all_source.LINE%TYPE;
SOURCE_TEXT all_source.TEXT%TYPE;
SOURCE_PROC VARCHAR2(32727);
BEGIN
OWA_UTIL.WHO_CALLED_ME(owner => SOURCE_OWNER,
name => SOURCE_NAME,
lineno => SOURCE_LINE,
caller_t => SOURCE_TEXT);
IF SOURCE_PROC IS NULL THEN
SOURCE_PROC := SUBSTR(GET_PROC_NAME(SOURCE_OWNER,SOURCE_NAME,SOURCE_LINE),1,125);
ELSE
SOURCE_PROC := IN_SOURCE;
END IF;
LIST_PARAM.DELETE(SOURCE_PROC);
EXCEPTION
WHEN OTHERS THEN
NULL;
END RESETS;
PROCEDURE PUT_LINE(TXT IN VARCHAR2)
AS
PRAGMA AUTONOMOUS_TRANSACTION;
SOURCE_OWNER all_source.OWNER%TYPE;
SOURCE_NAME all_source.NAME%TYPE;
SOURCE_LINE all_source.LINE%TYPE;
SOURCE_TEXT all_source.TEXT%TYPE;
SOURCE_PROC VARCHAR2(128);
BEGIN
IF TXT IS NULL OR TXT = '' THEN
RETURN;
END IF;
OWA_UTIL.WHO_CALLED_ME(owner => SOURCE_OWNER,
name => SOURCE_NAME,
lineno => SOURCE_LINE,
caller_t => SOURCE_TEXT);
SOURCE_PROC := GET_PROC_NAME(SOURCE_OWNER,SOURCE_NAME,SOURCE_LINE);
IF LIST_PARAM.EXISTS(SOURCE_PROC) THEN
LIST_PARAM(SOURCE_PROC)(LIST_PARAM(SOURCE_PROC).COUNT+1).ERR_TXT := TXT;
ELSE
LIST_PARAM(SOURCE_PROC)(1).ERR_TXT := TXT;
END IF;
EXCEPTION
WHEN OTHERS THEN
NULL;
END PUT_LINE;
PROCEDURE LOGS(REF_TYPE IN VARCHAR2 DEFAULT 'SITE', REF_VALUE IN VARCHAR2 DEFAULT '99')
AS
PRAGMA AUTONOMOUS_TRANSACTION;
MASTER_VALUE ERROR_LOG.ERR_MASTER%TYPE;
SITE PARAMTAB.SITE_CODE%TYPE;
SOURCE_OWNER all_source.OWNER%TYPE;
SOURCE_NAME all_source.NAME%TYPE;
SOURCE_LINE all_source.LINE%TYPE;
SOURCE_TEXT all_source.TEXT%TYPE;
SOURCE_PROC VARCHAR2(128);
ERR_KEY NUMBER;
BEGIN
-- NULL;
OWA_UTIL.WHO_CALLED_ME(owner => SOURCE_OWNER,
name => SOURCE_NAME,
lineno => SOURCE_LINE,
caller_t => SOURCE_TEXT);
SOURCE_PROC := SUBSTR(GET_PROC_NAME(SOURCE_OWNER,SOURCE_NAME,SOURCE_LINE),1,128);
LIST_PARAM.DELETE(SOURCE_PROC);
-- SELECT NVL(MAX(ACTIVE),'N') INTO LOG_TRC FROM LOG_PARAM WHERE TRIM(UPPER((PROC||'.'||SUBPROC))) = TRIM(UPPER(SOURCE_PROC))
-- AND OWNER =SOURCE_OWNER AND TYPE = SOURCE_TEXT ;
-- IF LOG_TRC = 'N' THEN
-- LIST_PARAM.DELETE(SOURCE_PROC);
-- RETURN;
-- END IF;
-- SELECT_MASTER(REF_TYPE => UPPER(REF_TYPE), PARAM_VALUE => REF_VALUE, SITE => SITE, REF_MASTER => MASTER_VALUE);
-- ERR_KEY := TO_CHAR(LOCALTIMESTAMP,'YYYYMMDDHH24MISSFF6');
-- FOR AIX IN 1..LIST_PARAM(SOURCE_PROC).COUNT LOOP
-- INSERT INTO ERROR_LOG (ERR_KEY, ERR_SITE,ERR_SLAVE ,ERR_MASTER ,ERR_TYPE ,ERR_PROC,ERR_DATE,ERR_TXT)
-- VALUES (ERR_KEY,SITE,REF_VALUE,MASTER_VALUE,'LOG',SOURCE_PROC,LIST_PARAM(SOURCE_PROC)(AIX).ERR_DATE ,LIST_PARAM(SOURCE_PROC)(AIX).ERR_TXT);
-- END LOOP;
-- UPDATE SESSION_CONTEXT SET SCX_ERR_KEY = ERR_KEY WHERE SCX_ID = SYS_CONTEXT('USERENV','SESSIONID');
-- LIST_PARAM.DELETE(SOURCE_PROC);
-- COMMIT;
EXCEPTION
WHEN OTHERS THEN
LIST_PARAM.DELETE(SOURCE_PROC);
END LOGS;
PROCEDURE ERRORS(REF_TYPE IN VARCHAR2 DEFAULT 'SITE', REF_VALUE IN VARCHAR2 DEFAULT '99', ERR_CODE IN NUMBER DEFAULT SQLCODE, ERR_MSG IN VARCHAR2 DEFAULT SQLERRM)
AS
PRAGMA AUTONOMOUS_TRANSACTION;
MASTER_VALUE ERROR_LOG.ERR_MASTER%TYPE;
SITE PARAMTAB.SITE_CODE%TYPE;
SOURCE_OWNER all_source.OWNER%TYPE;
SOURCE_NAME all_source.NAME%TYPE;
SOURCE_LINE all_source.LINE%TYPE;
SOURCE_TEXT all_source.TEXT%TYPE;
SOURCE_PROC VARCHAR2(4000);
ERR_KEY NUMBER := TO_CHAR(LOCALTIMESTAMP,'YYYYMMDDHH24MISSFF6');
BEGIN
OWA_UTIL.WHO_CALLED_ME(owner => SOURCE_OWNER,
name => SOURCE_NAME,
lineno => SOURCE_LINE,
caller_t => SOURCE_TEXT);
SOURCE_PROC := SUBSTR(GET_PROC_NAME(SOURCE_OWNER,SOURCE_NAME,SOURCE_LINE),1,125);
SELECT_MASTER(REF_TYPE => UPPER(REF_TYPE), PARAM_VALUE => REF_VALUE, SITE => SITE, REF_MASTER => MASTER_VALUE);
IF LIST_PARAM.EXISTS(SOURCE_PROC) THEN
FOR AIX IN 1..LIST_PARAM(SOURCE_PROC).COUNT LOOP
INSERT INTO ERROR_LOG (ERR_KEY,ERR_SITE,ERR_SLAVE,ERR_MASTER,ERR_PROC,ERR_DATE,ERR_TXT,ERR_CODE,ERR_MSG)
VALUES (ERR_KEY,SITE,REF_VALUE,MASTER_VALUE,SOURCE_PROC,LIST_PARAM(SOURCE_PROC)(AIX).ERR_DATE, LIST_PARAM(SOURCE_PROC)(AIX).ERR_TXT,ERR_CODE,ERR_MSG);
END LOOP;
LIST_PARAM.DELETE(SOURCE_PROC);
ELSE
INSERT INTO ERROR_LOG (ERR_KEY,ERR_SITE,ERR_SLAVE,ERR_MASTER,ERR_PROC,ERR_DATE,ERR_TXT,ERR_CODE,ERR_MSG)
VALUES (ERR_KEY,SITE,REF_VALUE,MASTER_VALUE,SOURCE_PROC,CURRENT_TIMESTAMP,'Error info',ERR_CODE,ERR_MSG);
END IF;
UPDATE SESSION_CONTEXT SET SCX_ERR_KEY = ERR_KEY WHERE SCX_ID = sys_context('usr_context', 'session_id');
COMMIT;
EXCEPTION
WHEN OTHERS THEN
LIST_PARAM.DELETE(SOURCE_PROC);
END ERRORS;
END PAC_LOG_ERROR;This package is always call. On each routines performed I execute it. In the trace log of the database we have see a problem we the procedure GET_PROC_NAME in the package. We have identify that is called more that 800x and increase the performance. Who increase is this select command :
SELECT * INTO SOURCE_TEXT
FROM (SELECT TEXT FROM all_source
WHERE OWNER = SOURCE_OWNER AND
NAME=SOURCE_NAME AND
TYPE IN ('PROCEDURE','FUNCTION','PACKAGE BODY') AND
LINE <= SOURCE_LINE AND SUBSTR(TRIM(TEXT),1,9) IN ('PROCEDURE','FUNCTION ')
ORDER BY LINE DESC)
WHERE ROWNUM = 1;Complex SQL like inline views and views of views can overwhelm the cost-based optimizer resulting in bad execution plans. Start with getting an execution plan of your problem query to see if it is inefficient - look for full table scans in particular. You might bet better performance by eliminating the IN and merging the results of 3 queries with a UNION. -
How to Identify unused columns in a table
Hiiya..
Is there a way to find out that following columns of table X,Y, Z have never been used. So that, I can check with the FCs and mark them un-used (using ALTER TABLE).
I don't want to go through every line of (avlbl) PLSQL code to identify that so and so column of so and so table has never been used. Is there any view or any sys proc/pkg using which I can identify them.
TIAGuido
Not getting you exactly. What I am doing is pick all the columns one by one and search in all_source (like where TEXT like %COLUMN_NAME%). Now what about 'AND <UnusedColumn> IS NULL'
Sidhu -
Nice solution to change a lot of procedures at once.
if you have to do little changes in a lot of your Procedures / Functions or Packages here is a nice solution to do this in a very short time:
CREATE TABLE T_SOURCE
SOURCE_ID NUMBER,
NAME VARCHAR2(30 BYTE),
SOURCETEXT CLOB
CREATE OR REPLACE PROCEDURE CIAS_PUFFER.pr_t_source
IS
NAME: pr_t_source
$Archive: //PVCS/archives/10gh/PR_T_SOURCE.prc_v $
$Author: ext0523 $
$Date: Aug 04 2008 17:26:54 $
$Revision: 1.2 $
CURSOR c_all_obj
IS
SELECT object_name
FROM all_objects
WHERE owner <>'SYS'
AND object_type = 'PROCEDURE'
ORDER BY object_name;
CURSOR c_prog (cp_name VARCHAR2)
IS
SELECT *
FROM all_source
WHERE NAME = cp_name
ORDER BY line;
v_replace VARCHAR2 (999);
v_st CLOB;
i PLS_INTEGER := 0;
BEGIN
EXECUTE IMMEDIATE ('truncate table t_source');
FOR rec_all_obj IN c_all_obj
LOOP
i := i + 1;
v_st := '--$ARCHIVE$'||chr(10)||'--$AUTHOR$'||chr(10)||'--$DATE$'
||chr(10)||'--$REVISION$'||chr(10)||chr(10);
v_st := v_st||'CREATE OR REPLACE ';
FOR rec_prog IN c_prog (rec_all_obj.object_name)
LOOP
v_replace := UPPER (rec_prog.text);
if instr(v_replace,'$ARCHIVE') >0 then v_replace :=''; end if;
if instr(v_replace,'$AUTHOR') >0 then v_replace :=''; end if;
if instr(v_replace,'$DATE') >0 then v_replace :=''; end if;
if instr(v_replace,'$REVISION') >0 then v_replace :=''; end if;
v_replace :=
REPLACE (v_replace,
'[email protected]',
'prot_easy_cias'
v_replace :=
REPLACE (v_replace, '[email protected]', 'easy2cias');
v_st := v_st || v_replace;
END LOOP;
INSERT INTO t_source
VALUES (i, rec_all_obj.object_name, v_st);
END LOOP;
COMMIT;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
NULL;
WHEN OTHERS
THEN
-- Consider logging the error and then re-raise
RAISE;
END pr_t_source;
// classpath= /ORACLE/u01/app/oracle/product/10.2.0.3/jdbc/lib/ojdbc14.jar
// Java SQL classes
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
// Oracle JDBC driver class
import oracle.jdbc.OracleDriver;
// Java IO classes
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
//Java Util classes
import java.util.Properties;
* This class demonstrates the Oracle JDBC 10g enhanced features for inserting
* and retrieving CLOB data from the database. Using the new features, large
* data of more than 32765 bytes can be inserted into the database using the
* existing PreparedStatement.setString() and PreparedStatement.getString()
* methods.
public class ClobMan {
/* Database Connection object */
private Connection conn = null;
/* Variables to hold database details */
private String url = null;
private String user = null;
private String password = null;
// Create a property object to hold the username, password and
// the new property SetBigStringTryClob.
private Properties props = new Properties();
/* String to hold file name */
private String fileName = null;
* Default Constructor to instantiate and get a handle to class methods
* and variables.
public ClobMan(String fileName) {
this.fileName = fileName;
* Main runnable class.
public static void main(String[] args) throws SQLException {
// Instantiate the main class.
ClobMan clobMan = new ClobMan(args[0]);
// Load the Oracle JDBC driver class.
DriverManager.registerDriver(new OracleDriver());
// Load the database details into the variables.
String dbUrl = "jdbc:oracle:thin:@pmol:1550:dbpmol";
clobMan.url = dbUrl;
clobMan.user = "gh10";
clobMan.password = "secret";
// Populate the property object to hold the username, password and
// the new property 'SetBigStringTryClob' which is set to true. Setting
// this property allows inserting of large data using the existing
// setString() method, to a CLOB column in the database.
clobMan.props.put("user", clobMan.user );
clobMan.props.put("password", clobMan.password);
clobMan.props.put("SetBigStringTryClob", "true");
// Check if the table 'CLOB_TAB' is present in the database.
//clobMan.checkTables();
// Call the methods to insert and select CLOB from the database.
//clobMan.insertClob();
clobMan.selectClob();
* This method will insert the data into a CLOB column in the database.
* Oracle JDBC 10g has enhanced the existing PreparedStatement.setString()
* method for setting the data more than 32765 bytes. So, using setString(),
* it is now easy to insert CLOB data into the database directly.
private void insertClob() throws SQLException {
// Create a PreparedStatement object.
PreparedStatement pstmt = null;
try {
// Create the database connection, if it is closed.
if ((conn==null)||conn.isClosed()){
// Connect to the database.
conn = DriverManager.getConnection( this.url, this.props );
// Create SQL query to insert data into the CLOB column in the database.
String sql = "INSERT INTO clob_tab VALUES(?)";
// Read a big file(larger than 32765 bytes)
String str = this.readFile();
// Create the OraclePreparedStatement object
pstmt = conn.prepareStatement(sql);
// Use the same setString() method which is enhanced to insert
// the CLOB data. The string data is automatically transformed into a
// clob and inserted into the database column. Make sure that the
// Connection property - 'SetBigStringTryClob' is set to true for
// the insert to happen.
pstmt.setString(1,str);
// Execute the PreparedStatement
pstmt.executeUpdate();
} catch (SQLException sqlex) {
// Catch Exceptions and display messages accordingly.
System.out.println("SQLException while connecting and inserting into " +
"the database table: " + sqlex.toString());
} catch (Exception ex) {
System.out.println("Exception while connecting and inserting into the" +
" database table: " + ex.toString());
} finally {
// Close the Statement and the connection objects.
if (pstmt!=null) pstmt.close();
if (conn!=null) conn.close();
* This method reads the CLOB data from the database by using getString()
* method.
private void selectClob() throws SQLException {
// Create a PreparedStatement object
PreparedStatement pstmt = null;
// Create a ResultSet to hold the records retrieved.
ResultSet rset = null;
try {
// Create the database connection, if it is closed.
if ((conn==null)||conn.isClosed()){
// Connect to the database.
conn = DriverManager.getConnection( this.url, this.props );
// Create SQL query statement to retrieve records having CLOB data from
// the database.
String sqlCall = "SELECT rownum, name, sourcetext FROM t_source";
pstmt= conn.prepareStatement(sqlCall);
// Execute the PrepareStatement
rset = pstmt.executeQuery();
String rownum = null;
String o_name =null;
String clobVal = null;
// Get the CLOB value from the resultset
//java.io.BufferedWriter out = new java.io.BufferedWriter(new java.io.FileWriter("pr_all.sql"));
while (rset.next()) {
rownum = rset.getString(1);
o_name = rset.getString(2);
clobVal = rset.getString(3);
System.out.println(" length: "+clobVal.length()+" "+o_name+" "+rownum);
java.io.BufferedWriter out =
new java.io.BufferedWriter(new java.io.FileWriter(o_name+".prc"));
out.write(clobVal);
out.newLine();
out.write("/");
out.newLine();
out.newLine();
out.flush();
out.close();
} catch (SQLException sqlex) {
// Catch Exceptions and display messages accordingly.
System.out.println("SQLException while connecting and querying the " +
"database table: " + sqlex.toString());
} catch (Exception ex) {
System.out.println("Exception while connecting and querying the " +
"database table: " + ex.toString());
} finally {
// Close the resultset, statement and the connection objects.
if (rset !=null) rset.close();
if (pstmt!=null) pstmt.close();
if (conn!=null) conn.close();
* Method to check if the table ('CLOB_TAB') exists in the database; if not
* then it is created.
* Table Name: CLOB_TAB
* Column Name Type
* col_col CLOB
private void checkTables() {
Statement stmt = null;
ResultSet rset = null;
try {
// Create the database connection, if it is closed.
if ((conn==null)||conn.isClosed()){
// Connect to the database.
conn = DriverManager.getConnection( this.url, this.props );
// Create Statement object
stmt = conn.createStatement();
// Check if the table is present
rset = stmt.executeQuery(" SELECT table_name FROM user_tables "+
" WHERE table_name = 'CLOB_TAB' ");
// If the table is not present, then create the table.
if (!rset.next()) {
// Table does not exist, create it
stmt.executeUpdate(" CREATE TABLE clob_tab(clob_col CLOB)");
} catch (SQLException sqlEx) {
System.out.println("Could not create table clob_tab : "
+sqlEx.toString());
} finally {
try {
if( rset != null ) rset.close();
if( stmt != null ) stmt.close();
if (conn!=null) conn.close();
} catch(SQLException ex) {
System.out.println("Could not close objects in checkTables method : "
+ex.toString());
* This method reads the specified text file and, returns the content
* as a string.
private String readFile()
throws FileNotFoundException, IOException{
// Read the file whose content has to be passed as String
BufferedReader br = new BufferedReader(new FileReader(fileName));
String nextLine = "";
StringBuffer sb = new StringBuffer();
while ((nextLine = br.readLine()) != null) {
sb.append(nextLine);
// Convert the content into to a string
String clobData = sb.toString();
// Return the data.
return clobData;
sqlplus -s @pr_all.sql;Is there a better way to satisfy such claim?I have to say I would not consider doing this in the database. Source control would allow you to manage (review / commit, not to mention revert) the results of such a potentially dangerours global search and replace.
Such as if it UPPERcased all my source code for example.
v_replace := UPPER (rec_prog.text); -
OS - win2003 server
DB - 9.2.0.5.0
Can you have a look on Statspack Report and offer your valuable suggestions?
Current Instance
~~~~~~~~~~~~~~~~
DB Id DB Name Inst Num Instance
340547761 CHRYSLER 1 chrysler
Instances in this Statspack schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id Inst Num DB Name Instance Host
340547761 1 CHRYSLER chrysler NOID2K36BGTP
B1
Using 340547761 for database Id
Using 1 for instance number
Completed Snapshots
Snap Snap
Instance DB Name Id Snap Started Level Comment
chrysler CHRYSLER 1 17 Jan 2008 10:05 5
2 17 Jan 2008 10:09 5
3 17 Jan 2008 10:16 5
4 17 Jan 2008 10:48 5
5 17 Jan 2008 11:02 5
6 17 Jan 2008 11:12 5
Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 4
Begin Snapshot Id specified: 4
Enter value for end_snap: 6
End Snapshot Id specified: 6
PAR VERSN
HOST_NAME DB Name
Instance BTIME
NO 9.2.0.5.0
NOID2K36BGTPB1 CHRYSLER
chrysler 20080117 10:48:11
ETIME
20080117 11:12:09
Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is sp_4_6. To use this name,
press <return> to continue, otherwise enter an alternative.
Enter value for report_name: Statspack Report
Using the report name Statspack Report
SP2-0333: Illegal spool file name: "Statspack Report" (bad character: ' ')
STATSPACK report for
DB Name DB Id Instance Inst Num Release Cluster Host
CHRYSLER 340547761 chrysler 1 9.2.0.5.0 NO NOID2K36BGTP
B1
Snap Id Snap Time Sessions Curs/Sess Comment
Begin Snap: 4 17-Jan-08 10:48:11 22 6.5
End Snap: 6 17-Jan-08 11:12:09 27 7.4
Elapsed: 23.97 (mins)
Cache Sizes (end)
~~~~~~~~~~~~~~~~~
Buffer Cache: 184M Std Block Size: 8K
Shared Pool Size: 904M Log Buffer: 512K
Load Profile
~~~~~~~~~~~~ Per Second Per Transaction
Redo size: 10,225.13 4,901,244.00
Logical reads: 700.13 335,593.67
Block changes: 68.68 32,918.67
Physical reads: 15.03 7,206.67
Physical writes: 14.41 6,906.00
User calls: 1.22 584.00
Parses: 0.73 349.33
Hard parses: 0.03 13.67
Sorts: 0.40 193.00
Logons: 0.01 4.67
Executes: 1.46 701.67
Transactions: 0.00
% Blocks changed per Read: 9.81 Recursive Call %: 91.60
Rollback per transaction %: 0.00 Rows per Sort: 1016.53
Instance Efficiency Percentages (Target 100%)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Buffer Nowait %: 100.00 Redo NoWait %: 100.00
Buffer Hit %: 99.57 In-memory Sort %: 99.65
Library Hit %: 100.00 Soft Parse %: 96.09
Execute to Parse %: 50.21 Latch Hit %: 99.98
Parse CPU to Parse Elapsd %: 56.76 % Non-Parse CPU: 99.34
Shared Pool Statistics Begin End
Memory Usage %: 53.83 53.90
% SQL with executions>1: 84.54 84.53
% Memory for SQL w/exec>1: 62.62 62.65
Top 5 Timed Events
~~~~~~~~~~~~~~~~~~ % Total
Event Waits Time (s) Ela Time
CPU time 32 79.76
direct path read 390 3 7.21
db file scattered read 275 2 3.78
log file parallel write 515 1 2.44
db file sequential read 365 1 2.07
Wait Events for DB: CHRYSLER Instance: chrysler Snaps: 4 -6
-> s - second
-> cs - centisecond - 100th of a second
-> ms - millisecond - 1000th of a second
-> us - microsecond - 1000000th of a second
-> ordered by wait time desc, waits desc (idle events last)
Avg
Total Wait wait Waits
Event Waits Timeouts Time (s) (ms) /txn
direct path read 390 0 3 7 130.0
db file scattered read 275 0 2 5 91.7
log file parallel write 515 449 1 2 171.7
db file sequential read 365 0 1 2 121.7
control file parallel write 467 0 0 1 155.7
control file sequential read 294 0 0 1 98.0
db file parallel write 35 0 0 10 11.7
db file parallel read 1 0 0 251 0.3
LGWR wait for redo copy 19 1 0 12 6.3
SQL*Net message from dblink 18 0 0 4 6.0
latch free 14 0 0 5 4.7
log file sync 14 0 0 1 4.7
SQL*Net break/reset to clien 36 0 0 0 12.0
log buffer space 19 0 0 1 6.3
SQL*Net more data to client 103 0 0 0 34.3
direct path write 8 0 0 1 2.7
SQL*Net message to dblink 18 0 0 0 6.0
SQL*Net message from client 1,606 0 11,104 6914 535.3
wakeup time manager 47 47 2,580 54895 15.7
SQL*Net more data from clien 11 0 0 14 3.7
SQL*Net message to client 1,611 0 0 0 537.0
Background Wait Events for DB: CHRYSLER Instance: chrysler Snaps: 4 -6
-> ordered by wait time desc, waits desc (idle events last)
Avg
Total Wait wait Waits
Event Waits Timeouts Time (s) (ms) /txn
log file parallel write 515 449 1 2 171.7
control file parallel write 467 0 0 1 155.7
db file parallel write 35 0 0 10 11.7
control file sequential read 188 0 0 2 62.7
LGWR wait for redo copy 19 1 0 12 6.3
latch free 4 0 0 17 1.3
rdbms ipc message 2,392 1,859 9,366 3916 797.3
pmon timer 487 487 2,651 5443 162.3
smon timer 4 4 2,307 ###### 1.3
SQL ordered by Gets for DB: CHRYSLER Instance: chrysler Snaps: 4 -6
-> End Buffer Gets Threshold: 10000
-> Note that resources reported for PL/SQL includes the resources used by
all SQL statements called within the PL/SQL code. As individual SQL
statements are also reported, it is possible and valid for the summed
total % to exceed 100
CPU Elapsd
Buffer Gets Executions Gets per Exec %Total Time (s) Time (s) Hash Value
415,514 2 207,757.0 41.3 5.45 5.44 1116368370
Module: SQL*Plus
INSERT INTO STATS$SQLTEXT ( HASH_VALUE , TEXT_SUBSET , PIECE , S
QL_TEXT , ADDRESS , COMMAND_TYPE , LAST_SNAP_ID ) SELECT ST1.HAS
H_VALUE , SS.TEXT_SUBSET , ST1.PIECE , ST1.SQL_TEXT , ST1.ADDRES
S , ST1.COMMAND_TYPE , SS.SNAP_ID FROM V$SQLTEXT ST1 , STATS$SQL
SUMMARY SS WHERE SS.SNAPID = :B3 AND SS.DBID = :B2 AND SS.INST
223,045 2 111,522.5 22.2 1.09 1.38 3446574552
Module: SQL Developer
select column_name from all_updatable_columns where TABLE_NAME
= :OBJECT_NAME and owner = :OBJECT_OWNER and updatable = 'YES'
208,951 1 208,951.0 20.8 10.42 14.21 1240367379
Module: SQL*Plus
BEGIN statspack.snap ; END;
208,539 1 208,539.0 20.7 10.47 14.11 2522684317
Module: sqlplus.exe
BEGIN statspack.snap; END;
81,198 1 81,198.0 8.1 0.73 0.73 401938015
Module: Oracle SQL Developer
SELECT s.owner, s.synonym_name, 'SYNONYM' as object_type FROM sy
s.all_synonyms s, sys.all_objects o WHERE s.table_name = o.objec
t_name AND s.table_owner = o.owner AND object_type IN ('PACKAGE'
, 'PROCEDURE', 'SEQUENCE', 'TABLE', 'TYPE', 'VIEW', 'FUNCTION' )
ORDER BY s.owner, s.synonym_name
58,656 10 5,865.6 5.8 3.34 3.33 3247664323
insert into source$(obj#,line,source) values (:1,:2,:3)
57,404 2 28,702.0 5.7 0.28 0.30 3259503395
Module: SQL Developer
select * from (SELECT OBJECT_NAME, OBJECT_ID ,'' short_name,
decode(( SELECT count (1) FROM SYS.ALL_TAB_PARTITIONS WHERE TAB
LE_OWNER =owner AND TABLE_NAME = object_name ),0,'FALSE','TRUE'
) partition, OWNER OBJECT_OWNER
FROM SYS.ALL_OBJECTS O WHERE O.OWNE
51,583 1 51,583.0 5.1 0.77 0.75 2077069258
Module: Oracle SQL Developer
SELECT owner, object_name, object_type FROM sys.all_objects WHER
E object_type IN ('PACKAGE', 'PROCEDURE', 'SEQUENCE', 'TABLE', '
TYPE', 'VIEW', 'FUNCTION' ) ORDER BY owner, object_name
41,310 2 20,655.0 4.1 0.27 0.29 1607513402
Module: SQL Developer
SELECT OWNER,TABLE_NAME FROM all_external_tables
SQL ordered by Gets for DB: CHRYSLER Instance: chrysler Snaps: 4 -6
-> End Buffer Gets Threshold: 10000
-> Note that resources reported for PL/SQL includes the resources used by
all SQL statements called within the PL/SQL code. As individual SQL
statements are also reported, it is possible and valid for the summed
total % to exceed 100
CPU Elapsd
Buffer Gets Executions Gets per Exec %Total Time (s) Time (s) Hash Value
20,776 1 20,776.0 2.1 0.20 0.21 1305228895
Module: SQL*Plus
select owner , object_name , object_type from dba_objects where
object_type = 'TABLE'
15,709 10 1,570.9 1.6 0.97 1.07 3098922061
delete from source$ where obj#=:1
11,854 1 11,854.0 1.2 0.11 0.21 4208944292
Module: SQL Developer
with pri_cols as ( SELECT cols.column_name column_name, cols.pos
ition column_position FROM all_constraints cons, al
l_cons_columns cols WHERE cons.constraint_type = 'P'
AND cons.constraint_name = cols.constraint_name
AND cons.owner = cols.owner and cols.table_name
7,493 1 7,493.0 0.7 0.17 1.87 1279266739
Module: SQL Developer
select count(*) from IMP_TEMPSS_PARTSLANG
3,904 47 83.1 0.4 0.00 0.14 815501214
select t.schema, t.name, t.flags, q.name from system.aq$_queue_t
ables t, sys.aq$_queue_table_affinities aft, system.aq$_que
ues q where aft.table_objno = t.objno and aft.owner_instance = :
1 and q.table_objno = t.objno and q.usage = 0 and b
itand(t.flags, 4+16+32+64+128+256) = 0 for update of t.name, aft
3,467 14 247.6 0.3 0.50 0.53 1554250272
Module: SQL Developer
select count(1) from all_objects where owner <> 'PUBLIC' and ob
ject_name in (:S0)
1,694 4 423.5 0.2 0.08 0.08 1547382267
Module: SQL Developer
select object_type,owner,object_name,rank from ( select objec
t_type,owner,object_name,0 rank from all_objects where obj
ect_name = :NAME and UPPER(owner) = nvl(:OWNER,UPPER(sys_cont
ext('USERENV', 'CURRENT_SCHEMA'))) and object_type not in ( '
SYNONYM' ) union all select ao.object_type,ao.owner,ao.ob
1,317 188 7.0 0.1 0.00 0.03 3371479671
select t.name, (select owner_instance from sys.aq$_queue_table_
affinities where table_objno = t.objno) from system.aq$_queue
_tables t where t.name = :1 and t.schema = :2 for update skip lo
cked
892 1 892.0 0.1 0.02 0.01 3021556466
Module: SQL Developer
SELECT OBJECT_NAME, OBJECT_ID, DECODE(STATUS, 'INVAL
ID', 'TRUE', 'FALSE') INVALID, 'TRUE' runnable,
SQL ordered by Gets for DB: CHRYSLER Instance: chrysler Snaps: 4 -6
-> End Buffer Gets Threshold: 10000
-> Note that resources reported for PL/SQL includes the resources used by
all SQL statements called within the PL/SQL code. As individual SQL
statements are also reported, it is possible and valid for the summed
total % to exceed 100
CPU Elapsd
Buffer Gets Executions Gets per Exec %Total Time (s) Time (s) Hash Value
NVL( b.HAS_BODY, 'FALSE') HAS_BODY FROM SYS.ALL_OBJECTS
a, (SELECT 'TRUE' HAS_BODY, object_name tmp_name FROM SYS.
ALL_OBJECTS WHERE OWNER = :SCHEMA AND OBJECT_TYPE = 'PACKAGE BOD
890 2 445.0 0.1 0.09 0.10 1201167771
Module: SQL Developer
SELECT T.TABLE_NAME, 'TABLE' OBJECT_TYPE , (SELECT O.OBJ
ECT_ID FROM ALL_OBJECTS O WHERE O.OWNER = T.OWNER
AND O.OBJECT_TYPE = 'TABLE' AND O.OBJECT_NAME = T.
TABLE_NAME) OBJECT_ID FROM ALL_TABLES T WHERE T.OWNER = :1 AN
D T.TABLE_NAME LIKE :2 AND T.IOT_NAME IS NULL AND T.NES
779 10 77.9 0.1 0.02 0.05 3067006941
delete from dependency$ where d_obj#=:1
748 146 5.1 0.1 0.05 0.05 3951809012
insert into dependency$(d_obj#,d_timestamp,order#,p_obj#,p_times
tamp,d_owner#, property)values (:1,:2,:3,:4,:5,:6, :7)
632 2 316.0 0.1 10.53 17.92 4043595143
Module: SQL*Plus
INSERT INTO STATS$SQL_SUMMARY ( SNAP_ID , DBID , INSTANCE_NUMBER
, TEXT_SUBSET , SHARABLE_MEM , SORTS , MODULE , LOADED_VERSIONS
SQL ordered by Reads for DB: CHRYSLER Instance: chrysler Snaps: 4 -6
-> End Disk Reads Threshold: 1000
CPU Elapsd
Physical Reads Executions Reads per Exec %Total Time (s) Time (s) Hash Value
17,317 2 8,658.5 80.1 10.53 17.92 4043595143
Module: SQL*Plus
INSERT INTO STATS$SQL_SUMMARY ( SNAP_ID , DBID , INSTANCE_NUMBER
, TEXT_SUBSET , SHARABLE_MEM , SORTS , MODULE , LOADED_VERSIONS
, FETCHES , EXECUTIONS , LOADS , INVALIDATIONS , PARSE_CALLS ,
DISK_READS , BUFFER_GETS , ROWS_PROCESSED , COMMAND_TYPE , ADDRE
SS , HASH_VALUE , VERSION_COUNT , CPU_TIME , ELAPSED_TIME , OUTL
8,659 1 8,659.0 40.1 10.42 14.21 1240367379
Module: SQL*Plus
BEGIN statspack.snap ; END;
8,658 1 8,658.0 40.0 10.47 14.11 2522684317
Module: sqlplus.exe
BEGIN statspack.snap; END;
3,880 1 3,880.0 17.9 0.17 1.87 1279266739
Module: SQL Developer
select count(*) from IMP_TEMPSS_PARTSLANG
299 2 149.5 1.4 1.09 1.38 3446574552
Module: SQL Developer
select column_name from all_updatable_columns where TABLE_NAME
= :OBJECT_NAME and owner = :OBJECT_OWNER and updatable = 'YES'
12 5 2.4 0.1 0.05 0.13 3444463493
Module: SQL Developer
SELECT TEXT FROM SYS.ALL_SOURCE WHERE TYPE = :TYPE AND OWNER =
:OWNER AND NAME = :NAME ORDER BY LINE
12 4 3.0 0.1 0.03 0.13 3833423502
Module: SQL Developer
SELECT TEXT FROM SYS.ALL_SOURCE WHERE TYPE = :1 AND OWNER = :2 A
ND NAME = :3 ORDER BY LINE
9 1 9.0 0.0 0.00 0.07 3687727603
insert into col$(obj#,name,intcol#,segcol#,type#,length,precisio
n#,scale,null$,offset,fixedstorage,segcollength,deflength,defaul
t$,col#,property,charsetid,charsetform,spare1,spare2,spare3)valu
es(:1,:2,:3,:4,:5,:6,decode(:7,0,null,:7),decode(:5,2,decode(:8,
-127/*MAXSB1MINAL*/,null,:8),178,:8,179,:8,180,:8,181,:8,182,:8,
8 2 4.0 0.0 0.28 0.30 3259503395
Module: SQL Developer
select * from (SELECT OBJECT_NAME, OBJECT_ID ,'' short_name,
decode(( SELECT count (1) FROM SYS.ALL_TAB_PARTITIONS WHERE TAB
LE_OWNER =owner AND TABLE_NAME = object_name ),0,'FALSE','TRUE'
) partition, OWNER OBJECT_OWNER
FROM SYS.ALL_OBJECTS O WHERE O.OWNE
7 5 1.4 0.0 0.02 0.06 3508476732
insert into idl_ub1$(obj#,part,version,piece#,length,piece) valu
es(:1,:2,:3,:4,:5,:6)
SQL ordered by Reads for DB: CHRYSLER Instance: chrysler Snaps: 4 -6
-> End Disk Reads Threshold: 1000
CPU Elapsd
Physical Reads Executions Reads per Exec %Total Time (s) Time (s) Hash Value
5 8 0.6 0.0 0.00 0.03 1008661772
update idl_ub1$ set piece#=:1 ,length=:2 , piece=:3 where obj#=:
4 and part=:5 and piece#=:6 and version=:7
5 1 5.0 0.0 0.11 0.21 4208944292
Module: SQL Developer
with pri_cols as ( SELECT cols.column_name column_name, cols.pos
ition column_position FROM all_constraints cons, al
l_cons_columns cols WHERE cons.constraint_type = 'P'
AND cons.constraint_name = cols.constraint_name
AND cons.owner = cols.owner and cols.table_name
2 3 0.7 0.0 0.00 0.01 761440199
insert into idl_ub2$(obj#,part,version,piece#,length,piece) valu
es(:1,:2,:3,:4,:5,:6)
1 3 0.3 0.0 0.00 0.01 1249304535
update idl_ub2$ set piece#=:1 ,length=:2 , piece=:3 where obj#=:
4 and part=:5 and piece#=:6 and version=:7
1 2 0.5 0.0 0.27 0.29 1607513402
Module: SQL Developer
SELECT OWNER,TABLE_NAME FROM all_external_tables
1 10 0.1 0.0 0.03 0.02 1825174980
delete from access$ where d_obj#=:1
1 10 0.1 0.0 0.02 0.05 3067006941
delete from dependency$ where d_obj#=:1
1 10 0.1 0.0 3.34 3.33 3247664323
insert into source$(obj#,line,source) values (:1,:2,:3)
1 146 0.0 0.0 0.05 0.05 3951809012
insert into dependency$(d_obj#,d_timestamp,order#,p_obj#,p_times
tamp,d_owner#, property)values (:1,:2,:3,:4,:5,:6, :7)
0 2 0.0 0.0 0.00 0.00 10821553
Module: SQL Developer
ALTER SESSION SET TIME_ZONE = '05:30'
0 3 0.0 0.0 0.00 0.01 66972507
Module: SQL Developer
SELECT TO_DATE(TIMESTAMP, 'YYYY-MM-DD:HH24:MI:SS') FROM SYS.ALL_
OBJECTS WHERE OWNER = :1 AND OBJECT_NAME = :2 AND OBJECT_TYPE =
:3
0 2 0.0 0.0 0.02 0.00 80089551
Module: SQL Developer
SELECT LAST_DDL_TIME FROM SYS.ALL_OBJECTS WHERE OWNER = :1 AND O
BJECT_NAME = :2 AND OBJECT_TYPE = :3
0 1 0.0 0.0 0.00 0.00 120978412
select col#,intcol#,ntab# from ntab$ where obj#=:1 order by intc
SQL ordered by Reads for DB: CHRYSLER Instance: chrysler Snaps: 4 -6
-> End Disk Reads Threshold: 1000
CPU Elapsd
Physical Reads Executions Reads per Exec %Total Time (s) Time (s) Hash Value
ol# asc
0 5 0.0 0.0 0.00 0.00 130926350
select count(*) from sys.job$ where next_date < :1 and (field1 =
:2 or (field1 = 0 and 'Y' = :3))
0 5 0.0 0.0 0.00 0.00 155765854
select count(*),min(piece#),max(piece#) from idl_ub1$ where obj#
=:1 and part=:2 and version=:3
0 1 0.0 0.0 0.00 0.00 162044583
select col#,intcol#,charsetid,charsetform from col$ where obj#=:
1 order by intcol# asc
0 2 0.0 0.0 0.00 0.00 179957765
select count(*),min(piece#),max(piece#) from idl_char$ where obj
#=:1 and part=:2 and version=:3
0 3 0.0 0.0 0.00 0.00 204386021
select col#, grantee#, privilege#,max(mod(nvl(option$,0),2)) fro
m objauth$ where obj#=:1 and col# is not null group by privilege
#, col#, grantee# order by col#, grantee#
0 10 0.0 0.0 0.00 0.00 292617943
delete from vtable$ where obj#=:1
0 1 0.0 0.0 0.73 0.73 401938015
Module: Oracle SQL Developer
SELECT s.owner, s.synonym_name, 'SYNONYM' as object_type FROM sy
SQL ordered by Executions for DB: CHRYSLER Instance: chrysler Snaps: 4 -6
-> End Executions Threshold: 100
CPU per Elap per
Executions Rows Processed Rows per Exec Exec (s) Exec (s) Hash Value
280 0 0.0 0.00 0.00 1316169839
select job, nvl2(last_date, 1, 0) from sys.job$ where (((:1 <= n
ext_date) and (next_date < :2)) or ((last_date is null) and
(next_date < :3))) and (field1 = :4 or (field1 = 0 and 'Y' = :5)
) and (this_date is null) order by next_date, job
280 280 1.0 0.00 0.00 1693927332
select count(*) from sys.job$ where (next_date > sysdate) and (n
ext_date < (sysdate+5/86400))
188 188 1.0 0.00 0.00 3371479671
select t.name, (select owner_instance from sys.aq$_queue_table_
affinities where table_objno = t.objno) from system.aq$_queue
_tables t where t.name = :1 and t.schema = :2 for update skip lo
cked
146 146 1.0 0.00 0.00 3951809012
insert into dependency$(d_obj#,d_timestamp,order#,p_obj#,p_times
tamp,d_owner#, property)values (:1,:2,:3,:4,:5,:6, :7)
76 76 1.0 0.00 0.00 2997854589
insert into access$(d_obj#,order#,columns,types) values (:1,:2,:
3,:4)
47 0 0.0 0.00 0.00 633914867
select q_name, state, delay, expiration, rowid, msgid, dequeu
e_msgid, chain_no, local_order_no, enq_time, enq_tid, step_no,
priority, exception_qschema, exception_queue, retry_count, corr
id, time_manager_info from SYS.AQ_EVENT_TABLE where time
managerinfo <= :1 and state != :2 for update skip locked
47 188 4.0 0.00 0.00 815501214
select t.schema, t.name, t.flags, q.name from system.aq$_queue_t
ables t, sys.aq$_queue_table_affinities aft, system.aq$_que
ues q where aft.table_objno = t.objno and aft.owner_instance = :
1 and q.table_objno = t.objno and q.usage = 0 and b
itand(t.flags, 4+16+32+64+128+256) = 0 for update of t.name, aft
47 0 0.0 0.00 0.00 870116171
select q_name, state, delay, expiration, rowid, msgid, dequeu
e_msgid, chain_no, local_order_no, enq_time, enq_tid, step_no,
priority, exception_qschema, exception_queue, retry_count, corr
id, time_manager_info from SYSTEM.DEF$_AQERROR where tim
e_manager_info <= :1 and state != :2 for update skip locked
47 0 0.0 0.00 0.00 1153132087
select q_name, state, delay, expiration, rowid, msgid, dequeu
e_msgid, chain_no, local_order_no, enq_time, enq_tid, step_no,
priority, exception_qschema, exception_queue, retry_count, corr
id, time_manager_info from SYSTEM.DEF$_AQCALL where time
managerinfo <= :1 and state != :2 for update skip locked
47 0 0.0 0.00 0.00 3920324236
select q_name, state, delay, expiration, rowid, msgid, dequeue
SQL ordered by Executions for DB: CHRYSLER Instance: chrysler Snaps: 4 -6
-> End Executions Threshold: 100
CPU per Elap per
Executions Rows Processed Rows per Exec Exec (s) Exec (s) Hash Value
msgid, chainno, local_order_no, enq_time, enq_tid, step_no,
priority, exception_qschema, exception_queue, retry_count, corri
d, time_manager_info, sender_name, sender_address, sender_prot
ocol from SYS.AQ_SRVNTFN_TABLE where time_manager_info <= :1
30 30 1.0 0.00 0.00 2201541053
insert into error$(obj#,sequence#,line,position#,textlength,text
) values (:1,:2,:3,:4,:5,:6)
26 115 4.4 0.00 0.00 1749333492
select position#,sequence#,level#,argument,type#,charsetid,chars
etform,properties,nvl(length, 0), nvl(precision#, 0),nvl(scale,
0),nvl(radix, 0), type_owner,type_name,type_subname,type_linknam
e,pls_type from argument$ where obj#=:1 and procedure#=:2 order
by sequence# desc
21 0 0.0 0.00 0.00 1683508596
delete from idl_sb4$ where obj#=:1 and part=:2
21 0 0.0 0.00 0.00 1894783783
delete from idl_char$ where obj#=:1 and part=:2
21 0 0.0 0.00 0.00 2479503691
delete from idl_ub1$ where obj#=:1 and part=:2
21 0 0.0 0.00 0.00 3926364396
delete from idl_ub2$ where obj#=:1 and part=:2
20 20 1.0 0.00 0.00 3401267293
insert into settings$(obj#, param, value) values (:1, :2, :3)
14 62 4.4 0.00 0.00 1356713530
select privilege#,level from sysauth$ connect by grantee#=prior
privilege# and privilege#>0 start with (grantee#=:1 or grantee#=
1) and privilege#>0
14 14 1.0 0.04 0.04 1554250272
Module: SQL Developer
select count(1) from all_objects where owner <> 'PUBLIC' and ob
ject_name in (:S0)
13 13 1.0 0.00 0.00 3468666020
select text from view$ where rowid=:1
12 12 1.0 0.00 0.00 825987371
Module: SQL Developer
declare l_line varchar2(255); l_done number; l_buffe
r long; begin loop exit when length(l_buffer)+255 > :maxby
tes OR l_done = 1; dbms_output.get_line( l_line, l_done );
l_buffer := l_buffer || l_line || chr(10); end loop; :done
:= l_done; :buffer := l_buffer; end;
12 0 0.0 0.00 0.00 2222871512
Module: SQL Developer
SQL ordered by Executions for DB: CHRYSLER Instance: chrysler Snaps: 4 -6
-> End Executions Threshold: 100
CPU per Elap per
Executions Rows Processed Rows per Exec Exec (s) Exec (s) Hash Value
SELECT LINE,POSITION,TEXT FROM USER_ERRORS WHERE TYPE=:1AND NAME
=:2
SQL ordered by Parse Calls for DB: CHRYSLER Instance: chrysler Snaps: 4 -6
-> End Parse Calls Threshold: 1000
% Total
Parse Calls Executions Parses Hash Value
47 47 4.48 633914867
select q_name, state, delay, expiration, rowid, msgid, dequeu
e_msgid, chain_no, local_order_no, enq_time, enq_tid, step_no,
priority, exception_qschema, exception_queue, retry_count, corr
id, time_manager_info from SYS.AQ_EVENT_TABLE where time
managerinfo <= :1 and state != :2 for update skip locked
47 47 4.48 815501214
select t.schema, t.name, t.flags, q.name from system.aq$_queue_t
ables t, sys.aq$_queue_table_affinities aft, system.aq$_que
ues q where aft.table_objno = t.objno and aft.owner_instance = :
1 and q.table_objno = t.objno and q.usage = 0 and b
itand(t.flags, 4+16+32+64+128+256) = 0 for update of t.name, aft
47 47 4.48 870116171
select q_name, state, delay, expiration, rowid, msgid, dequeu
e_msgid, chain_no, local_order_no, enq_time, enq_tid, step_no,
priority, exception_qschema, exception_queue, retry_count, corr
id, time_manager_info from SYSTEM.DEF$_AQERROR where tim
e_manager_info <= :1 and state != :2 for update skip locked
47 47 4.48 1153132087
select q_name, state, delay, expiration, rowid, msgid, dequeu
e_msgid, chain_no, local_order_no, enq_time, enq_tid, step_no,
priority, exception_qschema, exception_queue, retry_count, corr
id, time_manager_info from SYSTEM.DEF$_AQCALL where time
managerinfo <= :1 and state != :2 for update skip locked
47 188 4.48 3371479671
select t.name, (select owner_instance from sys.aq$_queue_table_
affinities where table_objno = t.objno) from system.aq$_queue
_tables t where t.name = :1 and t.schema = :2 for update skip lo
cked
47 47 4.48 3920324236
select q_name, state, delay, expiration, rowid, msgid, dequeue
msgid, chainno, local_order_no, enq_time, enq_tid, step_no,
priority, exception_qschema, exception_queue, retry_count, corri
d, time_manager_info, sender_name, sender_address, sender_prot
ocol from SYS.AQ_SRVNTFN_TABLE where time_manager_info <= :1
21 21 2.00 1683508596
delete from idl_sb4$ where obj#=:1 and part=:2
21 21 2.00 1894783783
delete from idl_char$ where obj#=:1 and part=:2
21 21 2.00 2479503691
delete from idl_ub1$ where obj#=:1 and part=:2
21 21 2.00 3926364396
delete from idl_ub2$ where obj#=:1 and part=:2
14 14 1.34 1356713530
SQL ordered by Parse Calls for DB: CHRYSLER Instance: chrysler Snaps: 4 -6
-> End Parse Calls Threshold: 1000
% Total
Parse Calls Executions Parses Hash Value
select privilege#,level from sysauth$ connect by grantee#=prior
privilege# and privilege#>0 start with (grantee#=:1 or grantee#=
1) and privilege#>0
14 14 1.34 1554250272
Module: SQL Developer
select count(1) from all_objects where owner <> 'PUBLIC' and ob
ject_name in (:S0)
13 13 1.24 3468666020
select text from view$ where rowid=:1
12 12 1.15 825987371
Module: SQL Developer
declare l_line varchar2(255); l_done number; l_buffe
r long; begin loop exit when length(l_buffer)+255 > :maxby
tes OR l_done = 1; dbms_output.get_line( l_line, l_done );
l_buffer := l_buffer || l_line || chr(10); end loop; :done
:= l_done; :buffer := l_buffer; end;
12 12 1.15 2222871512
Module: SQL Developer
SELECT LINE,POSITION,TEXT FROM USER_ERRORS WHERE TYPE=:1AND NAME
=:2
11 11 1.05 701589132
Module: SQL Developer
BEGIN /* NOP UNLESS A TABLE OBJECT */ IF dictionary_
obj_type = 'TABLE' AND sys.dbms_cdc_publish.active > 0 THE
N sys.dbms_cdc_publish.change_table_trigger(dictionary_o
bj_owner,dictionary_obj_name,sysevent); END IF; END;
11 11 1.05 4144490151
delete from error$ where obj#=:1
11 11 1.05 4151580176
update obj$ set obj#=:6,type#=:7,ctime=:8,mtime=:9,stime=:10,sta
tus=:11,dataobj#=:13,flags=:14,oid$=:15,spare1=:16, spare2=:17 w
here owner#=:1 and name=:2 and namespace=:3 and(remoteowner=:4 o
r remoteowner is null and :4 is null)and(linkname=:5 or linkname
is null and :5 is null)and(subname=:12 or subname is null and :
10 10 0.95 292617943
delete from vtable$ where obj#=:1
10 10 0.95 412513799
select o.owner#, u.name, o.name, o.namespace,
o.obj#, d.d_timestamp, nvl(d.property,0), o.type#, o.s
ubname from dependency$ d, obj$ o, user$ u where d.p_obj#=:1
and (d.p_timestamp=:2 or d.property=2) and d.d_obj#=o.obj#
and o.owner#=u.user# and decode(:3,0,0,o.type#)=:3
10 10 0.95 1077743770
SQL ordered by Parse Calls for DB: CHRYSLER Instance: chrysler Snaps: 4 -6
-> End Parse Calls Threshold: 1000
% Total
Parse Calls Executions Parses Hash Value
delete from argument$ where obj#=:1
SQL ordered by Sharable Memory for DB: CHRYSLER Instance: chrysler Snaps: 4 -6
-> End Sharable Memory Threshold: 1048576
Sharable Mem (b) Executions % Total Hash Value
3,898,908 2 0.4 3259503395
Module: SQL Developer
select * from (SELECT OBJECT_NAME, OBJECT_ID ,'' short_name,
decode(( SELECT count (1) FROM SYS.ALL_TAB_PARTITIONS WHERE TAB
LE_OWNER =owner AND TABLE_NAME = object_name ),0,'FALSE','TRUE'
) partition, OWNER OBJECT_OWNER
FROM SYS.ALL_OBJECTS O WHERE O.OWNE
2,519,473 1 0.3 680078008
Module: SQL Developer
SELECT O.OBJECT_NAME, O.OBJECT_TYPE, O.OBJECT_ID FROM ALL_OBJE
CTS O WHERE O.OWNER = :1 AND O.OBJECT_NAME LIKE :2 AND O.
OBJECT_TYPE IN (:3) AND O.SUBOBJECT_NAME IS NULL AND O.SEC
ONDARY = 'N' AND ( O.OBJECT_TYPE <> 'INDEX' OR (
EXISTS (SELECT 1 FROM ALL_INDEXES I
1,882,420 1 0.2 4208944292
Module: SQL Developer
with pri_cols as ( SELECT cols.column_name column_name, cols.pos
ition column_position FROM all_constraints cons, al
l_cons_columns cols WHERE cons.constraint_type = 'P'
AND cons.constraint_name = cols.constraint_name
AND cons.owner = cols.owner and cols.table_name
1,687,994 4 0.2 1547382267
Module: SQL Developer
select object_type,owner,object_name,rank from ( select objec
t_type,owner,object_name,0 rank from all_objects where obj
ect_name = :NAME and UPPER(owner) = nvl(:OWNER,UPPER(sys_cont
ext('USERENV', 'CURRENT_SCHEMA'))) and object_type not in ( '
SYNONYM' ) union all select ao.object_type,ao.owner,ao.ob
1,406,016 2 0.1 2033073833
Module: SQL Developer
select parameter,value from nls_session_parameters union all SE
LECT 'DB_TIMEZONE' name, DBTIMEZONE value FROM DUAL union all S
ELECT parameter, value FROM nls_database_parameters WHERE parame
ter='NLS_CHARACTERSET'
SQL ordered by Version Count for DB: CHRYSLER Instance: chrysler Snaps: 4 -6
-> End Version Count Threshold: 20
Version
Count Executions Hash Value
53 2 2033073833
Module: SQL Developer
select parameter,value from nls_session_parameters union all SE
LECT 'DB_TIMEZONE' name, DBTIMEZONE value FROM DUAL union all S
ELECT parameter, value FROM nls_database_parameters WHERE parame
ter='NLS_CHARACTERSET'
Instance Activity Stats for DB: CHRYSLER Instance: chrysler Snaps: 4 -6
Statistic Total per Second per Trans
CPU used by this session 3,185 2.2 1,061.7
CPU used when call started 3,185 2.2 1,061.7
CR blocks created 48 0.0 16.0
Cached Commit SCN referenced 0 0.0 0.0
Commit SCN cached 0 0.0 0.0
DBWR buffers scanned 0 0.0 0.0
DBWR checkpoint buffers written 22 0.0 7.3
DBWR checkpoints 0 0.0 0.0
DBWR free buffers found 0 0.0 0.0
DBWR lru scans 0 0.0 0.0
DBWR make free requests 0 0.0 0.0
DBWR revisited being-written buff 0 0.0 0.0
DBWR summed scan depth 0 0.0 0.0
DBWR transaction table writes 6 0.0 2.0
DBWR undo block writes 12 0.0 4.0
SQL*Net roundtrips to/from client 1,570 1.1 523.3
SQL*Net roundtrips to/from dblink 18 0.0 6.0
active txn count during cleanout 188 0.1 62.7
background checkpoints completed 0 0.0 0.0
background checkpoints started 0 0.0 0.0
background timeouts 1,682 1.2 560.7
branch node splits 0 0.0 0.0
buffer is not pinned count 436,985 303.9 145,661.7
buffer is pinned count 948,328 659.5 316,109.3
bytes received via SQL*Net from c 803,800 559.0 267,933.3
bytes received via SQL*Net from d 6,405 4.5 2,135.0
bytes sent via SQL*Net to client 831,677 578.4 277,225.7
bytes sent via SQL*Net to dblink 3,735 2.6 1,245.0
calls to get snapshot scn: kcmgss 7,027 4.9 2,342.3
calls to kcmgas 763 0.5 254.3
calls to kcmgcs 208 0.1 69.3
change write time 375 0.3 125.0
cleanout - number of ktugct calls 3,728 2.6 1,242.7
cleanouts and rollbacks - consist 0 0.0 0.0
cleanouts only - consistent read 3,527 2.5 1,175.7
cluster key scan block gets 27,451 19.1 9,150.3
cluster key scans 12,274 8.5 4,091.3
commit cleanout failures: block l 0 0.0 0.0
commit cleanout failures: buffer 0 0.0 0.0
commit cleanout failures: callbac 2 0.0 0.7
commit cleanout failures: cannot 0 0.0 0.0
commit cleanouts 1,219 0.9 406.3
commit cleanouts successfully com 1,217 0.9 405.7
commit txn count during cleanout 3,574 2.5 1,191.3
consistent changes 95 0.1 31.7
consistent gets 926,553 644.3 308,851.0
consistent gets - examination 304,799 212.0 101,599.7
current blocks converted for CR 0 0.0 0.0
cursor authentications 13 0.0 4.3
data blocks consistent reads - un 95 0.1 31.7
db block changes 98,756 68.7 32,918.7
db block gets 80,228 55.8 26,742.7
deferred (CURRENT) block cleanout 613 0.4 204.3
dirty buffers inspected 3,379 2.4 1,126.3
enqueue conversions 90 0.1 30.0
enqueue releases 2,288 1.6 762.7
Instance Activity Stats for DB: CHRYSLER Instance: chrysler Snaps: 4 -6
Statistic Total per Second per Trans
enqueue requests 2,290 1.6 763.3
enqueue timeouts 0 0.0 0.0
enqueue waits 0 0.0 0.0
execute count 2,105 1.5 701.7
free buffer inspected 3,379 2.4 1,126.3
free buffer requested 4,937 3.4 1,645.7
hot buffers moved to head of LRU 243 0.2 81.0
immediate (CR) block cleanout app 3,527 2.5 1,175.7
immediate (CURRENT) block cleanou 240 0.2 80.0
index fast full scans (full) 0 0.0 0.0
index fetch by key 248,987 173.2 82,995.7
index scans kdiixs1 457,728 318.3 152,576.0
leaf node 90-10 splits 1 0.0 0.3
leaf node splits 36 0.0 12.0
logons cumulative 14 0.0 4.7
messages received 553 0.4 184.3
messages sent 553 0.4 184.3
no buffer to keep pinned count 0 0.0 0.0
no work - consistent read gets 483,400 336.2 161,133.3
opened cursors cumulative 806 0.6 268.7
parse count (failures) 14 0.0 4.7
parse count (hard) 41 0.0 13.7
parse count (total) 1,048 0.7 349.3
parse time cpu 21 0.0 7.0
parse time elapsed 37 0.0 12.3
physical reads 21,620 15.0 7,206.7
physical reads direct 17,317 12.0 5,772.3
physical writes 20,718 14.4 6,906.0
physical writes direct 17,317 12.0 5,772.3
physical writes non checkpoint 20,698 14.4 6,899.3
pinned buffers inspected 0 0.0 0.0
prefetched blocks 3,662 2.6 1,220.7
prefetched blocks aged out before 0 0.0 0.0
process last non-idle time 16,807,669,922 11,688,226.7 ############
recovery blocks read 0 0.0 0.0
recursive calls 19,103 13.3 6,367.7
recursive cpu usage 2,568 1.8 856.0
redo blocks written 29,780 20.7 9,926.7
redo buffer allocation retries 19 0.0 6.3
redo entries 51,190 35.6 17,063.3
redo log space requests 0 0.0 0.0
redo log space wait time 0 0.0 0.0
redo ordering marks 17 0.0 5.7
redo sizeI know, I must apply the latest patch to make it 9.2.0.8.0. coming back to your question, I am actually new in this company, don't know much about their nature of database. their database appears to run prety slow. specially, when they perfrom bulk DML activity. I've already suggested them to disable the indexes
and drop the constraints, but that didn't seem to work eighter. I though, you guys would able to offer something , which would make sence in order to kill the ongoing problem. Anyways, thanks for the inputs
hare krishna
Alok
Maybe you are looking for
-
Printer setup utility freezes when I try to add drivers
I have an Epson Stylus Photo RX500 all-in-one printer which worked fine until a few weeks ago. My best guess as to why it stopped working is that I let my hard drive fill up and some data got corrupted/overwritten (I've had numerous problems incuding
-
Converting Photos taken on a 16:9 aspect camcorder?
Hi, I've taken quite a few pictures using my camcorder which is set to 16:9 aspect ratio which is exactly what I want for my video. However the pictures also seem to be on taht ratio and look strange in iphoto. Does anypone know of an app that will c
-
Ekko-adrnr or ekpo-adrnr are blank..how to retreive the vendor/delv adress
hi, First of all I want to know that though delivery address and vendor address are there in me23n but ekko-adrnr/ekpo-adrnr are blank...i need to display these addresses in my script... How do i retreive these addresses in the best possible way usin
-
Is the BI Content release correct?
Do you think we installed the correct BI Content release? Here is what we have: SAP EHP 1 for SAP NetWeaver 7.0 SAP_ABA 701 0005 SAPKA70105 Cross-Application Component SAP_BASIS 701 0005 SAPKB70105 SAP Basis Component PI_BASIS 701 0005 SAPK-70105INPI
-
JavaServer Faces v1.0 tutorial
Why sun is not releasing the tutorial for JavaServer Faces V1.0? Can anyone of you give me the tutorial for Server Faces V1.0. Any links?? Regards Shaf