Reattaching And Detaching

Jan 29, 2002

Hi
I have tried to restore on db to another on different servers. Unfortunatly the sort orders dont match. Does anyone out there have any articles or know how to attach the the source db data and log files to the destination db. I would appreciate any assistance.
Thanks
D

View 1 Replies


ADVERTISEMENT

Detaching And Reattaching A Read-only DB

Nov 30, 2000

Anybody know if it's possible to re-attach a readonly database without making it operational? I'm using log shipping to keep my hot standby current, but would like to take the detached db and duplicate it elsewhere, I just cant re-attach it as read-only again when I'm done. Thanks!

View 2 Replies View Related

Error 4064 After Detaching And Reattaching Database

Oct 8, 2007



Since the "Cannot Open User Default Database (error 4064)" thread is closed, and I had this same error, I'd thought I'd leave the solution that worked for me since I spent about 2 hours researching this problem. After detaching my database, then reattaching it, I couldn't log back in with my login ID. I could get in using the sa account. I could also log in with my login ID if I set the default database to master using SQL Server Management Studio by navigating to Security, Logins, right-clicking my login ID, then setting the default database to master. However, this isn't a solution, because I need my login ID to default to the database I reattached, not master.

One way of resolving this is to set the new Login ID as the owner. Right click the database under Databases in Management Studio, choose Properties, choose Files, then set the owner with the new login ID. I can then connect to the reattached database with my login ID. If I set the owner back to sa, I can't connect with my login ID, I have to use sa. If someone has a solution to relink my new login ID and the user with the same name so I can log in with sa set as the owner, I'd love to hear it. I can't make that work.

BTW, if I go under Logins, right click my new login ID, choose properties, then User Mapping, my reattached database is selected under Users mapped to this login. However, the Users and Default Schema columns are both set to dbo.

--Steve

View 1 Replies View Related

Reattaching Old Database

Apr 27, 2006

I have just installed SQLExpress version 9.0.1399.

I was using an earlier version of the server before and backed up a copy of my mdf files for safety's sake. However when I now try and attach the old databases I get an error that the database files from the old non-release version (590) is not compatible.

Probably my own fault - the information was probably clearly on display deep in a file somewhere in the documentation (cough). However I would kind of like to get at the data in these files.

Is there any way of getting hold of an earlier version of SQLExpress which will handle these files? Or can they be opened in any other way?

View 3 Replies View Related

Reattaching Lost Databases - No Backups

Feb 9, 2000

What do you do when the database actually, physically exists, intact, but is not recognized by SQL Server 7 and there is no backup?

On a newly installed system, I created a new database and imported tables from another system. I also disbled SQL Server 7 services, rebooted and file-copied into the directory another database, that was not on a current SQL Server system, then restarted SQL Server.

SQL Server 7 failed to recognize any of the databases - master, model, etc., as well as the user databases. Neither database was specifically detached - allegedly a requirement for using sp_attach_db. No backups had been done - I was still setting up(?).

I know that there must be a way to reload, reattach or recreate a database when the database actually exists. In this case, we also lost master, etc., which may change the situation. Any advice would be appreciated.

View 2 Replies View Related

Reinstalling SQL 7 After Detaching Dbs

Dec 8, 1999

I understand that you must sp_detach_db and sp_attach_db to move databases to a new server. What if you want to reinstall SQL 7.0 to a different drive on the same server? My situation is this:

We have C:, D:, and E: drives. I accidentally installed SQL 7 on the C: drive instead of the D: drive. I need to reinstall on D: and I need the data. Any suggestions?

Alan

View 1 Replies View Related

Detaching Non-existing Db's

Jan 9, 2006

Hello all

From time to time I receive mssql server databases to export from our customers. Last time I deleted the database files without detaching them. How can I detached them, since I need to atach new ones with the same name?
I'm using MS SQL Server 2003 and the databases are 6.5.

Thank you all.

Regards.

View 7 Replies View Related

Detaching And Attaching

Dec 10, 2006

Hi,
Im not new to SQL Server but I am new to v.2005. We have done a class project and to finish up I am creating schemas, logins and different user roles and permissions.
I now need to detach the DB and send it to our team leader for submission. I'm scared to do this because I don't know if all the logins and passwords I've created will appear in it's new location. Will they be there in the new server's security folder just as I created them or will they dissapear into the ether?
Signed:
Sweating very much


It is better to be prepared and not have an opportunity than to not be prepared and have an opportunity

View 7 Replies View Related

Detaching Database

Sep 28, 2007

I need to detach a db. When I right click and choose detach the popup box shows 0 connections however, I'm getting the error 3701 cannot detach because it's currently in use. How can I tell what is causing this or what is using the db?

View 3 Replies View Related

Attaching-detaching Db = Too Long

Jun 18, 2004

Why does it take time to detach or attach a Db sometimes ?

