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.

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 See Error message below please

Author  Topic 

Johnto
Starting Member

10 Posts

Posted - 2010-06-22 : 04:23:02
I am Trying to do simple tasks ie ... change back ups from Simple to FULL.

Also to do Database Integrity check.

Msg 2520, Level 16, State 5, Line 1
Could not find database 'AdventureWorks'. The database either does not exist, or was dropped before a statement tried to use it. Verify if the database exists by querying the sys.databases catalog view.

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-06-22 : 04:39:28
Does the adventureworks database exist?

What exactly were you doing when you got that error?

--
Gail Shaw
SQL Server MVP
Go to Top of Page

Johnto
Starting Member

10 Posts

Posted - 2010-06-22 : 04:58:28
Hi Gail

Yes it is in my Database Objects ... it is online.... i can scroll through it. They are the 2 Sample Databases that i have installed with SQL 2008.

Doing my exam sylabus.. am doing a query to Check the Database Integrity.

DBCC CHECKDB ('AdventureWorks') WITH NO_INFOMSGS, ALL_ERRORMSGS
GO

I am extremely green with SQL.

Hope that information helps

John
Go to Top of Page

Johnto
Starting Member

10 Posts

Posted - 2010-06-22 : 04:59:30
Gail

how do i query the sys.databases catalog view?

Go to Top of Page

Johnto
Starting Member

10 Posts

Posted - 2010-06-22 : 05:04:31
This was my first query and error code

ALTER DATABASE AdventureWorks

SET RECOVERY FULL
GO

Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'AdventureWorks', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-06-22 : 05:11:20
Looks like you may not have permissions. What permissions does your login have? Is this a local SQL instance, one you installed?

What does this return?

select name, state_desc from sys.databases

--
Gail Shaw
SQL Server MVP
Go to Top of Page

Johnto
Starting Member

10 Posts

Posted - 2010-06-22 : 05:15:56
Hi Gail

That brought up a table of my databases all showing online. AdventureWorksDW and AdventureWorksLT.

I could change the Back up from SIMPLE to FULL Manually.. but not through query

John

Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-06-22 : 05:21:25
Well that explains why your queries were failing.
You're trying to alter a database named AdventureWorks, but the actual database name is AdventureWorksLT. Database names must match exactly.

ALTER DATABASE AdventureWorksLT SET RECOVERY FULL
will work, same with CheckDB.

--
Gail Shaw
SQL Server MVP
Go to Top of Page

Johnto
Starting Member

10 Posts

Posted - 2010-06-22 : 05:23:30
Corrected... Sorry but i was following code wrote in syllabus verbatim ... thank fully i didnt make the typo.

All queries ran

Thank you
Go to Top of Page
   

- Advertisement -