Showing posts with label access. Show all posts
Showing posts with label access. Show all posts

Friday, March 30, 2012

Restored SQL 6.5 but can only access locally - Need Help

Pardon my long windedness, but I want to provide a full explanation.
I have very limited (next to none) knowledge of SQL Server or NT / 2000
Server.
We had a membership database stored on an SQL Server 6.5 on an NT system.
We accessed it via a custom written Visual Basic program called Member. The
computer crashed, not the drive. Apparently, it was an old single processor
PC. I tried to move the drive into a newer computer and got a HAL.DLL
error. I was able to recover the DAT files using the drive as a second dive
on a newer PC.
I put the drive in a newer computer and upgraded it to Windows 2000. Then I
reinstalled SQL Server 6.5. I created the matching database and database
devices. I then copied the old DAT files over and it worked. I was able to
access the old database files. Hooray!
I reinstalled the Member program, and sure enough the connection strings
work and I can access my data again. Another Hooray!
Now my only problem is that I cannot connect to the database from any of the
network computers, only locally. I have read many pages on the internet and
experimented quite a bit, but I still get an ODBC timeout failure every time
I try to connect from one of the other computers on the network.
It appears that my SQL is running and sharing the information, but only
locally. Or there is some other reason that I cannot access it over the
network? Any ideas? I really need to get this up and running again soon.
Thanks for any help.
TedDid you enabled the TCP/IP protocol while installing the SQL Server 6.5? If
not go to SQL 6.5 Setup program
and check if the TCP/IP is selected; else include that and try connecting.
Its been a long time I have worked with
SQL 6.5.
Thanks
Hari
SQL Server MVP
"Ted Hadley" <thadley@.cypresscoveresort.com> wrote in message
news:3MWdnUKfzpi_r3PZnZ2dnUVZ_oCdnZ2d@.gi
ganews.com...
> Pardon my long windedness, but I want to provide a full explanation.
> I have very limited (next to none) knowledge of SQL Server or NT / 2000
> Server.
> We had a membership database stored on an SQL Server 6.5 on an NT system.
> We accessed it via a custom written Visual Basic program called Member.
> The computer crashed, not the drive. Apparently, it was an old single
> processor PC. I tried to move the drive into a newer computer and got a
> HAL.DLL error. I was able to recover the DAT files using the drive as a
> second dive on a newer PC.
> I put the drive in a newer computer and upgraded it to Windows 2000. Then
> I reinstalled SQL Server 6.5. I created the matching database and
> database devices. I then copied the old DAT files over and it worked. I
> was able to access the old database files. Hooray!
> I reinstalled the Member program, and sure enough the connection strings
> work and I can access my data again. Another Hooray!
> Now my only problem is that I cannot connect to the database from any of
> the network computers, only locally. I have read many pages on the
> internet and experimented quite a bit, but I still get an ODBC timeout
> failure every time I try to connect from one of the other computers on the
> network.
> It appears that my SQL is running and sharing the information, but only
> locally. Or there is some other reason that I cannot access it over the
> network? Any ideas? I really need to get this up and running again soon.
> Thanks for any help.
> Ted
>|||Hi Ted
Just wondering if you changed the name of the server, in which case you may
need to change the connection properties for the application.
John
"Ted Hadley" wrote:

