Sybase space question


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Sybase space question
# 1  
Old 03-05-2008
Sybase space question

I want to write a script to ensure we have enough space in test to bcp in tables from production. Currently we bcp tables out of a sybase database in production and bcp in the table data to a test environment. We use isql and run the stored procedure sp_spaceused against each of the tables in the production environment; then we run sp_spaceused against the same tables in the test environment. We then want to compare the space in production with the space in test - and if the space of the tables in production is greater than the space available in test, send an email saying we need more space for that table.

We're a little confused on which columns returned by sp_spaceused would give us an accurate result of the space used in prod and required in test. I think it's the reserved space column in production minus the reservered space column in test that will give the amount of space needed for that table in our test environment. The person I'm working with on these scripts thinks it's the data size PLUS the index size that's in production MINUS the data size plus the index size in test that will give a more accurate result.

When we compare the space on production versus test, which colunm(s) from sp_spaceused will give the correct number? Any suggestions would be greatly appreciated!

Thanks in advance
# 2  
Old 03-06-2008
You probably already know, but make sure you have up to date data from spaceused - The info is only as good as the last time update stats was run on the table.
sp_spaceused displays estimates of the number of data pages, space used by a specified table or by all tables in the current database, and the number of rows in the tables. sp_spaceused computes the rowtotal value using the rowcnt built-in function. This function uses a value for the average number of rows per data page based on a value in the allocation pages for the object. This method is very fast, but the results are estimates, and update and insert activity change actual values. The update statistics command, dbcc checktable, and dbcc checkdb update the rows-per-page estimate, so rowtotal is most accurate after one of these commands executes. Always use select count(*) if you need exact row counts.
from: http://manuals.sybase.com/onlinebook...pt=117666;uf=0

I usually add data and index together for estimates. Or better yet, tell management dev needs to match prod and get the databases the same size. Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Emergency UNIX and Linux Support

Help with Sybase DB

Hi, I'm facing an emergency situation, wherein I have to provide limited support to a Sybase DB temporarily as the DBA was fired. There is an urgent need of adding to users to the database. After some time on google, I was able to gather the below information on the database setup ... (1 Reply)
Discussion started by: maverick_here
1 Replies

2. UNIX for Dummies Questions & Answers

Space Question?

hi guys I was presented a LUN from a storage 85GB. fdisk -l shows 85GB space cool but after I formatted the partition using fdisk and mkfs.ext3 I only get 75GB space available why is that? why too many GB lost? thanks a lot (1 Reply)
Discussion started by: karlochacon
1 Replies

3. Shell Programming and Scripting

Sybase server

I have requirement to connect to different sybase server's and store the data into flat file and load into oracle using sqlloader for each day drop the table and re create it and load the data based on business date as parameter which was taking from parameter file.Any help on this should be... (0 Replies)
Discussion started by: mohan705
0 Replies

4. Programming

Question on interrupts and user space app

Can a user space application be asynchronously affected of its normal execution course by an interrupt? How does the driver know which user space process to interrupt? What are the functions in user space and kernel drivers that achieve this? (1 Reply)
Discussion started by: dragonpoint
1 Replies

5. Shell Programming and Scripting

Calculate total space, total used space and total free space in filesystem names matching keyword

Good afternoon! Im new at scripting and Im trying to write a script to calculate total space, total used space and total free space in filesystem names matching a keyword (in this one we will use keyword virginia). Please dont be mean or harsh, like I said Im new and trying my best. Scripting... (4 Replies)
Discussion started by: bigben1220
4 Replies

6. UNIX for Dummies Questions & Answers

Help a newbie with an iostat/disk space question.

Hello, On Solaris 10, iostat -E gives me the following results: sd1 Soft Errors: 0 Hard Errors: 0 Transport Errors: 0 Vendor: FUJITSU Product: MAY2073RCSUN72G Revision: 0501 Serial No: 0708S08M2L Size: 73.40GB <73400057856 bytes> Media Error: 0 Device Not Ready: 0 No Device: 0... (1 Reply)
Discussion started by: lieselr
1 Replies

7. UNIX for Dummies Questions & Answers

non-breaking space question

Might anyone know how to make a nbsp (160|0xA0) character? I am using a Dell Latitude D620 running Windows XP and then starting Exceed 9.0 defaulting to native window emulation for my X (us.kbf keymapping) (Latin-1 symbol set I believe) and calling an xterm (fontdefault, whatever that might be)... (1 Reply)
Discussion started by: runmeat6
1 Replies

8. Shell Programming and Scripting

sybase and shell

I am writing a shell script that verifies if a device is created on wrong mounts 1> sp_helpdevice 2> go | awk '{print $2}' | grep database | grep -v `df -k | grep /dev/dsk | awk '{print $6}'` So if things are ok, the output should return nothing If the result gives 1 or more entry, then... (1 Reply)
Discussion started by: melanie_pfefer
1 Replies

9. Solaris

Connect From VB to Sybase 11

Dear All I have a problem that I can't connect from VB to Sybase 11. Could you help me? (2 Replies)
Discussion started by: Than Chanroeun
2 Replies
Login or Register to Ask a Question