Showing posts with label backups. Show all posts
Showing posts with label backups. Show all posts

Friday, March 30, 2012

restore db from network drive

All of our database servers are doing backups and saving the .bak files out
on a network share. With SQL 2005, how can I point to that share and restore
the database in SQL 2005 environment?
When I do 'restore database --> From Device --> File; when I click the 'ADD;
button, I only see my local drives on the computer. How can I map to my
network share and point to my restore file on the network?Use UNC names: \\servername\sharename\foldername\file.ext. The
account doing the backups - which is to say the account under which
SQL Server is running - needs appropriate rights to the share.
Roy Harvey
Beacon Falls, CT
On Tue, 5 Jun 2007 12:20:10 -0400, "Mike" <Mike@.community.nospam>
wrote:

>All of our database servers are doing backups and saving the .bak files out
>on a network share. With SQL 2005, how can I point to that share and restor
e
>the database in SQL 2005 environment?
>When I do 'restore database --> From Device --> File; when I click the 'ADD
;
>button, I only see my local drives on the computer. How can I map to my
>network share and point to my restore file on the network?
>|||I've tried the UNC path and I get 'network path not found' message
Beacon falls, ct, your in my nekc of the woods.
"Roy Harvey" <roy_harvey@.snet.net> wrote in message
news:km4b63p0q6hco968a82ngn955tgse4eg47@.
4ax.com...[vbcol=seagreen]
> Use UNC names: \\servername\sharename\foldername\file.ext. The
> account doing the backups - which is to say the account under which
> SQL Server is running - needs appropriate rights to the share.
> Roy Harvey
> Beacon Falls, CT
> On Tue, 5 Jun 2007 12:20:10 -0400, "Mike" <Mike@.community.nospam>
> wrote:
>|||Hello,
In the management studio; go to query window and use RESTORE DATABASE
command. Make sure that you start sql server service using
a domain account which has access to remote share.
RESTORE DATABASE <DBNAME> FROM DISK='\\Servername\Share\filename.bak' with
stats=5
Thanks
Hari
"Mike" <Mike@.community.nospam> wrote in message
news:%23xEIwJ5pHHA.1244@.TK2MSFTNGP04.phx.gbl...
> I've tried the UNC path and I get 'network path not found' message
> Beacon falls, ct, your in my nekc of the woods.
>
> "Roy Harvey" <roy_harvey@.snet.net> wrote in message
> news:km4b63p0q6hco968a82ngn955tgse4eg47@.
4ax.com...
>|||On Tue, 5 Jun 2007 12:56:18 -0400, "Mike" <Mike@.community.nospam>
wrote:

>I've tried the UNC path and I get 'network path not found' message
Perhaps it is an access rights problem. A partial test can be done
using xp_cmdshell:
EXEC master..xp_cmdshell 'dir \\servername\sharename\folder\*.*'

>Beacon falls, ct, your in my nekc of the woods.
Cool! If you ever need more hands-on help remember I'm around!
Hari's advice to use a query window is excellent, by the way.
Roy Harvey
Beacon Falls, CT|||Ok, I think I got it, but now I'm getting this message:
'the media set has 2 media families but only 1 are provided. All members
must be provided.'
"Roy Harvey" <roy_harvey@.snet.net> wrote in message
news:89eb631lpobifjd281tdpma4q57sct745h@.
4ax.com...
> On Tue, 5 Jun 2007 12:56:18 -0400, "Mike" <Mike@.community.nospam>
> wrote:
>
> Perhaps it is an access rights problem. A partial test can be done
> using xp_cmdshell:
> EXEC master..xp_cmdshell 'dir \\servername\sharename\folder\*.*'
>
> Cool! If you ever need more hands-on help remember I'm around!
> Hari's advice to use a query window is excellent, by the way.
> Roy Harvey
> Beacon Falls, CT|||Hello,
Did you strip the backup into multiple files? Can you execute RESTORE
LABELONLY (see books online) and see how many files are associated with the
backup.
Thanks
Hari
"Mike" <Mike@.community.nospam> wrote in message
news:u8sG$y6pHHA.2156@.TK2MSFTNGP03.phx.gbl...
> Ok, I think I got it, but now I'm getting this message:
> 'the media set has 2 media families but only 1 are provided. All members
> must be provided.'
>
> "Roy Harvey" <roy_harvey@.snet.net> wrote in message
> news:89eb631lpobifjd281tdpma4q57sct745h@.
4ax.com...
>|||No, one file. and now I can't even backup the SQL 2000 database version to
do a restore from.
This is driving me nuts.
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:%23Ov2b29pHHA.3264@.TK2MSFTNGP04.phx.gbl...
> Hello,
> Did you strip the backup into multiple files? Can you execute RESTORE
> LABELONLY (see books online) and see how many files are associated with
> the backup.
> Thanks
> Hari
> "Mike" <Mike@.community.nospam> wrote in message
> news:u8sG$y6pHHA.2156@.TK2MSFTNGP03.phx.gbl...
>sql

restore db from network drive