> Pardon my long windedness, but I want to provide a full explanation.
> I have very limited (next to none) knowledge of SQL Server or NT / 2000
> Server.
> We had a membership database stored on an SQL Server 6.5 on an NT system.
> We accessed it via a custom written Visual Basic program called Member. T
he
> computer crashed, not the drive. Apparently, it was an old single process
or
> PC. I tried to move the drive into a newer computer and got a HAL.DLL
> error. I was able to recover the DAT files using the drive as a second di
ve
> on a newer PC.
> I put the drive in a newer computer and upgraded it to Windows 2000. Then
I
> reinstalled SQL Server 6.5. I created the matching database and database
> devices. I then copied the old DAT files over and it worked. I was able
to
> access the old database files. Hooray!
> I reinstalled the Member program, and sure enough the connection strings
> work and I can access my data again. Another Hooray!
> Now my only problem is that I cannot connect to the database from any of t
he
> network computers, only locally. I have read many pages on the internet a
nd
> experimented quite a bit, but I still get an ODBC timeout failure every ti
me
> I try to connect from one of the other computers on the network.
> It appears that my SQL is running and sharing the information, but only
> locally. Or there is some other reason that I cannot access it over the
> network? Any ideas? I really need to get this up and running again soon.
> Thanks for any help.
> Ted
>
>|||That was exactly the problem. Thank you Hari. I ran the Setup program,
checked TCP/IP, and restarted SQL. It worked immediately.
You're a lifesaver!
Ted
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:%23Pe%23SG%23xGHA.4576@.TK2MSFTNGP06.phx.gbl...
> Did you enabled the TCP/IP protocol while installing the SQL Server 6.5?
> If not go to SQL 6.5 Setup program
> and check if the TCP/IP is selected; else include that and try connecting.
> Its been a long time I have worked with
> SQL 6.5.
> Thanks
> Hari
> SQL Server MVP
>
> "Ted Hadley" <thadley@.cypresscoveresort.com> wrote in message
> news:3MWdnUKfzpi_r3PZnZ2dnUVZ_oCdnZ2d@.gi
ganews.com...
>|||Thats a good news..
Thanks
Hari
SQL Server MVP
"Ted Hadley" <thadley@.cypresscoveresort.com> wrote in message
news:6a-dnUP6fbGi53LZnZ2dnUVZ_sydnZ2d@.giganews.com...
> That was exactly the problem. Thank you Hari. I ran the Setup program,
> checked TCP/IP, and restarted SQL. It worked immediately.
> You're a lifesaver!
> Ted
> "Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
> news:%23Pe%23SG%23xGHA.4576@.TK2MSFTNGP06.phx.gbl...
>sql

Restored SQL 6.5 but can only access locally - Need Help

