SQL Express Problems Attaching Mdf

Nov 23, 2006

Hi,

I have an mdf without an ldf. This was originally a sql 2000 db, since it was not working, I created a blank SQL Express DB and restored a backup over it.

I then detached and deleted the ldf as I used to do with MSDE.

The database will not attach on most machines (file access error for the ldf) even with attach_single_file_db

When I try to attach it on another machine of mine (with sp1 installed) it attaches fine. could this be something SP1 related?

View 1 Replies


ADVERTISEMENT

Attaching A DB In Express 2005

Jun 14, 2007

I am having trouble attaching a db to ms sql express 2005.I have the db in a folder deep down in my drive, within an asp.net website project. For some wierd reason i can't drill down more than two levels to get to the DB Anyone have any ideas why? Ilan   

View 3 Replies View Related

Attaching A Database To Sql Express

Aug 4, 2006

I'm trying to attach a database to sql express with the following code from the management tool. I keep getting an error message. An someone explain what I'm doing wrong.



Msg 102, Level 15, State 1, Line 9

Incorrect syntax near '<'.

IF NOT EXISTS(

SELECT *

FROM sys.databases

WHERE name = N'<northwind.mdb, I4V0Y6SQLEXPRESS, northwind>'

)

CREATE DATABASE <database_name, sysname, your_database_name>

ON PRIMARY (FILENAME = '<c:my documentsmy websmyweb3,,C:Program filesMicrosoft SQL ServerMSSQL.1MSSQLDataorthwind.MDF>')

FOR ATTACH

GO



Ira

View 1 Replies View Related

SQL Server Express...Attaching DataBase

Apr 14, 2007

Howdy Folks,
I have a site on WS2003, IIS 6 installed on c:.
I put the site in a folder on d:. Nothing else is on d: except the web site.
I added a new website in IIS and pointed to the site on d:.
Using the default connectionString in machine.config, I am unable to connect to ASPNETDB.MDF. Therefors, I can not log in.
In SQL Server Management Studio Express, I attached ASPNETDB.MDF. I then am able to log in.
Does ASPNETDB.MDF have to be manually attched like this when the web site is located on a drive othr than where IIS is installed and running?
Thanks

View 6 Replies View Related

Attaching A Mdf To A SQL Express Instance During Installation

Mar 16, 2007

Hi,

Im working in a proyect where i need to attach a mdf database to the client's SQL express instance. How can i accomplish during installation and without getting the user involved.

Any help will be greatly appretiated

View 3 Replies View Related

Attaching Sql Express Files In Sql Server 2005

Apr 18, 2006

Hello,
I am using the full version of sql server 2005 management studio to attempt to attach sql express mdf files to sql server 2005.

I was using the databases from an ASP.NET commerce starter kit in sql express. I want to update to sql server 2005, so i detached the dbs.
i deleted the sql express management studio ctp and installed sql server 2005 from the free 6 month trial available online.

I then attempted to attach the sql express files to sql server 2005 and get the following error:

TITLE: Microsoft SQL Server Management Studio
------------------------------

