Showing posts with label stating. Show all posts
Showing posts with label stating. Show all posts

Monday, March 19, 2012

Help needed with Transaction Logs

i keep getting a message stating that the disk is fulkl so i have been tryin
g
to shrink the database to start with using the following code
USE [BossData]
GO
DBCC SHRINKDATABASE(N'BossData', 50 )
GO
All i get is the following error
Msg 0, Level 11, State 0, Line 0
A severe error occurred on the current command. The results, if any, should
be discarded.
Has any one any suggestions please ?Check whether executing BACKUP LOG... can resolve the problem.
** Solution 1
- change the location of the backup device to a HDD with enough HDD space
- do a full backup on the database
- shrink the database using "dbcc shrinkdatabase (dbname)"
- change the location of the backup device to a HDD to the original
directory (with enough HDD space)
** Solution 2 (when there is not enough HDD space, and you cannot add a new
HDD)
** warning ** (from BOL) TRUNCATE_ONLY removes the inactive part of the log
without making a backup copy of it and truncates the lob. This option frees
space. Specifying a backup device is unnecessary because the log backup is
not saved. The changes recorded in the log are not recoverable. For recovery
purpose, immediately execute BACKUP DATABASE.
*** It would be better if you have a valid backup anyways.
- backup log dbname with truncate_only
- dbcc shrinkdatabase (dbname)
Both backup (full/log) and "dbcc shrinkdatabase" can be done with the
database online (and without detaching the database).
There is also a database option 'autoshrink' that could be used for
shrinking a database periodically and automcatically by SQL Server. By
default, the 'autoshrink' option is set to OFF in SS2000 (except SS2000
Personal Edition). You will need to implement an appropriate backup
strategy, anyways.
-- To set the autoshrink database option. (When true, the database files are
candidates for automatic periodic shrinking.)
sp_dboption 'dbname', 'autoshrink', 'TRUE/FALSE'
References
- Shrinking the transaction log
http://msdn.microsoft.com/library/d...r />
_1uzr.asp
- Truncating the transaction log
http://msdn.microsoft.com/library/d...r />
_7vaf.asp
Martin C K Poon
Senior Analyst Programmer
====================================
"Peter Newman" <PeterNewman@.discussions.microsoft.com> bl
news:1B25C6DC-84D9-4E8B-B62B-DC4A4689CD00@.microsoft.com g...
> i keep getting a message stating that the disk is fulkl so i have been
trying
> to shrink the database to start with using the following code
> USE [BossData]
> GO
> DBCC SHRINKDATABASE(N'BossData', 50 )
> GO
> All i get is the following error
> Msg 0, Level 11, State 0, Line 0
> A severe error occurred on the current command. The results, if any,
should
> be discarded.
> Has any one any suggestions please ?
>
>
>

Monday, March 12, 2012

help needed to drop a table!!!

hi,

can any one tell me how to drop a table...i tried to delete using the command :

drop table sample;

but it displays an error stating that,

Cannot drop the table 'dbo.sample', because it does not exist or you do not have permission.

pls post the reply asap

-Sweety

To verify that the table does indeed exists, try:

SET ROWCOUNT 1
SELECT * FROM MyTable
SET ROWCOUNT 0

Then if you receive data, and the statement DROP TABLE MyTable again fails, check your permissions. It is possible that your login does not have permission to remove a table.

|||

Make sure you're using the correct db.

USE MyTest
GO
DROP TABLE Test

Adamus

|||

check whether the table exists in the db at all... if exists , see who owns it.... give fully qualified name.

in SQL 2005

select Name from Sys.Objects where name='tablename'

Drop table databasename.schema.Tablename

SQL 2000

select Name from SysObjects where name='tablename'

Drop Table databasename.owner.Tablename

Madhu

|||

May be that table actually does not exist

|||

sweet_salt wrote:

hi,

can any one tell me how to drop a table...i tried to delete using the command :

drop table sample;

but it displays an error stating that,

Cannot drop the table 'dbo.sample', because it does not exist or you do not have permission.

pls post the reply asap

-Sweety

Check that the account that you are using to run this query has the appropriate permission to do so.

Check the user properties in the security node.