Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_database_setup thread: SQL Restore script


Message #1 by Eli Schilling <eschilli@t...> on Wed, 12 Dec 2001 16:59:28 -0800
I'm currently trying to setup a page that does an automatic SQL restore

using a file that gets dumped onto the SQL server every night.  Currently I

have:



	set conn = server.CreateObject("ADODB.connection")

   	conn.Open "Provider=SQLOLEDB.1;Driver={SQL

Server};Server=servername;Database=MyTest;UID=User;PWD=password"

	

	SQL = "Restore Database MyTest from Disk='c:\mytest.bk' with

Recovery"



	Set RS=Conn.execute(SQL)



	Conn.close



When I execute this script I get:



Error Type:

Microsoft OLE DB Provider for SQL Server (0x80040E14)

Database in use. The system administrator must have exclusive use of the

database to run the restore operation.

/sqlrestore.asp, line 11



However, I have nothing open in the DB and no one is connected to it.  If I

run this same script in query analyzer it executes but then the database

shows as "Loading" until I do a manual restore through Enterprise Manager.



Is there a better script for restoring or am I doing something wrong here?



Thanks,

Eli

Message #2 by "Ken Schaefer" <ken@a...> on Thu, 13 Dec 2001 14:17:38 +1100
Don't you either need to kill all the other processes using the DB (use EM

to see these), or start the server in admin mode (with the -m switch) to do

a restore? (I could be wrong abotu this...)



Cheers

Ken



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

From: "Eli Schilling" <eschilli@t...>

Subject: [asp_database_setup] SQL Restore script





: I'm currently trying to setup a page that does an automatic SQL restore

: using a file that gets dumped onto the SQL server every night.  Currently

I

: have:

:

: set conn = server.CreateObject("ADODB.connection")

:    conn.Open "Provider=SQLOLEDB.1;Driver={SQL

: Server};Server=servername;Database=MyTest;UID=User;PWD=password"

:

: SQL = "Restore Database MyTest from Disk='c:\mytest.bk' with

: Recovery"

:

: Set RS=Conn.execute(SQL)

:

: Conn.close

:

: When I execute this script I get:

:

: Error Type:

: Microsoft OLE DB Provider for SQL Server (0x80040E14)

: Database in use. The system administrator must have exclusive use of the

: database to run the restore operation.

: /sqlrestore.asp, line 11

:

: However, I have nothing open in the DB and no one is connected to it.  If

I

: run this same script in query analyzer it executes but then the database

: shows as "Loading" until I do a manual restore through Enterprise Manager.

:

: Is there a better script for restoring or am I doing something wrong here?



Message #3 by Eli Schilling <eschilli@t...> on Thu, 13 Dec 2001 12:48:12 -0500
You are probably right.  I'm a little bit in the dark on this one.  Can you

suggest any modifications to my script?



Thanks,

Eli



-----Original Message-----

From: Ken Schaefer [mailto:ken@a...]

Sent: Wednesday, December 12, 2001 7:18 PM

To: ASP Database Setup

Subject: [asp_database_setup] Re: SQL Restore script





Don't you either need to kill all the other processes using the DB (use EM

to see these), or start the server in admin mode (with the -m switch) to do

a restore? (I could be wrong abotu this...)



Cheers

Ken



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

From: "Eli Schilling" <eschilli@t...>

Subject: [asp_database_setup] SQL Restore script





: I'm currently trying to setup a page that does an automatic SQL restore

: using a file that gets dumped onto the SQL server every night.  Currently

I

: have:

:

: set conn = server.CreateObject("ADODB.connection")

:    conn.Open "Provider=SQLOLEDB.1;Driver={SQL

: Server};Server=servername;Database=MyTest;UID=User;PWD=password"

:

: SQL = "Restore Database MyTest from Disk='c:\mytest.bk' with

: Recovery"

:

: Set RS=Conn.execute(SQL)

:

: Conn.close

:

: When I execute this script I get:

:

: Error Type:

: Microsoft OLE DB Provider for SQL Server (0x80040E14)

: Database in use. The system administrator must have exclusive use of the

: database to run the restore operation.

: /sqlrestore.asp, line 11

:

: However, I have nothing open in the DB and no one is connected to it.  If

I

: run this same script in query analyzer it executes but then the database

: shows as "Loading" until I do a manual restore through Enterprise Manager.

:

: Is there a better script for restoring or am I doing something wrong here?








$subst('Email.Unsub')






$subst('Email.Unsub').


  Return to Index