Attach database failed for Server '<servername>'. (Microsoft.SqlServer.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.1399.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Attach+database+Server&LinkId=20476

------------------------------
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------

Could not find row in sysindexes for database ID 9, object ID 1, index ID 1. Run DBCC CHECKTABLE on sysindexes.
Could not open new database 'C:INETPUBWWWROOT<location>ASPNET.MDF'. CREATE DATABASE is aborted. (Microsoft SQL Server, Error: 602)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=602&LinkId=20476


I also tried with the original mdf files i had downloaded without making any changes.



any help here?

thank you,
K

View 1 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

Installing SQL 2005 Express And Attaching Database From CD

Apr 11, 2007

Hi there,



I have created an .iss file which when compiled creates a setup.exe file on a cd rom. Within the .iss I have extracted the sqlexpress files out so that it will install straight from disk to the users machine rather than from the .msi file. All this has been successful so far....



My problem is:- I want to attach a database to the an instance of sqlexpress on the users machine. I have detached it from SQL Server 2000 and copied it over to the cd. The setup file copies these over the users hard drive. I have looked through many forums etc and the words that keep popping up are:-



sqlcmd.exe

template.ini

type into the command prompt.



Sorry if I'm a little ignorant but I am not sure how to go about these. How do I open the command prompt on the users machine from CD? Do I have to create something to do this?



Any information would be appreciated, any guidance or scripts would be great.



Regards

Sam

View 2 Replies View Related

Installing SQL Express And Attaching A Mdf Db From The Command Prompt

Mar 21, 2007

Hi,

I need to install a customed SQL server express instance on the client's computer by using the Command prompt installation. I've already defined the security settings and everything i need but i was wondering if is possible to attach a mdf database during the installation. Perhaps there is a paramenter i can include in the in the ini file.

Thank you

View 6 Replies View Related

Create Database In SQL Server 2005 And Attaching It In SQL Express

Jun 29, 2007

Hi,

I've created a database in sql server 2005, but now I need to detach this database and attach it in sql express. Is this possible? I keep getting an error that my database is readonly. Any help would be greatly appreciated.





thanks in advance.

View 3 Replies View Related

Attaching A SQL Express Database To SQL Server Standard Instance...

Oct 18, 2006

If I create a database in SQL Express and then copy the MDF/LDF files and attach them to a machine running SQL Server 2005 Standard - will this new database have SQL Express limitations?

Are there good reasons not to do this and create the database in SQL Server Standard using scripts generated from the SQL Express instance instead?

Basically, I'm setting up a merge replication between Standard and SQL Express for a common database and I figure attaching a copy of the database created in SQL Express is the fastest way to get this started.

View 3 Replies View Related

Error In Attaching MSDE Database To SQL Server 2005 Express

Jul 3, 2006

I'm trying to attach a MSDE 2000 database to SQL Server 2005 Express.

I simply issue sp_detach_db XXX where XXX is the name of my MSDE database. Then sp_attach_db or create database ... with attach and both way gets the following message:

Event ID. : 3415

Description: Database 'XXX' cannot be upgraded because it is
read-only or has read-only files. Make the database or files writeable, and
rerun recovery.

What does it mean?

Thanks for any help,

Peter

View 4 Replies View Related

Configuring SQL Express During Installation And Attaching Smart Client DB / Silent Install For One Click?

Oct 9, 2006



Hey all,

Cool place! Has anyone deployed SQL Express silently using one click and an attached a smart client DB from within the app ... would love to see some of the best practices or horror stories! Just kidding... :) I'm about to deploy a smart client using SQL Express and could use some tips from someone who has been there.

Thanks in advance,

Bill

View 7 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

Re-Attaching DB

Aug 10, 2005

Forgive my ignorance, but I'm just working thru some examples, and I tried to reattach a db to another server, without the log file I created for the db. Having reattached it, it worked fine - without the log file??? Where does it make any log records? Why didn't it complain?

View 3 Replies View Related

Attaching MDF Without LDF

Oct 27, 2005

Hi GuysI'm recovering from a hard disk crash, trying to reattach recoveredfiles.The MDF file seems fine, but I get:"Server: Msg 9004, Level 23, State 1, Line 1An error occurred while processing the log for database'NetCoverAdmin'."when I try to include the LDF file. My command was:EXEC sp_attach_db @dbname = N'NetCoverAdmin',@filename1 = N'c:Program FilesMicrosoft SQLServerMSSQLDataNetcoverAdmin_Data.MDF',@filename2 = N'c:Program FilesMicrosoft SQLServerMSSQLDataNetcoverAdmin_Log.LDF'Is there any way I can restore the database without the LDF file?My backups where on another disk that mysteriously failed at the sametime, so I have to work what I got...Any help appreciated!!Thanks

View 2 Replies View Related

Attaching Files

Jun 21, 2005

I have just started using ASP.net.I have to develop a system that attaches word and PDF files to form.  I also need to be able to do a full text search on the documents attached.I'm currently using SQL server 2000 as my backend DBMS, but I have never used it to attach files. My mates recommend using BLOGS but I'm not sure how to do this and I'm not sure if I can do a full text search using this solution.Could some body please recommend a solution to get me started.Thanks in advancedPaddy

View 1 Replies View Related

Error Attaching .mdf

Feb 2, 2006

