I have used the copy database wizard, but I realized I had forgotten to shrink the transaction log file. So I canceled the wizard. My database, detached by the wizard, has now disappeared. The mdf file is still there, but when I try to attach it manually I get the "create file encountered operating system error 5 while attempting to open the physical file..." error.
Unable to open the physical mdf file or log file because it is being used by another process
I am trying to write a Windows Application using ASP.NET 2.0, C#2005 EXPRESS, and SQL 2005 EXPRESS.
I had followed the introductory video to create a connection to the Database using Windows Authentication, and use the wizard to create a dataset and checking all the tables in the database.
After that I dragged a table from the data source created from the above process. The Details Grid so created is able to perform update, delete and addition of records.
But when I went back to the database at my PC I wasn€™t able to connect to the database. And if I opened the database first and then load the windows application and perform some database operations and went back to the physical database I wasn€™t able to open the tables in the database.
The error message is that the physical database connection cannot open the .mdf file or log file because another process is using the database. I guess it refers to the Windows Application.
Is this normal? Will it have any implications after the application is deployed? I suppose that there isn€™t a scenario where a Windows application and a physical process will access the database at the same time.
Will appreciate some feedback and advice on this scenario and whether it is a problem.
Hi, i'm trying to interface a c# application with an sql database created with Visual Web Developer Express. I have published the site (and the db) on iis 5 (xp pro). Everithing goes fine on accessing the database from internet,but when i try to connect the db while it's opened with my c# program i keep an error in the sqlconnection open command: Unable to open the physical file "C:myApp_Datamydb.mdf". Operating system error 32: "32(The file is in use by another process.)". My connection string from webconfig: <add name="MYDBCS" connectionString="Data Source=.SQLEXPRESS;Database="C:myApp_Datamydb.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True" providerName="System.Data.SqlClient" /> .....and the connection string for the c# program: "Data Source=.\SQLEXPRESS;Database=c:myapp_datamydb.mdf;Integrated Security=False;Connect Timeout=30;User ID=abc;Password=abc;Trusted_Connection=False;"; I have used a user to connect the database because there was a conflict trying to open the db with Integrated Security=True.
Does anyone have an idea where is the error? Many thanks Max
Hi Everybody, I like to compute the actual physical database file size using queries.
From the EM database properties, the file size shown is not matching with the master..sysaltfiles.size
Ex. Actual file size is 12MB and 1MB for MDF & LDF respectively. 'sysaltfiles' shows 1464 & 96 resp. Since they are shoing it as 8K Pages, 96*8 = 768KB is not matching with 1024KB for the LDF file. Is there any overheads (additional space from the physical file for file headers) allocated?
Accidentally, I've managed to have this as part of a Create Database:
... FILENAME = N'C:MSSQLData\ estdb_Log.LDF' ...
, notice the triple backslash. The Create Database statement works fine, and sp_helpdb says the log file name is:
C:MSSQLData\ estdb_Log.LDF
I noticed the MSDOS command prompt also allows multiple backslashes, they're reduced to one when performing the command and I guess SQL Server does the same thing, so no problem so far really.
But is it supposed to work this way? Quite confusing, isn't it?
I have been trying to use DMO(C++) to backup a database and then restore from that backup to a new db name AND physical data and log files, with no success. I have been able to successfully restore the backup to the same database and change the physical file names using the RelocateFiles property on the Restore object, but not change both. Any help would be greatly appreciated.
Due to running out of disk space and reducing I/O contention, I plan to seperate data files and log files to different disk arrays.
My plan is to - detach all databases - copy log files to another disk - attach all databases
The total size of log files is about 60GB. It becomes a problem becasue it spend too much time passing files. To reduce down time, is there any way I can do?
Can I just create new log files and remove the current files by using sql management studio?
Scenario : I have VC++ 2005 Express IDE open and use the database explorer to browse tables in a database. Then I open SQL Server Managament Studio Express and try to browse the same database. I get "Unable to open the physical file ... The process cannot access the file because it is being used by another process".
What is this "other process" that is trying to open the file? I thought the whole point of a database server was that clients talk to the server, and the server accesses the physical file. So only one process should be accessing the file. Do VC++ IDE and SSMSE work directly with the physical file, or do they channel their requests, etc. through the server.
Hi, I've just finished creating my first ASP.NET website. I created it on my laptop and it works perfectly, but I'm having some problems deploying it to my web server (PC).The site works ok, but when I try to log in to my client area, I get this error: "Unable to open the physical file "c:inetpubwwwrootONeillStrataApp_Dataaspnetdb.mdf". Operating system error 5: "5(Access is denied.)".An attempt to attach an auto-named database for file c:inetpubwwwrootONeillStrataApp_Dataaspnetdb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share." I've searched far and wide for a solution and have read many articles, but none seem to be able to fix my problem. I've tried using that SEUtil tool, but that didn't work, I've made sure the App_Data directory on the web server isn't read only (the read-only checkbox isn't ticked, but it DOES have that little green square which I can't get rid of), I've assigned the ASPNET user as a db owner and that didn't work and I've manually attached the database to the web server's instance of SQL Express 2005.When I launch the solution in VS2005 on the web server, I can browse through the database and see the tables and data etc, but when I try to run the application, I get that message above... Surely it shouldn't be this hard to get it going?Any help would be massively appreciated.
Dim strComputer Dim objRegistry Dim strKeyPath Dim strValueName Dim strValue Dim arrValues Dim intValue Dim strpath Dim strpath2 Dim strDBServerName Dim objSQLServer
strComputer = "."
Set objRegistry = GetObject("winmgmts:\" & strComputer & " ootdefault: StdRegProv")
I am working in a C# database application quick test where I basically use two types of access to an SQL Server Express database. In the first part of the code, I use the traditional connection declaring a SqlConnection. When I just use only this kind of connection I do not have any problem. The issue starts when I access to the same database using Data Bindigs at the same time. When I start the application I got and error as soon as the instruction goes to open the data base connection. The reported error is "Unable to open the physical file "<Niños.mdf>". Operating System Error 32: (Process does not have access to the file because is being using by another process)"
For additional information my connection string is:
I am trying to attach a database to SQL 2005. This database has not previously been attached. I have only just installed SQL.  I get the following message: Unable to open physical file "C:ArrowSQLArr@DataArrow_data.mdf" Operating system error 5: "5(error not found)" (Microsoft SQL Server: Error 5120)".  I have loaded SQL and the database fiel and directory with the same user account which is a local administrator on this machine. I have checked that I have read/write access to the file.  The machine runs Windows Vista Business. SQL has SP 2 loaded. What causes this?
We have a very severe issue in our production, and this is very very ugent to fix this issue, there was a job started on server on 10th October, 2007, for backup of database of 3.2 TB, which caused this issue on 18th October, 2007. I cancelled that job and even restarted the server, but still there is same issue on the server.
I am using this command to expand the physical file,
ALTER DATABASE [ODS] MODIFY FILE ( NAME = N'ODSFG33File1', SIZE = 307200000KB )
Error:
MODIFY FILE encountered operating system error 1450(Insufficient system resources exist to complete the requested service.) while attempting to expand the physical file.
Server:
64bit Itanium Server with 4 Processors 4TB of SAN Storage 24GB of RAM MS Windows 2003 Enterprise Edition with SP1 MS SQL Server 2005 (9.0.3152) Enterprise Edition with SP2
Database:
3.2 TB Size of Partitioned Database with 60 File Groups Every File Group contains One month data in its only one physical File. Physical Files are of different size between 10GB and 300GB.
HOW TO GET A FILE'S CREATE DATE?? From SqlServer I need the create date of a file on C or D. Is there a function or code to retrieve the create date, or an API that could read and pass back the file's creation date???
Hello, I have gone to work for a new company and I have seen this company is running out of drive space on a daily basis. The DBA before me created huge databases. For example we have a database that it's created size is 103 GB. Only about 52 GB is ever needed. I know you can resize the tempdb but how about user databases? I have never tried this. Can this be done for a user database?
For tempdb Start SQL from cmd line sqlserver -c -f -s%instance_name% alter databse tempdb modify file
I have a an asp.net application running under IIS. this application is using two folders, the virtual directory under C:Inetpubwwwroot and the application phisical folder at C:. I want to manage this applications .mdf database using microsoft sql server management studio express(iam running sql express with advanced services) which means i have to attach the database to Ms sql server managemet studio express tool. What i dont know is if i should attach the .mdf file in the physical folder's App_Data folder at C:myapplicationFolderApp_data or the .mdf file in the virtual directory under C:InetpubwwwrootMyapplicationFolderApp_Data I dont know which of the two i should attach. Where exactly is the running database, the .mdf file in the physical folder or the .mdf file in the virtual directory under wwwroot.
We are trying to attach a database in Sql Server 2005 Express on Windows Vista.It will Show the following Error.
"Unable to open the physical file "Test.mdf". Operating system error 5 :". And then we installed the SQL Server 2005 Service pack 2. This error again comes.Could you please give me the steps to resolve the problem.
We are running into the following error while changing a column data type from nvarchar (1200) to varchar(8000) "Msg 1105, Level 17, State 2, Line 1
Could not allocate space for object 'dbo.TBL1 '.'PK_CL_ID' in database 'Client01' because the 'PRIMARY' filegroup is full. Create disk space by deleting unneeded files, dropping objects in the filegroup, adding additional files to the filegroup, or setting autogrowth on for existing files in the filegroup.
The statement has been terminated."
Now tried to change the filegrowth of the log file to unlimited
ALTER DATABASE Client01 MODIFY FILE ( NAME = Client01_log, MAXSIZE = unlimited);
The query executes without error but I do not see the auto growth as unrestricted. It's still 2GB
I can run this command to make changes for 1 DB USE [master]
GO ALTER DATABASE [DBName] MODIFY FILE ( NAME = N'Name_log', FILEGROWTH = 10000KB ) GO
Is it possible to create a script which changes log file size to let's say 100MB for all DBs in all servers instead of running the above command by logging into each server? We have about 200 servers and close to 3000 DBs.
Is there a way to modify the RSReportServer.config file with a Web Service call. We want to install an app and have it modify the Renders. We want to remove the Tiff export for example. We also want to add simple headers to Excel. Right now we have to open the file and then make our edits.
ALTER PROCEDURE ExecuteDTSPackage @ServerName VarChar(15),@UserID VarChar(15),@Password varChar(15),@PackageName VarChar(50) AS Declare @obj int Declare @conn int Declare @hrobj int , @hrconn int Declare @return varChar(255) Declare @CMD varChar(255) Declare @prop int Exec @hrobj=sp_OACreate 'DTS.Package', @obj OUT if @hrobj=0 begin set @CMD='LoadFromStorageFile("D:logmetrixDTS_Packages DTS_Domainlev1.DTS",Null)' EXEC @hrobj = sp_OAMethod @obj, @CMD if @hrobj=0 begin --SELECT FILEPROPERTY(@obj, 'Connections(0)') --Exec @hrconn=sp_OACreate 'DTS.Package.Connections(0)', @obj OUT --EXEC @hrconn = sp_OASetProperty @obj, 'Connections(0).Datasource', 'd:logmetrixcountrydomainlev1.csv' EXEC @prop = sp_OAGetProperty @obj, 'CreationDate' EXEC @prop = sp_OAGetProperty @obj, 'AutoCommitTransaction' --print @hrconn --print @dtcreate IF @hrconn = 0 BEGIN Print 'Ok' RETURN END end else print 'Error Loading Package.' Exec sp_OADestroy @obj end else print 'Error loading OLE Package.' go
I can acceed to the properties of my object DTS.package @obj but I don't know how to acceed to the properties of my first connection (I made a import with DTS Wizard from a flat data file to a database table (SQL Server). I need to change the filedir dynamically. It would be in the datasource or datafile property of this connection.
I had to to relocate the database log file and I issued an Alter database command but by mistake I put a space in the file name as below. The space is at the beginning file name. Now I am unable get the database loaded to SQL Server. The database has 2 replications configured, so deleting and re-attaching the database means the replication needs to be re-configured. Is there an alternative way to issue a command to update the database FILENAME ? Not sure if this can be edited in master database (sys files).
ALTER DATABASE [User_DB] MODIFY FILE (NAME = User_DB_log, FILENAME = 'I:SQLLogs User_DB_log.ldf') GO
Hello all. Before my arrival at my current employer, our consultantsphysically set up our MSSQL 7 server as follows:drive c: contains the mssql enginedrive d: contains the transaction logdrive e: contains the data filesNo filegroups were set up and the data files consist of only 1 largephysical file. Currently, our data file is >10GB. When I was trained onthe physical aspects of sqlserver, I was told to never create physical files[color=blue]> 2048MB each. If I did, I could expect inefficient physical storage of[/color]data and slower performance (due to the OS).Our server has 2 RAID-5 arrays. Drive c: and e: are located on the firstarray and drive d: on the second. We're running Windows 4.0 NT Server SP6with NTFS.Can someone comment on the use of 1 single large data file vs. more smallerdata files?
I installed sql 2005 a while back. Then I recently found out my file system was fat32 (I don't understand why the hardware people did this...) and I had to convert to NTFS. Naturally the sql service no longer worked so I uninstalled inorder to reinstall now I can't reinstall it I keep getting this message
native_error=5039, msg=[Microsoft][SQL Native Client][SQL Server]MODIFY FILE failed. Specified size is less than current size.
I am trying to resize a database initial log file from 500M to 2M. I€™m using€?
ALTER DATABASE <DBNAME> MODIFY FILE ( NAME = <DBLOGFILENAME, SIZE = 2 ) "
And I'm getting "MODIFY FILE failed. Specified size is less than current size." I tried going into the database properties and setting the log file to 2M, but it doesn€™t keep the changes.