All of our database servers are doing backups and saving the .bak files out
on a network share. With SQL 2005, how can I point to that share and restore
the database in SQL 2005 environment?
When I do 'restore database --> From Device --> File; when I click the 'ADD;
button, I only see my local drives on the computer. How can I map to my
network share and point to my restore file on the network?Use UNC names: \\servername\sharename\foldername\file.ext. The
account doing the backups - which is to say the account under which
SQL Server is running - needs appropriate rights to the share.
Roy Harvey
Beacon Falls, CT
On Tue, 5 Jun 2007 12:20:10 -0400, "Mike" <Mike@.community.nospam>
wrote:
>All of our database servers are doing backups and saving the .bak files out
>on a network share. With SQL 2005, how can I point to that share and restore
>the database in SQL 2005 environment?
>When I do 'restore database --> From Device --> File; when I click the 'ADD;
>button, I only see my local drives on the computer. How can I map to my
>network share and point to my restore file on the network?
>|||I've tried the UNC path and I get 'network path not found' message
Beacon falls, ct, your in my nekc of the woods.
"Roy Harvey" <roy_harvey@.snet.net> wrote in message
news:km4b63p0q6hco968a82ngn955tgse4eg47@.4ax.com...
> Use UNC names: \\servername\sharename\foldername\file.ext. The
> account doing the backups - which is to say the account under which
> SQL Server is running - needs appropriate rights to the share.
> Roy Harvey
> Beacon Falls, CT
> On Tue, 5 Jun 2007 12:20:10 -0400, "Mike" <Mike@.community.nospam>
> wrote:
>>All of our database servers are doing backups and saving the .bak files
>>out
>>on a network share. With SQL 2005, how can I point to that share and
>>restore
>>the database in SQL 2005 environment?
>>When I do 'restore database --> From Device --> File; when I click the
>>'ADD;
>>button, I only see my local drives on the computer. How can I map to my
>>network share and point to my restore file on the network?
>>|||Hello,
In the management studio; go to query window and use RESTORE DATABASE
command. Make sure that you start sql server service using
a domain account which has access to remote share.
RESTORE DATABASE <DBNAME> FROM DISK='\\Servername\Share\filename.bak' with
stats=5
Thanks
Hari
"Mike" <Mike@.community.nospam> wrote in message
news:%23xEIwJ5pHHA.1244@.TK2MSFTNGP04.phx.gbl...
> I've tried the UNC path and I get 'network path not found' message
> Beacon falls, ct, your in my nekc of the woods.
>
> "Roy Harvey" <roy_harvey@.snet.net> wrote in message
> news:km4b63p0q6hco968a82ngn955tgse4eg47@.4ax.com...
>> Use UNC names: \\servername\sharename\foldername\file.ext. The
>> account doing the backups - which is to say the account under which
>> SQL Server is running - needs appropriate rights to the share.
>> Roy Harvey
>> Beacon Falls, CT
>> On Tue, 5 Jun 2007 12:20:10 -0400, "Mike" <Mike@.community.nospam>
>> wrote:
>>All of our database servers are doing backups and saving the .bak files
>>out
>>on a network share. With SQL 2005, how can I point to that share and
>>restore
>>the database in SQL 2005 environment?
>>When I do 'restore database --> From Device --> File; when I click the
>>'ADD;
>>button, I only see my local drives on the computer. How can I map to my
>>network share and point to my restore file on the network?
>>
>|||On Tue, 5 Jun 2007 12:56:18 -0400, "Mike" <Mike@.community.nospam>
wrote:
>I've tried the UNC path and I get 'network path not found' message
Perhaps it is an access rights problem. A partial test can be done
using xp_cmdshell:
EXEC master..xp_cmdshell 'dir \\servername\sharename\folder\*.*'
>Beacon falls, ct, your in my nekc of the woods.
Cool! If you ever need more hands-on help remember I'm around!
Hari's advice to use a query window is excellent, by the way.
Roy Harvey
Beacon Falls, CT|||Ok, I think I got it, but now I'm getting this message:
'the media set has 2 media families but only 1 are provided. All members
must be provided.'
"Roy Harvey" <roy_harvey@.snet.net> wrote in message
news:89eb631lpobifjd281tdpma4q57sct745h@.4ax.com...
> On Tue, 5 Jun 2007 12:56:18 -0400, "Mike" <Mike@.community.nospam>
> wrote:
>>I've tried the UNC path and I get 'network path not found' message
> Perhaps it is an access rights problem. A partial test can be done
> using xp_cmdshell:
> EXEC master..xp_cmdshell 'dir \\servername\sharename\folder\*.*'
>>Beacon falls, ct, your in my nekc of the woods.
> Cool! If you ever need more hands-on help remember I'm around!
> Hari's advice to use a query window is excellent, by the way.
> Roy Harvey
> Beacon Falls, CT|||Hello,
Did you strip the backup into multiple files? Can you execute RESTORE
LABELONLY (see books online) and see how many files are associated with the
backup.
Thanks
Hari
"Mike" <Mike@.community.nospam> wrote in message
news:u8sG$y6pHHA.2156@.TK2MSFTNGP03.phx.gbl...
> Ok, I think I got it, but now I'm getting this message:
> 'the media set has 2 media families but only 1 are provided. All members
> must be provided.'
>
> "Roy Harvey" <roy_harvey@.snet.net> wrote in message
> news:89eb631lpobifjd281tdpma4q57sct745h@.4ax.com...
>> On Tue, 5 Jun 2007 12:56:18 -0400, "Mike" <Mike@.community.nospam>
>> wrote:
>>I've tried the UNC path and I get 'network path not found' message
>> Perhaps it is an access rights problem. A partial test can be done
>> using xp_cmdshell:
>> EXEC master..xp_cmdshell 'dir \\servername\sharename\folder\*.*'
>>Beacon falls, ct, your in my nekc of the woods.
>> Cool! If you ever need more hands-on help remember I'm around!
>> Hari's advice to use a query window is excellent, by the way.
>> Roy Harvey
>> Beacon Falls, CT
>|||No, one file. and now I can't even backup the SQL 2000 database version to
do a restore from.
This is driving me nuts.
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:%23Ov2b29pHHA.3264@.TK2MSFTNGP04.phx.gbl...
> Hello,
> Did you strip the backup into multiple files? Can you execute RESTORE
> LABELONLY (see books online) and see how many files are associated with
> the backup.
> Thanks
> Hari
> "Mike" <Mike@.community.nospam> wrote in message
> news:u8sG$y6pHHA.2156@.TK2MSFTNGP03.phx.gbl...
>> Ok, I think I got it, but now I'm getting this message:
>> 'the media set has 2 media families but only 1 are provided. All members
>> must be provided.'
>>
>> "Roy Harvey" <roy_harvey@.snet.net> wrote in message
>> news:89eb631lpobifjd281tdpma4q57sct745h@.4ax.com...
>> On Tue, 5 Jun 2007 12:56:18 -0400, "Mike" <Mike@.community.nospam>
>> wrote:
>>I've tried the UNC path and I get 'network path not found' message
>> Perhaps it is an access rights problem. A partial test can be done
>> using xp_cmdshell:
>> EXEC master..xp_cmdshell 'dir \\servername\sharename\folder\*.*'
>>Beacon falls, ct, your in my nekc of the woods.
>> Cool! If you ever need more hands-on help remember I'm around!
>> Hari's advice to use a query window is excellent, by the way.
>> Roy Harvey
>> Beacon Falls, CT
>>
>

Wednesday, March 28, 2012

restore databases 7.0

I have taken backups of 3 datbases

as

man1.dbf

msdb,model databases on drive d: but not taken master datbases then i had to format the c: on which sql server installed.

can i take full restore in this case or i have to create datbases and then sp_attach and sp_detach databases pls help me.

Some more details would be helpful:

1) what version of SQL Server is involved? Is it 7.0 or other?

2) What command was used to produce the backup files?

That will help us figure out the best course.

|||

how have u taken the backup. Is it using Backup Database command or using SP_Detach_db to detach the db and then backup the mdf and ldf files. If you have used detach method you can use sp_attach_db to attach the database. If you have used Backup database command then you need to use Restore database command probably with MOVE Option.

Madhu

Monday, March 26, 2012

Restore Database problem - LOADING forever

I had to restore a database late this afternoon. I have the database set to FULL recovery. Database backups are performed nightly and transaction log backups are performed every other hour. I decided to perform a point-in-time restore. When I restored this way everything seems to go ok and it finishes. Then the database is grayed and says "Loading". Although I tried 4 separate times, one time allowing over an hour, the grayed out database and "Loading" never goes away.