I have been asked to edit a web based database and have been given the site on cd.
I have installed IIS, sql server express and Visual Web Developer express.
I am having problems getting the mdf database connected. It works at the school where they have it installed and as far as I know I have mirrored the configuration they have on one  of my test servers.
The database is in App_Data
the connection string is "Data Source=.SQLEXPRESS;AttachDbFilename=c:inetpubwwwrootApp_Datacampbell.mdf;Integrated Security=True;User Instance=True"
And the state is closed.
When I view one of the aspx pages in IE I get the following.

Server Error in '/' Application.


Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.  This error can be caused by a virtual directory not being configured as an application in IIS.Source Error:



Line 6: <compilation defaultLanguage="vb" debug="true" />
Line 7: <customErrors mode="Off" />
Line 8: <authentication mode="Windows" />
Line 9: <trace enabled="false" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true" />
Line 10: <sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;user id=sa;password=" cookieless="false" timeout="20" />Source File: c:inetpubwwwrootappcampbell_houseweb.config    Line: 8
The common error is:
"Error 1 It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.  This error can be caused by a virtual directory not being configured as an application in IIS. c:inetpubwwwrootAppCampbell_HouseWeb.config 8 "
When I test the database connection I get a message
The header file for 'c:inetpubwwwrootApp_Datacampbell.mdf ' is not a valid database file header. The File Size property is incorrect. An attempt to attach an auto named database  for file 'c:inetpubwwwrootApp_Datacampbell.mdf ' failed.A database with the same name existsor the specified file cannot be opened or it is located on a UNC share
Any help would be great.

View 3 Replies View Related

Attaching 6.5 Databases To 7.0

Mar 17, 2001

Hi there:

Can any one help me for attaching the 6.5 databases to 7.0

Thanks,Jay

View 3 Replies View Related

Re-Attaching Databases

May 5, 2004

Haven't posted in a while but got great advice the last time I did - http://www.dbforums.com/t573220.html
I hope someone can give me some advice this time.

Due to a flawed Microsoft hotfix the o/s on which my SQL Server was trashed completely causing me to lose some databases completely. The o/s and SQL Server have now been reinstalled (same version as before).

I have about 716 databases and logfiles which I need to re-attach to the server. I don't have the old master db or a db of all the database names. I was thinking I could write an asp script using FSO to get all the database & log file names & paths and attach them using sp_attach_db.

If anyone knows an easier way to do it or has advice to give, I would be really greatful.

View 5 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

Renaming While Attaching

Apr 26, 2007

I am using SQL Server Management Studio with SQL Server 2005. On my development SQL server, I have developers using a database named TestData. An off-site developer has sent new versions of TestData.MDF and TestData.LDF. I want to attach this new database to the same development server for testing, without overwriting the existing database in use by the developers. How can I rename this new TestData to something like TestDataNew while attaching it? I only have the MDF and LDF files.

Thanks.

View 2 Replies View Related

Attaching A Database

Apr 2, 2008



The situation :
I am making mass changes to my program and database.
The goal is to not make changes to the database at the customer sites, but to clone their current database, and work with that one.

The solution:
I wrote code and queries to detach the database, copy it to another directory on the same computer with a different name, then attach it with the new name.
The process is:
run : sp_detach_db "' + aDatabase + '", ''false'';' (aDatabase is the original database name)
Then, in code, delete the original .ldf file, and copy the database.mdf file to new directory with new name.
then run (for both the new and the original databases):