Pardon my long windedness, but I want to provide a full explanation.
I have very limited (next to none) knowledge of SQL Server or NT / 2000
Server.
We had a membership database stored on an SQL Server 6.5 on an NT system.
We accessed it via a custom written Visual Basic program called Member. The
computer crashed, not the drive. Apparently, it was an old single processor
PC. I tried to move the drive into a newer computer and got a HAL.DLL
error. I was able to recover the DAT files using the drive as a second dive
on a newer PC.
I put the drive in a newer computer and upgraded it to Windows 2000. Then I
reinstalled SQL Server 6.5. I created the matching database and database
devices. I then copied the old DAT files over and it worked. I was able to
access the old database files. Hooray!
I reinstalled the Member program, and sure enough the connection strings
work and I can access my data again. Another Hooray!
Now my only problem is that I cannot connect to the database from any of the
network computers, only locally. I have read many pages on the internet and
experimented quite a bit, but I still get an ODBC timeout failure every time
I try to connect from one of the other computers on the network.
It appears that my SQL is running and sharing the information, but only
locally. Or there is some other reason that I cannot access it over the
network? Any ideas? I really need to get this up and running again soon.
Thanks for any help.
TedDid you enabled the TCP/IP protocol while installing the SQL Server 6.5? If
not go to SQL 6.5 Setup program
and check if the TCP/IP is selected; else include that and try connecting.
Its been a long time I have worked with
SQL 6.5.
Thanks
Hari
SQL Server MVP
"Ted Hadley" <thadley@.cypresscoveresort.com> wrote in message
news:3MWdnUKfzpi_r3PZnZ2dnUVZ_oCdnZ2d@.giganews.com...
> Pardon my long windedness, but I want to provide a full explanation.
> I have very limited (next to none) knowledge of SQL Server or NT / 2000
> Server.
> We had a membership database stored on an SQL Server 6.5 on an NT system.
> We accessed it via a custom written Visual Basic program called Member.
> The computer crashed, not the drive. Apparently, it was an old single
> processor PC. I tried to move the drive into a newer computer and got a
> HAL.DLL error. I was able to recover the DAT files using the drive as a
> second dive on a newer PC.
> I put the drive in a newer computer and upgraded it to Windows 2000. Then
> I reinstalled SQL Server 6.5. I created the matching database and
> database devices. I then copied the old DAT files over and it worked. I
> was able to access the old database files. Hooray!
> I reinstalled the Member program, and sure enough the connection strings
> work and I can access my data again. Another Hooray!
> Now my only problem is that I cannot connect to the database from any of
> the network computers, only locally. I have read many pages on the
> internet and experimented quite a bit, but I still get an ODBC timeout
> failure every time I try to connect from one of the other computers on the
> network.
> It appears that my SQL is running and sharing the information, but only
> locally. Or there is some other reason that I cannot access it over the
> network? Any ideas? I really need to get this up and running again soon.
> Thanks for any help.
> Ted
>|||Hi Ted
Just wondering if you changed the name of the server, in which case you may
need to change the connection properties for the application.
John
"Ted Hadley" wrote:
> Pardon my long windedness, but I want to provide a full explanation.
> I have very limited (next to none) knowledge of SQL Server or NT / 2000
> Server.
> We had a membership database stored on an SQL Server 6.5 on an NT system.
> We accessed it via a custom written Visual Basic program called Member. The
> computer crashed, not the drive. Apparently, it was an old single processor
> PC. I tried to move the drive into a newer computer and got a HAL.DLL
> error. I was able to recover the DAT files using the drive as a second dive
> on a newer PC.
> I put the drive in a newer computer and upgraded it to Windows 2000. Then I
> reinstalled SQL Server 6.5. I created the matching database and database
> devices. I then copied the old DAT files over and it worked. I was able to
> access the old database files. Hooray!
> I reinstalled the Member program, and sure enough the connection strings
> work and I can access my data again. Another Hooray!
> Now my only problem is that I cannot connect to the database from any of the
> network computers, only locally. I have read many pages on the internet and
> experimented quite a bit, but I still get an ODBC timeout failure every time
> I try to connect from one of the other computers on the network.
> It appears that my SQL is running and sharing the information, but only
> locally. Or there is some other reason that I cannot access it over the
> network? Any ideas? I really need to get this up and running again soon.
> Thanks for any help.
> Ted
>
>|||That was exactly the problem. Thank you Hari. I ran the Setup program,
checked TCP/IP, and restarted SQL. It worked immediately.
You're a lifesaver!
Ted
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:%23Pe%23SG%23xGHA.4576@.TK2MSFTNGP06.phx.gbl...
> Did you enabled the TCP/IP protocol while installing the SQL Server 6.5?
> If not go to SQL 6.5 Setup program
> and check if the TCP/IP is selected; else include that and try connecting.
> Its been a long time I have worked with
> SQL 6.5.
> Thanks
> Hari
> SQL Server MVP
>
> "Ted Hadley" <thadley@.cypresscoveresort.com> wrote in message
> news:3MWdnUKfzpi_r3PZnZ2dnUVZ_oCdnZ2d@.giganews.com...
>> Pardon my long windedness, but I want to provide a full explanation.
>> I have very limited (next to none) knowledge of SQL Server or NT / 2000
>> Server.
>> We had a membership database stored on an SQL Server 6.5 on an NT system.
>> We accessed it via a custom written Visual Basic program called Member.
>> The computer crashed, not the drive. Apparently, it was an old single
>> processor PC. I tried to move the drive into a newer computer and got a
>> HAL.DLL error. I was able to recover the DAT files using the drive as a
>> second dive on a newer PC.
>> I put the drive in a newer computer and upgraded it to Windows 2000.
>> Then I reinstalled SQL Server 6.5. I created the matching database and
>> database devices. I then copied the old DAT files over and it worked. I
>> was able to access the old database files. Hooray!
>> I reinstalled the Member program, and sure enough the connection strings
>> work and I can access my data again. Another Hooray!
>> Now my only problem is that I cannot connect to the database from any of
>> the network computers, only locally. I have read many pages on the
>> internet and experimented quite a bit, but I still get an ODBC timeout
>> failure every time I try to connect from one of the other computers on
>> the network.
>> It appears that my SQL is running and sharing the information, but only
>> locally. Or there is some other reason that I cannot access it over the
>> network? Any ideas? I really need to get this up and running again
>> soon.
>> Thanks for any help.
>> Ted
>|||Thats a good news..
Thanks
Hari
SQL Server MVP
"Ted Hadley" <thadley@.cypresscoveresort.com> wrote in message
news:6a-dnUP6fbGi53LZnZ2dnUVZ_sydnZ2d@.giganews.com...
> That was exactly the problem. Thank you Hari. I ran the Setup program,
> checked TCP/IP, and restarted SQL. It worked immediately.
> You're a lifesaver!
> Ted
> "Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
> news:%23Pe%23SG%23xGHA.4576@.TK2MSFTNGP06.phx.gbl...
>> Did you enabled the TCP/IP protocol while installing the SQL Server 6.5?
>> If not go to SQL 6.5 Setup program
>> and check if the TCP/IP is selected; else include that and try
>> connecting. Its been a long time I have worked with
>> SQL 6.5.
>> Thanks
>> Hari
>> SQL Server MVP
>>
>> "Ted Hadley" <thadley@.cypresscoveresort.com> wrote in message
>> news:3MWdnUKfzpi_r3PZnZ2dnUVZ_oCdnZ2d@.giganews.com...
>> Pardon my long windedness, but I want to provide a full explanation.
>> I have very limited (next to none) knowledge of SQL Server or NT / 2000
>> Server.
>> We had a membership database stored on an SQL Server 6.5 on an NT
>> system. We accessed it via a custom written Visual Basic program called
>> Member. The computer crashed, not the drive. Apparently, it was an old
>> single processor PC. I tried to move the drive into a newer computer
>> and got a HAL.DLL error. I was able to recover the DAT files using the
>> drive as a second dive on a newer PC.
>> I put the drive in a newer computer and upgraded it to Windows 2000.
>> Then I reinstalled SQL Server 6.5. I created the matching database and
>> database devices. I then copied the old DAT files over and it worked.
>> I was able to access the old database files. Hooray!
>> I reinstalled the Member program, and sure enough the connection strings
>> work and I can access my data again. Another Hooray!
>> Now my only problem is that I cannot connect to the database from any of
>> the network computers, only locally. I have read many pages on the
>> internet and experimented quite a bit, but I still get an ODBC timeout
>> failure every time I try to connect from one of the other computers on
>> the network.
>> It appears that my SQL is running and sharing the information, but only
>> locally. Or there is some other reason that I cannot access it over the
>> network? Any ideas? I really need to get this up and running again
>> soon.
>> Thanks for any help.
>> Ted
>>
>

