Restore Database Fails Because Database Is In Use.
Jul 23, 2005
I'm a newbie so please be gentle.
In attempting to run a restore I get the following error message:
"Exclusive access could not be obtained because the database is in
use." However, it doesn't appear that there are any connections to the
database. At the suggestion of another thread, I ran sp_who2 and there
are no connections to the database in question. I've been running the
same restore for months and all has been well, until yesterday....
I wrote an .asp page (below) to test connectivity to this database.
The vb code ran successfully and soon thereafter, my nightly restore
failed. Task manager does no show that the asp page is active.
Lastly, I did add a user ("jbtest") as well as change the option to use
either Windows authentication or SQL Server authentication in
Enterprise Manager.
Any ideas would be greatly appreciated.
Thanks.
<%@ Language=VBScript %>
<%
companyName = "agemni"
Set cnn = Server.CreateObject("ADODB.Connection")
cnn.ConnectionString = "DRIVER=SQL
Server;SERVER=SHEELA-NA-GIG;UID=jbtest;PWD=test1;APP=Microsoft
Development Environment;WSID=SHEELA-NA-GIG;DATABASE=" & companyName &
";Trusted_Connection=No"
cnn.ConnectionTimeout = 300
cnn.CommandTimeout = 300
cnn.Open
Set RS = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM Preferences"
RS.Open strSQL, cnn
Response.Write "connection established with the <b>" & RS("Company
Name") & "</b> database. They are a <b>" & RS("street") & "</b>
customer. "
RS.Close
Set RS = Nothing
%>
View 2 Replies
ADVERTISEMENT
Jun 4, 2007
I'm trying to use ADO to restore a SQL 7 database using a backup file. Thedatabase already exists on the target computer, and is named the same as onthe source computer, and the MDF and LDF files are named the same as well.I am running the below in a stored procedure:RESTORE DATABASE DB1FROM DISK = 'c:mssql7ackupDB1.bak'WITH MOVE 'DB1' TO 'c:mssql7dataDB1.mdf',MOVE 'DB1_log' TO 'c:mssql7dataDB1_log.ldf'And I get an error message "File 'DB1' is not a database file for database'DB1' ".I also tried it without the LDF file in the expression. Same results.Thanks.
View 5 Replies
View Related
Nov 19, 1999
11/19
Trying to keep out sysadmins & sa during/between database RESTORE
Configuration:
WINNT Server Enterprise 4.0 w/SP5
SQL Server 7 Enterprise & SP1
2 SQL Servers:
Production Server
Standby server
I Backup (full backup) databases to disk on primary server (logical backup devices are physicaly located on a Standby server (dedicated gigabit NIC in each server for this process). Transaction logs are applied to the Standby server throughout the day.
Problem:
How to keep out "sa" and sysadmins from a database while I'm restoring (or between restores) to a standby server?
The database being restored cannot be in use during a restore.
If a DBA forgets that this process is happening, the statement fails (RESTORE)for the database they happen to be in at the time of the restore.
Example restore statement:
Standby Server -
RESTORE DATABASE databasename FROM database_dd WITH DBO_ONLY, REPLACE, STANDBY = 'g:Mssql7FromPrimaryDatabaseName_undo.ldf'
I could restrict Domain sysadmin access and change sa password. I could also put the database in "Single user" mode, however this could become problem if my process disconnects and then someone else connects - then my process is locked out. What I'm really looking for is to lock out all activity for a database that is in "standby mode" except for RESTORE processes.
Any ideas??
Wade
wadej@vailresorts.com
View 1 Replies
View Related
May 24, 2006
We are running SQL 2000 sp4, only one user database (SAP) the database is 63 GB.
The ldf files were trashed so I went to tape to restore.
We are using veritas backup exec 9.1 sp4. Veritas is on the same server. I can restore the master db and the msdb fine. However when we attempt to restore the DEV db it runs for 2 hours and then fails with a communication error from veritas.
When we restore the master the DEV db comes up suspect as there are no files for it to attach to) so we cannot attach to it to restore, so I have deleted it and attempted to restore - same communication error. I have recreated a db named DEV with the mdf etc created to the size needed plus some to be sure, no good same behavior (behavior described below).
The job starts and it creates all the folders for the database (there are 1 MDF, 5 NDF, and 4 LDF files each in its own folder). Then it begins to create teh individual files it gets ~half way through at about an hour-hour and fifteen. During this time there are a large number of writes being performed by SQL (I assume it is creating the structures). Then it switches over to reading from tape a large number of read by beengine for another 45-1.5 hours then the job fails with the error unable to communicate with the device. I ahve noticed that once it starts reading from tape the db is gone from enterprise manager, and the mdf etc. files that were being created are now gone.
Help this has gone on for three days!!!
View 11 Replies
View Related
Sep 20, 2006
Hello,
I have a fresh install of sqlExpress and Management Studio Express on my test server. I want to restore my master database from backup.
From the command prompt I set the Sqlservr -s SQLEXPRESS -m
Then I opened another comand prompt and ran my SQLCMD script to restore the Master Database.
here is the sql script:
RESTORE DATABASE [Master] FROM DISK = N'E:COPLEYNEWSDATABASEBACKUPMaster.bak' WITH FILE = 1, MOVE N'mastlog' TO N'C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLDATAMaster_1.ldf', NOUNLOAD, STATS = 10
GO
I recieve the following error.
Msg 3154, Level 16, State 4, Server COPLEYNEWSSQLEXPRESS, Line 1
The backup set holds a backup of a database other than the existing 'Master' dat
abase.
Msg 3013, Level 16, State 1, Server COPLEYNEWSSQLEXPRESS, Line 1
How do I restore a Master Database on SQL Express?
View 6 Replies
View Related
Apr 9, 2008
I have a problem when i restore my .DAT_BAK file. I am getting error like "The backup set holds a backup of a database other than existing database. Restore Database is terminating abnormally".
I tried by using
RESTORE DATABASE <DATABASENAME>
FROM DISK = 'D:DATAMYTEST.DAT_BAK'
WITH MOVE 'VZAI_DATA' TO D:PROGRAM FILES..MSSQLTEST.MDF',
MOVE 'VZAI_LOG' TO D:PROGRAM FILES..MSSQLTEST.LDF',
REPLACE
And also i tried like
RESTORE DATABASE <DATABASENAME>
FROM DISK = 'D:DATAMYTEST.DAT_BAK'
WITH REPLACE
When i use like this,
RESTORE FILELISTONLY FROM DISK = 'D:DATAMYTEST.DAT_BAK'. I am able to get the output as LogicalName, PhysicalName, Type, FileGroupName, Size, etc.
Can i anyone please help me out?
Thanks in Advance,
Anand Rajagopal
View 8 Replies
View Related
May 9, 2012
I'm taking a database(read-only) backup from one server and restoring it on other server. As soon as restore is done it is bringing database into single-user read-only mode.
why it is bringing the database into single user mode ?
View 1 Replies
View Related
Nov 15, 2006
Hello,i am in great trouble. I want to revert back to original state ofdatabase before i performed restore database on my sql server 2KDatabase. Accidently i didn't take backup of my Database and i didrestore, so is there any way to get the original state back of myDatabase?Any suggestion will be highly appriciated.Regards,S. Domadia.
View 2 Replies
View Related
Apr 23, 2008
Hi all,I come up with a problem aleady discussed in some posts especially in the post http://forums.asp.net/t/1235761.aspx. but I got in not finally solved.The main problem is connecting to a database twice which causes errors. So I think this might be the right place to ask my questions. Here ist the problem in short:I'm using VWD on XP-Professional with SQL-Server Express and Reporting Services Express. All with Windwos Integrated Security and User Instance (SQLExpress). In my web-application I had for all Datasources the connect string:Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|mydatabase.mdf;Integrated Security=True;User Instance=True This works fine so far. I also have Reports designed with the Report designer using the same connection string. I can preview the reports and I deployd thre reports successfully. I want to call these report using a report viewer web control.Now the problem:when I call the remote remote report from my web-application, the database cannot be opened because an other process is using the database (see post mentioned above). It seems that this is a problem with attaching the database twice: from the sql-server and from the report-server.So I used now a new connection string without "attaching" the database (in vwd and in report designer):Data Source=.SQLExpress;Initial Catalog=C:inetpubwwwrootmyappAPP_DATAmydatabase;Integrated Security=True Now everything works...but ... only on my machine. On the production machine this does not work. I wonder anyway, why its working on my machine, because I never "attach" the database (there is no connection string with AttachDbFilename and I have not opend the developer and have not opened the sql management studio).On the production machine the concurrent (SQL-Server and Report-Server) connection to database does not work with either connection strings, no matter if i attach the database with sql server manager or not).This all drives me crazy for days now. All I want is to use SQL-server and Reporting- Services with its nice features and not repairing my tools. I thought I have a standard Installation, nothing special, but the standard obviously makes problems.Here finally my question:Does this environment ( web-application with remote reports) with Express edition cause normally no problems?Can I "attach" a database only once? How should I connect with my web application that uses the sql-server connections and also the report-server-connections (attaching twice does not work).What connection strings to use and when (AttachDbFilename or Initial Catalog).Are these problems specific to the Express Editions? I thank you in advance for any help Dieter
View 2 Replies
View Related
May 7, 1999
Anybody figure a way around this:
In a development server you take a backup and you want to move the entire database to a production server. The production server does not contain the database, users, or logins in master.
When you restore the backup to production in 7.0, the users get moved to DBO because the logins do not exist and then you cannot delete them.
We are having to drop the users from the database on development, back up the database and restore it to production, then recreate the users on production.
This is bogus and did not happen in 6.5 because of the aliases.
Anybody come up with a better way?
View 1 Replies
View Related
Jul 3, 2007
I am fairly new to VS 2005 and SQL Server CE. I have developed a Desktop Windows application using VB 2005 and the SQL Compact Edition Database. This application will sell to users via web download.
When they download a service patch, or updated version, I wish for them to retain the data in their present database. In other words, fill the new database with the old data. The new table structures will remain intact except for added columns at the end.
Question is how to save the old data and update the new database with it. Is there an easy way to do this, or do I need to write a module to save a database copy, and update the new database with content at install time?
View 6 Replies
View Related
Jul 29, 2014
Sometime during the night last night some user account permissions were "lost". Am I right to think that restoring the master database would be the way to go? We have a 2 node 2012 cluster and I stop the cluster resource and start the db in single user mode from the active node. Somehow the sharepoint farm is still trying to connect so I can't get logged in single user. What method could I use to stop users from connecting when I don't have access to the sharepoint farm.
View 8 Replies
View Related
Apr 26, 2007
i have a development database that has updates and changes to a production database. rather than go through individually and alter all relevant tables and stored procedures, id like to back up the database on the development side and restore it on the production side as the production database. is there a way to restore the database on the production server but preserve all the security settings (ie logins and such)? i noticed on our development server, that if i try to restore the database with my development database, it overwrites the users and/or if the user is the same on both, it removes the login name for that user.
View 3 Replies
View Related
Aug 10, 2007
Hi,
I was wondering how I could restore a bkp file into a database with a different name. For example, I made a backup of T1.mdf and i want to restore t1.bkp to T2.mdf.
I am using VB.Net to do the backup and restore.
Is there any way of doing it?
Thanks!
View 21 Replies
View Related
Aug 19, 2015
I have a client that has POS software called Restaurant Pro Express (RPE) from [URL] ...
Their old POS computer had a hardware failure, but I was able to attach the hard-drive to another computer and recover the data. RPE uses a MSSQL database system. However, my client doesn't seem to make backups very often
- the last one is dated January 5, 2015. I was able to copy the C:Program FilesMicrosoft SQL Server folder over which contained the instance as well as all the data files - and has up-to-date information. The instance in the recovered Microsoft SQL Server folder was called MSSQL.1. I installed the RPE software on their new computer, and it too now has an instance called MSSQL10_50.PCAMERICA. The new computer is using MSSQL 2008 R2, while I believe the old computer would have been using MSSQL 2005.
I am no DBA expert, especially when it comes to MSSQL. Is is possible to 'restore' the database from the 'raw' .mdf and .ldf files of the old computer to the new computer / database instance? If so, how should I proceed?
View 3 Replies
View Related
Apr 27, 2007
I have seen this before. A 2000 restore fails, leaving the database thinking it is being restored but the restore job failed and errors when it is restarted. EM is clueless. I believe there is a proc to reset some flag. Can you share it with me???
Thanks!
View 4 Replies
View Related
Jun 6, 2000
I had a major disk failure, and the only SQL Server files I was able to recover were master.dat, msdb.dat,msdblog.dat, two text files and two database devices. My question, is it possible in SQL 6.5 to restore a database from just the database device, and if so, how? Thank you.
MH
View 1 Replies
View Related
Sep 11, 2002
Hi,
I need to restore a database to different server.
Orignal .mdf is 16 G, Now on the new serever I have 16 G adn 12 G of drive space available.
Is there a way i can split the data of 1 mdf over to 2 or 3 data files on the new server ?
Thanks in advance.
:confused:
View 3 Replies
View Related
May 7, 2008
hi
how can restore database when user use this database.?
to posibility any error and how can solution
View 5 Replies
View Related
Jul 20, 2005
Yesterday I received a response to my CI/CS Collation problem and therecommendation was to try and restore a CI Collation database to a CSCollation database. After creating a blank CS database a full restore(Force restore over existing database) does change the Collation toCI. I'm unsure as to how I can restore without changing theCollation. Any suggestions?
View 2 Replies
View Related
Apr 21, 2003
I have several Maintenance jobs that keep failing. They
are , Integrity Checks, Index rebuild, and Update
statistics. I keep getting a similar error on all three. I
have pasted it below. None of my other SQL 2000 servers
have any problems. I have tried changing the database
options in question. The error I keep getting is as
follows:
Microsoft (R) SQLMaint Utility (Unicode), Version Logged
on to SQL Server 'DAPHNE' as 'CDCNorm' (trusted)
Starting maintenance plan 'FSPRD84A Integrity Checks' on
4/21/2003 10:20:59 AM
[1] Database FSPRD84A: Check Data and Index Linkage...
[Microsoft SQL-DMO (ODBC SQLState: 42000)] Error 1934:
[Microsoft][ODBC SQL Server Driver][SQL Server]DBCC failed
because the following SET options have incorrect
settings: 'QUOTED_IDENTIFIER'.
The following errors were found:
[Microsoft][ODBC SQL Server Driver][SQL Server]DBCC failed
because the following SET options have incorrect
settings: 'QUOTED_IDENTIFIER'.
** Execution Time: 0 hrs, 0 mins, 8 secs **
End of maintenance plan 'FSPRD84A Integrity Checks' on
4/21/2003 10:21:07 AM
SQLMAINT.EXE Process Exit Code: 1 (Failed)
Any suggestions?
View 8 Replies
View Related
Sep 20, 2004
Folks, i had a database with data and log file on seperate disks. After reboot, i've lost the log file; now i am trying to attache the data file using EM and QA, i get the following error; plz guide:
sp_attach_single_file_db 'production', 'd:production_data.mdf'
Server: Msg 1813, Level 16, State 2, Line 1
Could not open new database 'production'. CREATE DATABASE is aborted.
Device activation error. The physical file name 'D:production_log.LDF' may be incorrect.
Howdy!
View 2 Replies
View Related
Jan 30, 2008
Hello all,
I am trying to restore a database made on a Windows Server 2003 machine using SQL Server 2005 Standard, to a Windows XP Pro machine running SQL Server 2005 (both express, and Standard on another machine). I am doing this using Management Studio (tried express on the other computer).
The restore process seems to go okay, it states it finished, but the database name still looks like this: "DBName (Restoring...)", and it stays that way.
This has happened to me on both XP SP2 computers, and happened with backups from SQL Server 2000 in the past as well. I have no idea what causes this; i've even tried SQL Server 2000. It has worked a few times, but it seemed to just be luck. My thoughts on the SQL Server 2000 backup were that the data was corrupted, but at this moment i no longer believe that.
I don't have experience with doing the restore process outside of management studio, and my knowledge with SQL is basicly the part you use when programming (data and table manipulation, joins, some stored procedures).
I hope any of you can help me, it's really appreciated!
Marc
[edit]More information
I first created a database, right click > All Tasks > Restore > Database
Selected the file, checked the box at the left of the file
Went to Options, checked 'Overwrite existing data', changed the 2 filenames to the new ones, selected the 'leave the database non-operational ... (restore with norecovery)' option and clicked OK.
View 3 Replies
View Related
Jun 28, 2006
Hi
I can logon to my Sql server using the SSMS management tool, I am using Windows Authentication to logon to SSMS. Create a database OK, with all the necessary tables.
However when I start a VB Express app and try to connect to this database I get an error that login filed for user AMDLarry, AMD is my PC name and my login (Larry) is the computer Administrator logon. The PC is a standalone ie not part of a domain etc.
Can anyone help?
Regards.
Larry.
View 4 Replies
View Related
Jun 17, 2007
Hi,
I am getting the error below when I try to copy a database.
OnError,SQLSERVER2005,AUTORIDADE NTSYSTEM,XX_XX_XX_XX_SQLSERVER2005_Transfer Objects Task,{E2404B46-E96F-47DA-91F7-ACBB914BD89D},{6D380D9F-9A9E-42F6-AE14-B8852DF6B8E9},16/6/2007 22:24:02,16/6/2007 22:24:02,0,0x,ERROR : errorCode=0 description=CREATE DATABASE failed. Some file names listed could not be created. Check related errors. helpFile= helpContext=0 idofInterfaceWithError={8BDFE893-E9D8-4D23-9739-DA807BCDC2AC}
StackTrace: em Microsoft.SqlServer.Management.Dts.DtsTransferProvider.ExecuteTransfer()
em Microsoft.SqlServer.Management.Smo.Transfer.TransferData()
em Microsoft.SqlServer.Dts.Tasks.TransferObjectsTask.TransferObjectsTask.TransferDatabasesUsingSMOTransfer()
I am using SQL Server 2005 SP2 (9.0.3042) with Windows XP SP2 inside a virtual machine (Virtual PC 2007 version 6.0.156.0).
I am copying the database to a local drive (C:) and the error occurs after 45 minutes.
Using SQL Server 2000 takes 40 minutes to copy the same database without problem.
View 3 Replies
View Related
Jun 22, 2006
Hey everyone.
View 2 Replies
View Related
Mar 26, 2001
Hi all,
I have a table with 4869068 rows and when some one tries to insert the records into this table the database times out....Does any one know what could be the reason and from where do I start debugging.
I have no problem with the disk space?
Thanks,
Venu
View 1 Replies
View Related
Aug 21, 2014
If I try to backup of database in sql 2012 with t-Sql as follows:
Backup database db1
to disk='c:myfullbkup.bak' with init
go
This code works absolutely fine.
But if I try to take backup through SSMS -Task -Backup in object explorer and gave the same path of c: drive or any other folder outside sql default "Backup" folder.It gives error as access denied.This was not the scene in Sql server 2008.
View 8 Replies
View Related
May 8, 2008
Hi all
I have a Job
Code Snippet
set nocount on
declare @My_Return int
declare @command1 varchar(1000)
set @command1 = 'use [?] DBCC SHRINKDATABASE ([?], 50)'
print @command1
exec @My_Return = master.dbo.sp_MSforeachdb
@command1 = @command1
print @My_Return
Some of Errors are comming like
Cannot shrink log file 2 (modellog) because requested size (1234KB) is larger than the start of the last logical log file. [SQLSTATE 01000]
Cannot shrink log file 2 (xxxxx_Log) because all logical log files are in use. [SQLSTATE 01000]
Msg 1205, Sev 13: Transaction (Process ID 33) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction. [SQLSTATE 40001]
Any suggestion appreciated.
View 4 Replies
View Related
Apr 27, 2007
I have a WinXP Pro sp2 system that I have installed SQL Express in one case and in another caes I have installed SQL Express sp1. When trying to upgrade either to the next service pack, I get a "Setup Failed" on the "SQL Server Database Services". When I look at the log file, the following is the error:
...
MSI (s) (F8!28) [14:43:23:980]: PROPERTY CHANGE: Adding EditionTypechecksum.CC1A8C58_27D1_4D38_BF1B_C0A5CBB90616 property. Its value is 'Express Edition with Advanced Services'.
<Func Name='GetSkuIt'>
GetServiceUserGroup failed for SQLEXPRESS, 5
Error Code: 0x80070534 (1332)
Windows Error Text: No mapping between account names and security IDs was done.
Source File Name: sqlcasqlcax.cpp
Compiler Timestamp: Fri Feb 9 22:35:05 2007
Function Name: SetInstanceProperty
Source Line Number: 1223
Error Code: 1332
MSI (s) (F8!28) [14:43:27:235]: Product: Microsoft SQL Server 2005 -- Error 29528. The setup has encountered an unexpected error while Setting Internal Properties. The error is: Fatal error during installation.
Error 29528. The setup has encountered an unexpected error while Setting Internal Properties. The error is: Fatal error during installation.
<EndFunc Name='LaunchFunction' Return='1332' GetLastError='203'>...
I was hoping someone has run into this before and can direct me to the solution.
Thank you.
KSLarson
View 3 Replies
View Related
Aug 28, 2006
Hello,
I would like to have a script , that sends a mail to the dba mail box when the database backup fails . The mail should be sent to the SMTP server.
I have the script which gives the whole output of the backup status but I would like it to change so that it fires only when a backup fails. Please suggest me what to do..
select
bmf.physical_device_name,
RIGHT(bmf.physical_device_name, CHARINDEX('', REVERSE(bmf.physical_device_name))-1) as physical_device_file,
bs.database_name,
bs.backup_start_date,
bs.backup_finish_date,
bs.type,
bs.first_lsn,
bs.last_lsn,
bs.checkpoint_lsn,
bs.database_backup_lsn
into #backup
from
msdb.dbo.backupset bs,
msdb.dbo.backupmediafamily bmf
where bmf.media_set_id = bs.media_set_id
and bs.backup_finish_date is not null
AND bs.type = 'D'
AND bs.backup_start_date = (select max(backup_start_date) from msdb.dbo.backupset WHERE type = bs.type and database_name = bs.database_name)
order by bs.database_name, bs.backup_start_date asc
select @message = @message + char(13) + Char(13) + 'Backup Status' + Char(13)
DECLARE GetBackup CURSOR FOR
select database_name, backup_finish_date from #backup order by database_name
OPEN GetBackup
FETCH NEXT FROM GetBackup INTO @dbname, @Status
WHILE @@FETCH_STATUS = 0
BEGIN
select @message = @message + @dbname + ' backup up on ' + @Status + Char(13)
FETCH NEXT FROM GetBackup INTO @dbname, @Status
END
Close GetBackup
Deallocate GetBackup
drop table #backup
print @message
EXEC master.dbo.xp_smtp_sendmail
@FROM = N'testsql2000@is.depaul.edu',
@TO = N'dvaddi@depaul.edu',
@server = N'smtp.depaul.edu',
@subject = N'Status of sqlserver!',
@type = N'text/html',
@message = @message
Thanks
View 1 Replies
View Related
Oct 8, 2007
I am havig trouble getting database mail to work. I setup IIS on the same box as sql. I setup SMTP with the relay to 127.0.0.0. In sql server, I setup database mail to point to localhost, with no authentication. After the setup, when I test the email (RMB Send test message) it works fine.
I created a job that will fail every time. I setup myself as the notify party on the job. When I run the job, it fails. I get no email. The job log has the following error:
Message
The job failed. The Job was invoked by User xxxxAdministrator. The last step to run was step 1 (test 1). NOTE: Failed to notify 'Dan Jones' via email.
I have spent lots of hours trying to make this simple thing work. What is wrong?
View 11 Replies
View Related
Jul 26, 2007
I have a backup of an SQL Server database named "UserData.bak" now i want Restore this backup to my SQL Server.pls tell me whole process.Can i also restore it to MS-Access, if possible pls do let me know. Thanks
View 5 Replies
View Related