Update stats for table in dbstatc
Hello all,
I am very new to administrating SAP on Oracle. My question is. There are some tables in dbstatc with ignore flag. I ran the below query to get that...
select COUNT(*) from sapsr3.dbstatc
where ACTIV = 'I';
Now from my understanding the I flag means...do not update stats for that table...
So i first ran below...which runs the full stats and it did not update or touched those table in dbstats with I flag
brconnect -c -u / -f stats -t all -f collect -p 8
so after researching i found we can update those stats with below .... even after running the below, stats still do not show up as update.... how can i update (forcefully if required) to update stats for a particular table....
brconnect -u / -c -f stats -t SAPSR3.table_name -f allsel -p 4
i query dba_tables at DB level to see if that specific table was analyzed or not. I am on 11.2 oracle version...and this is a BW SAP system....
New User:
1) Which objects do you have the INACTIVE flag set for:
col dbobj format a20
select dbobj, activ from sapsr3.dbstatc where activ = 'I' order by 1;
2) Check that you have the correct DBSTATC settings per SAP Note 403704.
If you do not, then I would suggest you update the DBSTATC table following SAP Note 403704, but before you do take a copy of the dbstatc table:
sqlplus sapsr3/<pass.
create table dbstatc_old as select * from dbstatc;
3) To check to see if you have stats on a table:
select table_name, partitioned, last_analyzed, num_rows from dba_tables where table_name = 'TBTCO';
TABLE_NAME PAR LAST_ANALYZED NUM_ROWS
TBTCO NO 19-MAY-11 163030
If the LAST_ANALYZED shows up with NO values, then there are NO stats on the table.
HOWEVER, be careful for partitioned tables in BW because there are stats at the partition level as well:
select TABLE_NAME, PARTITION_NAME, LAST_ANALYZED, NUM_ROWS from dba_tab_partitions where table_name = '<table>';
4) To collect the statistics on a table
brconnect -c -u / -f stats -t <TABLE> -f allsel,collect -g 4 -p 16
5) If the stats are still not collected with the brconnect command, it may be because the stats are locked at the table level from SAP Note 1020260:
SELECT stattype_locked FROM dba_tab_statistics WHERE table_name = '<TABLE>';
If the value is ALL, then the stats may be locked at the table level and may require to unlock the stats before updating.
Good Luck,
Mike Kennedy
Similar Messages
-
Update statement for object table.
Hi,
I have created one type as
Create type test as object(
ins_by varchar2(30),
ins_on date,
upd_by varchar2( 30),
upd_on date);
and then created an object table as
create table imst(
i_code number(5),
i_desc varchar2(35),
i_op test);
now i am able to insert record in this table as
insert into imst values(1,'Hawkins cooker',test(user,sysdate,'',''));
Above works fine.
But I would also like to update the record with i_op.upd_by,i_op.upd_on with some other values.
Can any body help me specifying how to write a plain update statement for the same.
Regards.
SoumenCheck it out:
SQL> Create type myTest as object(
2 ins_by varchar2(30),
3 ins_on date,
4 upd_by varchar2( 30),
5 upd_on date);
6 /
Type created.
SQL> create table imst(
2 i_code number(5),
3 i_desc varchar2(35),
4 i_op myTest);
Table created.
SQL> insert into imst values(1,'Hawkins cooker', mytest(user,sysdate,'',''));
1 row created.
SQL> select * from imst;
I_CODE I_DESC
I_OP(INS_BY, INS_ON, UPD_BY, UPD_ON)
1 Hawkins cooker
MYTEST('APC_LOAD', '12-JUL-04', NULL, NULL)
SQL> update imst i set i.i_op.upd_by = USER, i.i_op.upd_on = add_months(sysdate, 1);
1 row updated.
SQL> select * from imst;
I_CODE I_DESC
I_OP(INS_BY, INS_ON, UPD_BY, UPD_ON)
1 Hawkins cooker
MYTEST('APC_LOAD', '12-JUL-04', 'APC_LOAD', '12-AUG-04')
SQL> Smoke me a kipper I'll be back before breakfast.
Cheers, APC -
File to JDBC :Error when executing statement for table/stored proc.
Hi,
I am getting following error when i am trying to insert data into z-table using JDBC recr adapter.
Error while parsing or executing XML-SQL document: Error processing request in sax parser: Error when executing statement for table/stored proc. 'ZTEST' (structure 'STATEMENT'): java.sql.SQLException: <u>[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Invalid object name '<b>ZTEST</b>'.</u>
But the database table name 'ZTEST' exists in the system.
XML structure:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_RECR xmlns:ns0="http://urn:srini/FileToJDBC">
<STATEMENT>
<TEST action="INSERT">
<table>ZTEST</table>
<access>
<ROLLNO>123</ROLLNO>
<FIRSTNAME>ABC</FIRSTNAME>
<LASTNAME>XYZ</LASTNAME>
</access>
</TEST>
</STATEMENT>
</ns0:MT_RECR>
Regards,
SrinivasHi,
I have changed my MT str but still getting the same error.Is it possible to insert/ update a z-table using JDBC adapter.
XML str:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_RECR xmlns:ns0="http://urn:srini/FileToJDBC">
<STATEMENT>
<ZTEST action="INSERT">
<access>
<ROLLNO>123</ROLLNO>
<FIRSTNAME>abc</FIRSTNAME>
<LASTNAME>XYZ</LASTNAME>
</access>
</ZTEST>
</STATEMENT>
</ns0:MT_RECR>
Regards,
Srinivas -
Update statement for multiple records
i have table a and table b
common col in both the tables is emp_id
in table b i have district_id
which i want to update in table a.... column district_id for all the employees
how to write update statement for this
Edited by: user10873676 on Oct 17, 2011 8:00 AMBased on your current description, we have something like this...
SQL> create table a (emp_id number)
2 /
Table created.
SQL>
SQL> create table b (emp_id number, district_id number)
2 /
Table created.
SQL>
SQL> insert into a (emp_id)
2 select rownum from dual connect by rownum <= 10
3 /
10 rows created.
SQL>
SQL> insert into b (emp_id, district_id)
2 select rownum, 10-rownum from dual connect by rownum <= 10
3 /
10 rows created.
SQL>
SQL> update b
2 set district_id = 1
3 /
10 rows updated.
SQL>
SQL> select * from a;
EMP_ID
1
2
3
4
5
6
7
8
9
10
10 rows selected.
SQL> select * from b;
EMP_ID DISTRICT_ID
1 1
2 1
3 1
4 1
5 1
6 1
7 1
8 1
9 1
10 1
10 rows selected.Which I'm sure is NOT what you want as the update on table b has nothing to do with table a, and we have no idea what the district_id should be updated with. -
Error when executing statement for table/stored proc
Hi All,
I am getting this error when executing IDOC to JDBC (Stored Procedure) Scenario.
In my stored procedure I have three insert statements to insert rows in to 3 tables.
This stored procedure is working fine for two insert statements i.e,
For this I have created data type for stored procedure with 10 elements and executed the scenario and was successfully running.
when I added 3rd insert statement to stored procedure ie., when i added 5 more elements to the datatype (totally 15 elements) it starts giving the bellow error in Message Monitoring.
<i><b>Exception caught by adapter framework: Error processing request in sax parser: Error when executing statement for table/stored proc. 'COGRP_TMP_PROC_1' (structure 'Statements'): java.sql.SQLException: General error</b></i>
<i><b>Delivery of the message to the application using connection JDBC_http://sap.com/xi/XI/System failed, due to: com.sap.aii.af.ra.ms.api.RecoverableException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'COGRP_TMP_PROC_1' (structure 'Statements'): java.sql.SQLException: General error</b></i>
Note:- I have run the stored procedure with three insert statements in Sql Server, and also by calling an external program also, and was working fine.
<i><b> Note : Is there any structure needs to be follow when working with IDOC to Stored procedure.</b></i>
I am struck up with the error, can any body resolve this issue.
Thanks in Advance,
MurthyHi narasimha,
This seems to be any error due to incorrect query formation.In your receiver jdbc channel set the parameter logSQLstatement = true.you can find this parameter in the advanced mode. Using this parameter you will be able to see the sql query which is generated at runtime in the audit log in RWB.
Regards,
Pragati -
How to gather table stats for tables in a different schema
Hi All,
I have a table present in one schema and I want to gather stats for the table in a different schema.
I gave GRANT ALL ON SCHEMA1.T1 TO SCHEMA2;
And when I tried to execute the command to gather stats using
DBMS_STATS.GATHER_TABLE_STATS (OWNNAME=>'SCHMEA1',TABNAME=>'T1');
The function is failing.
Is there any way we can gather table stats for tables in one schema in an another schema.
Thanks,
MK.You need to grant analyze any to schema2.
SY. -
SQL*Loader-929: Error parsing insert statement for table
Hi,
I get the following error with SQL*Loader:
Table MYTABLE loaded from every logical record.
Insert option in effect for this table: INSERT
Column Name Position Len Term Encl Datatype
IDE FIRST * ; CHARACTER
SQL string for column : "mysequence.NEXTVAL"
CSI_NBR 1:10 10 ; CHARACTER
POLICY_NBR 11:22 12 ; CHARACTER
CURRENCY_COD 23:25 3 ; CHARACTER
POLICY_STAT 26:27 2 ; CHARACTER
PRODUCT_COD 28:35 8 ; CHARACTER
END_DAT 44:53 10 ; CHARACTER
FISCAL_COD 83:83 1 ; CHARACTER
TOT_VAL 92:112 21 ; CHARACTER
SQL*Loader-929: Error parsing insert statement for table MYTABLE.
ORA-01031: insufficient privileges
I am positive that I can SELECT the sequence and INSERT into the table with the user invoking sql*loader.
Where does that "ORA-01031" come from?
Regards
...Options:
1) you are wrong about privileges OR
2) you have the privilege only when you connect via SQL*Plus (or whichever other tool you used to test the insert).
Is it possible that during your test you enabled the role which granted you the INSERT privilege - and that SQL*Loader doesn't do this?
Can you see the table in this list?
select *
from user_tab_privs_recd
where table_name='MY_TABLE'
and owner='table owner whoever';
select *
from user_role_privs;Any roles where DEFAULT_ROLE is not YES?
HTH
Regards Nigel -
Error when executing statement for table/stored proc DB2 - Data Truncation
Hi,
I have one call sp in XI with n parameters int and two parameters out.
well, to implement the interface gives the following error
com.sap.aii.af.ra.ms.api.DeliveryException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'SPSAPAR9' (structure 'Statement'): java.sql.SQLException: The number of parameter values set or registered does not match the number of parameters
Thanks for your help
Ximena
Edited by: Ximena Gonzalez on Feb 19, 2008 11:50 AM
Edited by: Ximena Gonzalez on Feb 20, 2008 12:17 PMMy Error is change
Error while parsing or executing XML-SQL document: Error processing request in sax parser: Error when executing statement for table/stored proc. 'SAPPRG.SPSAPAR9' (structure 'Statement'): java.sql.DataTruncation: Data truncation
but de change DT SP
<?xml version="1.0" encoding="UTF-8" ?>
<ns1:AlistReqDet2_MT xmlns:ns1="urn:proxl:tmuc:proxl01:AlistReqItems">
<Statement>
<SPSAPAR9 action="EXECUTE">
<table>SAPPRG.SPSAPAR9</table>
<ISAPNU1 isInput="TRUE" type="STRING">0080000353</ISAPNU1>
<ISAPEM1 isInput="TRUE" type="STRING">'LU'</ISAPEM1>
<ISAPC05 isInput="TRUE" type="STRING">15353</ISAPC05>
<ISAPSEC isInput="TRUE" type="STRING">10</ISAPSEC>
<ISAPLOT isInput="TRUE" type="STRING">'lats'</ISAPLOT>
<ISAPCA1 isInput="TRUE" type="STRING">10</ISAPCA1>
<ISAPCA2 isInput="TRUE" type="STRING">10</ISAPCA2>
<ISAPKIL isInput="TRUE" type="STRING">10</ISAPKIL>
<ISAPES1 isInput="TRUE" type="STRING">'T'</ISAPES1>
<ISAPSW isOutput="TRUE" type="STRING" />
</SPSAPAR9>
</Statement>
</ns1:AlistReqDet2_MT> -
Error when executing statement for table/stored proc. : ORA-00911
Hi All,
I am posting IDOC->XI->JDBC, approx 5000 Idocs.
But few messages are giving following error in XI-_SXMB_MONI
Can any one guide me what is the cause of error? I check whole Idoc data I am not able to see bad character? can any once guide me what are the bad character in XML to post data in oracle? so that i can search in XML and how to avoide this error.
"com.sap.aii.af.ra.ms.api.MessagingException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'HRP1001' (structure 'INSERT_PAD34'): java.sql.SQLException: ORA-00911: invalid character"> I am talking about following IDOC.<ZRMD_A06> ->
> <E1PLOGI SEGMENT="1">-> <E1PITYP SEGMENT="1"> ->
> <E1PAD34 SEGMENT="1"> -><PROZT>0.00 #</PROZT>.
> Can we remove this # during message mapping in XI??
sure you can remove it using Replace function or by writing UDF.
as I am seing # is last character..<b>so remove # with " " (single space) and then use the TRIM fucntion.</b>
Thanks
Farooq.
*<b>Rewards points if you find it useful*</b> -
Convert a SQL Server Update Statement for Oracle
Hi,
i need to convert an update statement written for SQL Server to make it work on Oracle,
the update is the following:
UPDATE TABLE1
SET CDate = TBL2.CDate
FROM TABLE1 TBL1
JOIN TABLE2 TBL2 ON TBL2.Code = TBL1.TBL2Code
JOIN TABLE3 TBL3 ON TBL3.Id = TBL1.Id
WHERE TBL3.TypeCode = '07'
how can i make it compatible with oracle?
thanks!!Billy Verreynne wrote:
Karthick_Arp wrote:
Try this
<snipped>Dislike such an approach that requires multiple hits on the same tables. This is never scalable. A key performance issue is to do only one pass through a data set when possible and not do multiple passes.Yes i understand. But to do a update on a join the table must be a Key Preserved Table. And for a normal Update it is necessory to have an EXISTS clause so that we dont update the non-matching rows to NULL. -
How to tune the Update statement for 20 million rows
Hi,
I want to update 20 million rows of a table. I wrote the PL/SQL code like this:
DECLARE
v1
v2
cursor C1 is
select ....
BEGIN
Open C1;
loop
fetch C1 bulk collect into v1,v2 LIMIT 1000
exit when C1%NOTFOUND;
forall i in v1.first..v1.last
update /*+INDEX(tab indx)*/....
end loop;
commit;
close C1;
END;
The above code took 24 mins to update 100k records, so for around 20 million records it will take 4800 mins (80 hrs).
How can I tune the code further ? Will a simple Update statement, instead of PL/SQL make the update faster ?
Will adding few more hints help ?
Thanks for your suggestions.
Regards,
Yogini JoshiHello
You have implemented this update in the slowest possible way. Cursor FOR loops should be absolute last resort. If you post the SQL in your cursor there is a very good chance we can re-code it to be a single update statement with a subquery which will be the fastest possible way to run this. Please remember to use the {noformat}{noformat} tags before and after your code so the formatting is preserved.
David -
Need a simple UPDATE statement for updating areas of the polygons
Hi,
I need a simple UPDATE SQL statement for updating areas of the polygons in a table shema.table (geom) with sdo_area function.
DejanDejan,
Maybe I don't understand your question but I will offer this:
update SOME_TABLE t set t.areasqft = SDO_GEOM.SDO_AREA(GEOM, 0.005) where t.geom.GET_GTYPE() = 3
This assumes a "feet" based SRID.
r,
dennis
Edited by: user633187 on Dec 1, 2008 9:04 AM -
Update statement for modifying day of the month
Hi,
i hope there is an easy answer to a question i'm probably over thinking. i have a situation where i need to update all the days in a date field to a certain day of the month regardless of the month or year. Here is an example of a small number of dates in the table:
07/28/2004
04/21/2008
12/21/2011
08/21/2006
04/04/2008
04/16/2012
08/13/2011
03/01/2006
04/17/2012
So, for each of these dates the day (or DD) would need to be converted to the 15th (ie. 07/15/2004, 04/15/2008, 12/15/2011, etc). I've used to_char to pull out just the DD, but am unsure what the update statement would need to look like. Any assistance would be greatly appreciated. Thank you!If you don't care about the time component
UPDATE your_table
SET your_column = trunc(your_column,'MM') + 14Justin
Edited by: Justin Cave on Apr 26, 2012 9:47 PM
Off by 1. Should be +14 not +15 -
UPDATE statement (merge table content)
I have two tables t1 and t2 with the same structure: an unique primary key and some arbitrary fields. The tables look something like:
pk number
f1 varchar2(10)
f2 varchar2(10)
f3 varchar2(10)
I have some "new" data in the records in t2 that I would like to update the corresponding rows in t1 with.
On a Microsoft SQL server I could use a SQL statement like:
UPDATE t1
SET t1.f1 = new.f1, t1.f2 = new.f2
FROM t1, t2 new
WHERE new.pk = t1.pk;
But this doesn't work with Oracle (8.1.7). Instead I have come up with something like:
UPDATE t1 old
SET (f1, f2) =
(SELECT f1, f2 FROM t2 new WHERE new.pk = old.pk)
WHERE old.pk IN (SELECT pk FROM t2);
The problem here is that the Oracle version performs very poorly (it's obvious why), whereas the MS SQL server version works like a charm.
There must be something I'm missing here - can anybody please enlithen me.
How do you merge the contents of two tables on Oracle.
Regards,
Tom Bjerre
nullI have had two sugestions. Stephan Born from Germany suggests:
update t1 old
set ( f1, f2 ) = ( select f1, f2
from t2 new
where new.pk = old.pk
where exits ( select x
from t2 new
where new.pk = old.pk
When there exists an index for t2.pk this should result in one full-scan on t1 and two index-scans on t2.
Another suggestion from Ian Ledzion was to combine both tables in the first select:
UPDATE (SELECT old.f1 old_f1, new.f1 new_f1, old.f2 old_f2, new.f2 new_f2
FROM t1 old, t2 new
WHERE (old.id = new.id)) a
SET a.old_f1 = a.new_f1, a.old_f2 = a.new_f2;
Both suggestions seems to be faster than my first attempt (usning the IN clause). Can anybody tell which is best? It could depend on the relative size of t1 and t2 (number of records)
Regards, Tom Bjerre
null -
Unable to create updatable statement for MySQL?
The following code fragment prints 'Read only', even though the updatable flag is being set for the createStatement function. Can anyone give me an idea of what I am doing wrong here? I'm able to read stuff OK, but not update anything.
Connection conn = DriverManager.getConnection("jdbc:mysql:[removed]");
Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
String query = "select * from foo";
rs = stmt.executeQuery(query);
int concurrency = rs.getConcurrency();
if (concurrency == ResultSet.CONCUR_READ_ONLY)
System.out.println("Read only");
else
if (concurrency == ResultSet.CONCUR_UPDATABLE)
System.out.println("Updatable");
else
System.out.println("Unknown concurrency - " + concurrency);Not all databases support all the listed resultSetType and resultSetConcurrency values; usually, if you try to use an unsopported type, you still get a connection but it's type os downgraded.
You can usually find out if a type is supported by reading the documentation, or querying the database, using DataBaseMetaData.supportsResultSetConcurrency()
Sadly, the only thing in the MySQL documentation that I'm aware of on this topic is a note in the changelog for the 3.0.2-dev version of MySQL
- Fixed DBMD.supportsResultSetConcurrency() so that it returns true
for ResultSet.TYPE_SCROLL_INSENSITIVE and ResultSet.CONCUR_READ_ONLY or
ResultSet.CONCUR_UPDATABLEI did a quick search and might have missed something:
http://dev.mysql.com/doc/mysql/en/index.html
I suspect TYPE_SCROLL_SENSITIVE is not supported and your connection is being downgraded; you might try testing the DBMD to see what the database says is supported...
Maybe you are looking for
-
Command not found error while executing shell programs in terminal
I have written one sample shell program. while executing shell program in terminal,it shows COMMAND NOT FOUND error. How to slove this.
-
CR183190 in WLS 8.1 SP4
Hi. I'm using WLS 8.1 SP4 (with CR132575) and just ran into a problem with my datasources using the BEA's DB2 driver(Type 4 XA). The error I receive is: [BEA][DB2 JDBC Driver]No more available statements. Please recreate your package with a larger dy
-
Hi, As mentioned previously I have purchased a MacBook Pro Retina with 512GB SSD and am getting used to it after using a PC for years. I'm so impressed with it I am going to order a new iMac 27. I would like some ideas as to what to order: 1. Shoul
-
Trying to defrag my macbook pro(2010)with drive genius startup disc and the disc is stuck in my computer. How do I get it out??
-
Does captivate allow for quizzing that includes selecting proper electronic medical record action
Looking to see if Captivate will allow screen recording and interactivity to have end user select proper action in a medical record