Create Database "' + aDatabase + '" on
(NAME = ''' + aDatabase + ''', FILENAME = ''' + FormatFilePath(aPath) + aDatabase + '.mdf''
For Attach

This works, up to a point.
The problem :
When I inspect the properties of the newly attached database, with the new name and new directory, the logical name of the database is still the original name.


I TRIED running this query :
sp_attach_single_file_db @dbName= "' + aDatabase + '",'
@physname= ''' + FormatFilePath(aPath) + aDatabase + '.mdf'

but it returns(even though I have deleted the .ldf files for the original dataset) :
Could not open new database 'Test62'. CREATE DATABASE is aborted.
Cannot create file 'E:Data6Test62Test62_log.LDF' because it already exists. Change the file path or the file name, and retry the operation.
File activation failure. The physical file name "E:Data6TestTest_log.LDF" may be incorrect.

(original database name = data6 est est, new database name is data6 est62 est62)
Is there a way to do this? Or do I just need to give it up?

View 1 Replies View Related

Attaching DB Without .ldf File ???

Aug 12, 2006

hi !!

I want to attach database to SQL Server, but I'hv only .mdf file.

I lost .ldf file, how should i attach this DB to server ?

Thanks

SP



View 38 Replies View Related

Help Attaching The Database

Oct 11, 2007



hello
i am having a problem attaching database.
The Problem :


I have created a database using sqlserver express edition.now i have installed enterprise edition ,so i am attaching the database which is created in sqlserver express edition into the enterprise edition.it is showing error


TITLE: Microsoft SQL Server Management Studio
------------------------------
Attach database failed for Server 'SRINIVAS'. (Microsoft.SqlServer.Smo)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.1399.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Attach+database+Server&LinkId=20476
------------------------------
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
Could not find row in sysindexes for database ID 13, object ID 1, index ID 1. Run DBCC CHECKTABLE on sysindexes.
Could not open new database 'FMS'. CREATE DATABASE is aborted. (Microsoft SQL Server, Error: 602)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=602&LinkId=20476
------------------------------
BUTTONS:
OK
------------------------------
Can anyone Help me

thanks

View 1 Replies View Related

Attaching DB And Mapping Users

Oct 15, 2007

I am trying to attach a db to SQL Server 2005 and assign a User to the DB that can read and write.  I am using one user (CreateDBs) to attach the DB and a second user (TestUser) to do the reading and writing.  I run the following code and the DB is attached but I get the following error when I run the code below.
********************ERROR********************
System.Data.SqlClient.SqlException: Cannot open database "hello2" requested by the login. The login failed.
Login failed for user 'CreateDBs'.
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)
at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at NewSite.submit_Click(Object sender, EventArgs e) in X:InetpubRMA4NewSite.aspx.vb:line 120
 
********************CODE********************
'Need to attach to SQL Server
Dim objConn As New SqlConnection("Server=Web-testbedSQLExpress;uid=CreateDBs;pwd=ABC123;database=master")
objConn.Open()Dim objCmd As New SqlCommand("EXEC sp_attach_db @dbname = N'" & sitename & "', @filename1 = N'X:sites" & sitename & "Database" & sitename & ".mdf', @filename2 = N'X:sites" & sitename & "Database" & sitename & "_log.ldf'", objConn)
objCmd.CommandType = CommandType.Text
objCmd.ExecuteNonQuery()
objConn.Close()objConn = New SqlConnection("Server=Web-testbedSQLExpress;uid=CreateDBs;pwd=ABC123;database=" & sitename)
objConn.Open()objCmd = New SqlCommand("EXEC sp_addrolemember db_datareader, TestUser", objConn)
objCmd.CommandType = CommandType.Text
objCmd.ExecuteNonQuery()
objConn.Close()objConn = New SqlConnection("Server=Web-testbedSQLExpress;uid=CreateDBs;pwd=ABC123;database=" & sitename)
objConn.Open()objCmd = New SqlCommand("EXEC sp_addrolemember db_datawriter, TestUser", objConn)
objCmd.CommandType = CommandType.Text
objCmd.ExecuteNonQuery()
objConn.Close()
 
It still doesn't work if I use sa as the user.  I know I am missing a step, what is it? 

View 2 Replies View Related

Help - Error In Attaching Database

Jun 12, 2008

i try to attach sqlserver db but i get this error
 
TITLE: Microsoft SQL Server Management Studio Express------------------------------
Attach database failed for Server 'srvsqlsrv'.  (Microsoft.SqlServer.Express.Smo)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.2047.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Attach+database+Server&LinkId=20476
------------------------------ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.Express.ConnectionInfo)
------------------------------
One or more files do not match the primary file of the database. If you are attempting to attach a database, retry the operation with the correct files.  If this is an existing database, the file may be corrupted and should be restored from a backup. (Microsoft SQL Server, Error: 5173)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.2047&EvtSrc=MSSQLServer&EvtID=5173&LinkId=20476
------------------------------BUTTONS:
OK------------------------------
 
 
what i will do to solve this  error

