Error while attaching mdf file - sql

While attaching a mdf file in sql server i got unable to open the physical file name.mdf error. how to resolve this error?

I am referring below URL forum thread in which the topic "Unable to open physical file - Operating system error 5: 5(error not found) Microsoft SQL Server: Error 5120" discussed..
http://social.msdn.microsoft.com/Forums/en/sqldatabaseengine/thread/9e563890-e35f-4524-82b9-3cca08fec5ed
I hope in this various solutions have and trying to solve by using anyone of them.

Related

Exception: ORA-31640: unable to open dump file "..." for read

When I am trying to import .DMP file via SQL developer I am getting this error
Exception: ORA-31640: unable to open dump file "/home/oracle/Desktop/dump/vahe.DMP" for read
dump directory and vahe.dmp file have read and write permission.
I use Database App Development VM.
how can I fix this issue ?
Thanks.
Well I found the problem. Actually I had type error. I have typo "vahe.DMP" instead of "vahe.dmp"(in lower case ). I think error message is not good one, because it should clearly say that file does not exist instead of saying "unable to open dump file '' for read" (IMHO)
Thanks everybody who tried to help me.
I was having the same error while importing DMP file shared from colleague.
error “ora-31640 unable to open dump file for read”
By creating new user with same name and password which was used while creating DMP file, and used this user for connect and importing, it resolved this error.
I was importing the data using "Data Pump Import Wizard" in oracle 11g R2 server.

SSIS OLEDB Connection issues with acquire connection error

Thank you for looking into this. I am fairly new to SSIS and got stuck. I have googled a lot of resources but dont see anybody else having the same issue.
I have created an SSIS package which downloads a 'abc.zip' file from a website. I am unzipping the file using 'Execute Process Task', the unzipped file is in 'abc.DBF' format. I am importing the data from the 'abc.dbf' into sql server 2008R2. The package runs fine and exactly as intended when I run it in BIDS without config file, but when I create a config file for the package it fails at the Connection at 'DBF Source' in the Data Flow Task with the errors mentioned below:
[DBF Source 1] Error: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager "DBF Connection" failed with error code 0xC0202009. There may be error messages posted before this with more information on why the AcquireConnection method call failed.
[SSIS.Pipeline] Error: component "DBF Source" (1) failed validation and returned error code 0xC020801C.
[SSIS.Pipeline] Error: One or more component failed validation.
Error: There were errors during task validation.
[Connection manager "DBF Connection"] Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E21.
An OLE DB record is available. Source: "Microsoft OLE DB Service Components" Hresult: 0x80040E21 Description: "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.".
I have configured the 'DBF Connection' as suggested in http://www.midnightdba.com/Jen/2010/08/tip-connect-to-dbase-files-in-ssis/ and works find without config.
I have not changed anything but just created a config file and I am using it on the same machine, with the same settings. Any help is appreciated. Thanks again.
Apologize for not being able to answer this earlier and thank each and everyone of you for taking time to look into this issue. I was able to finally get the package working by using the UNC path in my package. I saw that my package was working fine when run in the test environment but was failing when I created a configuration file. So I decided not to change anything in my Config file and the only way I thought I could do this was to use a UNC path (for the connection strings) which would allow me run the package with configuration file but without modifying anything in configuration file in production.

SQL REPLICATION ERROR

I have this error and i don't understand what i have to do.
I have tried all day but it doesn't work...
Error messages:
The schema script 'BOOKING_2.sch' could not be propagated to the subscriber. (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147201001)
Get help: ...
The process could not read file 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER2012\MSSQL\repldata\unc\K-DEV$MSSQLSERVER2012_FSC_FLIPBOARD_FSC_FLIPBOARD\20130927184606\BOOKING_2.sch' due to OS error 3. (Source: MSSQL_REPL, Error number: MSSQL_REPL0)
Get help: ....
Impossibile trovare il percorso specificato.
(Source: MSSQL_REPL, Error number: MSSQL_REPL3)
Get help: ...
You need to specify a shared path and not a local path to use as your "remote" publisher. Share a folder on the local server then point the replication to \\server\shareyouhave.
Reference: MSDN
Create a network share path. And specify the path for Snapshot while configuring
\serverName\shareFolder
Please click here.

sp_attach_single_file_db Error: failed with the operating system error 5(Access is denied.)

