You have two options both are covered in the thread below, if you have more questions post again. Hope this helps
http://forums.asp.net/1194348/ShowPost.aspx
You have two options both are covered in the thread below, if you have more questions post again. Hope this helps
http://forums.asp.net/1194348/ShowPost.aspx
space constraints I have to move one of the database(mdf & ldf) to
second server and access the same from the 1st server.
The following are the steps I ned to follow on the 1st server:
Detached the database
Moved the mdf & ldf files to 2nd machine/server
Attach the database pointing to the 2nd server.
The 1st and 2nd steps went fine, the problem is with the 3rd step.
In the Attach Databases window, I clicked on ADD, it opened LOCATE
DATABASE FILE, the folder structure of the 1st server. Is there any way
I can change the SELECTED PATH and poin to the 2nd server?
I did even mapped network drive to the 2nd server but the mapped drive
is not getting displayed in the LOCATE DATABASE FILE folder structure.
Can we attach mdf/ldf files which reside on other machine?
Thanks in advance.
No - you can't use mdf, ldf or ndf files on devices which are not directly attached to SQL Server. It can't resolve shares, drive mappings, or redirects at this low a level.
Buck Woody
|||Network databases are normally not recommended. Unless your network storage meets strict I/O requirements, it's _not_ supported.That's said, you can mount a network database if you enable trace flag 1807.
http://support.microsoft.com/kb/304261
http://msdn2.microsoft.com/en-us/library/ms176061.aspx
http://www.microsoft.com/sql/alwayson/default.mspx
http://www.microsoft.com/technet/prodtechnol/sql/2000/maintain/sqlIObasics.mspx
Hi all
I am having trouble moving an .mdf file from a dev machine to a production machine.
On the dev machine(windows xp sp2 login <MyName>) I have an SSE instance - part of VisualStudio installation.
on the production machine I have only one full version SS instance called "PROD"(windows server 2k3, login Administrator) I do have SSMS installed too.
I create a website in VS on my dev machine. C:\Websites\Website1
I add to App_Data a new file: DB1.mdf
I add a couple of tables to DB1.mdf and maybe other objects etc. - all dbo.
Then I detach DB1.mdf and physically copy the file (without the .ldf as suggested in books online) via tha LAN.
from: C:\Websites\Website1\App_Data\DB1.mdf(dev machine)
to: C:\DB1.mdf (production machine)
I then try to attach C:\DB1.mdf to PROD and I get an error. The server is looking for a db by the name of the original path on the dev machine C:\Websites\Website1\App_Data\DB1.mdf There seems to be no way to rename the db.-not in VS before detaching it, not on PROD in the GUI to attach.
Just for kicks, I created the same folders on the production machine, so the file would have the same physical path as its name(which I still cannot change). C:\Websites\Website1\App_Data\DB1.mdf I even pasted the original .ldf file. This time it worked. I was able to attach it.
What is up with this? Is an .mdf file for ever stuck with the name of the path where it was first created?
This seems to be a most common scenario, even though I am not deploying a whole website.
Are we always supposed to execute our own script?
How are you reattaching the file ?You should be able to use the command:
CREATE DATABASE database_name
ON
(name = logical_file_name,
filename = 'new file location')
FOR ATTACH
You'll need to know the logical_file_name that the mdf file uses. Find that out by running this command in the database before detaching:
select name from sysfiles where filename like '%.mdf'
|||
If you right click on the databases folder in Object Explorer in SSMS and select Attach... you get a UI to locate the .mdf file. The UI looks for the other files in database (.ndf or .ldf) in the locations specified in the .mdf file. If it doesn't find them there, it displays an error message for the files it can't find.
You can change the location where it is looking for the other files by editing the "Current File Path" in the lower grid. You can also remove the .ldf files from the grid (so it won't try to attach them) by selecting them in the grid and clicking on the Remove button.
Hope this helps,
Steve
|||Thanks to both of you.
Both ways work now. I can't even duplicate the issue, and I remember I struggled for a while prior to posting a few days ago. It just didn't like that file name. I swear there is a voodoo ghost on the network!
Steven, I also played with some test UDFs and TVFs written in c#. I right-click deployed the assembly in visual studio. The test was to see what all I needed to do when I reattach the .mdf file. Well the functions work on the new machine just like that. So where is the .net assembly? Is the .dll embedded in the .mdf file? Because that is all I transferred.
Carl
Quote:
Originally Posted by kentwong
I have 2 files from MS SQL 2005, .mdf and .ldf . How am I going to attach it to the MS SQL 2000? Does it need converter? Please guide.
Thanks.
ADMIN
Hi all.
I am going around in circles all day on this.
I have a clean new install of win XP SP2, VS 2005 Pro RTM,
and a NAMED instance of Sql Express with mixed authentication mode specified at setup.
The sa pw is 123456
I would have liked just SQL authentication but no such option.
I am trying to add a new mdf file. If I just use the "Add New Item" in VS web app project it just adds a new .mdf file with windows authentication tied to the current profile I am logged in the os with. I am trying to avoid that as this projects is to be zipped and downloaded as a sample app. I am also trying to avoid embedding an instance of SSE as the recipients of the zip file already have SSE running iwth thei VS IDE.
So most logical is to create the file with SQL authentication.
I have to do it by the Add Connection GUI
and for data source: "Microsoft SQL Server Database File (SqlClient) "
for data file name: C:\WebSites\Website1\App_Data\MyDatabase1.mdf (not yet existing file)
Use SQl server authentication:
user: sa, password: 123456 (the ones specified at set up of the SSE)
I keep getting
Login failed for user 'sa'. The user is not associated with a trusted SQL Server connection.
I keep getting the same error no matter what username I use or password, the current login, etc. It just does not let me use sql authentication.
Please help anyone. This is a nightmare.
"Login failed for user 'sa'. The user is not associated with a trusted SQL Server connection."
This seems that you didn′t activate Mmixed Authentication, its an error you are getting if you only specified the Windows Authentication. Try setting the authentication mode for the express instance:
<snip>
Another way to change the security mode after installation is to stop
SQL Server and set the appropriate registry key for your installation:
Default instance:
HKLM\Software\Microsoft\MSSqlserver\MSSqlServer\LoginMode
Named instance:
HKLM\Software\Microsoft\Microsoft SQL Server\Instance
Name\MSSQLServer\LoginMode
to 2 for mixed-mode or 1 for integrated. (Integrated is the default
setup for the SQL Server 2000 Data Engine.)
</snip>
HTH, Jens Suessmeyer.
|||Thanks Jens,
1. I made sure during the install I selected mixed mode.
2. This article essentially says the same. However, I cannot find in the registry any "LoginMode" subkey for either the default SQLEXPRESS, or MySSE named instance.
Actually I did a complete search and there is no Key, Value or Data that contains "LoginMode" in the whole registry.
|||
You can interrogate the database engine with the CTP SQL Express Mamnagement Suite downloadable from Microsoft.
Click select the database engine..... right click and select export
You'll get a file like this:
<?xml version="1.0" encoding="utf-8"?>
<Export serverType="8c91a03d-f9b4-46c0-a305-b5dcc79ff907">
<ServerType id="8c91a03d-f9b4-46c0-a305-b5dcc79ff907" name="Database Engine">
<Server name="Shhhh\sqlexpress" description="Local instance - 'bliss\sqlexpress'">
<ConnectionInformation>
<ServerType>8c91a03d-f9b4-46c0-a305-b5dcc79ff907</ServerType>
<ServerName>Shhhh\sqlexpress</ServerName>
<AuthenticationType>0</AuthenticationType>
<UserName />
<Password />
<AdvancedOptions />
</ConnectionInformation>
</Server>
</ServerType>
</Export>
You'll see that ny authentication type is 0 which is windows authentification.
I ust went through this and there is a way to attach this programattically.
Use the Sql Management Classes in your code....
Create an XP UserGroup and user using the SMO classes. Then create the same user group in and user in the database and Attach it. It never fails and yes... I know how frustrating this is. I lost a lost of sleep over this this weekend.
Check out the thread in the first forum of this board for more information.
Renee
|||
Thanks Rene,
I learned something. I don't need the SSMSE becuase I have the full version installed too.
However I still can't fix the problem. This is what I have done so far:
I exported a .regservr and the xml looks just like you show. authetication 0. So I went back and looked in the registry again. I found a LoginMode subkey but in a different key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.4\MSSQLServer
It didn't quite make sense, because I am trying to change a NAMED instance. As expected it did not work. The exported .regsrvr still shows the same authentication mode 0.
I am scared to start adding registry keys that do not even exist.
The nightmare continues.
Carl,
You are doing this programmatically?
|||I meant to ask you about a link to the thread you mentioned.
What do you mean programmatically?
Create a c# app that could access and modify these registry keys in code? in which case NO.|||
Not true.... I spent the weekend working on this and a friend really helped my understand. You can do excellent work with SSE.
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=223272&SiteID=1&PageID=0
post an email adress and I will send you the solution.
|||http://msdn2.microsoft.com/microsoft.sqlserver.management.smo.server.attachdatabase.aspx
http://msdn2.microsoft.com/ms160723.aspx
|||oh yeah. . . you can't do SQL authentication only.
its either windows or mixed mode