Wednesday, March 21, 2012

Restore SQL database

I'm attempting to restore a backup of a database as another database -
so I can access the data in the backup file and transfer some of it to
the existing (operational) database.
However, when doing this, I get the following error:
"Cannot open backup device 'x:\file path on server'. Device error or
device off-line. RESTORE DATABASE is terminating abnormally."
This is the second time this has happened, despite the fact that the
backup device is on-line.
Yet I was able to perform the same operation a couple of days ago! Any
ideas?
Is the path a local path or a remote path? Is there any chance that another process might be using
that file (AV software, or SQL Server itself currently writing or reading that backup file)?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"pinhead" <dlynes2005@.gmail.com> wrote in message
news:1144142488.550473.84590@.j33g2000cwa.googlegro ups.com...
> I'm attempting to restore a backup of a database as another database -
> so I can access the data in the backup file and transfer some of it to
> the existing (operational) database.
> However, when doing this, I get the following error:
> "Cannot open backup device 'x:\file path on server'. Device error or
> device off-line. RESTORE DATABASE is terminating abnormally."
> This is the second time this has happened, despite the fact that the
> backup device is on-line.
> Yet I was able to perform the same operation a couple of days ago! Any
> ideas?
>

Restore SQL database

I'm attempting to restore a backup of a database as another database -
so I can access the data in the backup file and transfer some of it to
the existing (operational) database.
However, when doing this, I get the following error:
"Cannot open backup device 'x:\file path on server'. Device error or
device off-line. RESTORE DATABASE is terminating abnormally."
This is the second time this has happened, despite the fact that the
backup device is on-line.
Yet I was able to perform the same operation a couple of days ago! Any
ideas?Is the path a local path or a remote path? Is there any chance that another
process might be using
that file (AV software, or SQL Server itself currently writing or reading th
at backup file)?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"pinhead" <dlynes2005@.gmail.com> wrote in message
news:1144142488.550473.84590@.j33g2000cwa.googlegroups.com...
> I'm attempting to restore a backup of a database as another database -
> so I can access the data in the backup file and transfer some of it to
> the existing (operational) database.
> However, when doing this, I get the following error:
> "Cannot open backup device 'x:\file path on server'. Device error or
> device off-line. RESTORE DATABASE is terminating abnormally."
> This is the second time this has happened, despite the fact that the
> backup device is on-line.
> Yet I was able to perform the same operation a couple of days ago! Any
> ideas?
>

