Database size versus table data size
I ran the below query that queries all tables in the database and the total size for reserved space is 17GB. The database size is 294GB. Why is there such a big difference in size. I would expect the database to be a little bigger but not 277GB bigger.
DECLARE @TableName VARCHAR(100) --For storing values in the cursor
--Cursor to get the name of all user tables from the sysobjects listing
DECLARE tableCursor CURSOR FOR
select [name] from dbo.sysobjects where OBJECTPROPERTY(id, N'IsUserTable') = 1 FOR READ ONLY
--A procedure level temp table to store the results
CREATE TABLE #TempTable ( tableName varchar(100), numberofRows varchar(100), reservedSize varchar(50), dataSize varchar(50), indexSize varchar(50),
unusedSize varchar(50) )
--Open the cursor
OPEN tableCursor
--Get the first table name from the cursor
FETCH NEXT FROM tableCursor INTO @TableName
--Loop until the cursor was not able to fetch
WHILE (@@Fetch_Status >= 0) BEGIN
--Dump the results of the sp_spaceused query to the temp table
INSERT #TempTable
EXEC sp_spaceused @TableName
--Get the next table name
FETCH NEXT FROM tableCursor INTO @TableName END
--Get rid of the cursor
CLOSE tableCursor
DEALLOCATE tableCursor
--Select all records so we can use the reults
SELECT * FROM #TempTable
order by 2
--Final cleanup!
DROP TABLE #TempTable
Alan
Hi anaylor,
According to your description, the database size is larger than sum of tables sizes. There could be a number of reasons , for example,
• There may have the large transaction, or a lot of data in the database but it has been removed in some process.
• Indexes/constraints are being stored in other files.
•Last database cleanup (including table deletion, record deletion) did not affect any disk reclamation.
•The initial size of the database is large.
• Have you calculate unused spaces? Databases usually trade space for speeding and allocating huge amounts of disk space ahead of time, to avoid allocation at transaction time. Space freed by delete may be reused or not due to speed reasons.
Hope it can help.
Regards,
Sofiya Li
Sofiya Li
TechNet Community Support
Similar Messages
-
Pointers on ABAP documentations (Database/Respositories/Structures/Tables/
Hi ABAP Gurus/Experts,
I am basically a SAP Functional consultant, but recently taken a new assignment on SAP Net Weaver MDM, where in i require lot of ABAP knowledge mainly in Database area, like Structure, Tables, Data Objects etc,
I am looking for an good ABAP documentations on Database/Repositories/Structures/Tables/Data Objects etc.
Good pointers will be Fully Rewarded.
Regards
RehmanHi,
Go thru this link for ABAP Programming,
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf
To start with you should use book....
[bTeach yourself ]ABAP in 21 Days...by SAMS publication.
this book will fundamentally stat up with basics of SAP and ABAP..
it will b the best to start with...
you can get it here...
http://www.allfreetech.com/EBook_index.asp?CategoryID=1
ABAP has so many contents. start learning one by one;
First pay attention to basic chapters like REPORTS, SCRIPTS, TRANSACTIONS, and BDC's,.Once you become perfect start learning other chapters. To learn Netweaver Java is very useful
go through the links:
Start with this.Refer this
http://www.sapbrain.com/FAQs/TECHNICAL/SAP_ABAP_DATADICTIONARY_FAQ.html
http://www.****************/InterviewQ/interviewQ.htm
http://help.sap.com/saphelp_46c/helpdata/en/35/2cd77bd7705394e10000009b387c12/frameset.htm
Reports
http://www.sapgenie.com/abap/reports.htm
http://www.allsaplinks.com/material.html
http://www.sapdevelopment.co.uk/reporting/reportinghome.htm
http://www.sapfans.com/forums/viewtopic.php?t=58286
http://www.sapfans.com/forums/viewtopic.php?t=76490
http://www.sapfans.com/forums/viewtopic.php?t=20591
http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
ALE/ IDOC
http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm
http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.doc
http://edocs.bea.com/elink/adapter/r3/userhtm/ale.htm#1008419
http://www.netweaverguru.com/EDI/HTML/IDocBook.htm
http://www.sapgenie.com/sapedi/index.htm
http://www.sappoint.com/abap/ale.pdf
http://www.sappoint.com/abap/ale2.pdf
http://www.sapgenie.com/sapedi/idoc_abap.htm
http://help.sap.com/saphelp_erp2005/helpdata/en/0b/2a60bb507d11d18ee90000e8366fc2/frameset.htm
http://help.sap.com/saphelp_erp2005/helpdata/en/78/217da751ce11d189570000e829fbbd/frameset.htm
http://www.allsaplinks.com/idoc_sample.html
http://www.sappoint.com/abap.html
http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm
http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.doc
http://edocs.bea.com/elink/adapter/r3/userhtm/ale.htm#1008419
http://www.netweaverguru.com/EDI/HTML/IDocBook.htm
http://www.sapgenie.com/sapedi/index.htm
http://www.allsaplinks.com/idoc_sample.html
Check these step-by-step links
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/ccab6730-0501-0010-ee84-de050a6cc287
https://sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/8fd773b3-0301-0010-eabe-82149bcc292e
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/3c5d9ae3-0501-0010-0090-bdfb2d458985
for Smartforms material
http://www.sap-basis-abap.com/sapsf001.htm
http://www.sap-press.com/downloads/h955_preview.pdf
http://www.ossincorp.com/Black_Box/Black_Box_2.htm
http://www.sap-img.com/smartforms/sap-smart-forms.htm
http://www.sap-img.com/smartforms/smartform-tutorial.htm
http://www.sapgenie.com/abap/smartforms.htm
How to trace smartform
http://help.sap.com/saphelp_47x200/helpdata/en/49/c3d8a4a05b11d5b6ef006094192fe3/frameset.htm
http://www.help.sap.com/bp_presmartformsv1500/DOCU/OVIEW_EN.PDF
http://www.sap-img.com/smartforms/smart-006.htm
http://www.sap-img.com/smartforms/smartforms-faq-part-two.htm
Re: Need FAQ's
check most imp link
http://www.sapbrain.com/ARTICLES/TECHNICAL/SMARTFORMS/smartforms.html
step by step good ex link is....
http://smoschid.tripod.com/How_to_do_things_in_SAP/How_To_Build_SMARTFORMS/How_To_Build_SMARTFORMS.html
SAPScripts
http://esnips.com/doc/1ff9f8e8-0a4c-42a7-8819-6e3ff9e7ab44/sapscripts.pdf
http://esnips.com/doc/1e487f0c-8009-4ae1-9f9c-c07bd953dbfa/script-command.pdf
http://esnips.com/doc/64d4eccb-e09b-48e1-9be9-e2818d73f074/faqss.pdf
http://esnips.com/doc/cb7e39b4-3161-437f-bfc6-21e6a50e1b39/sscript.pdf
http://esnips.com/doc/fced4d36-ba52-4df9-ab35-b3d194830bbf/symbols-in-scripts.pdf
http://esnips.com/doc/b57e8989-ccf0-40d0-8992-8183be831030/sapscript-how-to-calculate-totals-and-subtotals.htm
SAP SCRIPT FIELDS
http://help.sap.com/saphelp_erp2005vp/helpdata/en/d1/8033ea454211d189710000e8322d00/content.htm
scripts easy material
http://www.allsaplinks.com/sap_script_made_easy.html
Debugging Document.
http://www.cba.nau.edu/haney-j/CIS497/Assignments/Debugging.doc
http://help.sap.com/saphelp_47x200/helpdata/en/c6/617ca9e68c11d2b2ab080009b43351/content.htm
http://www.cba.nau.edu/haney-j/CIS497/Assignments/Debugging.doc
http://help.sap.com/saphelp_erp2005/helpdata/en/b3/d322540c3beb4ba53795784eebb680/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/84/1f624f4505144199e3d570cf7a9225/frameset.htm
http://help.sap.com/saphelp_bw30b/helpdata/en/c6/617ca9e68c11d2b2ab080009b43351/content.htm
http://help.sap.com/saphelp_erp2005/helpdata/en/b3/d322540c3beb4ba53795784eebb680/frameset.htm
Regards,
Padmam. -
SQL azure database size not dropping down after deleting all table
Dear all,
I have a simple database on Azure for which I have deleted all table data. The size of the database is still showing 5Mb of data and I am charge for that. I have heard that this may happen from cluster index getting fragmented.
I have run a querry I found on internet on all my table index to show percentage of fragmentation and all report 0%.
DBA is not so my job but what could it be or how can I reduce that size ?
ON premise I would use COMPACT DB but not available in azure like some others DB action
Thnaks for tips
regardsuser created objects/data are not the only ones stored in your database. you got system objects and metadata as Mike mentions above.
are you trying to skip being charged if you're not storing data? looking at the pricing table, you'll still get charged the $4.995 for the 0-100MB database size range. -
Tables are deleted but database size does not change in sql server 2008r2
Hi All,
20GB Tables are deleted in my database but database size does not change and disk size showing same size.Hi ,
I have ran the Disk usage by Top Tables report and Identified couple of tables with unwanted data for last 5 years. I have deleted the data for the first 3 years and then ran the Disk usage by Top Tables report again. When I compared the report before
and after the data deletion, I have noticed certain facts which is not matching with what I know or learned from experts like you. The following are the points where I am looking for clarification:
1.Reserved (KB) has been reduced. I was expecting the data Reserved (KB) will remain the same after the data deletion.
2. The Data(KB) and Indexes(KB) fields have been reduced as expected. The Unused(KB) field have been increased as expected.
I was expecting the total of Data(KB) and Indexes(KB) field space gained will be equal to the Unused(KB) field gained after deleting the data. But that is not the case. When I deducted(subtracted) the difference in the Reserved(KB)(Difference before
and after data deletion) field from the Total of space gained from the data deletion is equal to the Unused(KB) gained field value.
I am not a SQL expert and not questioning but trying to understand whether we really gain space by deleting data from the tables. Also keen to get the concepts right, but my testing by deleting some records confused me.
Looking ahead to all your expert advice.
Thanks,
Vennayat -
Database Size goes on Increasing in SAP B1.Now the Size of my Data is 34Gb
Hello Experts,
As one of my client data is going on increasing the data,As of now the transaction data of the Database is 34Gb.
This how the cases i have'been tested in the test database with no results.
experts,would be greatly appreciated for this solution.Since,many days im into the problem to solve the issues.
The cases as follows:
1.Transaction (Mdf File)=34Gb
2.LogFile(LdfFile)=1Mb
3.History tables like AITW,AITM,ACRD--Reserves 6Gb compares to other history table.So,I 've changed the historyLog in SAP general setting to 1 and runned the addon to update the Itemmaster.Now the records aare been reduced from 1lakh to 25000.But the size occupied and freespace remains.
Is there any solution to solved this problem.
4.After deleting the records by addon,took the backup and restored .But same size effects for this case.
5.I have shrinked the database and file for the Db,with no result.
If the same problem continues for couple of years my data would reach to 60Gb.
Experts would be appreciated for this big solution.
Thanks,
KumarHi,
Plz check the following links :
Rapid increase in database size
SAP Database Size
Rapid DataBase size Increase's nearly 30Gb for SAP B1 8.81 PL5 -
Should We consider Temp Data Files While Estimating The Database Size
Hi,
The Database Size is sum of physical files like
Control file
redo log file
datafiles
temp files
so i want to know why are we considering the temp files..Because it's temporary. At one stage of database, temp size it could me more and at one stage it could be less.
So why consider the temp file???
Please share your views on it..
Thanks
UmeshSo, in essence the size of your datafiles is the size of your tablespaces?No. The size of the tablespace is the sum of the sizes of the datafiles in the tablespace --- i.e. the datafiles determine the tablespace size, not the other way round.
(Although when you CREATE or ALTER TABLESPACE, you specify the sizes of the datafiles that you want to belong to the tablespace).
the temporary tablespace has space allocated to it regardless of whether there are temporary tables in that tablespace or not.Two points here :
1. On most OSs the temporary tablespace tempfile is created as a "sparse" file. So, if you issue a CREATE TEMPORARY TABLESPACE TEMP TEMPFILE 'xyz.dbf' SIZE 1000M; and then did an "ls -l" at the OS level, "xyz.dbf' would appear to be only a few tens of KBs in size. The OS "grows" the file to 1000M as necessary.
When talking to your OS administrator ensure that you get 1000M (or the AUTOEXTEND MAXSIZE !!) space allocated even though he might "see" only a few 10s of KBs used on the first day.
2. The temporary tablespace does not have objects (other than "global temporary tables" that overflow from memory to disk). It is really temporary space for joins, sorts, order bys etc.
So, your datafile size is not affected regardless of your temporary tables coming and going.Yes, your datafile sizes and tempfile sizes are independent. Yet, when "sizing" disk space for the database you must include the tempfile size. However, when reporting to IT Management with a statement "our database size is ".. you might want to break it up into components like Data Dictionary, Tables, Indexes, TemporarySpace, RedoLogs and ArchiveLogs. You could also differentiate between OS-allocated space (sizes of datafiles) and Oracle-allocated space (sizes of segments) and actual used space (which you'd have to compute !) .
Hemant K Chitale
Edited by: Hemant K Chitale on Feb 17, 2011 10:42 PM
Added (Although ....) paragraph to first point. -
How to fix the size of table data in html
I want to fix the size of table data in html. ie if i want to insert only 50 char in a <td> field then it contain only 50 character, after that it switched to another line and contain the remaining character. Means <td> field wil not get automatically adjust there size according to data.
you cant specify how many characters a td cell can have but u can specify the pixel width of a td cell
<td width=50>
as long as you have wrap text on, then text will not force the box size over the 50 pixels
this wont limit it to only 50 chars though, you will probably have to use some javascript to cut the string down to size (unless youre using something like php or asp then that will do the trick too) -
QUERY TO GET database size, used size, freesize, tablespacesize of RQ table
Pls give me a query for to get database size, used size, freesize, tablespacesize of sometables which is starting with 'RQ%'
I have to get result like this
Total size, used size, free size ,tablespace size of RQ tables alone
Reason why i go for "tablespace size of RQ tables" i want to know the size of database after deleting the rq tables
( Since i am not getting any reply i go for database forum)
Pls reply
S
Edited by: AswinGousalya on Jul 8, 2009 3:41 PMHello,
This question looks like it is really for the Oracle RDBMS and not for Berkeley DB. In BDB, we do not have a notion of tablespace size. What database product are you using?
regards,
mike brey
BDB engineering -
Using MaxL in batch script to get Essbase database size before proceeding
I have a batch script which dynamically generates some MaxL before passing it to ESSMSH. I would like to insert a command at the beginning of the MaxL script, to get and assess the size of the database before proceeding. If the database is empty I would like the script to quit. This is to prevent the script from exporting data and overwriting the previous export file if the database is empty.
The generated MaxL (modified) is currently as follows. What logic can I add to the MaxL script, to assess the database size and go to the "errorhandler" label if it is empty? Is this even possible?
login %USER% identified by %PASS% on %SERVER%;
iferror "errorhandler";
/* log file */
spool stdout on to '<directory>.log';
iferror "errorhandler";
/* error file */
spool stderr on to '<directory>.err';
iferror "errorhandler";
/* export data */
set timestamp on;
execute calculation %APP%.%DB%.C_Export;
iferror "errorhandler";
/* reset database */
alter database %APP%.%DB% reset data;
iferror "errorhandler";
/* import data */
import database %APP%.%DB% data from server data_file "<filename>.txt" on error abort;
iferror "errorhandler";
/* calculate database */
execute calculation default on %APP%.%DB%;
iferror "errorhandler";
/* error handler */
spool off;
define label "errorhandler";
logout;
exit;Hi Stuart,
Yes I was aware of display database "app"."db"; however this will output a table rather than a specific value. And what logic can I then add to the MaxL script to assess the specific value of "Db Status" and go to the "errorhandler" label if it is empty?
It would seem this needs to be done via a VBScript, to loop through the file rows to find the value before proceeding accordingly. But I was hoping there might be a way to do this within MaxL. -
How to get the Database size?
Hai Friends,
I have created a Z Table with 100 fields. i want to check the database size after uploading the data. How can i do this?. That is, after uploading the first entry i want to know the size and again i want to upload 5 more entries and to check the growth.
Where can i see this?. i have checked in DB02 but even after data upload i didnt see the size. kindly explain me the process.
Thanks..................Hi,
In the Go to Menu then Check the Number of entries to track your current set of entries.
For DB Size check Technical Settings . Tab Logical Settings parameters the Data class and Size category can give you how much data the table can hold.
Thanks,
Anita -
SharePoint 2010 content database size issues alldocs streams
HI All,
We are planning to do migration from sharepoint 2010 to sharepoint 2013. our database team identified that "all docs streams" and "audit log table" using almost 300 gig
we dropped "audit log" table today almost 100 gig
but still "all doc streams" table size is almost 147 gig
how to handle this situation before migration?
do I need to migrate as it is or do I need to work on "all doc streams" table
hot to handle database size
which way you recommend ? what are the best practices
please see database table size
can any one please send me step by step implementation?
Thanks,
kumar
kkmFirst off, touching SharePoint database tables is completely unsupported.
http://support.microsoft.com/kb/841057
You shouldn't be making changes within the database at all and you're putting yourself out of support by doing so.
AllDocStreams is your data. You need to have users clean up data, or move Site Collections to new Content Databases if you feel you need to reduce the size of the table itself.
Trevor Seward
Follow or contact me at...
  
This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs. -
Is there a method available by which I can benchmark whether my database growth size is appropriate or not. As of now my database size is growing at an average of 20GB per month which I caonsider to be excessive. Please guide.
Hi Deepak,
You may want to understand first where the growth is from - which table space and which table? As mentioned by Markus, you can use DBA Cockpit to monitor your database. You can use the historical data in DBA Cockpit to see what's the delta change for tables/tablespaces and sort by the largest differences.
Have you also checked the High Water Mark (HWM) of the table spaces? If not you may need to use a combination of db2dart /rhwn or /lhwm and offline table REORG to reduce them(OSS Note 152531 and 486559). As update/insert/delete goes on, there is a lot of "holes" in the table spaces, these "holes" may make your table spaces bigger than it needs.
I hope it helps.
Regards,
-Beck -
Need to find Exact Database Size in MB
Hi
I need to find the Exeact database size the actual space taken by data not the extent allocated by the table. I mean if the extent size is 64k and there is only 2k of actual data sitting there i need to get that 2k answer.
Thanks in advance.Hi,
Consider using DBMS_SPACE.SPACE_USAGE.
There are lots of examples somewhere on AskTom website.
Regards.
PS: Bear in mind, SPACE_USAGE works with ASSM only. For MSSM you should use another procedures of DBMS_SPACE package.
http://asktom.oracle.com/pls/ask/f?p=4950:8:3624308638663951627::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:5350053031470
There you go.
Message was edited: added a note about MSSM. -
how to estimate the database size ,can anyone help, what are the parameters I need to consider.
I doubt that this is a worthwhile exercise... space is relatively cheap. And whether a database is 50GB or 500GB will be a very small cost factor given the cost of the server, the cost of o/s and Oracle licensing, the cost of development, the cost of maintenance and so on.
Take for example the size of the data dictionary that you want to estimate. That's not only dependent on the number of tables and columns. It also depends on how much PL/SQL code there is. The number of views. Whether the tables and columns are defined with comments or not. Etc.
Redo size? Nothing to do with the number of tables, the size of the tables, or number and sizes of the columns - everything to do with the amount of transactions there will be.
Tablespace size for the tables? What about block size, the amount of free space in a block (pctused and pctfree), how often rows are deleted, whether new rows are primarily added via direct path inserts (using new data blocks) or normal inserts (re-using existing data blocks with sufficient free space).
It seems to me that you think that you can accurately estimate the sizes of all areas of the database and tie a pretty pink ribbon around it, and will be nice and clean and correct and accurate.
In my experience... Real world database ain't like that. And trying to do an accurate size estimate is a waste of time and resources, with the end result not wort the 2c's of the piece of white paper it is printed on... -
Database Size Incresing Fastly
In our Database ,Their only one master Table and 250 tables r logically connected to that master table.
Only master table contains Primary Kye.
So we are doing Indexing daily for faster performace.
Before some days database size is 10 gb and now it is 50 gb and the Database size is till incresing fastly.
I am not able to find out the problem that why database size incresing fastly.
And even i m not able find out logical connection between the table.
I have done shriking and re - indexing but still i m not able to resolve the problem.
How can i analyse that why database is incresing....
I m using SQL Server 2005.......
Thanks & Regards
PrashI am not able to find out the problem that why database size incresing fastly.
And even i m not able find out logical connection between the table.
I have done shriking and re - indexing but still i m not able to resolve the problem.
How can i analyse that why database is incresing....You must understand your application first and then can find out what data is growing rapidly..
Bear in mind this is Oracle Database Forum. No MSSQL Questions.
Maybe you are looking for
-
Is their a way to disable the Battery MacPro15inch 2008/9
And yes i have seen the relevant responses here. They do not mention the FACT that the Battery expands and since it is directly below the track pad can AND HAS expanded , making the track pad useless . I know for i've had to replace mine. I will note
-
Error 42201 the input signal is empty
hi all can you help fixing this error please ? error 42201 the input signal is empty .( i am having this error while connecting the build array function to the detrend function . Bill David
-
Multiple .jar in libary directory
Hi. My application is using more and more libraries that are packed as jars. Is there anyway to include all jar files in applications /lib when executing the program whit out that every jar must be declared in the classpath...
-
In Pages, is it possible to get a navigation outline to appear in the left sidebar - such as the document's Table of Contents with all its chapter headings and subheadings (all as clickable links)? I sometimes work on large documents with many pages
-
Weighted moving average planning
Hi All, We are doing weighted average planning. We will consider the past nine monthu2019s consumption and will decide the future requirement. Our calculation is as below Consumption Weight age Consumption/Weight age 0