View 4 Replies View Related

Detaching A Replication Databse

Mar 17, 2004

I am trying to detatch a database that is set up as a publisher. I have desabled the replication tasks on both the publisher and subscriber db and am still unable to detach the db. Any ideas?

The image below is an example of the message I receive. I have tried after hours so at that time the users are 0.

Thanks.

View 3 Replies View Related

Detaching A Replication Databse

Mar 17, 2004

I am trying to detatch a database that is set up as a publisher. I have desabled the replication tasks on both the publisher and subscriber db and am still unable to detach the db. Any ideas?

The image below is an example of the message I receive. I have tried after hours so at that time the users are 0.

Thanks.

View 2 Replies View Related

Attaching And Detaching A Database

Jul 20, 2005

Q1.)In SQL Server 2000, is it always possible to use copies of thedata and transaction log files of a database from one server toreattach to a new database on another server, or even to the sameserver, without first detaching from the existing database?Books Online says that detaching a database closes the data and logfiles cleanly. I read some where that some times, it is possible toattach without detaching, if the data and log file are in stablestate.This is what I tried - Tried to copy Northwind.mdf and ldf files usingwindows explorer and it gave an error message that the files are inuse. I shutdown the server and now I could easily copy them. Afterthat I renamed these files and successfully attached them as a newdatabase.Q2.)Is it possible to do the same with large production databases?Q3.) Please explain what goes on during detaching /attaching process.Thanks in advanceRavi

View 1 Replies View Related

Detaching And Moving Databases

Nov 23, 2006

Not sure if this is the exact forum I need but here goes.

Having a bit of an issue 'moving' a database. I've only just installed SQL Server 2005 on a Development/Test box so I can learn and mess around with it without doing any serious damage to anything important.

One of the first things I've done is install the AdventureWorks database and, having installed it, decided I would move the files to their optimum locations. However having detached the database I can't seem to move or copy the .mdf or .ldf files - something still seems to have its tentacles around them - 'Access denied' error. Even rebooting the server doesn't work. So I've had to delete then re-attach the database. The question then is does Detach serve any useful purpose? Or am am doing something wrong? With SS2000 I could detach a database, relocate the physical files and re-attach in seconds. The same procedure with SS2005 has taken me an hour!

Regards,

Gordon F.

View 4 Replies View Related

Views On Attaching/Detaching Mdf Files

Apr 9, 2008

I am currently having a problem in the implementation of a Database for my C#.net winform application.

Look at the 2 diagrams below:

Diagram 1 : A typical databse design where it usees only 1 mdf file.


Diagram 2: A new proposed approach to implement the Database with multiple mdf files of the same schema!!

In the new proposal of the DB, each mdf files is kept separately and an additional module is required to attach and detach these databases as and when required. The purpose: the performance of all actions on the small data is not affected by the size of the large data

How does this 2 methods measure up in terms of resource usage, performance, etc??

Need comments and views. Thanks.

View 9 Replies View Related

Detaching And Attaching A Database For My Project

Mar 22, 2008

I hope this is the right forum for this question.

I am working with an asp.net project in Visual Web Developer 2005 Express. This is a starter kit project. There is a database that came with the project that I want to open up in the SQL Server 2005 Express management studio so that I can modify it.

I have detached the db in the VWD environment.But, I do not see this db in the db folder with in the SQL Server studio's IDE. I am assuming that I have to attach the database to the SQL Server management studio in order to work with it. Is this the correct way to do this type of thing? Is there a better way of doing it(a stored proc like mentioned below)?

I also have a question about the icons that pertain to this situation. I have noticed two variations of the same icon. I want to be sure I am interpretting these correctly. I am assuming that the icon that is a cylinder representing a db with the little
electrical plug coming out from behind it means that the db is attached. There is another version of this icon that has a red "x" over the plug. I am assuming that this means it is detached. Is this correct?

I have attached and detached dbs in Sql Server Express. Is the process the same for doing this with a project in Visual Web Developer? Is there a stored proc that I can use to detach from the SQL Server 2005 environment after I have made a database and attach this to my project in VWD in one step?

-thanks in advance

View 4 Replies View Related

Detaching DB From MSDE And Attaching To SQL Express Using SQLDMO.

Dec 19, 2007

All,

I wanted to to detach a DB say MyDB from MSDE and wanted to attach it to SQL Express.
It could able to Detach the DB from MSDE,but attachment to SQL 2005 is failing. When I verified MSDE Instance through Managment studio "MyDB" wasnot there ; means it got detached.I couldnt find the DB in SQL 2005. When I tried manually through command prompt I was able to attach "MyDB" to SQL2005.
Please help me out!!
Here is the code which I have written.