Restore SQL database

I'm attempting to restore a backup of a database as another database -
so I can access the data in the backup file and transfer some of it to
the existing (operational) database.
However, when doing this, I get the following error:
"Cannot open backup device 'x:\file path on server'. Device error or
device off-line. RESTORE DATABASE is terminating abnormally."
This is the second time this has happened, despite the fact that the
backup device is on-line.
Yet I was able to perform the same operation a couple of days ago! Any
ideas?Is the path a local path or a remote path? Is there any chance that another process might be using
that file (AV software, or SQL Server itself currently writing or reading that backup file)?
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"pinhead" <dlynes2005@.gmail.com> wrote in message
news:1144142488.550473.84590@.j33g2000cwa.googlegroups.com...
> I'm attempting to restore a backup of a database as another database -
> so I can access the data in the backup file and transfer some of it to
> the existing (operational) database.
> However, when doing this, I get the following error:
> "Cannot open backup device 'x:\file path on server'. Device error or
> device off-line. RESTORE DATABASE is terminating abnormally."
> This is the second time this has happened, despite the fact that the
> backup device is on-line.
> Yet I was able to perform the same operation a couple of days ago! Any
> ideas?
>

Tuesday, March 20, 2012

Restore ReportServer

I keep getting this message when i try and restore the ReportServer "system.data.sqlclient.sqlerror: Exclusive access could not be obtained because the database in in use"

All the other databases restored successfully.

Any ideas?
just check if you are accidentally using the db in the management studio.....proceed as follows,
use master
go
then perform the restoration as usual....cool
fyi
http://technet.microsoft.com/en-us/library/ms156421.aspx

restore replicated databases

I can't restore trans replicated databases because I get message that they
are in use - do I need to stop agents to get exclusive access - then restore
- then restart agents?
Thanks
yes, stop Sql Server agent, run sp_who2 to identify and kill spids that are
continuing to use the db and then retry your restore.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"DrBob" <DrBob@.discussions.microsoft.com> wrote in message
news:F2DC7A4C-D2DB-493B-BBDB-6BBBF95306CE@.microsoft.com...
> I can't restore trans replicated databases because I get message that they
> are in use - do I need to stop agents to get exclusive access - then
restore
> - then restart agents?
> Thanks
|||Thanks
"Hilary Cotter" wrote:

> yes, stop Sql Server agent, run sp_who2 to identify and kill spids that are
> continuing to use the db and then retry your restore.
> --
> Hilary Cotter
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
> "DrBob" <DrBob@.discussions.microsoft.com> wrote in message
> news:F2DC7A4C-D2DB-493B-BBDB-6BBBF95306CE@.microsoft.com...
> restore
>
>

Monday, March 12, 2012

restore problem

hi
I have a problem with restore db (can not obtain exclusice access to db)
the question is:
how to obtain exclusive access to database using jdbc driver ?
how to log off all users and prerform restore ?
thanks for help
Artur
| From: "Monika" <monika@.o2.pl>
| Newsgroups: microsoft.public.sqlserver.jdbcdriver
| Subject: restore problem
| Date: Fri, 22 Oct 2004 09:57:42 +0200
| Organization: tp.internet - http://www.tpi.pl/
| Lines: 12
| Message-ID: <claeo7$80f$1@.nemesis.news.tpi.pl>
| NNTP-Posting-Host: acn10.neoplus.adsl.tpnet.pl
| X-Trace: nemesis.news.tpi.pl 1098432071 8207 83.25.65.10 (22 Oct 2004
08:01:11 GMT)
| X-Complaints-To: usenet@.tpi.pl
| NNTP-Posting-Date: Fri, 22 Oct 2004 08:01:11 +0000 (UTC)
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
| Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFT NGP08.phx.gbl!newsfeed00.s
ul.t-online.de!t-online.de!news.zanker.org!nntp.idg.pl!newsfeed.gaz eta.pl!ne
ws.nask.pl!newsfeed.tpinternet.pl!atlantis.news.tp i.pl!news.tpi.pl!not-for-m
ail
| Xref: cpmsftngxa10.phx.gbl microsoft.public.sqlserver.jdbcdriver:6416
| X-Tomcat-NG: microsoft.public.sqlserver.jdbcdriver
|
| hi
|
| I have a problem with restore db (can not obtain exclusice access to db)
| the question is:
| how to obtain exclusive access to database using jdbc driver ?
| how to log off all users and prerform restore ?
|
| thanks for help
|
| Artur
|
|
|
Hello Artur,
I'm not clear on what your end goal is. Are you asking how to restore a
database, or are you asking how to restrict database access to a single
user?
In SQL Server, you can issue an ALTER DATABASE command to set the
SINGLE_USER state option for a given database. This effectively allows
only one user to access the database at a time. This is a Transact-SQL
command, and it is not specific to JDBC. The syntax for this operation
would be:
ALTER DATABASE pubs SET SINGLE_USER WITH ROLLBACK IMMEDIATE
So, you could connect to your database using JDBC code and execute the
statement above. This will rollback any pending transactions and then
close all other connections to the same database.
===========
If you are trying to restore a database, then you should use the RESTORE
DATABASE Transact-SQL command:
USE master
GO
RESTORE DATABASE pubs FROM DISK='c:\pubs.bak' WITH REPLACE
You cannot be using the database that you intend to restore. This is why
the command above changes the context to Master first. If you are finding
yourself contending with access to the database for the restore operation,
you may consider taking the database offline first and then restoring a new
copy.
I recommend consulting the SQL Server 2000 Books Online for further
information.
Carb Simien, MCSE MCDBA MCAD
Microsoft Developer Support - Web Data
Please reply only to the newsgroups.
This posting is provided "AS IS" with no warranties, and confers no rights.
Are you secure? For information about the Strategic Technology Protection
Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.com/security.
|||Hello
my goal is to write a code (java), which will restore a database from file
I've tried to do it by executing sql statement
conn.createStatement().executeUpdate("RESTORE DATABASE pubs FROM
DISK='c:\pubs.bak' WITH REPLACE")
but I've got the following exception:
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for
JDBC][SQLServer]Exclusive access could not be obtained because the database
is in use.
my question is: how to restore a database from java (assuming that some
clients may be connected to database from another pc's) ?
(my first idea was to force exclusive access - but how to do it ?)
thanks again
Artur
Uytkownik ""Carb Simien [MSFT]"" <CarbinoS@.online.microsoft.com> napisa w
wiadomoci news:ZKRQvy4uEHA.3436@.cpmsftngxa10.phx.gbl...
> --
> | From: "Monika" <monika@.o2.pl>
> | Newsgroups: microsoft.public.sqlserver.jdbcdriver
> | Subject: restore problem
> | Date: Fri, 22 Oct 2004 09:57:42 +0200
> | Organization: tp.internet - http://www.tpi.pl/
> | Lines: 12
> | Message-ID: <claeo7$80f$1@.nemesis.news.tpi.pl>
> | NNTP-Posting-Host: acn10.neoplus.adsl.tpnet.pl
> | X-Trace: nemesis.news.tpi.pl 1098432071 8207 83.25.65.10 (22 Oct 2004
> 08:01:11 GMT)
> | X-Complaints-To: usenet@.tpi.pl
> | NNTP-Posting-Date: Fri, 22 Oct 2004 08:01:11 +0000 (UTC)
> | X-Priority: 3
> | X-MSMail-Priority: Normal
> | X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
> | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
> | Path:
>
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFT NGP08.phx.gbl!newsfeed00.s
>
ul.t-online.de!t-online.de!news.zanker.org!nntp.idg.pl!newsfeed.gaz eta.pl!ne
>
ws.nask.pl!newsfeed.tpinternet.pl!atlantis.news.tp i.pl!news.tpi.pl!not-for-m
> ail
> | Xref: cpmsftngxa10.phx.gbl microsoft.public.sqlserver.jdbcdriver:6416
> | X-Tomcat-NG: microsoft.public.sqlserver.jdbcdriver
> |
> | hi
> |
> | I have a problem with restore db (can not obtain exclusice access to db)
> | the question is:
> | how to obtain exclusive access to database using jdbc driver ?
> | how to log off all users and prerform restore ?
> |
> | thanks for help
> |
> | Artur
> |
> |
> |
> Hello Artur,
> I'm not clear on what your end goal is. Are you asking how to restore a
> database, or are you asking how to restrict database access to a single
> user?
> In SQL Server, you can issue an ALTER DATABASE command to set the
> SINGLE_USER state option for a given database. This effectively allows
> only one user to access the database at a time. This is a Transact-SQL
> command, and it is not specific to JDBC. The syntax for this operation
> would be:
> ALTER DATABASE pubs SET SINGLE_USER WITH ROLLBACK IMMEDIATE
> So, you could connect to your database using JDBC code and execute the
> statement above. This will rollback any pending transactions and then
> close all other connections to the same database.
> ===========
> If you are trying to restore a database, then you should use the RESTORE
> DATABASE Transact-SQL command:
> USE master
> GO
> RESTORE DATABASE pubs FROM DISK='c:\pubs.bak' WITH REPLACE
> You cannot be using the database that you intend to restore. This is why
> the command above changes the context to Master first. If you are finding
> yourself contending with access to the database for the restore operation,
> you may consider taking the database offline first and then restoring a
new
> copy.
> I recommend consulting the SQL Server 2000 Books Online for further
> information.
> Carb Simien, MCSE MCDBA MCAD
> Microsoft Developer Support - Web Data
> Please reply only to the newsgroups.
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> Are you secure? For information about the Strategic Technology Protection
> Program and to order your FREE Security Tool Kit, please visit
> http://www.microsoft.com/security.
>
|||| From: "Artur" <monika@.o2.pl>
| Newsgroups: microsoft.public.sqlserver.jdbcdriver
| Subject: Re: restore problem
| Date: Wed, 3 Nov 2004 22:18:59 +0100
| Organization: tp.internet - http://www.tpi.pl/
| Lines: 116
| Message-ID: <cmbi6u$nm2$1@.nemesis.news.tpi.pl>
| References: <claeo7$80f$1@.nemesis.news.tpi.pl>
<ZKRQvy4uEHA.3436@.cpmsftngxa10.phx.gbl>
| NNTP-Posting-Host: acs36.neoplus.adsl.tpnet.pl
| X-Trace: nemesis.news.tpi.pl 1099516958 24258 83.25.70.36 (3 Nov 2004
21:22:38 GMT)
| X-Complaints-To: usenet@.tpi.pl
| NNTP-Posting-Date: Wed, 3 Nov 2004 21:22:38 +0000 (UTC)
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
| Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFT NGP08.phx.gbl!newsfeed00.s
ul.t-online.de!t-online.de!news.zanker.org!nntp.idg.pl!newsfeed.gaz eta.pl!ne
ws.nask.pl!newsfeed.tpinternet.pl!atlantis.news.tp i.pl!news.tpi.pl!not-for-m
ail
| Xref: cpmsftngxa10.phx.gbl microsoft.public.sqlserver.jdbcdriver:6443
| X-Tomcat-NG: microsoft.public.sqlserver.jdbcdriver
|
| Hello
|
| my goal is to write a code (java), which will restore a database from file
| I've tried to do it by executing sql statement
| conn.createStatement().executeUpdate("RESTORE DATABASE pubs FROM
| DISK='c:\pubs.bak' WITH REPLACE")
| but I've got the following exception:
| java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for
| JDBC][SQLServer]Exclusive access could not be obtained because the
database
| is in use.
|
| my question is: how to restore a database from java (assuming that some
| clients may be connected to database from another pc's) ?
|
| (my first idea was to force exclusive access - but how to do it ?)
|
| thanks again
|
| Artur
|
|
| Uytkownik ""Carb Simien [MSFT]"" <CarbinoS@.online.microsoft.com> napisa
w
| wiadomoci news:ZKRQvy4uEHA.3436@.cpmsftngxa10.phx.gbl...
| >
| > --
| > | From: "Monika" <monika@.o2.pl>
| > | Newsgroups: microsoft.public.sqlserver.jdbcdriver
| > | Subject: restore problem
| > | Date: Fri, 22 Oct 2004 09:57:42 +0200
| > | Organization: tp.internet - http://www.tpi.pl/
| > | Lines: 12
| > | Message-ID: <claeo7$80f$1@.nemesis.news.tpi.pl>
| > | NNTP-Posting-Host: acn10.neoplus.adsl.tpnet.pl
| > | X-Trace: nemesis.news.tpi.pl 1098432071 8207 83.25.65.10 (22 Oct 2004
| > 08:01:11 GMT)
| > | X-Complaints-To: usenet@.tpi.pl
| > | NNTP-Posting-Date: Fri, 22 Oct 2004 08:01:11 +0000 (UTC)
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
| > | Path:
| >
|
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFT NGP08.phx.gbl!newsfeed00.s
| >
|
ul.t-online.de!t-online.de!news.zanker.org!nntp.idg.pl!newsfeed.gaz eta.pl!ne
| >
|
ws.nask.pl!newsfeed.tpinternet.pl!atlantis.news.tp i.pl!news.tpi.pl!not-for-m
| > ail
| > | Xref: cpmsftngxa10.phx.gbl microsoft.public.sqlserver.jdbcdriver:6416
| > | X-Tomcat-NG: microsoft.public.sqlserver.jdbcdriver
| > |
| > | hi
| > |
| > | I have a problem with restore db (can not obtain exclusice access to
db)
| > | the question is:
| > | how to obtain exclusive access to database using jdbc driver ?
| > | how to log off all users and prerform restore ?
| > |
| > | thanks for help
| > |
| > | Artur
| > |
| > |
| > |
| >
| > Hello Artur,
| >
| > I'm not clear on what your end goal is. Are you asking how to restore a
| > database, or are you asking how to restrict database access to a single
| > user?
| >
| > In SQL Server, you can issue an ALTER DATABASE command to set the
| > SINGLE_USER state option for a given database. This effectively allows
| > only one user to access the database at a time. This is a Transact-SQL
| > command, and it is not specific to JDBC. The syntax for this operation
| > would be:
| >
| > ALTER DATABASE pubs SET SINGLE_USER WITH ROLLBACK IMMEDIATE
| >
| > So, you could connect to your database using JDBC code and execute the
| > statement above. This will rollback any pending transactions and then
| > close all other connections to the same database.
| >
| > ===========
| >
| > If you are trying to restore a database, then you should use the RESTORE
| > DATABASE Transact-SQL command:
| >
| > USE master
| > GO
| > RESTORE DATABASE pubs FROM DISK='c:\pubs.bak' WITH REPLACE
| >
| > You cannot be using the database that you intend to restore. This is
why
| > the command above changes the context to Master first. If you are
finding
| > yourself contending with access to the database for the restore
operation,
| > you may consider taking the database offline first and then restoring a
| new
| > copy.
| >
| > I recommend consulting the SQL Server 2000 Books Online for further
| > information.
| >
| > Carb Simien, MCSE MCDBA MCAD
| > Microsoft Developer Support - Web Data
| >
| > Please reply only to the newsgroups.
| > This posting is provided "AS IS" with no warranties, and confers no
| rights.
| >
| > Are you secure? For information about the Strategic Technology
Protection
| > Program and to order your FREE Security Tool Kit, please visit
| > http://www.microsoft.com/security.
| >
|
|
|
Hello,
Thanks for the clarification. As I stated before, you can take the
database offline and forcibly kick other users out of the database. Any
pending transactions will be rolled back to maintain proper consistency.
Once this is done, you can restore the database as suggested. Below are
the queries you can run from your code to accomplish this task:
ALTER DATABASE pubs SET offline WITH rollback immediate
RESTORE DATABASE pubs FROM DISK='c:\pubsbak.bak' WITH REPLACE
These are all SQL Server concepts, so they are not specific to Java or
JDBC. Please consult the SQL Server 2000 Books Online for further
information.
Carb Simien, MCSE MCDBA MCAD
Microsoft Developer Support - Web Data
Please reply only to the newsgroups.
This posting is provided "AS IS" with no warranties, and confers no rights.
Are you secure? For information about the Strategic Technology Protection
Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.com/security.