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 1Could 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 ShawSQL Server MVP |
 |
|
Johnto
Starting Member
10 Posts |
Posted - 2010-06-22 : 04:58:28
|
Hi GailYes 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_ERRORMSGSGOI am extremely green with SQL.Hope that information helpsJohn |
 |
|
Johnto
Starting Member
10 Posts |
Posted - 2010-06-22 : 04:59:30
|
Gail how do i query the sys.databases catalog view? |
 |
|
Johnto
Starting Member
10 Posts |
Posted - 2010-06-22 : 05:04:31
|
This was my first query and error codeALTER DATABASE AdventureWorksSET RECOVERY FULLGOMsg 5011, Level 14, State 5, Line 1User 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 1ALTER DATABASE statement failed. |
 |
|
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 ShawSQL Server MVP |
 |
|
Johnto
Starting Member
10 Posts |
Posted - 2010-06-22 : 05:15:56
|
Hi GailThat 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 queryJohn |
 |
|
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 FULLwill work, same with CheckDB.--Gail ShawSQL Server MVP |
 |
|
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 ranThank you |
 |
|
|