How to retrieve the number of "free" rows in a table?
Hi,
if in a client only environment (no sync to mobile server) rows are inserted and deleted into a table,
is there a way to retrieve the number of "free" rows in a table? Number of "Free" rows stands for
number of rows that can be inserted again, before the table extents in size.
Is there a way in OLite 10.3.0.2.0 to retrieve the size of tables and indexes? ALL_TABLES is not
a place that really works.
Best regards and many thanks,
Gerd
Hi Gary,
many thanks, the partner uses a Lite client db without sync. The db runs inside an laboratory device and collects measures. There must be a way to estimate the the number of "measures" rows, that stil can be stored in the db.
Than we need to make the deleted space available for new rows. The partner tested defrag.exe and found that it
needs very long time to run, especially if the db is bigger than 2GB. ... and that this run sometimes fails.
Is there any recommendation the partner can follow on?
Thanks,
Gerd
Similar Messages
-
How to find the number of columns in an internal table DYNAMICALLY ?
Hi,
How to find the number of columns in an internal table DYNAMICALLY ?
Thanks and Regards,
saleem.Hi,
you can find the number of columns and their order using
the <b>'REUSE_ALV_FIELDCATALOG_MERGE'</b>
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = sy-repid
I_INTERNAL_TABNAME = 'ITAB'
I_INCLNAME = sy-repid
changing
ct_fieldcat = IT_FIELDCAT
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif
now describe your fieldcat . and find no of columns.
and their order also..
regards
vijay -
Result Set - How to retrieve the number of rows in resultset
harlo....everyone.
i m new in this language and would like to ask that how can i store the result into an array or u all hav others ideal to do it......? Hopefully can get answer asap....thanksssss.
Below is the source code that i did. Please comment it
ResultSet rs = stmt.executeQuery("Select CCourse_Code from RegisteredCourse, Student where Student.NStud_ID ='123'and Student.CStud_Pwd='123' and Student.NStud_ID = RegisteredCourse.NStud_ID ");
if(rs!=null){
// can i get the the number of records in resultset, rs to define my array size
String course[] = new String[2];
while(rs.next()){
for(int i =0; i<course.length; i++)
course[i] = rs.getString("ccourse_code");
return course;Or...
ResultSet rs = stmt.executeQuery("Select count(CCourse_Code) from RegisteredCourse, Student where Student.NStud_ID ='123'and Student.CStud_Pwd='123' and Student.NStud_ID = RegisteredCourse.NStud_ID ");
This should return a table with one row and one column. This will hold the number originally requested.
However I would still go with the ArrayList suggestion given above. -
How to count the number of deleted rows processed
Sybase ASE version: 15.7-SP52
Hi all,
I have a delete statement that will potentially delete millions of rows
DELETE from TAB_A where COL_A='Y'
The delete is long, at some point I'd like to know how many rows were deleted.
If I do SELECT COUNT(*) from TAB_A where COL_A='Y', the query should be locked because of the exclusive-lock held by the DELETE in progress.
If this is the case, how can I actually count the number of rows deleted so far?
Thanks all
SimonSimon
For deleting significant number of rows best practice is to delete rows in small batches of known size (e.g. 10 K) inside a while loop.
This keeps transaction log from filling up as well.
Also between two iterations of delete you can give some wait to make sure that you do not monopolize the server. Sleep could be for a fixed number of seconds (e.g. 5) or for randomized number say from 1 to whatever makes sense.
Typically "set rowcount " is used to set up the batch size and "waitfor delay" to sleep between iterations.
Global variable @@rowcount gives yo actual rows deleted. For the last batch this may be lower than the batch size you set up.
HTH
Avinash -
How to calculate the percentage of free space for a table in Oracle
okay, I am a little confused here. I have been searching the web and looking at a lot of documents. What I basically want to find out is this, how do I calculate the difference between the number of bytes a table is using and the total bytes allocated to a table space (going that way to get percent free for a particular table). So I need a byte count of a table and total table space and the percentage difference. I have been looking at the DBA_TABLES DBA_TABLESPACES and DBA_SEGMENTS views. I have tried to calculated the space as num_rows * avg_row_len (if I am wrong, let me know). I have been trying to compare that calculation to the number in DBA_TABLESPACES and DBA_SEGMENTS. I am just looking for the total space allocated to the table space that the table sits in (seem logical right now) to make the percentage value work. Thus I want to be able to track the table as it grows as compated to the table space it sits in to see a value as it changes over time (days, weeks, etc.) each time I run this script I am working on.
Can someone get me straight and help me to find out if I am looking in the right places. Any advice would help.
EdwardYou can use a little modified version of dbms_space from Tom, show_space. Have a look,
SQL> create table test222 as select * from all_objects;
Table created.
SQL> delete from test22 where rownum<=100;
delete from test22 where rownum<=100
ERROR at line 1:
ORA-00942: table or view does not exist
SQL> delete from test222 where rownum<=100;
100 rows deleted.
SQL> analyze table test222 compute statistics;
Table analyzed.
SQL> create or replace procedure show_space
2 ( p_segname in varchar2,
3 p_owner in varchar2 default user,
4 p_type in varchar2 default 'TABLE',
5 p_partition in varchar2 default NULL )
6 -- this procedure uses authid current user so it can query DBA_*
7 -- views using privileges from a ROLE and so it can be installed
8 -- once per database, instead of once per user that wanted to use it
9 authid current_user
10 as
11 l_free_blks number;
12 l_total_blocks number;
13 l_total_bytes number;
14 l_unused_blocks number;
15 l_unused_bytes number;
16 l_LastUsedExtFileId number;
17 l_LastUsedExtBlockId number;
18 l_LAST_USED_BLOCK number;
19 l_segment_space_mgmt varchar2(255);
20 l_unformatted_blocks number;
21 l_unformatted_bytes number;
22 l_fs1_blocks number; l_fs1_bytes number;
23 l_fs2_blocks number; l_fs2_bytes number;
24 l_fs3_blocks number; l_fs3_bytes number;
25 l_fs4_blocks number; l_fs4_bytes number;
26 l_full_blocks number; l_full_bytes number;
27
28 -- inline procedure to print out numbers nicely formatted
29 -- with a simple label
30 procedure p( p_label in varchar2, p_num in number )
31 is
32 begin
33 dbms_output.put_line( rpad(p_label,40,'.') ||
34 to_char(p_num,'999,999,999,999') );
35 end;
36 begin
37 -- this query is executed dynamically in order to allow this procedure
38 -- to be created by a user who has access to DBA_SEGMENTS/TABLESPACES
39 -- via a role as is customary.
40 -- NOTE: at runtime, the invoker MUST have access to these two
41 -- views!
42 -- this query determines if the object is a ASSM object or not
43 begin
44 execute immediate
45 'select ts.segment_space_management
46 from dba_segments seg, dba_tablespaces ts
47 where seg.segment_name = :p_segname
48 and (:p_partition is null or
49 seg.partition_name = :p_partition)
50 and seg.owner = :p_owner
51 and seg.tablespace_name = ts.tablespace_name'
52 into l_segment_space_mgmt
53 using p_segname, p_partition, p_partition, p_owner;
54 exception
55 when too_many_rows then
56 dbms_output.put_line
57 ( 'This must be a partitioned table, use p_partition => ');
58 return;
59 end;
60
61
62 -- if the object is in an ASSM tablespace, we must use this API
63 -- call to get space information, else we use the FREE_BLOCKS
64 -- API for the user managed segments
65 if l_segment_space_mgmt = 'AUTO'
66 then
67 dbms_space.space_usage
68 ( p_owner, p_segname, p_type, l_unformatted_blocks,
69 l_unformatted_bytes, l_fs1_blocks, l_fs1_bytes,
70 l_fs2_blocks, l_fs2_bytes, l_fs3_blocks, l_fs3_bytes,
71 l_fs4_blocks, l_fs4_bytes, l_full_blocks, l_full_bytes, p_partition);
72
73 p( 'Unformatted Blocks ', l_unformatted_blocks );
74 p( 'FS1 Blocks (0-25) ', l_fs1_blocks );
75 p( 'FS2 Blocks (25-50) ', l_fs2_blocks );
76 p( 'FS3 Blocks (50-75) ', l_fs3_blocks );
77 p( 'FS4 Blocks (75-100)', l_fs4_blocks );
78 p( 'Full Blocks ', l_full_blocks );
79 else
80 dbms_space.free_blocks(
81 segment_owner => p_owner,
82 segment_name => p_segname,
83 segment_type => p_type,
84 freelist_group_id => 0,
85 free_blks => l_free_blks);
86
87 p( 'Free Blocks', l_free_blks );
88 end if;
89
90 -- and then the unused space API call to get the rest of the
91 -- information
92 dbms_space.unused_space
93 ( segment_owner => p_owner,
94 segment_name => p_segname,
95 segment_type => p_type,
96 partition_name => p_partition,
97 total_blocks => l_total_blocks,
98 total_bytes => l_total_bytes,
99 unused_blocks => l_unused_blocks,
100 unused_bytes => l_unused_bytes,
101 LAST_USED_EXTENT_FILE_ID => l_LastUsedExtFileId,
102 LAST_USED_EXTENT_BLOCK_ID => l_LastUsedExtBlockId,
103 LAST_USED_BLOCK => l_LAST_USED_BLOCK );
104
105 p( 'Total Blocks', l_total_blocks );
106 p( 'Total Bytes', l_total_bytes );
107 p( 'Total MBytes', trunc(l_total_bytes/1024/1024) );
108 p( 'Unused Blocks', l_unused_blocks );
109 p( 'Unused Bytes', l_unused_bytes );
110 p( 'Last Used Ext FileId', l_LastUsedExtFileId );
111 p( 'Last Used Ext BlockId', l_LastUsedExtBlockId );
112 p( 'Last Used Block', l_LAST_USED_BLOCK );
113 end;
114
115 /
Procedure created.
SQL> desc show_space
PROCEDURE show_space
Argument Name Type In/Out Default?
P_SEGNAME VARCHAR2 IN
P_OWNER VARCHAR2 IN DEFAULT
P_TYPE VARCHAR2 IN DEFAULT
P_PARTITION VARCHAR2 IN DEFAULT
SQL> set serveroutput on
SQL> exec show_space('TEST222','SCOTT');
BEGIN show_space('TEST222','SCOTT'); END;
ERROR at line 1:
ORA-00942: table or view does not exist
ORA-06512: at "SCOTT.SHOW_SPACE", line 44
ORA-06512: at line 1
SQL> conn / as sysdba
Connected.
SQL> grant sysdba to scott;
Grant succeeded.
SQL> conn scott/tiger as sysdba
Connected.
SQL> exec show_space('TEST222','SCOTT');
BEGIN show_space('TEST222','SCOTT'); END;
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00201: identifier 'SHOW_SPACE' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
SQL> exec scott.show_space('TEST222','SCOTT');
PL/SQL procedure successfully completed.
SQL> set serveroutput on
SQL> exec scott.show_space('TEST222','SCOTT');
Unformatted Blocks ..................... 0
FS1 Blocks (0-25) ..................... 0
FS2 Blocks (25-50) ..................... 1
FS3 Blocks (50-75) ..................... 0
FS4 Blocks (75-100)..................... 1
Full Blocks ..................... 807
Total Blocks............................ 896
Total Bytes............................. 7,340,032
Total MBytes............................ 7
Unused Blocks........................... 65
Unused Bytes............................ 532,480
Last Used Ext FileId.................... 4
Last Used Ext BlockId................... 1,289
Last Used Block......................... 63
PL/SQL procedure successfully completed.
SQL>http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:5350053031470
I use this to find the space allocations.
Just read your post again,this is not going to show you the percentage of the free/used space. This is going to be the number of blocks which are free/used. For the growth trend, you can look at (in 10g) Oracle EM. It has added now,Segment Growth Trend report which can show you for each object,comparing to the allocated space to the object,how much space is being used by it.
HTH
Aman.... -
How to get the values of all rows in advanced table
HI All,
I am using an advanced table to enter the values for the service contract line (its a custom page)in that advanced table i ahave column with lov called task number for that task number once i had choosed one task number and creating one more row using add anethor row button i want to restrict the user to not to choose the task number which was entered in the previus row.
Or if this is not possible i want to restrict the user by showing an error message when click on the submit button by saying you have choosed the duplicate task number please choose a uniqu task number
please give some hints
thanks
ajayHi
your approach will have two steps
1.) use the row refernce and get the value of task number of the row which is enterd by user .
2.) use getRows in range and compare values of task number of every row with the user selected value ,if value match then throw error.
Thanks
Pratap -
How to get the number of routes in MLS L3SW table with SNMP
Hello experts,
Is there any way to get the number of routes in the MLS-hardware Layer 3-switching table with SNMP, like with CLI command "show mls cef summary"?
If possible, please let me know the OID and which MIB do I use.
[e.g.]
#show mls cef summary
Total routes: 400000
<omit>
====
Device : C6509E
IOS : s72033-advipservicesk9_wan-mz.122-33.SXH3a.bin
====
Thank you,function buttonClick()
var table = profileTable;
var lnRow = table.rows.length;
var insertedRow = table.insertRow(parseFloat(lnRow));
var cell1 = insertedRow.insertCell();
cell1.innerHTML ="<tr><td><Input type=\"hidden\" >>>name=\"rowNum\" value="+cnt"+></td></tr>";
document.profileform.submit;
on submit it goes to the second page, but the value i got using >>>System.out.println("row number from text >>>box"+request.getParameter("rowNum")); is null. What is wrong with >>>my coding. Can anyone solve this.HI carry
Check the value of bold data
function buttonClick()
var table = profileTable;
var lnRow = table.rows.length;
var insertedRow = table.insertRow(parseFloat(lnRow));var cnt=inRow
var cell1 = insertedRow.insertCell();
cell1.innerHTML ="<tr><td><Input type=\"hidden\" >>>name=\"rowNum\" value="+cnt+"></td></tr>";
document.profileform.submit;
}try with it -
How to reduce the number of data blocks used by table
Hi,
I was trying to reduce the space usage of a particular table of my apex application which stores blob content and therefore deleted many records from it.
However, the data block usage remained the same as before.
I have tried to 'analyze' the table and validate the structure,but am unable to overcome this problem.
Could someone throw some light on what needs to be to reduce the number of data blocks used by this table?
Best Regards,
Priya JetleyPriya:
It is likely that the BLOB content defined in your table is being stored 'Out-of-Line'. This means that the LOB columns are stored in segments of their own. These then are the segments that may need shrinking.
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14249/adlob_tables.htm#i1006363
Varad -
How to find the number views for a particular DB Table
Hi Friends,
I would like to know the number of views(all) exists for a particular Data Base Table like MARA, MARC etc.,
Thanks in advance.
BaLuHi Balaji,
check this below link may be helpful for u
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ecab446011d189700000e8322d00/content.htm
If u find it useful plz mark the points
Regards,
Naveen -
DB Update - How to Return the Number of Affected Rows?
I created a DB Adapter that updates a record. I'd like to know if there is a way to return the affected number of rows. Currently, the DB Adapter Wizard seems not to create a return for the generated XSD.
Thanks,
Mark> Is it by somehow possible to use some custom query
for this and use the 'returning'-clause to get the
results back from the DB-adapter. On these results
you can do some counts.
Thanks for your reply.
I have given a thought to that option too, however the issue is that, in order to use returning clause you have to use a temporary SQL variable which I believe can not be used unless we use a PL/SQL block (Please correct me, if I am wrong).
I wanted to get away with the option of re-querying the 'SELECT' or a PL/SQL Block. Any suggestions?
Thanks & regards -
How to get the class from selected row in af:table
I know that you can get individual selcted row values from an af:table using getRow().getAttribute("attName").
But, can I obtain the class that the table iterator used to populate the table?
For instance, a table lists the result of an employee search that was bound to a session bean method returning List<Employee>.
After selecting the employee of interest and clicking a command button I want to access that instance of the Employee class to pass onto the session bean to do some stuff.
I don't want to hit the database to do it either (via a query on a key value for example) - the search iterator has already retrieved it, I just want to access it and do something with it.
Possible?
Thanks.Hi,
if you use ADF try iterator.getCurrentRow().getDataProvider() on the binding container. If you use ADF Faces without then the Row object is the instance of your class
Frank -
How to find the difference between 2 rows in a table
Hi all
I have a table say emp which has only 2 rows
emp
empno name age sex deptno
1 X 20 M 10
2 Y 21 M 20
The output should be
empno name age deptno
1 X 20 10
2 Y 21 20
Since the sex are same , so it is not included in the output.
thanks
HariHi there rajkumar,
Although your lead solution is more elegant than the one presented below,
I believe the complete answer it would be:
with mytable as (
SELECT ROW_NUMBER() OVER (ORDER BY EMPNO) POS, Z.* FROM (
select 1 empno, 'X' name, 20 age, 'M' sex, 10 deptno from dual
union
select 2, 'Y', 21, 'M', 20 from dual) Z
SELECT
DECODE(A.EMPNO,B.EMPNO,NULL,A.EMPNO) EMPNO,
DECODE(A.NAME,B.NAME,NULL,A.NAME) NAME,
DECODE(A.AGE,B.AGE,NULL,A.AGE) AGE,
DECODE(A.SEX,B.SEX,NULL,A.SEX) SEX,
DECODE(A.DEPTNO,B.DEPTNO,NULL,A.DEPTNO) DEPTNO
FROM
(SELECT * FROM mytable WHERE POS = 1) A,
(SELECT * FROM mytable WHERE POS = 2) B
UNION
SELECT
DECODE(B.EMPNO,A.EMPNO,NULL,B.EMPNO) EMPNO,
DECODE(B.NAME,A.NAME,NULL,B.NAME) NAME,
DECODE(B.AGE,A.AGE,NULL,B.AGE) AGE,
DECODE(B.SEX,A.SEX,NULL,B.SEX) SEX,
DECODE(B.DEPTNO,A.DEPTNO,NULL,B.DEPTNO) DEPTNO
FROM
(SELECT * FROM mytable WHERE POS = 1) A,
(SELECT * FROM mytable WHERE POS = 2) B
Your query indeed returns NULL in the column for which values are the same, but still, you get just the first row.
Anyway, the question is how to dinamically select the columns that hold NULL values, in the newly generated result. Because i believe the request is like this, if column holds equal values on both rows, then don't select the column (maybe i'm wrong).
If this is the case then just by one sql it will not solve your problem, it needs to be more, with sqlplus and some other scripts checking the values in the columns, if it's not null then set an operator, and in the end (in sqlplus)
select operator1, operator2 etc. from mytable.
Hope it helps,
Michael.
[All the above presented is based on the fact that you shall always have TWO rows to be compared, having more or less it will fail!]
Message was edited by:
kjt -
How to retrieve the multiple rows data on PDF form in a web service method using WSDL DataConnection
How to retrieve the multiple rows data on PDF form in a web service method using WSDL DataConnection.
I have a multiple rows on PDF form. All rows have 4 textfields. I want to submit the multiple rows data to a method defiened in webservice.
Unable to retrieve the data in multiple rows within webservice method.Hi Paul,
I'm now able to save the retrieved xml in a hidden text field and create dynamic table, and I'm able to fill this table from the XML, but the problem is that I could not find the correct way to loop on the xml, what I'm trying to say, the table will have number of rows with the data of the first row only, so can you tell me the right way to loop on the xml!
this is my code
TextField1.rawValue=xmlData.document.rawValue;
xfa.datasets.data.loadXML(TextField1.rawValue, true, false);
for(var i=0; i<count; i++)
xfa.form.resolveNode("form1.P1.Table1.Row1["+i+"].Num").rawValue = xfa.datasets.data.record.num.value;
xfa.form.resolveNode("form1.P1.Table1.Row1["+i+"].Name").rawValue = xfa.datasets.data.record.name.value;
Table1.Row1.instanceManager.addInstance(true);
Thanks
Hussam -
How to increase the number of rows in Status Oveview iView in MSS?
Hi
We have implemented MSS and have a question regarding Status overview iview.
The standard status overview iview of the team workset has 5 rows and we have to scroll using the arrow buttons to select/view a request.
Now can anyone explain me how to increase the number of rows in this iview? Is this somthing that has to be accoplished through web dynpro customization?
I checked the options in iView property and do not see any option to increase the number of rows.
please help
Thanks
-MichaelHi Micheal,
Well, I am not really sure, if you could accomplish this using customizing, but I am sure that you can accomplish this using the JDI. Well, you can extract the application's source code using JDI and then change the required display rows property and republish it.
Am not really sure if this is suggestable method for this requirement,but it can be achieved using this JDI stuff.
Regards
<b>Raja Sekhar</b><i></i> -
How to increase the number of rows to be displayed in BEx Web Analyzer
hi,
I am viewing reports using BEx Web analyzer option. It is displaying only 24 rows of data at a time. How to increase the number of rows? do i need to any kind of settings?
pls reply.Hi,
I think the standard template in 2004s is named 0ANALYSIS_PATTERN. You can find it in Web Application Designer, open, and search for the technical name. If you want to change the number of rows or columns, you can find this setting near the bottom of the XHTML view of the template:
<bi:BLOCK_COLUMNS_SIZE value="4" />
<bi:BLOCK_ROWS_SIZE value="17" />
Then just save, and ignore the error messages.
Message was edited by:
vind Reinsberg
Maybe you are looking for
-
OCreditNotes added but nothing in A/R Credit Memo
Is there someone who understand this behaviour ? I just added a oCreditNotes. Everything is fine, no errror. The .Add() works fine but when looking in SAP, what I just added isn't there in A/R Credit Memo Maybe I'm not creating the right Document ?
-
How to use video in a slide show
I've created slideshows in iPhoto and incorperated a mizture of photos and videos. I've now made one using Aperture but the video does not play - it just shows the first frame. The video will play if I select it alone in the browser. Any suggestions.
-
Where I can download Web Premium CS5 PL version?
My Web Premium CS5 PL version on CD stop working. Where I can download PL version of this product? It is Mac version. I am trying to find it since two days. Please help.
-
Width of phtmlb:ganttChart
I just inserted a phtmlb:ganttChart into my WebAS application. Cool stuff. Now, I wonder how to set the width of the chart. In my case, the chart is inserted into a table, which has width="100%". If the time frame that is shown in the chart is too bi
-
Security API on web.xml
hello i'm java junior programmer. my file web.xml bind the follow tag <security-constraint> <web-resource-collection> <web-resource-name>UIWebSecurity</web-resource-name> <description></description> <url-pattern>/</url-pattern> <http-method> GET</htt