View 1 Replies View Related

Attaching .mdf To SQL Server 2005???

Feb 27, 2006

If I only have a .mdf file available, how can I attach it to SQL Server 2005? It keeps asking for a .ldf file which I don't have.This one's related to post http://forums.asp.net/1210138/ShowPost.aspx

View 5 Replies View Related

Attaching Old DBs After Server Re-install

Feb 24, 2000

Hi. I'm just learning SQL Server. I built a db last week, then had to reinstall SQL Server in a new O/S this week(Win 98, if it makes any difference. was WinNT.). How can I get my new SQL Server to recognize the db? Can I do this in Enterprise Manager? Thanks for any help...

View 2 Replies View Related

Attaching A Removable Database

Dec 1, 2000

Hi,

I wanted to create a removable SQL Server 7.0 database. So I created the database using the sp_create_removable system stored procedure, imported objects and data, ensured that the database is configured properly for distribution on removable media (using sp_certify_removable system stored procedure), and detached it from original SQL Server. So far, so good. The database consists of 3 files: MYDB_SYS, MYDB_DATA and MYDB_LOG. I copied
MYDB_DATA on a CD, and MYDB_SYS and MYDB_LOG on hard disk of a different server. If I execute the following statement:

Execute sp_attach_db
@dbname = 'MYDB'
, @filename1 = 'C:MYDB_SYS.MDF'
, @filename2 = 'E:MYDB_DATA.NDF'
, @filename3 = 'C:MYDB_LOG.LDF'

I get the following messages:

Server: Msg 5105, Level 16, State 4, Line 1
Device activation error. The physical file name 'E:MYDB_DATA.NDF' may be incorrect.
Server: Msg 945, Level 14, State 1, Line 1
Database 'MYDB' cannot be opened because some of the files could not be activated.
Server: Msg 1813, Level 16, State 1, Line 1
Could not open new database 'MYDB'. CREATE DATABASE is aborted.

I can successfully execute the above statement if I make MYDB_SYS.MDF file read only, but then MYDB is created as read only, and this option can not be changed.

Please, help.

Maja

View 1 Replies View Related

Attaching Db Doesn&#39;t Work

Mar 1, 2001

I try to copy a DB from one server to another. On the target server an older version of the DB has been deleted and I now try to attach the new version using "sp_attach_db DBname, Filelocation", but I always get an error "Device Activation error. The physical file name 'D:mssql7dataAgency_log.ldf' may be incorrect"
"Database 'Agency' cannot be Created"

To me it seems that the database is looking for the log files (now deleted).
I've tried forcing a new log file I created using the same locations for the mdfs. I've tried using create a new database and replace the mdf file, but nothing works.

View 3 Replies View Related

Attaching Db Error After Copy

Mar 4, 2005

i tried to copy the database manually by using sqldmo
here r my codes:


On Error GoTo CopySQLDB_Err

'Create Objects
Set sql = CreateObject("SQLDMO.SQLServer")
Set db = CreateObject("SQLDMO.Database")

'Connect to the server
sql.Connect strSrv, strLogin, strPwd

'Set the database object
Set db = sql.Databases(strDatabase, "dbo")

'Determine the location of database files, primary and log
strMDFfilePath = db.PrimaryFilePath
strMDFfileName = _
Trim(db.FileGroups.Item(1).DBFiles.Item(1).Physica lName)
strLOGfile = Trim(db.TransactionLog.LogFiles(1).PhysicalName)

'Clear out the database object
Set db = Nothing

'Detach database to allow copying
sql.DetachDB (strDatabase)

'Copy database files to new names
FileCopy strMDFfileName, strMDFfilePath & strNewName & ".mdf"
FileCopy strLOGfile, strMDFfilePath & strNewName & "_log.ldf"

problem comes when i tried to attach the db using enterprise manager, error come out :

"passed to log scan in database "SIPS' is invalid" come out ...what is the problem of this?

View 3 Replies View Related

Attaching Just A Data File.

Nov 24, 2006

Hi guys,

we lost a drive that was holding our log files for a database. I have the .mdf file from the database. So I'm trying to attach the database using just the mdf file but it fails because its still looking for the log file.

How do i work around this?

View 4 Replies View Related







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