Freaking out I deleted the "Loading" database (didn't delete logs and backup files) and tried a manual restore from the previous night's backup file. It attached and restored properly and was ready to go in 2 minutes.

Of course I wanted to get the transaction log files restored too, since it had work from earlier today. So I tried another restore via point-in-time and got the same old messages. Currently, the database is running with the previous night's backup restored but the users aren't too keen on having to do 5 hours worth of work to catch up to the previous transaction log backup come Monday morning.

Any suggestions?

Thanks,
JBHow are you doing the restore? And why do you want to restore to a point in time?

Do it via query analyser with standby - this will enable you to look at the database between restores.

Do the full restore - look at it.

Now do the tr logs in turn - checking the database between each one.
Now you can do the last one with the point in time recovery.

If that fails then go back and redo up to the last one that restored successfully. At least you will lose at the most 2 hours.|||The poster probably did not click on Refresh menu item on Databases folder in EM.sql

Wednesday, March 21, 2012

Restore database fails only when source is read from another machine ( server),even with U

Steen,
Thank you, but it fails with the same message when using an UNC like
disk='\\Peter\C\backups\dottietest.bak', instead of disk =
'K:\backups\dottietest.bak'
where \\Peter\C\backups is copied from the address bar of the Windows
Explorer, so its syntax is correct.
If I use an UNC pointing to the local machine, i.e. the one I am executing
it from and on which the target server is, like
disk='\\thisserver\C\Temp\dottietest.bak', then the UNC format works.
What could it be?
PKuhne
"Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
news:OG1uxTjJFHA.2628@.tk2msftngp13.phx.gbl...
> You can't use a mapped drive, so you'll have to use the UNC path instead -
> that will do the trick....
> Regards
> Steen
> PKuhne wrote:
>
The account that's running the backups needs to have permissions to the
share on the other machine. You have to make sure that:
1. You are using a UNC. You can't use mapped drives for directories on
other machines.
2. The account that's running the backup has write permissions on the share
for the other machine.
"PKuhne" <peter@.chsoft.com> wrote in message
news:OLFH4jmJFHA.4012@.TK2MSFTNGP09.phx.gbl...[vbcol=seagreen]
> Steen,
> Thank you, but it fails with the same message when using an UNC like
> disk='\\Peter\C\backups\dottietest.bak', instead of disk =
> 'K:\backups\dottietest.bak'
> where \\Peter\C\backups is copied from the address bar of the Windows
> Explorer, so its syntax is correct.
> If I use an UNC pointing to the local machine, i.e. the one I am executing
> it from and on which the target server is, like
> disk='\\thisserver\C\Temp\dottietest.bak', then the UNC format works.
> What could it be?
> PKuhne
> "Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
> news:OG1uxTjJFHA.2628@.tk2msftngp13.phx.gbl...
instead -
>
|||Derrick,
1. When I execute this command on a Win2k Prof (drive d like
" restore database restoretest
from disk = 'k:\backups\dottietest.bak'
with move 'vam_system_data' to 'd:\vamdata\sample\vamsystemdata.mdf',
....",
where K: is a Win2k server and d: is on the Win2kProf machine then it works
without UNC.
2. When I reverse this, ie I execute this command on the WIN2k Server (drive
d to restore from the Win2kProf machine like
" restore database restoretest
from disk = '\\win2kprof\d\backups\dottietest.bak'
with move 'vam_system_data' to 'd:\vamdata\sample\vamsystemdata.mdf',
....",
then I get the original error "... Operating system error = 5(Access is
denied.)."
At this time the Property page's Security tab for the dottietest.bak file on
the winProf machine, looked at from the Win2kServer via WinExplorer, has:
'Everyone' as group name, with all these perimissions checked, but greyed
out:
Full control,Modify, Read & Execute,Read, write, and no other group or user.
The win2k server and win2k prof machines are on the same network (belonging
to the same workgroup, with no domain present)
3. Do you really mean that ".. the account that's running the backup needs
to have permissions to the
share on the other machine." ? I could have gotten the *.bak file that I
try to restore from any server in the world, and that is why I think that
you mean ".. the account that's running the RESTORE needs to have
permissions to the share on the other machine.
If this is so, then all this boils down now to "assigning the permissions".
I wonder how this is done, i.e. what more has to be done beyond the server
having rights to reading and writing from/to the Win2kProf machine (at least
via drag and drop of files through Win Explorer).
It is strange that when I execute this from a batch file:
" copy \\Laptop\Laptop_C\vamdata6\sample\sample.bak c:\
isql /S . /U vamlogin /P go /i restore_db.sql "
...with this in restore_db.sql :
"restore database sample
from disk = 'c:\sample.bak'
with move 'vsm_system_data' to 'd:\temp\vsmsystemdata.ndf' ,
move 'vsm_user_data' to 'd:\temp\vsmuserdata.ndf',
move 'vsm_log' to 'd:\temp\vsmlog.ldf',
stats=10"
... then the restore works, i.e. I seem to be able to copy the file from the
win2kProf machine, but it fails to execute the "restore" from that same
machine (as shown further up).
Perhaps this can only work on a domain controller system, which I do not
intend to establish.
Any suggestion?
TIA
"Derrick Leggett" <derrickleggett@.yahoo.com> wrote in message
news:etVuFJxJFHA.4064@.tk2msftngp13.phx.gbl...
> The account that's running the backups needs to have permissions to the
> share on the other machine. You have to make sure that:
> 1. You are using a UNC. You can't use mapped drives for directories on
> other machines.
> 2. The account that's running the backup has write permissions on the
share[vbcol=seagreen]
> for the other machine.
>
>
> "PKuhne" <peter@.chsoft.com> wrote in message
> news:OLFH4jmJFHA.4012@.TK2MSFTNGP09.phx.gbl...
executing[vbcol=seagreen]
> instead -
'd:\vamdata\sample\vamsystemdata.mdf',[vbcol=seagreen]
"[vbcol=seagreen]
the[vbcol=seagreen]
'k:\backups\dottietest.bak'[vbcol=seagreen]
is
>
|||Run that copy command from an xp_cmdshell and see if you get the permissions
error. Also, on the other machine set up a specific share for the backup
directory. You can do this my right-clicking on My Computer and going to
Manage. Click on Shared Folders/Shares/Right-click on Shares to Add
Share, then add the backups. Put full permissions to everyone. You will
then map the restore with like this:
\\win2kprof\sharename\backupfile.bak
The mapped drive might work when you are logged in; however, it will not
work when you log off. Remember that mapped drive is for your profile.
"PKuhne" <p.kuhne@.verizon.net> wrote in message
news:#Mpzr$yJFHA.2736@.TK2MSFTNGP09.phx.gbl...
> Derrick,
> 1. When I execute this command on a Win2k Prof (drive d like
> " restore database restoretest
> from disk = 'k:\backups\dottietest.bak'
> with move 'vam_system_data' to 'd:\vamdata\sample\vamsystemdata.mdf',
> ...",
> where K: is a Win2k server and d: is on the Win2kProf machine then it
works
> without UNC.
> 2. When I reverse this, ie I execute this command on the WIN2k Server
(drive
> d to restore from the Win2kProf machine like
> " restore database restoretest
> from disk = '\\win2kprof\d\backups\dottietest.bak'
> with move 'vam_system_data' to 'd:\vamdata\sample\vamsystemdata.mdf',
> ...",
> then I get the original error "... Operating system error = 5(Access is
> denied.)."
> At this time the Property page's Security tab for the dottietest.bak file
on
> the winProf machine, looked at from the Win2kServer via WinExplorer, has:
> 'Everyone' as group name, with all these perimissions checked, but greyed
> out:
> Full control,Modify, Read & Execute,Read, write, and no other group or
user.
> The win2k server and win2k prof machines are on the same network
(belonging
> to the same workgroup, with no domain present)
> 3. Do you really mean that ".. the account that's running the backup needs
> to have permissions to the
> share on the other machine." ? I could have gotten the *.bak file that I
> try to restore from any server in the world, and that is why I think that
> you mean ".. the account that's running the RESTORE needs to have
> permissions to the share on the other machine.
> If this is so, then all this boils down now to "assigning the
permissions".
> I wonder how this is done, i.e. what more has to be done beyond the server
> having rights to reading and writing from/to the Win2kProf machine (at
least
> via drag and drop of files through Win Explorer).
> It is strange that when I execute this from a batch file:
> " copy \\Laptop\Laptop_C\vamdata6\sample\sample.bak c:\
> isql /S . /U vamlogin /P go /i restore_db.sql "
> ..with this in restore_db.sql :
> "restore database sample
> from disk = 'c:\sample.bak'
> with move 'vsm_system_data' to 'd:\temp\vsmsystemdata.ndf' ,
> move 'vsm_user_data' to 'd:\temp\vsmuserdata.ndf',
> move 'vsm_log' to 'd:\temp\vsmlog.ldf',
> stats=10"
> .. then the restore works, i.e. I seem to be able to copy the file from
the[vbcol=seagreen]
> win2kProf machine, but it fails to execute the "restore" from that same
> machine (as shown further up).
> Perhaps this can only work on a domain controller system, which I do not
> intend to establish.
> Any suggestion?
> TIA
>
>
>
> "Derrick Leggett" <derrickleggett@.yahoo.com> wrote in message
> news:etVuFJxJFHA.4064@.tk2msftngp13.phx.gbl...
> share
> executing
target[vbcol=seagreen]
> 'd:\vamdata\sample\vamsystemdata.mdf',
> "
"
> the
> 'k:\backups\dottietest.bak'
> is
>
|||Hi
You also need to make sure that the account that runs the SQL Server Service
(and maybe also the SQL Server Agent service) has access to the shares you
need to access. It's this account that determines the access - not the
account you are logged on with.
Regards
Steen
PKuhne wrote:[vbcol=seagreen]
> Derrick,
> 1. When I execute this command on a Win2k Prof (drive d like
> " restore database restoretest
> from disk = 'k:\backups\dottietest.bak'
> with move 'vam_system_data' to
> 'd:\vamdata\sample\vamsystemdata.mdf', ...",
> where K: is a Win2k server and d: is on the Win2kProf machine then it
> works without UNC.
> 2. When I reverse this, ie I execute this command on the WIN2k Server
> (drive d to restore from the Win2kProf machine like
> " restore database restoretest
> from disk = '\\win2kprof\d\backups\dottietest.bak'
> with move 'vam_system_data' to
> 'd:\vamdata\sample\vamsystemdata.mdf', ...",
> then I get the original error "... Operating system error = 5(Access
> is denied.)."
> At this time the Property page's Security tab for the dottietest.bak
> file on the winProf machine, looked at from the Win2kServer via
> WinExplorer, has: 'Everyone' as group name, with all these
> perimissions checked, but greyed out:
> Full control,Modify, Read & Execute,Read, write, and no other group
> or user.
> The win2k server and win2k prof machines are on the same network
> (belonging to the same workgroup, with no domain present)
> 3. Do you really mean that ".. the account that's running the backup
> needs to have permissions to the
> share on the other machine." ? I could have gotten the *.bak file
> that I try to restore from any server in the world, and that is why I
> think that you mean ".. the account that's running the RESTORE needs
> to have permissions to the share on the other machine.
> If this is so, then all this boils down now to "assigning the
> permissions". I wonder how this is done, i.e. what more has to be
> done beyond the server having rights to reading and writing from/to
> the Win2kProf machine (at least via drag and drop of files through
> Win Explorer).
> It is strange that when I execute this from a batch file:
> " copy \\Laptop\Laptop_C\vamdata6\sample\sample.bak c:\
> isql /S . /U vamlogin /P go /i restore_db.sql "
> ..with this in restore_db.sql :
> "restore database sample
> from disk = 'c:\sample.bak'
> with move 'vsm_system_data' to 'd:\temp\vsmsystemdata.ndf' ,
> move 'vsm_user_data' to 'd:\temp\vsmuserdata.ndf',
> move 'vsm_log' to 'd:\temp\vsmlog.ldf',
> stats=10"
> .. then the restore works, i.e. I seem to be able to copy the file
> from the win2kProf machine, but it fails to execute the "restore"
> from that same machine (as shown further up).
> Perhaps this can only work on a domain controller system, which I do
> not intend to establish.
> Any suggestion?
> TIA
>
>
>
> "Derrick Leggett" <derrickleggett@.yahoo.com> wrote in message
> news:etVuFJxJFHA.4064@.tk2msftngp13.phx.gbl...
> 'd:\vamdata\sample\vamsystemdata.mdf',
sql

Restore database fails only when source is read from another machine ( server),even wi

Steen,
Thank you, but it fails with the same message when using an UNC like
disk='\\Peter\C\backups\dottietest.bak', instead of disk =
'K:\backups\dottietest.bak'
where \\Peter\C\backups is copied from the address bar of the Windows
Explorer, so its syntax is correct.
If I use an UNC pointing to the local machine, i.e. the one I am executing
it from and on which the target server is, like
disk='\\thisserver\C\Temp\dottietest.bak', then the UNC format works.
What could it be?
PKuhne
"Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
news:OG1uxTjJFHA.2628@.tk2msftngp13.phx.gbl...
> You can't use a mapped drive, so you'll have to use the UNC path instead -
> that will do the trick....
> Regards
> Steen
> PKuhne wrote:
>The account that's running the backups needs to have permissions to the
share on the other machine. You have to make sure that:
1. You are using a UNC. You can't use mapped drives for directories on
other machines.
2. The account that's running the backup has write permissions on the share
for the other machine.
"PKuhne" <peter@.chsoft.com> wrote in message
news:OLFH4jmJFHA.4012@.TK2MSFTNGP09.phx.gbl...
> Steen,
> Thank you, but it fails with the same message when using an UNC like
> disk='\\Peter\C\backups\dottietest.bak', instead of disk =
> 'K:\backups\dottietest.bak'
> where \\Peter\C\backups is copied from the address bar of the Windows
> Explorer, so its syntax is correct.
> If I use an UNC pointing to the local machine, i.e. the one I am executing
> it from and on which the target server is, like
> disk='\\thisserver\C\Temp\dottietest.bak', then the UNC format works.
> What could it be?
> PKuhne
> "Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
> news:OG1uxTjJFHA.2628@.tk2msftngp13.phx.gbl...
instead -[vbcol=seagreen]
>|||Derrick,
1. When I execute this command on a Win2k Prof (drive d like
" restore database restoretest
from disk = 'k:\backups\dottietest.bak'
with move 'vam_system_data' to 'd:\vamdata\sample\vamsystemdata.mdf',
...",
where K: is a Win2k server and d: is on the Win2kProf machine then it works
without UNC.
2. When I reverse this, ie I execute this command on the WIN2k Server (drive
d to restore from the Win2kProf machine like
" restore database restoretest
from disk = '\\win2kprof\d\backups\dottietest.bak'
with move 'vam_system_data' to 'd:\vamdata\sample\vamsystemdata.mdf',
...",
then I get the original error "... Operating system error = 5(Access is
denied.)."
At this time the Property page's Security tab for the dottietest.bak file on
the winProf machine, looked at from the Win2kServer via WinExplorer, has:
'Everyone' as group name, with all these perimissions checked, but greyed
out:
Full control,Modify, Read & Execute,Read, write, and no other group or user.
The win2k server and win2k prof machines are on the same network (belonging
to the same workgroup, with no domain present)
3. Do you really mean that ".. the account that's running the backup needs
to have permissions to the
share on the other machine." ? I could have gotten the *.bak file that I
try to restore from any server in the world, and that is why I think that
you mean ".. the account that's running the RESTORE needs to have
permissions to the share on the other machine.
If this is so, then all this boils down now to "assigning the permissions".
I wonder how this is done, i.e. what more has to be done beyond the server
having rights to reading and writing from/to the Win2kProf machine (at least
via drag and drop of files through Win Explorer).
It is strange that when I execute this from a batch file:
" copy \\Laptop\Laptop_C\vamdata6\sample\sample
.bak c:\
isql /S . /U vamlogin /P go /i restore_db.sql "
..with this in restore_db.sql :
"restore database sample
from disk = 'c:\sample.bak'
with move 'vsm_system_data' to 'd:\temp\vsmsystemdata.ndf' ,
move 'vsm_user_data' to 'd:\temp\vsmuserdata.ndf',
move 'vsm_log' to 'd:\temp\vsmlog.ldf',
stats=10"
.. then the restore works, i.e. I seem to be able to copy the file from the
win2kProf machine, but it fails to execute the "restore" from that same
machine (as shown further up).
Perhaps this can only work on a domain controller system, which I do not
intend to establish.
Any suggestion?
TIA
"Derrick Leggett" <derrickleggett@.yahoo.com> wrote in message
news:etVuFJxJFHA.4064@.tk2msftngp13.phx.gbl...
> The account that's running the backups needs to have permissions to the
> share on the other machine. You have to make sure that:
> 1. You are using a UNC. You can't use mapped drives for directories on
> other machines.
> 2. The account that's running the backup has write permissions on the
share
> for the other machine.
>
>
> "PKuhne" <peter@.chsoft.com> wrote in message
> news:OLFH4jmJFHA.4012@.TK2MSFTNGP09.phx.gbl...
executing[vbcol=seagreen]
> instead -
'd:\vamdata\sample\vamsystemdata.mdf',[vbcol=seagreen]
"[vbcol=seagreen]
the[vbcol=seagreen]
'k:\backups\dottietest.bak'[vbcol=seagreen]
is[vbcol=seagreen]
>|||Run that copy command from an xp_cmdshell and see if you get the permissions
error. Also, on the other machine set up a specific share for the backup
directory. You can do this my right-clicking on My Computer and going to
Manage. Click on Shared Folders/Shares/Right-click on Shares to Add
Share, then add the backups. Put full permissions to everyone. You will
then map the restore with like this:
\\win2kprof\sharename\backupfile.bak
The mapped drive might work when you are logged in; however, it will not
work when you log off. Remember that mapped drive is for your profile.
"PKuhne" <p.kuhne@.verizon.net> wrote in message
news:#Mpzr$yJFHA.2736@.TK2MSFTNGP09.phx.gbl...
> Derrick,
> 1. When I execute this command on a Win2k Prof (drive d like
> " restore database restoretest
> from disk = 'k:\backups\dottietest.bak'
> with move 'vam_system_data' to 'd:\vamdata\sample\vamsystemdata.mdf',
> ...",
> where K: is a Win2k server and d: is on the Win2kProf machine then it
works
> without UNC.
> 2. When I reverse this, ie I execute this command on the WIN2k Server
(drive
> d to restore from the Win2kProf machine like
> " restore database restoretest
> from disk = '\\win2kprof\d\backups\dottietest.bak'
> with move 'vam_system_data' to 'd:\vamdata\sample\vamsystemdata.mdf',
> ...",
> then I get the original error "... Operating system error = 5(Access is
> denied.)."
> At this time the Property page's Security tab for the dottietest.bak file
on
> the winProf machine, looked at from the Win2kServer via WinExplorer, has:
> 'Everyone' as group name, with all these perimissions checked, but greyed
> out:
> Full control,Modify, Read & Execute,Read, write, and no other group or
user.
> The win2k server and win2k prof machines are on the same network
(belonging
> to the same workgroup, with no domain present)
> 3. Do you really mean that ".. the account that's running the backup needs
> to have permissions to the
> share on the other machine." ? I could have gotten the *.bak file that I
> try to restore from any server in the world, and that is why I think that
> you mean ".. the account that's running the RESTORE needs to have
> permissions to the share on the other machine.
> If this is so, then all this boils down now to "assigning the
permissions".
> I wonder how this is done, i.e. what more has to be done beyond the server
> having rights to reading and writing from/to the Win2kProf machine (at
least
> via drag and drop of files through Win Explorer).
> It is strange that when I execute this from a batch file:
> " copy \\Laptop\Laptop_C\vamdata6\sample\sample
.bak c:\
> isql /S . /U vamlogin /P go /i restore_db.sql "
> ..with this in restore_db.sql :
> "restore database sample
> from disk = 'c:\sample.bak'
> with move 'vsm_system_data' to 'd:\temp\vsmsystemdata.ndf' ,
> move 'vsm_user_data' to 'd:\temp\vsmuserdata.ndf',
> move 'vsm_log' to 'd:\temp\vsmlog.ldf',
> stats=10"
> .. then the restore works, i.e. I seem to be able to copy the file from
the
> win2kProf machine, but it fails to execute the "restore" from that same
> machine (as shown further up).
> Perhaps this can only work on a domain controller system, which I do not
> intend to establish.
> Any suggestion?
> TIA
>
>
>
> "Derrick Leggett" <derrickleggett@.yahoo.com> wrote in message
> news:etVuFJxJFHA.4064@.tk2msftngp13.phx.gbl...
> share
> executing
target[vbcol=seagreen]
> 'd:\vamdata\sample\vamsystemdata.mdf',
> "
"[vbcol=seagreen]
> the
> 'k:\backups\dottietest.bak'
> is
>|||Hi
You also need to make sure that the account that runs the SQL Server Service
(and maybe also the SQL Server Agent service) has access to the shares you
need to access. It's this account that determines the access - not the
account you are logged on with.
Regards
Steen
PKuhne wrote:[vbcol=seagreen]
> Derrick,
> 1. When I execute this command on a Win2k Prof (drive d like
> " restore database restoretest
> from disk = 'k:\backups\dottietest.bak'
> with move 'vam_system_data' to
> 'd:\vamdata\sample\vamsystemdata.mdf', ...",
> where K: is a Win2k server and d: is on the Win2kProf machine then it
> works without UNC.
> 2. When I reverse this, ie I execute this command on the WIN2k Server
> (drive d to restore from the Win2kProf machine like
> " restore database restoretest
> from disk = '\\win2kprof\d\backups\dottietest.bak'
> with move 'vam_system_data' to
> 'd:\vamdata\sample\vamsystemdata.mdf', ...",
> then I get the original error "... Operating system error = 5(Access
> is denied.)."
> At this time the Property page's Security tab for the dottietest.bak
> file on the winProf machine, looked at from the Win2kServer via
> WinExplorer, has: 'Everyone' as group name, with all these
> perimissions checked, but greyed out:
> Full control,Modify, Read & Execute,Read, write, and no other group
> or user.
> The win2k server and win2k prof machines are on the same network
> (belonging to the same workgroup, with no domain present)
> 3. Do you really mean that ".. the account that's running the backup
> needs to have permissions to the
> share on the other machine." ? I could have gotten the *.bak file
> that I try to restore from any server in the world, and that is why I
> think that you mean ".. the account that's running the RESTORE needs
> to have permissions to the share on the other machine.
> If this is so, then all this boils down now to "assigning the
> permissions". I wonder how this is done, i.e. what more has to be
> done beyond the server having rights to reading and writing from/to
> the Win2kProf machine (at least via drag and drop of files through
> Win Explorer).
> It is strange that when I execute this from a batch file:
> " copy \\Laptop\Laptop_C\vamdata6\sample\sample
.bak c:\
> isql /S . /U vamlogin /P go /i restore_db.sql "
> ..with this in restore_db.sql :
> "restore database sample
> from disk = 'c:\sample.bak'
> with move 'vsm_system_data' to 'd:\temp\vsmsystemdata.ndf' ,
> move 'vsm_user_data' to 'd:\temp\vsmuserdata.ndf',
> move 'vsm_log' to 'd:\temp\vsmlog.ldf',
> stats=10"
> .. then the restore works, i.e. I seem to be able to copy the file
> from the win2kProf machine, but it fails to execute the "restore"
> from that same machine (as shown further up).
> Perhaps this can only work on a domain controller system, which I do
> not intend to establish.
> Any suggestion?
> TIA
>
>
>
> "Derrick Leggett" <derrickleggett@.yahoo.com> wrote in message
> news:etVuFJxJFHA.4064@.tk2msftngp13.phx.gbl...
> 'd:\vamdata\sample\vamsystemdata.mdf',

Restore Database Dialog Shows Old Backup File Location

We're running SQL 7.0 (SP4,MS03-031) on Windows 2000. We recently
moved our database backups from the D:\ drive to the E:\ drive. In
the process, we dropped all of our old backup devices and created new
ones pointing to the new drive. The backups have been running
successfully for several weeks now; sending data to the new location.
The other day I needed to restore a database. While reviewing the
restore database dialog information, I noticed that the old path
(D:\)appeared under "Restore from" column. The other information;
type, backup set date and size are correct and apply to the backup
file on the E:\ drive. I attempted the restore and naturally received
an error.
I've checked sysdevices and found it has the correct location for the
backup files.
Any ideas why this could be and any suggestions on how to fix it?
Thanks!
Michael Brule
Database Administrator
The Phoenix CompaniesThe first 3 links should be relevant but the rest may also be of interest:
http://www.support.microsoft.com/?id=314546 Moving DB's between Servers
http://www.support.microsoft.com/?id=224071 Moving SQL Server Databases
to a New Location with Detach/Attach
http://support.microsoft.com/?id=221465 Using WITH MOVE in a
Restore
http://www.support.microsoft.com/?id=246133 How To Transfer Logins and
Passwords Between SQL Servers
http://www.support.microsoft.com/?id=298897 Mapping Logins & SIDs after a
Restore
http://www.dbmaint.com/SyncSqlLogins.asp Utility to map logins to
users
http://www.support.microsoft.com/?id=168001 User Logon and/or Permission
Errors After Restoring Dump
http://www.support.microsoft.com/?id=240872 How to Resolve Permission
Issues When a Database Is Moved Between SQL Servers
http://www.sqlservercentral.com/scripts/scriptdetails.asp?scriptid=599
Restoring a .mdf
http://www.support.microsoft.com/?id=307775 Disaster Recovery Articles
for SQL Server
Andrew J. Kelly
SQL Server MVP
"michael brule" <michael.brule@.phoenixwm.com> wrote in message
news:55f7800f.0402181409.25c474c4@.posting.google.com...
> We're running SQL 7.0 (SP4,MS03-031) on Windows 2000. We recently
> moved our database backups from the D:\ drive to the E:\ drive. In
> the process, we dropped all of our old backup devices and created new
> ones pointing to the new drive. The backups have been running
> successfully for several weeks now; sending data to the new location.
> The other day I needed to restore a database. While reviewing the
> restore database dialog information, I noticed that the old path
> (D:\)appeared under "Restore from" column. The other information;
> type, backup set date and size are correct and apply to the backup
> file on the E:\ drive. I attempted the restore and naturally received
> an error.
> I've checked sysdevices and found it has the correct location for the
> backup files.
> Any ideas why this could be and any suggestions on how to fix it?
> Thanks!
> Michael Brule
> Database Administrator
> The Phoenix Companies|||I had the same problem before.
You can restore the database from the restore diaglog
panel by choosing "From device" rather than "database".
Fix the problem permanently is to delete the old backup
files on D:\ drive, the restore diaglog panel should show
correctly after the backup run on E:\ drive.|||Thanks for the replies, Andrew and Johnny!
Andrew: The information you provided seemed to concern issues
surrounding moving a database to a new location My question was about
moving database backup files. The databases remain in their original
location.
Johnny: Actually, we moved the backup directory to the new location.
Neither that directory nor any of its files remains in the original
location. Numerous backups have been run since.
Thanks!
Michael Brule
Database Administrator
The Phoenix Companies|||Some of the links refer to methods that can be used to move to a new server
or just a new location. You can either use RESTORE with the MOVE option or
sp_attach_db. Both are covered in there as well as BooksOnLine.
--
Andrew J. Kelly
SQL Server MVP
"michael brule" <michael.brule@.phoenixwm.com> wrote in message
news:55f7800f.0402190654.660f72e5@.posting.google.com...
> Thanks for the replies, Andrew and Johnny!
> Andrew: The information you provided seemed to concern issues
> surrounding moving a database to a new location My question was about
> moving database backup files. The databases remain in their original
> location.
> Johnny: Actually, we moved the backup directory to the new location.
> Neither that directory nor any of its files remains in the original
> location. Numerous backups have been run since.
> Thanks!
> Michael Brule
> Database Administrator
> The Phoenix Companies|||Sorry.
The files in the new location ie E:\ have to be deleted as
well.
Overwritten the existing backup files still showed the old
backup directory path in the restore panel. If you don't
want to delete all the backup files in one go, you may
delete the oldest backup files until all are recycled.

Tuesday, March 20, 2012

Restore Database

Hello, him story my problem, we had a problem with the server where was installed the sqlserver2005, we do not have backups, nevertheless we could recover the files data.mdf and log.ldf of the database, like I can carry out a restore utilizing these files?

No, you do NOT need to RESTORE with those two files.

You need to ATTACH the files. Check in Books Online about using ATTACH.

Monday, March 12, 2012

Restore backup on different machine

We are moving backups from being written on a local box, to writing tham on a
NAS and making a daily copy to a report server. So, to start, I made a manual
copy of the backup files to the NAS and then wen't to restore tham.
What I get is an error message that includes the path name from the machine
where the backup was made as well as the path name for the log file.
Duh!
I can see that I need to add the 'WITH MOVE' parameters to the restore
command, but I can't get them to work. This is probably because I flat-out
don't understand what is happening. Once I say where the full backup is, why
does it care about the path is was backed up to? Why does it care about
restoring a log file I didn't ask for?
Once I change the backup path on the production machine to the NAS (so that
the paths are the same, will this issue just go away?> I can see that I need to add the 'WITH MOVE' parameters to the restore
> command, but I can't get them to work. This is probably because I flat-out
> don't understand what is happening. Once I say where the full backup is,
> why
> does it care about the path is was backed up to?
Because when it restores the database, it needs to create an MDF and LDF
file of the same size for the database to be restored correctly and usable.
> Why does it care about
> restoring a log file I didn't ask for?
When you restore a database, you get the data file(s) and the log file(s).
This is not negotiable.
> Once I change the backup path on the production machine to the NAS (so
> that
> the paths are the same, will this issue just go away?
That depends, if you mean that you intend to restore to the exact same
location as an existing data/log file location, then no, that won't work.

Restore backup on different machine

We are moving backups from being written on a local box, to writing tham on a
NAS and making a daily copy to a report server. So, to start, I made a manual
copy of the backup files to the NAS and then wen't to restore tham.
What I get is an error message that includes the path name from the machine
where the backup was made as well as the path name for the log file.
Duh!
I can see that I need to add the 'WITH MOVE' parameters to the restore
command, but I can't get them to work. This is probably because I flat-out
don't understand what is happening. Once I say where the full backup is, why
does it care about the path is was backed up to? Why does it care about
restoring a log file I didn't ask for?
Once I change the backup path on the production machine to the NAS (so that
the paths are the same, will this issue just go away?
> I can see that I need to add the 'WITH MOVE' parameters to the restore
> command, but I can't get them to work. This is probably because I flat-out
> don't understand what is happening. Once I say where the full backup is,
> why
> does it care about the path is was backed up to?
Because when it restores the database, it needs to create an MDF and LDF
file of the same size for the database to be restored correctly and usable.

> Why does it care about
> restoring a log file I didn't ask for?
When you restore a database, you get the data file(s) and the log file(s).
This is not negotiable.

> Once I change the backup path on the production machine to the NAS (so
> that
> the paths are the same, will this issue just go away?
That depends, if you mean that you intend to restore to the exact same
location as an existing data/log file location, then no, that won't work.

Restore backup on different machine

We are moving backups from being written on a local box, to writing tham on
a
NAS and making a daily copy to a report server. So, to start, I made a manua
l
copy of the backup files to the NAS and then wen't to restore tham.
What I get is an error message that includes the path name from the machine
where the backup was made as well as the path name for the log file.
Duh!
I can see that I need to add the 'WITH MOVE' parameters to the restore
command, but I can't get them to work. This is probably because I flat-out
don't understand what is happening. Once I say where the full backup is, why
does it care about the path is was backed up to? Why does it care about
restoring a log file I didn't ask for?
Once I change the backup path on the production machine to the NAS (so that
the paths are the same, will this issue just go away?> I can see that I need to add the 'WITH MOVE' parameters to the restore
> command, but I can't get them to work. This is probably because I flat-out
> don't understand what is happening. Once I say where the full backup is,
> why
> does it care about the path is was backed up to?
Because when it restores the database, it needs to create an MDF and LDF
file of the same size for the database to be restored correctly and usable.

> Why does it care about
> restoring a log file I didn't ask for?
When you restore a database, you get the data file(s) and the log file(s).
This is not negotiable.

> Once I change the backup path on the production machine to the NAS (so
> that
> the paths are the same, will this issue just go away?
That depends, if you mean that you intend to restore to the exact same
location as an existing data/log file location, then no, that won't work.

Wednesday, March 7, 2012

Restore a single table

I have online and offline backup of my SQL Server 2000 databases.
I want to restore a single table from this backups .
I cant restore as my full db with a new name because I dont have enough room
for it.
What's your offers?Hi
Since it was a SQL Server 6.5 feature , you cannot restore a single table in
SQL Server 7/2000
Do you have another server to restore the database?
"Banu_tr" <abuslu@.hotmail.com> wrote in message
news:4C761E38-1E6A-421A-A782-C66D07B3E2AE@.microsoft.com...
> I have online and offline backup of my SQL Server 2000 databases.
> I want to restore a single table from this backups .
> I cant restore as my full db with a new name because I dont have enough
room
> for it.
> What's your offers?|||SQL Server 2000 don't have a feature that allows you to restore a single
table.
Stephen Jiang
Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Banu_tr" <abuslu@.hotmail.com> wrote in message
news:4C761E38-1E6A-421A-A782-C66D07B3E2AE@.microsoft.com...
> I have online and offline backup of my SQL Server 2000 databases.
> I want to restore a single table from this backups .
> I cant restore as my full db with a new name because I dont have enough
room
> for it.
> What's your offers?

Restore a single table

I have online and offline backup of my SQL Server 2000 databases.
I want to restore a single table from this backups .
I cant restore as my full db with a new name because I dont have enough room
for it.
What's your offers?
Hi
Since it was a SQL Server 6.5 feature , you cannot restore a single table in
SQL Server 7/2000
Do you have another server to restore the database?
"Banu_tr" <abuslu@.hotmail.com> wrote in message
news:4C761E38-1E6A-421A-A782-C66D07B3E2AE@.microsoft.com...
> I have online and offline backup of my SQL Server 2000 databases.
> I want to restore a single table from this backups .
> I cant restore as my full db with a new name because I dont have enough
room
> for it.
> What's your offers?
|||SQL Server 2000 don't have a feature that allows you to restore a single
table.
Stephen Jiang
Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Banu_tr" <abuslu@.hotmail.com> wrote in message
news:4C761E38-1E6A-421A-A782-C66D07B3E2AE@.microsoft.com...
> I have online and offline backup of my SQL Server 2000 databases.
> I want to restore a single table from this backups .
> I cant restore as my full db with a new name because I dont have enough
room
> for it.
> What's your offers?

Restore a single table

I have online and offline backup of my SQL Server 2000 databases.
I want to restore a single table from this backups .
I cant restore as my full db with a new name because I dont have enough room
for it.
What's your offers?Hi
Since it was a SQL Server 6.5 feature , you cannot restore a single table in
SQL Server 7/2000
Do you have another server to restore the database?
"Banu_tr" <abuslu@.hotmail.com> wrote in message
news:4C761E38-1E6A-421A-A782-C66D07B3E2AE@.microsoft.com...
> I have online and offline backup of my SQL Server 2000 databases.
> I want to restore a single table from this backups .
> I cant restore as my full db with a new name because I dont have enough
room
> for it.
> What's your offers?|||SQL Server 2000 don't have a feature that allows you to restore a single
table.
--
Stephen Jiang
Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Banu_tr" <abuslu@.hotmail.com> wrote in message
news:4C761E38-1E6A-421A-A782-C66D07B3E2AE@.microsoft.com...
> I have online and offline backup of my SQL Server 2000 databases.
> I want to restore a single table from this backups .
> I cant restore as my full db with a new name because I dont have enough
room
> for it.
> What's your offers?

Saturday, February 25, 2012

Restore a database to another server

Hi, i am using sql server 2000, and i make daily backups. I want to
restore my backup to a test msde database i have. I don't know how i
did it last time.

-The database name is the same: "web" on both places
-The database is located on different hard drives and the file name
are different on both places.

I tried to do it from enterprise manager, restore database, from
device, i chose the transaction file and the database backup itself
and tried to restore, but i got an error that i don't have exclusive
access to the database.

How can i fix this?Seguros Catatumbo (seguroscatatumbo@.gmail.com) writes:

Quote:

Originally Posted by

Hi, i am using sql server 2000, and i make daily backups. I want to
restore my backup to a test msde database i have. I don't know how i
did it last time.
>
-The database name is the same: "web" on both places
-The database is located on different hard drives and the file name
are different on both places.
>
I tried to do it from enterprise manager, restore database, from
device, i chose the transaction file and the database backup itself
and tried to restore, but i got an error that i don't have exclusive
access to the database.


RESTORE DATABASE db FROM DISK ='filenamehere'
WITH MOVE 'logicalname1' TO 'path.mdf',
MOVE 'logicalname2' TO 'path_log.ldf',
REPLACE

logicalname1/2 are the logical names of the device file. You find these
with help of sp_helpdb on the source database, or RESTORE FILELISTONLY
on the backup file.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||

Quote:

Originally Posted by

RESTORE DATABASE db FROM DISK ='filenamehere'
WITH MOVE 'logicalname1' TO 'path.mdf',
MOVE 'logicalname2' TO 'path_log.ldf',
REPLACE
>


Hey Erland, thanks for replying. I couldn't get it to work. Here's the
command:

RESTORE DATABASE db FROM DISK ='c:\publica\web_db_200711150500.bak'
WITH MOVE 'WEB_Data' TO 'c:\pruebadb\web_dos.mdf',
MOVE 'WEB_Log' TO 'c:\pruebadb\web_dos_log.ldf',
REPLACE

Here's the error message:

The file 'c:\pruebadb\web_dos.mdf' cannot be overwritten. It is being
used by database 'web'.
File 'WEB_Data' cannot be restored to 'c:\pruebadb\web_dos.mdf'. Use
WITH MOVE to identify a valid location for the file.
The file 'c:\pruebadb\web_dos_log.ldf' cannot be overwritten. It is
being used by database 'web'.
File 'WEB_Log' cannot be restored to 'c:\pruebadb\web_dos_log.ldf'.
Use WITH MOVE to identify a valid location for the file.
RESTORE DATABASE is terminating abnormally.

Here's the output of sp_helpdb on the source db and destination db:

source:

WEB_Data
1D:\DataWEB\Data
\web_Data.MDF
PRIMARY4348096 KBUnlimited5120 KBdata only
WEB_Log
2D:\DataWEB\Data
\web_Log.LDF
NULL32448 KBUnlimited10%log only

destination:

WEB_Data
1C:\pruebadb
\web_dos.mdf
PRIMARY2092928 KBUnlimited5120 KBdata only
WEB_Log
2C:\pruebadb
\web_dos_log.ldf
NULL1024 KBUnlimited10%log only

The c:\publica\web_db_200711150500.bak was obtained from a backup made
by sql server itself on the source server itself|||I made a mistake with the command. My database name is not db, it's
"web". So now i get the same error i get when i do with the GUI:

RESTORE DATABASE db FROM DISK ='c:\publica\web_db_200711150500.bak'
WITH MOVE 'WEB_Data' TO 'c:\pruebadb\web_dos.mdf',
MOVE 'WEB_Log' TO 'c:\pruebadb\web_dos_log.ldf',
REPLACE

Here's the error message:

Exclusive access could not be obtained because the database is in use.

Do i need to take the database offline or something?|||Ok, i think i know how to fix it.

-WEB is my default database, so when i use query analizer it opens
that database. It can't restore the database if i am connected. So
instead of figuring off how to change the default database, i
connected, changed the current db to master (use master), and then i
could take web offline with enterprise manager. Now the command seems
to be working, it will take long, the database is 4GB.

RESTORE DATABASE web FROM DISK ='c:\publica\web_db_200711150500.bak'
WITH MOVE 'WEB_Data' TO 'c:\pruebadb\web_dos.mdf',
MOVE 'WEB_Log' TO 'c:\pruebadb\web_dos_log.ldf',
REPLACE|||Yup, it worked, so the conclusion is that it would have worked from
the start if i just would have taken the database offline. Thanks for
your help