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
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 issues with detaching and reattaching a database

Author  Topic 

jford
Starting Member

19 Posts

Posted - 2010-05-14 : 15:12:15
I detached a database to prep for migration. Once the copy was made I reattached the database on the old server but am unable to connect to it. I have tried to do back up restores but no luck.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-05-14 : 15:41:41
How about posting the errors? Also, did you backup the database just prior to doing the detach?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-05-14 : 15:46:38
The errors would definitely be useful. In the absence, I'm going to guess security, but it shouldn't be if it's the original server.

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

jford
Starting Member

19 Posts

Posted - 2010-05-14 : 15:51:22
the errors I get are from browsing to the web server. When I reattached the only error I got was error 15110 which is The propopsed new database owner is aleady a user or aliased in the database.
Go to Top of Page

jford
Starting Member

19 Posts

Posted - 2010-05-14 : 15:51:27
the errors I get are from browsing to the web server. When I reattached the only error I got was error 15110 which is The propopsed new database owner is aleady a user or aliased in the database.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-05-14 : 16:30:02
So you can't post the errors?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

jford
Starting Member

19 Posts

Posted - 2010-05-14 : 16:46:26
Do you want the website sql code? The error I received in attaching the database is 15110.
Go to Top of Page

jford
Starting Member

19 Posts

Posted - 2010-05-14 : 16:53:20
I'm pretty new to sql administration. I'm not sure what you need?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-05-14 : 17:10:42
I don't have the error codes memorized, so please post the text of it. I don't want to see the SQL code, I want to see the text of all errors you are getting.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

jford
Starting Member

19 Posts

Posted - 2010-05-14 : 17:45:52
Alright from the website I'm getting all sorts of database connection errors

Object reference not set to an instance of an object.
[OleDbException (0x80040e14): Could not find stored procedure 'rsp_GetSetting'.]
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-05-14 : 17:48:38
Is the database accessible in SSMS?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

jford
Starting Member

19 Posts

Posted - 2010-05-14 : 18:16:10
Yes it is accessible.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-05-14 : 18:23:54
Is the application properly referring to the object as SchemaName.rsp_GetSetting? SchemaName is typically dbo.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

jford
Starting Member

19 Posts

Posted - 2010-05-14 : 18:28:59
yes the user is the database owner. Why would the backup exec job fail to restore the database and the metadata. The job ran sucessfully but no luck.
Go to Top of Page

jford
Starting Member

19 Posts

Posted - 2010-05-14 : 18:29:03
yes the user is the database owner. Why would the backup exec job fail to restore the database and the metadata. The job ran sucessfully but no luck.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-05-14 : 18:40:49
We don't use Backup Exec for our backups, so I can't comment on that.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

jford
Starting Member

19 Posts

Posted - 2010-05-14 : 18:44:26
alright... So it seems my website is having is having security issues logging into the sql database. It doesn't have to do with the database directly because I did do a sql restore before asking for help. I have tried giving the schema and users the most access possible but am still encountering errors. What else can I try?
Go to Top of Page

jford
Starting Member

19 Posts

Posted - 2010-05-14 : 18:44:48
Thanks for your help by the way.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-05-15 : 04:33:11
Just want to double check some things:

You have a backup.

You had a problem (with re-attach) and you restored the database from backup.

Your backup was made from the original database, on the same machine (and NOT from a different database / different machine)?

Your backup is relatively recent? (same time, roughly, as the DETACHED database, not weeks / months earlier?) (My point is that if the database backup is old it might be that the database / schema / database users / permissiosn / etc. may have changed considerably since)

Have I got all that right?

Secondly, you are backing up the database with Backup Exec - and that is directly backing up the database to tape? You do not have any backups of the database where you used the BACKUP command to make a backup file on DISK?

(Sad to say but we've seen all sorts of problems people have had with direct SQL backup to tape, and the recommended advice is to create a backup FILE on the disk first, then back that up to tape separately)

DO you know if the backup contains multiple backups within a single backup? If so it is possible that what you have restored is actually a much older "version" of your database, and you need to tell the Restore software to find the most recent version (i.e. within the actual backup)
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-05-15 : 04:37:38
(perhaps there is some data in the database that you could check, with SSMS, to see if what you have restored actually contains recent data)
Go to Top of Page

jford
Starting Member

19 Posts

Posted - 2010-05-18 : 10:09:20
Detach from previous server. Attach to new sever.

Delete the user from the [database]?[users], this may require changing schema ownerships to dbo

Create or edit a target user for that database, assign dbo role and set default schema to desired schema (dbo or in instance user)

Its resolved now. Thanks for the help!
Go to Top of Page
    Next Page

- Advertisement -