I'm trying to use this DataBase that come with this sample project with from MS:
http://code.msdn.microsoft.com/ASPNET-Web-Forms-6c7197aa/sourcecode?fileId=18930&pathId=365206059
So after I downloaded the files: I need to attach the .mdf DataBase to my Instance of MS SQL 2008.
From Management Studio Attaching DataBase does not work and event using this command i receive the same error:
sp_attach_single_file_db 'School.mdf', 'C:\School.mdf'
ERROR:
Msg 5133, Level 16, State 1, Line 1
Directory lookup for the file "C:\School.mdf" failed with the operating system error 5(Access is denied.).
Any idea what is wrong? Thanks for your help!
Give full permission on folder in which you want to create the mdf file
to the logon account with which the SQL Server service is running.
Usually: NT Service\MSSQL$
You can look that up
Control Panel-> Administrative Tools-> Services=> SQL Server -> Prperties-> Logon Tab-> Note the account
What operating system are you running on? Did you get an elevation prompt when you saved the file to the root of the C drive? What user account is SQL Server running under, and does it have permissions to read any files in the root of the C drive?
You might do better placing the file into %ProgramFiles%\Microsoft SQL Server\MSSQL10.<instance name>\MSSQL\DATA, alongside the other .mdf files that you know it can already read (adjust path above as necessary, but you hopefully get the idea).
I had this issue and all the solutions online was misleading.
The solution was to open SSMS as Administrator. In my opinion first try this and later try all other solutions.
Moving it to DATA folder basically resolved permission issue. Another solution is to change the permissions of the file (or files) and thus still have DB in different folder. I just ran into similar permission error "CREATE FILE encountered operating system error 5(Access is denied.)" trying to attach DB in SQL Server 2012 express on Windows 7.
Solution I did was following:
1) Rich-click on each MDF, LDF, and NDF file to get menu --> select properties
2) Add Users for computer and give them full control (instead of Everyone - to dangerous)
After that I could attach the DB.
However, even if not moved to DATA folder, should move into subfolder instead of C:\ root (example: C:\mydb).
create DATABASE newDataBaseName
on (FILENAME = 'C:\Program Files (x86)\Microsoft SQL Server\MSSQL12.SQLEXPRESS\MSSQL\DATA\filename.mdf'),
(FILENAME = 'C:\Program Files (x86)\Microsoft SQL Server\MSSQL12.SQLEXPRESS\MSSQL\DATA\filename_log.ldf')
FOR ATTACH_REBUILD_LOG;
GO
Also as Damien mentioned above put the mdf files in the where your other mdf files are located. For me C:\Program Files (x86)\Microsoft SQL Server\MSSQL12.SQLEXPRESS\MSSQL\DATA
In my case I found the Directory lookup needed the computer/users group in read/list permissions. While the service and the actual user running the (in my case) restore had full permissions that permission was important.
Security wise I hate it.

SQL Server - An error occurred while executing batch. Error message is: The directory name is invalid

Our database server had run out of disk space, after freeing up some disk space any query run in sql server management studio, with the results sent to grid view, resulted in this error:
An error occurred while executing batch. Error message is: The directory name is invalid.
When the results sent to text view the queries worked fine.
Does anyone know why this error occurs and how to get rid of it?
All you need to do is to open command prompt and type:
mkdir %temp% and press Enter.
Simple as that. No logout/login required.
Received the message:
SQL Server - An error occurred while executing batch. Error message is: The directory name is invalid
When trying to execute a query in Management Studio after deleting temp files from c:\documents and settings\administrator\local settings\temp
Resolved when logging out of server session and back in again.
This resolution fixes this error on the following environments:
Windows Server 2003
Windows Server 2008
Windows Server 2012
Sql Server 2005
Sql Server 2008
Sql Server 2008 R2
Sql Server 2012
Sql Server 2014
Sql Server 2016
I had similar problem on SQL Server 2012. I checked the folder value in %TEMP% variable (echo %TEMP% from command prompt ) and noticed that the folder did not exist. I created the folder and it did the trick!
I had this issue on my webserver (windows server r2 running SQL Server 2012)
The directory name is invalid.
(mscore lib)
Logging out (killing my remote session) and logging back in fixed the issue for me.
Is the "Default Location for saving Query Results" set to a valid path in Tools/Options/Query Results/SQL Server/General?
Do the TMP/TEMP environment variables point to valid directories?
Reinstalling the client tools will probably fix the problem.
I had this same issue on my Windows 7 machine. I actually encountered the error both in SQL Server Management Studio and Visual Studio 2012. I checked my temp directory and found over 66,000 files. Significantly, there were a large number of files called tmpXXXX.tmp where XXXX was a hex number. The problem was that the files went all the way up to tmpFFFF.tmp. So whatever was creating the temp files was not cleaning them up properly and eventually just ran out of files. The solution was to delete all the files in that folder. Not surprisingly, this also greatly improved performance.
The temp folder can be found at: %TEMP% which will be correct for both XP and Win7.
I was facing this problem for a long time.....simple answer for this problem An error occurred while executing batch. Error message is: The directory name is invalid is just free up the disk drive space ....my problem resloved by this may be this will be helpful for many more...
I faced the same problem if DB was created in SQL Server 2008 and it was opened by SQL Server 2005. Just reopen it in 2008.
I was facing the same problem,
so to check this i typed %temp% and it gives an error for folder not found .../temp/2
so i created a folder name 2 inside temp folder and restart the sql server.
which works for me.
I know it can sound like a joke, but have you tried restarting SQL Server instance?
Yesterday i faced the same error "The directory name is invalid" when i tried to open New Query Window in SQL Management Studio 2014. It happened after cleaning (deleting) %temp% folder files.
I Restarted SQL services but no luck!
My problem was solved after restarting the server.