SQL Server Database Attach error. The system cannot find the file specified - sql

When im trying to attach database get such error Does Anyone have an idea what can be problem?

On your first picture, I see the med_log.ldf file. On second picture you trying to attach med.ldf. Try to change the name of file in line 3 to med_log.ldf.

Your error message states that it is looking for Med.ldf, not Med_log.ldf.
You need to change the filename in the second part of your restore command to match this filename.

The name of the Log file seems to be incorrect. it should be "Med_log.ldf" instead of "Med.ldf"

Related

AzureSynapse Lookup UserErrorFileNotFound with Wildcard path

I am facing an odd issue where my lookup is returning a filenotfound error when I use a wildcard path. If I specify and exact file path, the lookup runs without error. However, if I replace the filename with a *, I get a filenotfound error.
The file is Data_643.json, located in my Azure Data Lake Storage Gen2, under the labournavigatorfile system. The exact file path is:
labournavigatorfile/raw_data/Scraped/HeadHunter/Saudi_Arabia/Data_643.json.
If I put this exact path into the Integration dataset configuration, the pipeline runs without issue. However, as soon as I replace the 'Data_643.json' with a '*', the pipeline crashes with a filenotfound error.
What am I doing wrong? Many Thanks for any support. This must be something very simple that I am missing.
Exact path works:
Wildcrad path throws error:
I have 3 files in my container as file1.json, file2.json, file3.json as shown below:
The following is how I configured my dataset to read using wildcard with configuration same as in the image provided in the question.
When I used this in lookup I got the same error:
To overcome this, go to your lookup activity. When you want to use wildcards to read a file/files, check the wildcard file path option. Then specify the folder structure and use wildcard where required. The following is an image for reference.
The following is the debug output when I run the pipeline (Each of my files had 10 rows):

How to ignore failure when file does exist when downloading with WinSCP script

Running a script to get a file from SFTP server, however this is recurring job and should still succeed if no file exist, is there an option I can specify?
option batch on
option confirm off
option transfer binary
open sftp://server -timeout=60
password
get /File/2_04-28-2015.txt D:\Files
close
exit
Getting this result:
Can't get attributes of file 'File/2_04-28-2015.txt'.
No such file or directory.
Error code: 2
Tried setting failonnomatch:
winscp> option failonnomatch on
Unknown option 'failonnomatch'.
You cannot tell WinSCP to ignore absent file, when using a specific file name.
But you can check the file existence prior to the actual download.
Easy alternative hack is to use a file mask (note the trailing *) and set the failonnomatch off:
option failonnomatch off
get /File/2_04-28-2015.txt* D:\Files\
(if you are getting "Unknown option 'failonnomatch'", then you have an old version of WinSCP).
Have you tried using MGET instead of GET? It shouldn't fail, just not transfer anything if there's nothing there.

ERROR attaching adventureworks2012_data.mdf file with sql server 2012

I have been trying to add adventure works database to my SQL server 2012..I tried to attach the database using SQL Server Management Studio as follows: I Right Clicked on Databases > Attach and clicked Add... > selected the AdventureWorks2012_Data file. and then I Selected the log file and removed the log file by clicking on the Remove button then clicked OK but I still get an error that the header file is not a valid database header file and the FILESIZE property is incorrect ......please help me
As Martin suggested, it may be that the file you downloaded is incorrect. You should download a new copy from here (I wouldn't get it anywhere else):
Once you do, don't use the UI for this. Make sure you copy the .mdf file to your instance's data folder. Then run this code in a query window:
CREATE DATABASE AdventureWorks2012
ON (name = 'AdventureWorks2012_data',
filename = 'drive:\path\AdventureWorks2012_Data.mdf')
FOR ATTACH_REBUILD_LOG;
You will get this "error" message:
File activation failure. The physical file name "drive:\path\AdventureWorks2012_Log.ldf" may be incorrect.
This is just SQL Server telling you that it didn't find the log file; it should still create one for you unless you have other issues (permission denied, lack of space, the same name file already exists, etc).

Error trying rename a file

Hi community!
I have an application in VB.Net, in the user's computer is located in program files.
The users run always the program as an Administrators.
But in some cases; when the program try to rename a file in the program files the program throws the following exception:
The given path's format is not supported.
SOURCE = System.Security.Util.StringExpressionSet.CanonicalizePath
Also, happens when I try to copy a file.
The application does the rename or copy automatically and it's the same name for all the users
Example:
Rename(vOld, vNew)
FileCopy(vOld, vNew)
This exception only happen in Win7.
Somebody have an idea what is the reason to some users appear this exception?
This will happen when the user provides an invalid file name, for example one that includes colons.
You should validate that the user-entered file name does not contain any of the values in System.IO.Path.GetInvalidPathChars.
All it's my fault!
-_-'
I'm trying to rename this path:
C:\_MyFile.xlsx
To:
C:\MyFile.xlsx
In my computer all works fine because I have the both files (The users only has the file with the underscore).
When the program try to validate it try to rename the file "_C:\MyFile.xlsx" to "C:\MyFile.xlsx"
The exception don't give much information about my error...

Automatically locating a file

By default AutoCAD installs a text based file called acad2010.lsp at the set location below
Dim FILE_NAME As String = "C:\Program Files\AutoCAD 2010\Support\acad2010.lsp"
However it my be that the user/ administrator/ or third party has changed the location of this file. Is it possible to then locate it using the following
Dim FILE_NAME As String = "C:\*\acad2010.lsp"
In other words search the entire c:\ drive for file acad2010.lsp?
If this doesn't work can you please let me know what would?
You could search for it with an FSO. It's not going to be fast however you do it but this is the fastest way I can think of.
http://www.microbion.co.uk/developers/fso.htm should give you a rough idea of how it's done.
Your solution will not work. Is not possible to locate it using *. (BTW is possible in ms-builds scripts). The only way of doing it is:
1- Create a FindFile function (check for example
http://xlvba.3.forumer.com/index.php?showtopic=125)
2- Use it to locate the exact path of the file. (It could be really time
consuming)
3- From this point your code is the same...
Unfortunately, you can't use wildcards in a filepath. You have two options:
Prompt the user for the file location using the "Open File" dialog. The code to do this varies based on which Office product you are using. In Excel, you would use the Application.FindFile method (more info here).
Write your own function to search the filesystem for the file. Microsoft provides an example here.
If that file is used by internal functions of the application, the installer will have recorded a registry key for the file's location.
Open regedit.exe and search for the file name and path.
You can read a registry entry using this VBA one-liner:
CreateObject("WScript.Shell").RegRead(strRegPath)
You may need a terminating backslash on the key address, but that's a safe and simple registry access method. More details on the MSDN site:
https://msdn.microsoft.com/en-us/library/x05fawxd%28v=vs.84%29.aspx