Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
junkjar
Starting Member
4 Posts |
Posted - 2009-01-29 : 05:23:59
|
Hi I am doing some archiving of my servers and running a script to shrink and backup my database in sql 2000SET databaseName=XXXosql -U backup -P backup -S 129.000.200.100,25555 -Q "DBCC SHRINKFILE (%databaseName%)"osql -U backup -P backup -S 129.000.200.100,25555 -Q "BACKUP DATABASE [%databaseName%]When i run this on the cmd line the back up works fine but the shrink come up with the error "Could not locate the database "XXX" in sysfilesWay can it do the backup and not the shrink? Permissions? |
|
umertahir
Posting Yak Master
154 Posts |
Posted - 2009-01-29 : 05:28:13
|
Run DBCC UPDATEUSAGE to make sure you are seeing accurate information.You may be confused about the Enterprise Manager display. Use the TASKPADview to get a good look at the overall space and the space used. If you dohave a lot of free data and log space, then you can proceed to recapturethat empty space.DBCC SHRINKDATABASE is probably not the correct command. I strongly preferDBCC SHRINKFILE since it gives me a finer degree of control. It sounds likeyour log file may not be able to accommodate what you are trying to do solets do it in smaller increments. Run DBCC SHRINKFILE(MyBigHonkingDataFileName, xxxxx) where xxxx is maybe 1 or 2 GB smaller thanyour existing file size. You will have to run it several times, buteventually you will get more space.If you want to empty a large table, try the TRUNCATE TABLE command. Itdoesn't take up much log space at all. Delete does take up log space.These suggestions should get you started. Feel free to ask back for morehelp if you run into more problems. quote: Originally posted by junkjar Hi I am doing some archiving of my servers and running a script to shrink and backup my database in sql 2000SET databaseName=XXXosql -U backup -P backup -S 129.000.200.100,25555 -Q "DBCC SHRINKFILE (%databaseName%)"osql -U backup -P backup -S 129.000.200.100,25555 -Q "BACKUP DATABASE [%databaseName%]When i run this on the cmd line the back up works fine but the shrink come up with the error "Could not locate the database "XXX" in sysfilesWay can it do the backup and not the shrink? Permissions?
|
|
|
junkjar
Starting Member
4 Posts |
Posted - 2009-01-29 : 05:31:38
|
Solved ... its DBCC ShrinkDatabase not the file as i was using . Thanks |
|
|
|
|
|