Showing posts with label sp_detach_db. Show all posts
Showing posts with label sp_detach_db. Show all posts

Monday, March 26, 2012

moving a database

Using SS2000 SP3. I'm trying to move a database using:
EXEC sp_detach_db 'vesta_archive', 'false'
but I get a "cannot detach the database 'vesta_archive' because it is
currently in use."
There is no one here and no dts packages running. Is there any way to tell
who might be using the database or is there maybe another reason for this
message?
Thanks,
--
Dan D.Try sp_who, and then look at column loginame, and dbname column.
----
----
--
Need SQL Server Examples check out my website at
http://www.geocities.com/sqlserverexamples
"Dan D." <DanD@.discussions.microsoft.com> wrote in message
news:7D0CBB5C-EC60-447E-A465-DDC14FD436FC@.microsoft.com...
> Using SS2000 SP3. I'm trying to move a database using:
> EXEC sp_detach_db 'vesta_archive', 'false'
> but I get a "cannot detach the database 'vesta_archive' because it is
> currently in use."
> There is no one here and no dts packages running. Is there any way to tell
> who might be using the database or is there maybe another reason for this
> message?
> Thanks,
> --
> Dan D.|||Dan,
When I get such a message it is often me.
Do you have Enterprise manager open to that database? Another Query
Analyzer panel that is in that database? Etc?
Russell Fields
"Dan D." <DanD@.discussions.microsoft.com> wrote in message
news:7D0CBB5C-EC60-447E-A465-DDC14FD436FC@.microsoft.com...
> Using SS2000 SP3. I'm trying to move a database using:
> EXEC sp_detach_db 'vesta_archive', 'false'
> but I get a "cannot detach the database 'vesta_archive' because it is
> currently in use."
> There is no one here and no dts packages running. Is there any way to tell
> who might be using the database or is there maybe another reason for this
> message?
> Thanks,
> --
> Dan D.|||Thanks. I found the culprit.
"Gregory A. Larsen" wrote:

> Try sp_who, and then look at column loginame, and dbname column.
> --
> ----
--
> ----
--
> --
> Need SQL Server Examples check out my website at
> http://www.geocities.com/sqlserverexamples
> "Dan D." <DanD@.discussions.microsoft.com> wrote in message
> news:7D0CBB5C-EC60-447E-A465-DDC14FD436FC@.microsoft.com...
>
>|||Thanks. I found the person.
"Russell Fields" wrote:

> Dan,
> When I get such a message it is often me.
> Do you have Enterprise manager open to that database? Another Query
> Analyzer panel that is in that database? Etc?
> Russell Fields
> "Dan D." <DanD@.discussions.microsoft.com> wrote in message
> news:7D0CBB5C-EC60-447E-A465-DDC14FD436FC@.microsoft.com...
>
>|||Russell, I agree. It's often the DBA. Sometimes even if you switch the
highlight to a non database object in Enterprise Manager, sp_who2 still
shows you are connected. In this case, I have to disconnect ...
"Russell Fields" <RussellFields@.NoMailPlease.Com> wrote in message
news:%23s7UjDfhEHA.1184@.TK2MSFTNGP12.phx.gbl...
> Dan,
> When I get such a message it is often me.
> Do you have Enterprise manager open to that database? Another Query
> Analyzer panel that is in that database? Etc?
> Russell Fields
> "Dan D." <DanD@.discussions.microsoft.com> wrote in message
> news:7D0CBB5C-EC60-447E-A465-DDC14FD436FC@.microsoft.com...
tell[vbcol=seagreen]
this[vbcol=seagreen]
>|||More information needed than this.|||Arc Serve has a database containing the information of the datastore
including indexes references etc. This is needed if a restore is going t
o
be done. I would like this database that arcserve creates to be put into
an SQL database, instead of residing on my local drive.
"unc27932@.yahoo.com" wrote:

> More information needed than this.
>

moving a database

Using SS2000 SP3. I'm trying to move a database using:
EXEC sp_detach_db 'vesta_archive', 'false'
but I get a "cannot detach the database 'vesta_archive' because it is
currently in use."
There is no one here and no dts packages running. Is there any way to tell
who might be using the database or is there maybe another reason for this
message?
Thanks,
Dan D.
Try sp_who, and then look at column loginame, and dbname column.
----
Need SQL Server Examples check out my website at
http://www.geocities.com/sqlserverexamples
"Dan D." <DanD@.discussions.microsoft.com> wrote in message
news:7D0CBB5C-EC60-447E-A465-DDC14FD436FC@.microsoft.com...
> Using SS2000 SP3. I'm trying to move a database using:
> EXEC sp_detach_db 'vesta_archive', 'false'
> but I get a "cannot detach the database 'vesta_archive' because it is
> currently in use."
> There is no one here and no dts packages running. Is there any way to tell
> who might be using the database or is there maybe another reason for this
> message?
> Thanks,
> --
> Dan D.
|||Dan,
When I get such a message it is often me.
Do you have Enterprise manager open to that database? Another Query
Analyzer panel that is in that database? Etc?
Russell Fields
"Dan D." <DanD@.discussions.microsoft.com> wrote in message
news:7D0CBB5C-EC60-447E-A465-DDC14FD436FC@.microsoft.com...
> Using SS2000 SP3. I'm trying to move a database using:
> EXEC sp_detach_db 'vesta_archive', 'false'
> but I get a "cannot detach the database 'vesta_archive' because it is
> currently in use."
> There is no one here and no dts packages running. Is there any way to tell
> who might be using the database or is there maybe another reason for this
> message?
> Thanks,
> --
> Dan D.
|||Thanks. I found the culprit.
"Gregory A. Larsen" wrote:

> Try sp_who, and then look at column loginame, and dbname column.
> --
> ----
> ----
> --
> Need SQL Server Examples check out my website at
> http://www.geocities.com/sqlserverexamples
> "Dan D." <DanD@.discussions.microsoft.com> wrote in message
> news:7D0CBB5C-EC60-447E-A465-DDC14FD436FC@.microsoft.com...
>
>
|||Thanks. I found the person.
"Russell Fields" wrote:

> Dan,
> When I get such a message it is often me.
> Do you have Enterprise manager open to that database? Another Query
> Analyzer panel that is in that database? Etc?
> Russell Fields
> "Dan D." <DanD@.discussions.microsoft.com> wrote in message
> news:7D0CBB5C-EC60-447E-A465-DDC14FD436FC@.microsoft.com...
>
>
|||Russell, I agree. It's often the DBA. Sometimes even if you switch the
highlight to a non database object in Enterprise Manager, sp_who2 still
shows you are connected. In this case, I have to disconnect ...
"Russell Fields" <RussellFields@.NoMailPlease.Com> wrote in message
news:%23s7UjDfhEHA.1184@.TK2MSFTNGP12.phx.gbl...[vbcol=seagreen]
> Dan,
> When I get such a message it is often me.
> Do you have Enterprise manager open to that database? Another Query
> Analyzer panel that is in that database? Etc?
> Russell Fields
> "Dan D." <DanD@.discussions.microsoft.com> wrote in message
> news:7D0CBB5C-EC60-447E-A465-DDC14FD436FC@.microsoft.com...
tell[vbcol=seagreen]
this
>
|||More information needed than this.
|||Arc Serve has a database containing the information of the datastore
including indexes references etc. This is needed if a restore is going to
be done. I would like this database that arcserve creates to be put into
an SQL database, instead of residing on my local drive.
"unc27932@.yahoo.com" wrote:

> More information needed than this.
>

Saturday, February 25, 2012

Move database from 1 server to another

If we would like to move a database from Server A to
Server B, we should use sp_detach_db or make a backup copy
and restore on Server B ?
Is there any difference and advantage of these 2 methods ?
Moreover, if there are 60 logins & users are created in
that database (It is done by contractor), is it necessary
for us to create those Logins in Server B before
restoring / attaching the Database ?
Thanks
Detach or backup is fine. Detach (with update statistics) / Attach
is probably easier.
Doesn't really matter when you handle the users. You could
write a little script for that. If you use the Generate Script option on
the database and select the option to include users and permissions,
you can review the script and pull out just that section.
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.masterado.net/home/listings.aspx
"Jason" <anonymous@.discussions.microsoft.com> wrote in message
news:749e01c525d6$99190530$a401280a@.phx.gbl...
> If we would like to move a database from Server A to
> Server B, we should use sp_detach_db or make a backup copy
> and restore on Server B ?
> Is there any difference and advantage of these 2 methods ?
> Moreover, if there are 60 logins & users are created in
> that database (It is done by contractor), is it necessary
> for us to create those Logins in Server B before
> restoring / attaching the Database ?
> Thanks
|||Dear Robbe,
Thank you for your advice.
I have selected the database I have to transfer to another
Server, Generate Script, select all options AND get a SQL
script generated.
Should I run the script in target server before I attach
the database from Source Server ?
Thank you !

>--Original Message--
>Detach or backup is fine. Detach (with update
statistics) / Attach
>is probably easier.
>Doesn't really matter when you handle the users. You
could
>write a little script for that. If you use the Generate
Script option on
>the database and select the option to include users and
permissions,
>you can review the script and pull out just that section.
>--
>2005 Microsoft MVP C#
>Robbe Morris
>http://www.robbemorris.com
>http://www.masterado.net/home/listings.aspx
>
>"Jason" <anonymous@.discussions.microsoft.com> wrote in
message[vbcol=seagreen]
>news:749e01c525d6$99190530$a401280a@.phx.gbl...
copy[vbcol=seagreen]
methods ?[vbcol=seagreen]
necessary
>
>.
>
|||Pull the script up in Query analyzer and strip out everything but
the code that creates the users and grants permissions. Attach
your database and then run the modified script.
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.masterado.net/home/listings.aspx
"Jason" <anonymous@.discussions.microsoft.com> wrote in message
news:753701c525ee$0457e340$a401280a@.phx.gbl...[vbcol=seagreen]
> Dear Robbe,
> Thank you for your advice.
> I have selected the database I have to transfer to another
> Server, Generate Script, select all options AND get a SQL
> script generated.
> Should I run the script in target server before I attach
> the database from Source Server ?
> Thank you !
> statistics) / Attach
> could
> Script option on
> permissions,
> message
> copy
> methods ?
> necessary

Move database from 1 server to another

If we would like to move a database from Server A to
Server B, we should use sp_detach_db or make a backup copy
and restore on Server B ?
Is there any difference and advantage of these 2 methods ?
Moreover, if there are 60 logins & users are created in
that database (It is done by contractor), is it necessary
for us to create those Logins in Server B before
restoring / attaching the Database ?
ThanksDetach or backup is fine. Detach (with update statistics) / Attach
is probably easier.
Doesn't really matter when you handle the users. You could
write a little script for that. If you use the Generate Script option on
the database and select the option to include users and permissions,
you can review the script and pull out just that section.
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.masterado.net/home/listings.aspx
"Jason" <anonymous@.discussions.microsoft.com> wrote in message
news:749e01c525d6$99190530$a401280a@.phx.gbl...
> If we would like to move a database from Server A to
> Server B, we should use sp_detach_db or make a backup copy
> and restore on Server B ?
> Is there any difference and advantage of these 2 methods ?
> Moreover, if there are 60 logins & users are created in
> that database (It is done by contractor), is it necessary
> for us to create those Logins in Server B before
> restoring / attaching the Database ?
> Thanks|||Dear Robbe,
Thank you for your advice.
I have selected the database I have to transfer to another
Server, Generate Script, select all options AND get a SQL
script generated.
Should I run the script in target server before I attach
the database from Source Server ?
Thank you !

>--Original Message--
>Detach or backup is fine. Detach (with update
statistics) / Attach
>is probably easier.
>Doesn't really matter when you handle the users. You
could
>write a little script for that. If you use the Generate
Script option on
>the database and select the option to include users and
permissions,
>you can review the script and pull out just that section.
>--
>2005 Microsoft MVP C#
>Robbe Morris
>http://www.robbemorris.com
>http://www.masterado.net/home/listings.aspx
>
>"Jason" <anonymous@.discussions.microsoft.com> wrote in
message
>news:749e01c525d6$99190530$a401280a@.phx.gbl...
copy[vbcol=seagreen]
methods ?[vbcol=seagreen]
necessary[vbcol=seagreen]
>
>.
>|||Pull the script up in Query analyzer and strip out everything but
the code that creates the users and grants permissions. Attach
your database and then run the modified script.
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.masterado.net/home/listings.aspx
"Jason" <anonymous@.discussions.microsoft.com> wrote in message
news:753701c525ee$0457e340$a401280a@.phx.gbl...[vbcol=seagreen]
> Dear Robbe,
> Thank you for your advice.
> I have selected the database I have to transfer to another
> Server, Generate Script, select all options AND get a SQL
> script generated.
> Should I run the script in target server before I attach
> the database from Source Server ?
> Thank you !
>
> statistics) / Attach
> could
> Script option on
> permissions,
> message
> copy
> methods ?
> necessary

Move database from 1 server to another

If we would like to move a database from Server A to
Server B, we should use sp_detach_db or make a backup copy
and restore on Server B ?
Is there any difference and advantage of these 2 methods ?
Moreover, if there are 60 logins & users are created in
that database (It is done by contractor), is it necessary
for us to create those Logins in Server B before
restoring / attaching the Database ?
ThanksDetach or backup is fine. Detach (with update statistics) / Attach
is probably easier.
Doesn't really matter when you handle the users. You could
write a little script for that. If you use the Generate Script option on
the database and select the option to include users and permissions,
you can review the script and pull out just that section.
--
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.masterado.net/home/listings.aspx
"Jason" <anonymous@.discussions.microsoft.com> wrote in message
news:749e01c525d6$99190530$a401280a@.phx.gbl...
> If we would like to move a database from Server A to
> Server B, we should use sp_detach_db or make a backup copy
> and restore on Server B ?
> Is there any difference and advantage of these 2 methods ?
> Moreover, if there are 60 logins & users are created in
> that database (It is done by contractor), is it necessary
> for us to create those Logins in Server B before
> restoring / attaching the Database ?
> Thanks|||Dear Robbe,
Thank you for your advice.
I have selected the database I have to transfer to another
Server, Generate Script, select all options AND get a SQL
script generated.
Should I run the script in target server before I attach
the database from Source Server ?
Thank you !
>--Original Message--
>Detach or backup is fine. Detach (with update
statistics) / Attach
>is probably easier.
>Doesn't really matter when you handle the users. You
could
>write a little script for that. If you use the Generate
Script option on
>the database and select the option to include users and
permissions,
>you can review the script and pull out just that section.
>--
>2005 Microsoft MVP C#
>Robbe Morris
>http://www.robbemorris.com
>http://www.masterado.net/home/listings.aspx
>
>"Jason" <anonymous@.discussions.microsoft.com> wrote in
message
>news:749e01c525d6$99190530$a401280a@.phx.gbl...
>> If we would like to move a database from Server A to
>> Server B, we should use sp_detach_db or make a backup
copy
>> and restore on Server B ?
>> Is there any difference and advantage of these 2
methods ?
>> Moreover, if there are 60 logins & users are created in
>> that database (It is done by contractor), is it
necessary
>> for us to create those Logins in Server B before
>> restoring / attaching the Database ?
>> Thanks
>
>.
>|||Pull the script up in Query analyzer and strip out everything but
the code that creates the users and grants permissions. Attach
your database and then run the modified script.
--
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.masterado.net/home/listings.aspx
"Jason" <anonymous@.discussions.microsoft.com> wrote in message
news:753701c525ee$0457e340$a401280a@.phx.gbl...
> Dear Robbe,
> Thank you for your advice.
> I have selected the database I have to transfer to another
> Server, Generate Script, select all options AND get a SQL
> script generated.
> Should I run the script in target server before I attach
> the database from Source Server ?
> Thank you !
>>--Original Message--
>>Detach or backup is fine. Detach (with update
> statistics) / Attach
>>is probably easier.
>>Doesn't really matter when you handle the users. You
> could
>>write a little script for that. If you use the Generate
> Script option on
>>the database and select the option to include users and
> permissions,
>>you can review the script and pull out just that section.
>>--
>>2005 Microsoft MVP C#
>>Robbe Morris
>>http://www.robbemorris.com
>>http://www.masterado.net/home/listings.aspx
>>
>>"Jason" <anonymous@.discussions.microsoft.com> wrote in
> message
>>news:749e01c525d6$99190530$a401280a@.phx.gbl...
>> If we would like to move a database from Server A to
>> Server B, we should use sp_detach_db or make a backup
> copy
>> and restore on Server B ?
>> Is there any difference and advantage of these 2
> methods ?
>> Moreover, if there are 60 logins & users are created in
>> that database (It is done by contractor), is it
> necessary
>> for us to create those Logins in Server B before
>> restoring / attaching the Database ?
>> Thanks
>>
>>.