Showing posts with label SQL Error. Show all posts
Showing posts with label SQL Error. Show all posts

Thursday, July 19, 2012

SQL Error System.Data.SqlClient.SqlError: The operating system returned the error '32(The process cannot access the file because it is being used by another process.)' while attempting 'RestoreContainer::ValidateTargetForCreation'

Hi all,

While Restoring a SQL Backup from SQL Server Management Studio sometime we get an error as shown below -


System.Data.SqlClient.SqlError: The operating system returned the error '32(The process cannot access the file because it is being used by another process.)' while attempting 'RestoreContainer::ValidateTargetForCreation' on 'C:\Program Files\SQL\Databases\\TestDB_2012_10.mdf'. (Microsoft.SqlServer.Smo)




Cause of Error
we typed the name incorrectly during the file name creation in Restore Operation.

Resolution -


Check out the file name in Option tab of Restore Database window.
You would have put two \\ instead of one while specifying the path where file should get created.

Below is the image of what i did -



Thanks & Regards,
Saurav Dhyani
http://saurav-nav.blogspot.com/

Friday, July 6, 2012

Error: 5133 SQL Server while attaching the Database

Hi all,

One of my friend reported an error while trying to attached a database received from client to SQL SERVER 2008 R2.

The database received have only two files one is .mdf & second one is .ndf.

while attaching database to the server he was getting below error -


TITLE: Microsoft SQL Server Management Studio
------------------------------
Attach database failed for Server 'XXX-XX--XX'.  (Microsoft.SqlServer.Smo)


For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.2500.0+((KJ_PCU_Main).110617-0038+)&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)
------------------------------
Directory lookup for the file "G:\SQLLOG\NAV_D_CQPA_370B_Log.ldf" failed with the operating system error 3(The system cannot find the path specified.). (Microsoft SQL Server, Error: 5133)
------------------------------


Resolution -


1) Check for the file path during attach.
In my case as i don't have the Log File (.ldf)  it was taking a random path which does not exist in the system.

2) Delete the selected file (in my case the log file) and click attach.

The system creates the missing file automatically.

Thanks & Regards,
Saurav Dhyani
http://saurav-nav.blogspot.com/

Wednesday, June 6, 2012

Error 3154 - The backup set holds a backup of a database other than the existing database.


Hi all,

While Restoring Database on SQL Server Management Studio, some of us encounter an error i.e
Error 3154- "The backup set holds a backup of a database other than the existing database".



Resolution for the error

After selecting the database backup, goto option Tab from the Left Hand Side Menu and click on First Restore Option i.e Overwrite the existing database(WITH REPLACE) as shown in screen below.


* Make sure that there is no database file exist at the path mentioned in RESTORE the database file as section with same file name otherwise it will replace those files.

For Reading How to Restore a database from scratch in SQL Server Managment Studio, read article here.
Thanks & Regards,
Saurav Dhyani
http://saurav-nav.blogspot.in/

Friday, September 23, 2011

Create File encountered operating system error 5(Access is denied.) while attempting to open or create the physical file

Hi all,

Most of time while trying to attach a database in SQL Server We face a issue.

ERROR Message -









TITLE: Microsoft SQL Server Management Studio
------------------------------
Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc)
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file 'D:Databasefilepath.mdf'.
(Microsoft SQL Server, Error: 5123)
For help, click:
http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.00.4000&EvtSrc=MSSQLServer&EvtID=5123&LinkId=20476
------------------------------

Resolution -
While starting SQL Server Managment Studio, dont just double click the icon, Right Click it and select Run As Administrator.

Thanks & Regards,
Saurav Dhyani

Friday, July 1, 2011

ERROR The trasaction log for database is full.


Hi all,

Sometime we face an error in SQL Server while performing transaction in Navision.

ERROR - (Error 9002)

The following SQL Server Error or errors occured when accessing the "Table Name" table:
9002,"42000",[Microsoft][ODBC SQL Server Driver][SQL Server] The trasaction log for 
database 'Database name' is full. To find out why space in the log cannot be reused, see the
log_reuse_Wait_desc column in sys.database.

SQL:
Update "database name"."dbo"."Table Name" with (RepeatTableRead) set something where 
query.

Reason For Error-
The error is due to space avilability in the disk where Log file reside.

Resoultion -

There are multiple options for the resoultion of the same, choose one that best suite you-
1) Backing up the Log.
2) Freeing Disk Space.
3) Moving the Log File to a Different Disk
4) Increasing the size of a log file.
5) Adding a log file on a different disk.
6) Completing or killing a long-running transaction.

For more information click here.

Regards,
Saurav Dhyani
http://saurav-nav.blogspot.com/