if SUCCEEDED(hr = CoCreateInstance (CLSID_SQLDMOServer, NULL, CLSCTX_INPROC_SERVER,
IID_ISQLDMOServer, (LPVOID*)&pSQLServer))
{

pSQLServer->SetLoginSecure (TRUE);
SQLDMO_LPCSTR DB = OLESTR("MyDB");
//Connect to MSDE First
if SUCCEEDED(hr = pSQLServer->Connect (szDbServer, szUserName, szPassword))
{

pSQLServer->DetachDB(DB,lpszResult); //Detach the DB
pSQLServer->DisConnect(); //Disconnect MSDE
LPBSTR lpszResult2 = NULL;
long lNumDB;
//Connect to SQL 2005
if SUCCEEDED(hr = pSQLServer->Connect (szSQLExpDbServer, szUserName, szPassword))
{
//LPCOLESTR lpo = A2COLE(sTemp);
//sTemp.operator LPCTSTR
pSQLServer->GetDatabaseCount (&lNumDB);
SQLDMO_LPCSTR files = OLESTR("C:\Program Files\Microsoft SQL Server\MSSQLData\MyDB.mdf,C:\Program Files\Microsoft SQL Server\MSSQL\Data\MyDB_log.ldf");
pSQLServer->AttachDB(DB,files,lpszResult2); // Attach the DB to SQL 2005

pSQLServer->DisConnect(); // Disconnect SQL 2005}

View 1 Replies View Related

Whats The Difference Between Detaching And Taking A Db Offline?

Oct 22, 2007

what is the difference between these two db tasks in mgt studio?

View 7 Replies View Related

Is There A Problem Detaching A Database From SQL2000 And Attaching It To SQL2005?

Dec 5, 2007

Hi

I have to migrate a SQL2000 database to SQL2005, I tried to use CopyDatabase Wizard (CDW) but invariably stopped all processes (may be for permissions, but I really I don€™t know) so I decided to detach de database, copy files to new server and attach it to SQL2005, it apparently works well, except for the fact that Schemas where created with the name of the users of SQL2000.
Is that correct?
Could it affect the performance or any other thing?
Is correct to do what I did?
Could be another problem in the recently attached database?
(Compatibility, data loss, corrupted structures, collation or something like that)

The server I am using is in a domain, it has windows server 2003 R2 SP2
@@Vesion returns

Microsoft SQL Server 2005 - 9.00.3042.00 (Intel X86)
Feb 9 2007 22:47:07
Copyright (c) 1988-2005 Microsoft Corporation
Standard Edition on Windows NT 5.2 (Build 3790: Service Pack 2)

And in the source server with windows 2000 SP4
@@Vesion returns

Microsoft SQL Server 2000 - 8.00.194 (Intel X86)
Aug 6 2000 00:57:48
Copyright (c) 1988-2000 Microsoft Corporation
Enterprise Edition on Windows NT 5.0 (Build 2195: Service Pack 4)


Thank you in advance

Any comment will be greatly appreciated

JAPonce

View 4 Replies View Related

Unable To Open User Instance Type Database After Attaching And Detaching In SQL Mgmt Studio

Apr 15, 2007

I've been using my DotNetNuke database for weeks on my local PC with SQL Server Express. It attaches as a "User Instance". Basically, I am using all the DotNetNuke defaults. Today I decided to attach the DotNetNuke database in SQL Server Management Studio Express and peek at the tables. I attached the database; then I detached it when I was done. This all went well. But when I tried to open my DotNetNuke web site again I now get a message that it cannot connect. Attaching and detaching the database in SQL Server Management Studio obviously changed something about the database, but I don't know what. My connection string to the database has not changed.



The specific error displayed in the browser is:
ERROR: Could not connect to database specified in connectionString for SqlDataProvider

In event viewer is this message:

Exception information:

Exception type: SqlException

Exception message: Cannot open user default database. Login failed.

Login failed for user 'NT AUTHORITYNETWORK SERVICE'.



My connection string is this:

<add name="SiteSqlServer" connectionString="Data Source=.SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|Database.mdf;" providerName="System.Data.SqlClient" />



Any suggestions about how I can correct this?

View 3 Replies View Related

SQL Server Management Studio Express On Vista Home Premium (Error On Attaching And Detaching .mdf)

Sep 5, 2007



I have SQL Express 2005 SP2 installed in my Vista Home Premium. I am using SQL Server Management Studio Express to manage .mdf.

When I click "Add..." to attach .mdf database, I have this prompt error message :

The server principal "My-PCMyName" is not able to access the database "model" under the current security context. (Microsoft SQL Server, Error: 916)


I have elevated the rights, "Run as administrator", of my SQL Server Management Studio Express, but still having problem.

I also encounter security error when detaching the existing .mdf :
The EXECUTE permission was denied on the object 'sp_detach_db', database 'mssqlsystemresource', schema 'sys'. (Microsoft SQL Server, Error: 229)


Please advice. Thanks.

View 8 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved