I have a problem with restoring, so I am doing several test in order to
properly to backup my database. So I have first of all, restore all
data(from database 1) into a new database (database 2) and and it is
works fine (no problem and no error). Now I would like to restore my
really database but I have an error...
Error database in use. Exclusive access could not be obtained because
the database is in use. Restore database is termanatting abnornally
The others issue is that someone is connecto tosqlserver using but to
another database. (this person is connecting since this morning; and
during the first restore I had no problem database 1 --> database 2)
I do not understand please could someone help me on that?
InaHi
You can not restore when someone is accessing the database, check on the
activity screens in Enterprise Manager (Management/Current Activity/Process
Info) for people connected to the database or you can use sp_who2 to see who
is using the database
e.g
USE MASTER
EXEC sp_who2
To kill a process connected to the database in Enterprise Manager right
click on the process and choose the Kill Process option or use the KILL
command in T-SQL specifying the SPID to kill e.g. KILL 53
HTH
John
"ina" wrote:
> Hello,
> I have a problem with restoring, so I am doing several test in order to
> properly to backup my database. So I have first of all, restore all
> data(from database 1) into a new database (database 2) and and it is
> works fine (no problem and no error). Now I would like to restore my
> really database but I have an error...
>
> Error database in use. Exclusive access could not be obtained because
> the database is in use. Restore database is termanatting abnornally
> The others issue is that someone is connecto tosqlserver using but to
> another database. (this person is connecting since this morning; and
> during the first restore I had no problem database 1 --> database 2)
> I do not understand please could someone help me on that?
> Ina
>|||thanks john but access the database means connect to the software that
use this database or sql server , I am newbie on that. because nobody
is connect to the software

I have a program that are in two version, demo version and true version
the TEST_PROD is the database of the DEMO version
TEST the database of the TRUE version
This is my current activies ( few lines); tester is the user for both
database
54 sleeping tester server TEST_PROD AWAITING COMMAND 0 0 01/01/2006
00:0054 ?
55 sleeping tester server TEST AWAITING COMMAND 01 0 01/05/2019 15:38
55 people working in test database
56 sleeping tester server TEST AWAITING COMMAND 0 001/01/2006 00:00 56
57sleeping tester serverTEST_PRODAWAITING COMMAND 0 0 01/01/2006 00:00
57 ?
58 sleeping tester server TEST_PRODAWAITING COMMAND 0 001/01/2006
00:00 58
59sleeping tester server TEST AWAITING COMMAND 0 001/01/2006 00:00 59
Can I kill process or do I need to do something else?
Ina|||Hi Ina
It is better to get you users to log off the application rather than kill
the processes. Books online states
Use KILL very carefully, especially when critical processes are running. You
cannot kill your own process. Other processes not to kill are:
AWAITING COMMAND
CHECKPOINT SLEEP
LAZY WRITER
LOCK MONITOR
SELECT
SIGNAL HANDLER
It seems several processes are connected to both the TEST_PROD and TEST
databases, Processes 54, 57 and 58 on TEST_PROD. You could use DBCC
INPUTBUFFER to see information about the last command executed for each of
these SPIDs.
Another way to KILL off connections would be to set the database into single
user mode after setting it to be the current database.
John
"ina" wrote:
> I have this process
> I have a program that are in two version, demo version and true version
> the TEST_PROD is the database of the DEMO version
> TEST the database of the TRUE version
> This is my current activies ( few lines); tester is the user for both
> database
>
> 54 sleeping tester server TEST_PROD AWAITING COMMAND 0 0 01/01/2006
> 00:0054 ?
> 55 sleeping tester server TEST AWAITING COMMAND 01 0 01/05/2019 15:38
> 55 people working in test database
> 56 sleeping tester server TEST AWAITING COMMAND 0 001/01/2006 00:00 56
> 57sleeping tester serverTEST_PRODAWAITING COMMAND 0 0 01/01/2006 00:00
> 57 ?
> 58 sleeping tester server TEST_PRODAWAITING COMMAND 0 001/01/2006
> 00:00 58
> 59sleeping tester server TEST AWAITING COMMAND 0 001/01/2006 00:00 59
> Can I kill process or do I need to do something else?
> Ina
>|||Thanks John, the trick is that nobody is using the softwares. So I do
not know why it is like this?
Ina|||Hi Ina
Use DBCC INPUTBUFFER with the SPID from sp_who2 to see what commands last
command was executed on that connection. This may help you find out what has
caused this.
John
"ina" wrote:
> Thanks John, the trick is that nobody is using the softwares. So I do
> not know why it is like this?
> Ina
>|||Thanks John

