SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 DELETING DATABASE
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

gmkrrishnan
Starting Member

India
3 Posts

Posted - 11/07/2012 :  08:32:16  Show Profile  Reply with Quote
Hi all,
while am deleting the database, getting the following error message
"Cannot drop the database 'abc', because it does not exist or you do not have permission", but there is no database in the name 'abc' and while creating the same database again, getting an error like "The logical file name 'abc' is already in use. Choose a different name". now what can i do for delete that logical file named as abc completly. Any one give me the suitable solution.
Thank U

sunitabeck
Flowing Fount of Yak Knowledge

5155 Posts

Posted - 11/07/2012 :  08:51:46  Show Profile  Reply with Quote
Are you logged in as a user who has sysadmin role? If not, you may not be seeing the database even if it exists. Assuming that you do have sysadmin privileges, run this query to see what files and names are in use.
EXEC sp_msforeachdb 
	'select ''?'' as databasename,[type_desc],[name],[physical_name] 
	 FROM ?.sys.database_files';
If that does not help, look in the path where you are trying to create the data and log files and see if a file with the same name already exists there.
Go to Top of Page

gmkrrishnan
Starting Member

India
3 Posts

Posted - 11/09/2012 :  08:54:53  Show Profile  Reply with Quote
HI sunitabeck,
I've checked all those tables still am getting the same message so kindly tel me any other solution.
even though, if am create new database with the name which one could'n't be created already, it shows same error message again yar...
Thank You. . . !
Go to Top of Page

sunitabeck
Flowing Fount of Yak Knowledge

5155 Posts

Posted - 11/09/2012 :  09:58:10  Show Profile  Reply with Quote
Do you have the right permissions to create the database? Run this query to see if you are a sysadmin or dbcreator
SELECT
	ServerRole = rp.name,
	PrincipalName = SP.name
FROM sys.server_role_members rm
	INNER JOIN sys.server_principals rp
		ON rm.role_principal_id = rp.principal_id
	INNER JOIN sys.server_principals SP
		ON rm.member_principal_id = SP.principal_id
Go to Top of Page

gmkrrishnan
Starting Member

India
3 Posts

Posted - 11/15/2012 :  02:38:24  Show Profile  Reply with Quote
Sorry, even though am getting the same error, here i show you what i did in my side
--------------------------------------
SET QUOTED_IDENTIFIER OFF
GO
CREATE DATABASE abc
ON (NAME = abc,
FILENAME = 'D:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\abc_data.mdf',
SIZE = 2048,
MAXSIZE = UNLIMITED)
LOG ON (NAME = abc,
FILENAME = 'D:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\abc_log.ldf',
SIZE = 1048,
MAXSIZE = UNLIMITED)
COLLATE Latin1_General_BIN
GO
ALTER DATABASE abc SET READ_COMMITTED_SNAPSHOT ON;
GO
ALTER DATABASE abc
SET ARITHABORT ON
GO
ALTER DATABASE abc
SET QUOTED_IDENTIFIER ON
go
----------------------------------

and an error is :
--------------------------------
Msg 1828, Level 16, State 5, Line 1
The logical file name "abc" is already in use. Choose a different name.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'abc', or the database does not exist.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'abc', or the database does not exist.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'abc', or the database does not exist.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
--------------------------------------------
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000