Showing posts with label file. Show all posts
Showing posts with label file. Show all posts

Friday, March 30, 2012

Restoreing From Log File

if the datafile is corrupted but log file is there how do I restore the
database with latest transaction from log file in sql server
*** Sent via Developersdex http://www.codecomments.com ***Backup the log file (using NO_TRUNCATE), restore latest database backup, and
all subsequent log
backups (including this last one).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Jaydip Das" <jaydip_j@.hotmail.com> wrote in message news:ezGvukroFHA.2444@.tk2msftngp13.phx.
gbl...
> if the datafile is corrupted but log file is there how do I restore the
> database with latest transaction from log file in sql server
> *** Sent via Developersdex http://www.codecomments.com ***

Restore?

I am trying to restore a .bak to a test server in order to test the integrity
of my production DB backups but the test server rejects the .bak file because
it is a file used by the production server. A full and transactional backups
are used in the production DB. Any insights on how to perform a test restore
is highly appreciated.
What error message are you getting ?
Razvan
morphius wrote:
> I am trying to restore a .bak to a test server in order to test the integrity
> of my production DB backups but the test server rejects the .bak file because
> it is a file used by the production server. A full and transactional backups
> are used in the production DB. Any insights on how to perform a test restore
> is highly appreciated.
|||Please post the exact error message.
Is your test machine a separate instance on the same hardware, or a
completely different server?
Kevin Hill
3NF Consulting
http://www.3nf-inc.com/NewsGroups.htm
Real-world stuff I run across with SQL Server:
http://kevin3nf.blogspot.com
"morphius" <morphius@.discussions.microsoft.com> wrote in message
news:0AA8DE03-924A-41D8-A706-87E9F047B945@.microsoft.com...
>I am trying to restore a .bak to a test server in order to test the
>integrity
> of my production DB backups but the test server rejects the .bak file
> because
> it is a file used by the production server. A full and transactional
> backups
> are used in the production DB. Any insights on how to perform a test
> restore
> is highly appreciated.
>
|||Razvan
I think the OP is asking how to restore .bak file and are not getting any
errors :-)
morphius
RESTORE DATABASE dbname FROM DISK='C:\db.bak' WITH FILE = 1,NORECOVERY
RESTORE LOG dbname FROM DISK = 'C:\Log.bak' WITH FILE = 1, NORECOVERY
RESTORE LOG dbname FROM DISK = 'C:\Log.bak' WITH FILE = 2, NORECOVERY
.....
RESTORE LOG dbname FROM DISK = 'C:\Log.bak' WITH FILE = n, RECOVERY
"Razvan Socol" <rsocol@.gmail.com> wrote in message
news:1165930086.612341.260330@.16g2000cwy.googlegro ups.com...
> What error message are you getting ?
> Razvan
> morphius wrote:
>
|||morphius wrote:
> I am trying to restore a .bak to a test server in order to test the integrity
> of my production DB backups but the test server rejects the .bak file because
> it is a file used by the production server. A full and transactional backups
> are used in the production DB. Any insights on how to perform a test restore
> is highly appreciated.
>
My guess is you're restoring over an existing database, and the message
you're seeing is telling you that there are existing files, in which
case you need to use the WITH MOVE option on the RESTORE command.
Posting the full error message will tell us for sure.
Tracy McKibben
MCDBA
http://www.realsqlguy.com
|||It is a totally different server. Maybe I am doing something wrong. How would
you specifically restore a copy of the production db to the test server?
Thanks...
"Kevin3NF" wrote:

> Please post the exact error message.
> Is your test machine a separate instance on the same hardware, or a
> completely different server?
> --
> Kevin Hill
> 3NF Consulting
> http://www.3nf-inc.com/NewsGroups.htm
> Real-world stuff I run across with SQL Server:
> http://kevin3nf.blogspot.com
>
> "morphius" <morphius@.discussions.microsoft.com> wrote in message
> news:0AA8DE03-924A-41D8-A706-87E9F047B945@.microsoft.com...
>
>
|||Hello,
1. Copy the Full database backup file to test server
2. Copy the Transaction log backup files to test servr
3. Open Query Analyzer (SQL2000) or SSMS (SQL 2005) in test server
4. Use RESTORE DATABASE Command with NORECOVERY and MOVE option to restore
the Full database
5. Resttore all the transaction log backups using RESTORE LOG WITH
NORECOVERY until last file
6. Restore the Last Log backup using RESTORE LOG WITH Recovery option. THsi
will make the database online
See the commands usage in books online...
Thanks
Hari
"morphius" <morphius@.discussions.microsoft.com> wrote in message
news:63F7B1D4-F3F2-43EB-81DD-065B7D6FF35B@.microsoft.com...[vbcol=seagreen]
> It is a totally different server. Maybe I am doing something wrong. How
> would
> you specifically restore a copy of the production db to the test server?
> Thanks...
> "Kevin3NF" wrote:
|||So, basically i need to copy the data.bak files to the local HD of the test
server and execute the backup statement. By log.bak did you mean .trn files?
"Uri Dimant" wrote:

> Razvan
> I think the OP is asking how to restore .bak file and are not getting any
> errors :-)
> morphius
> RESTORE DATABASE dbname FROM DISK='C:\db.bak' WITH FILE = 1,NORECOVERY
> RESTORE LOG dbname FROM DISK = 'C:\Log.bak' WITH FILE = 1, NORECOVERY
> RESTORE LOG dbname FROM DISK = 'C:\Log.bak' WITH FILE = 2, NORECOVERY
> .....
> RESTORE LOG dbname FROM DISK = 'C:\Log.bak' WITH FILE = n, RECOVERY
>
>
> "Razvan Socol" <rsocol@.gmail.com> wrote in message
> news:1165930086.612341.260330@.16g2000cwy.googlegro ups.com...
>
>
|||Yes, take a look at WITH MOVE option in the BOL as well
"morphius" <morphius@.discussions.microsoft.com> wrote in message
news:7C00AC18-E4EB-48EB-8134-8544FDE6FCD1@.microsoft.com...[vbcol=seagreen]
> So, basically i need to copy the data.bak files to the local HD of the
> test
> server and execute the backup statement. By log.bak did you mean .trn
> files?
> "Uri Dimant" wrote:
|||morphius wrote:
> So, basically i need to copy the data.bak files to the local HD of the test
> server and execute the backup statement. By log.bak did you mean .trn files?
>
Technically, NO, you don't HAVE to copy the BAK files to the local HD.
You can restore from a remote share:
RESTORE DATABASE foo FROM DISK = '\\server\sharename'
However, the SQL Server service account must have permission to read
from this network share. This is NOT, repeat, NOT the account that YOU
login to SQL with, this is the account that the SERVICE runs under.
Tracy McKibben
MCDBA
http://www.realsqlguy.com

Restore?

I am trying to restore a .bak to a test server in order to test the integrit
y
of my production DB backups but the test server rejects the .bak file becaus
e
it is a file used by the production server. A full and transactional backups
are used in the production DB. Any insights on how to perform a test restore
is highly appreciated.What error message are you getting ?
Razvan
morphius wrote:
> I am trying to restore a .bak to a test server in order to test the integr
ity
> of my production DB backups but the test server rejects the .bak file beca
use
> it is a file used by the production server. A full and transactional backu
ps
> are used in the production DB. Any insights on how to perform a test resto
re
> is highly appreciated.|||Please post the exact error message.
Is your test machine a separate instance on the same hardware, or a
completely different server?
Kevin Hill
3NF Consulting
http://www.3nf-inc.com/NewsGroups.htm
Real-world stuff I run across with SQL Server:
http://kevin3nf.blogspot.com
"morphius" <morphius@.discussions.microsoft.com> wrote in message
news:0AA8DE03-924A-41D8-A706-87E9F047B945@.microsoft.com...
>I am trying to restore a .bak to a test server in order to test the
>integrity
> of my production DB backups but the test server rejects the .bak file
> because
> it is a file used by the production server. A full and transactional
> backups
> are used in the production DB. Any insights on how to perform a test
> restore
> is highly appreciated.
>|||Razvan
I think the OP is asking how to restore .bak file and are not getting any
errors :-)
morphius
RESTORE DATABASE dbname FROM DISK='C:\db.bak' WITH FILE = 1,NORECOVERY
RESTORE LOG dbname FROM DISK = 'C:\Log.bak' WITH FILE = 1, NORECOVERY
RESTORE LOG dbname FROM DISK = 'C:\Log.bak' WITH FILE = 2, NORECOVERY
....
RESTORE LOG dbname FROM DISK = 'C:\Log.bak' WITH FILE = n, RECOVERY
"Razvan Socol" <rsocol@.gmail.com> wrote in message
news:1165930086.612341.260330@.16g2000cwy.googlegroups.com...
> What error message are you getting ?
> Razvan
> morphius wrote:
>|||morphius wrote:
> I am trying to restore a .bak to a test server in order to test the integr
ity
> of my production DB backups but the test server rejects the .bak file beca
use
> it is a file used by the production server. A full and transactional backu
ps
> are used in the production DB. Any insights on how to perform a test resto
re
> is highly appreciated.
>
My guess is you're restoring over an existing database, and the message
you're seeing is telling you that there are existing files, in which
case you need to use the WITH MOVE option on the RESTORE command.
Posting the full error message will tell us for sure.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||It is a totally different server. Maybe I am doing something wrong. How woul
d
you specifically restore a copy of the production db to the test server?
Thanks...
"Kevin3NF" wrote:

> Please post the exact error message.
> Is your test machine a separate instance on the same hardware, or a
> completely different server?
> --
> Kevin Hill
> 3NF Consulting
> http://www.3nf-inc.com/NewsGroups.htm
> Real-world stuff I run across with SQL Server:
> http://kevin3nf.blogspot.com
>
> "morphius" <morphius@.discussions.microsoft.com> wrote in message
> news:0AA8DE03-924A-41D8-A706-87E9F047B945@.microsoft.com...
>
>|||Hello,
1. Copy the Full database backup file to test server
2. Copy the Transaction log backup files to test servr
3. Open Query Analyzer (SQL2000) or SSMS (SQL 2005) in test server
4. Use RESTORE DATABASE Command with NORECOVERY and MOVE option to restore
the Full database
5. Resttore all the transaction log backups using RESTORE LOG WITH
NORECOVERY until last file
6. Restore the Last Log backup using RESTORE LOG WITH Recovery option. THsi
will make the database online
See the commands usage in books online...
Thanks
Hari
"morphius" <morphius@.discussions.microsoft.com> wrote in message
news:63F7B1D4-F3F2-43EB-81DD-065B7D6FF35B@.microsoft.com...[vbcol=seagreen]
> It is a totally different server. Maybe I am doing something wrong. How
> would
> you specifically restore a copy of the production db to the test server?
> Thanks...
> "Kevin3NF" wrote:
>|||So, basically i need to copy the data.bak files to the local HD of the test
server and execute the backup statement. By log.bak did you mean .trn files?
"Uri Dimant" wrote:

> Razvan
> I think the OP is asking how to restore .bak file and are not getting any
> errors :-)
> morphius
> RESTORE DATABASE dbname FROM DISK='C:\db.bak' WITH FILE = 1,NORECOVERY
> RESTORE LOG dbname FROM DISK = 'C:\Log.bak' WITH FILE = 1, NORECOVERY
> RESTORE LOG dbname FROM DISK = 'C:\Log.bak' WITH FILE = 2, NORECOVERY
> .....
> RESTORE LOG dbname FROM DISK = 'C:\Log.bak' WITH FILE = n, RECOVERY
>
>
> "Razvan Socol" <rsocol@.gmail.com> wrote in message
> news:1165930086.612341.260330@.16g2000cwy.googlegroups.com...
>
>|||Yes, take a look at WITH MOVE option in the BOL as well
"morphius" <morphius@.discussions.microsoft.com> wrote in message
news:7C00AC18-E4EB-48EB-8134-8544FDE6FCD1@.microsoft.com...[vbcol=seagreen]
> So, basically i need to copy the data.bak files to the local HD of the
> test
> server and execute the backup statement. By log.bak did you mean .trn
> files?
> "Uri Dimant" wrote:
>|||morphius wrote:
> So, basically i need to copy the data.bak files to the local HD of the tes
t
> server and execute the backup statement. By log.bak did you mean .trn file
s?
>
Technically, NO, you don't HAVE to copy the BAK files to the local HD.
You can restore from a remote share:
RESTORE DATABASE foo FROM DISK = '\\server\sharename'
However, the SQL Server service account must have permission to read
from this network share. This is NOT, repeat, NOT the account that YOU
login to SQL with, this is the account that the SERVICE runs under.
Tracy McKibben
MCDBA
http://www.realsqlguy.com

Restore: Cannot Open Backup Device

I am attempting to restore a database onto "Server_A" from a backup file
located on a disk from a different server, "Server_B". My T-SQL is the
following:
restore database [dbname] from disk = '\\server_b\e$\backups\[backupfile.bak]
'
1. I have a domain account set up, and the domain account is running SQLAgent
on Server_A. This service has been stopped and restarted, and even
MSSQLServer service has been stopped and restarted.
2. From Server_A I can UNC successfully to '\\server_b\e$\backups\[backupfile.
bak]'.
3. When I run master..xp_cmdshell 'dir \\server_b\e$\backups\[backupfile.bak]
' I get returned "Access is Denied"
What am I missing? Since I can successfully UNC to the directory and file on
Server_B, it seems there is something not set up right on SQL Server. Please
help.
--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/200507/1You need to give read / write permission on the shared folder
"\\server_b\e$\backups" to the account used by sql server and sql agent
services.
AMB
"Robert Richards via SQLMonster.com" wrote:
> I am attempting to restore a database onto "Server_A" from a backup file
> located on a disk from a different server, "Server_B". My T-SQL is the
> following:
> restore database [dbname] from disk = '\\server_b\e$\backups\[backupfile.bak]
> '
> 1. I have a domain account set up, and the domain account is running SQLAgent
> on Server_A. This service has been stopped and restarted, and even
> MSSQLServer service has been stopped and restarted.
> 2. From Server_A I can UNC successfully to '\\server_b\e$\backups\[backupfile.
> bak]'.
> 3. When I run master..xp_cmdshell 'dir \\server_b\e$\backups\[backupfile.bak]
> ' I get returned "Access is Denied"
> What am I missing? Since I can successfully UNC to the directory and file on
> Server_B, it seems there is something not set up right on SQL Server. Please
> help.
>
> --
> Message posted via SQLMonster.com
> http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/200507/1
>|||The account has full control on "\\server_b\e$\backups". As a check, I UNC'd
over to the directory and created a text file, just to test.
Alejandro Mesa wrote:
>You need to give read / write permission on the shared folder
>"\\server_b\e$\backups" to the account used by sql server and sql agent
>services.
>AMB
>> I am attempting to restore a database onto "Server_A" from a backup file
>> located on a disk from a different server, "Server_B". My T-SQL is the
>[quoted text clipped - 13 lines]
>> Server_B, it seems there is something not set up right on SQL Server. Please
>> help.
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/200507/1|||RESOLUTION:
Not only did I have to have the domain account running SQLAgent, but I also
had to have the domain account running MSSQLServer on Server_A.
Robert Richards wrote:
>I am attempting to restore a database onto "Server_A" from a backup file
>located on a disk from a different server, "Server_B". My T-SQL is the
>following:
>restore database [dbname] from disk = '\\server_b\e$\backups\[backupfile.bak]
>'
>1. I have a domain account set up, and the domain account is running SQLAgent
>on Server_A. This service has been stopped and restarted, and even
>MSSQLServer service has been stopped and restarted.
>2. From Server_A I can UNC successfully to '\\server_b\e$\backups\[backupfile.
>bak]'.
>3. When I run master..xp_cmdshell 'dir \\server_b\e$\backups\[backupfile.bak]
>' I get returned "Access is Denied"
>What am I missing? Since I can successfully UNC to the directory and file on
>Server_B, it seems there is something not set up right on SQL Server. Please
>help.
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/200507/1|||Robert,
> The account has full control on "\\server_b\e$\backups". As a check, I UNC'd
> over to the directory and created a text file, just to test.
I am not talking about your account, I am talking about the domain account
used by sql server and sql agent services.
Why can't I backup/restore my SQL Server database to a share on another
server?
http://www.windowsitpro.com/Article/ArticleID/14025/14025.html
AMB
"Robert Richards via SQLMonster.com" wrote:
> The account has full control on "\\server_b\e$\backups". As a check, I UNC'd
> over to the directory and created a text file, just to test.
> Alejandro Mesa wrote:
> >You need to give read / write permission on the shared folder
> >"\\server_b\e$\backups" to the account used by sql server and sql agent
> >services.
> >
> >AMB
> >
> >> I am attempting to restore a database onto "Server_A" from a backup file
> >> located on a disk from a different server, "Server_B". My T-SQL is the
> >[quoted text clipped - 13 lines]
> >> Server_B, it seems there is something not set up right on SQL Server. Please
> >> help.
>
> --
> Message posted via SQLMonster.com
> http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/200507/1
>

Restore.RelocateFiles

Hi,

I'm trying to restore a *.bak file into a different database.

Old Database SVW_TEST (from where the *.bak file is):

SVW_TEST_DATA - d:\SVW_TEST_DATA.mdf
SVW_TEST_DATA - d:\SVW_TEST_LOG.ldf

New Database SVW (to restore to):

SVW_DATA - d:\SVW_DATA.mdf
SVW_DATA - d:\SVW_LOG.ldf

I used the following code:

Dim pRestore As New Restore

pRestore.Action = SQLDMORestore_Database
pRestore.Database = "SVW"
pRestore.ReplaceDatabase = True

pRestore.Files = "D:\SVW_TEST.bak"

pRestore.RelocateFiles = "SVW_Test_Data, D:\SVW_DATA.mdf, SVW_TEST_LOG, D:\SVW_LOG.ldf"

pRestore.SQLRestore pServer

But it would work: I get an error saying that "The logical file 'SQL' is not part of the SVW-Database". Why 'SQL' ??
I also tried this version:

pRestore.RelocateFiles = "SVW_Data, D:\SVW_DATA.mdf, SVW_LOG, D:\SVW_LOG.ldf"

There I get an error saying that "The logical file 'SVW_DATA' is not part of the SVW-Database".

Can someone please help.I found the problem myself. I just had to put [] arround the names:

pRestore.RelocateFiles = "[SVW_Test_Data], [D:\SVW_DATA.mdf], [SVW_TEST_LOG], [D:\SVW_LOG.ldf]"

eventhough in some examples i found, it was with out them......

Restore with scheduler!

Is there anyway you can schedule to restore a database table(s) from a backup file *.bak?


I think you can restore a entire db from a backup but not selected tables........you can restore the
entire db from a perticular days backup file and then script out the objects you need and run
it in some development or uat servers to recreate it there......

|||

Which version and edition of sql server u have? Yes u can schedule tasks in sql server. SQL Server Agent is the scheduller for SQL Server. You can create Jobs which run periodically as u scheduled. But if u have SQL Server 2005 Experss , then sql server agent is not available in that edition. Then u may use Windows Scheduller and SQLCMD command to schedule tasks.

As already mentioned you can not restore only few tables from a DB backup. But there are method alternate methods like restore the whole db with some temp name ,pump the table and drop the database etc etc.

Read about *JOBS* in BOL

and if u want further assistance pse let us know

Madhu

sql

RESTORE WITH REPLACE

Hi all, I am restoring a database just like from BOL
RESTORE DATABASE MyNwind
FROM MyNwind_1
WITH FILE = 1, STATS=10, RECOVERY,
MOVE 'MyNwind' TO 'c:\MSSQL\Data\NewNwind.mdf',
MOVE 'MyNwindLog1' TO 'c:\MSSQL\Data\NewNwind.ldf'
I do have the database MyNwind already, but it
it is restored anyway without any problems or warnings. I though that one
would need to use the REPLACE clause to achieve this.
The REPLACE option is not needed when the source and target database names
are the same. From the Books Online:
<Excerpt href="http://links.10026.com/?link=tsqlref.chm::/ts_ra-rz_25rm.htm">
When the REPLACE option is not specified, a safety check occurs (which
prevents overwriting a different database by accident). The safety check
ensures that the RESTORE DATABASE statement will not restore the database to
the current server if:
The database named in the RESTORE statement already exists on the current
server, and
The database name is different from the database name recorded in the backup
set.
REPLACE also allows RESTORE to overwrite an existing file which cannot be
verified as belonging to the database being restored. Normally, RESTORE will
refuse to overwrite pre-existing files.
</Excerpt>
Hope this helps.
Dan Guzman
SQL Server MVP
"Ruski" <Ruski@.discussions.microsoft.com> wrote in message
news:CB543689-E5A9-4253-AF29-01048D208C1C@.microsoft.com...
> Hi all, I am restoring a database just like from BOL
> RESTORE DATABASE MyNwind
> FROM MyNwind_1
> WITH FILE = 1, STATS=10, RECOVERY,
> MOVE 'MyNwind' TO 'c:\MSSQL\Data\NewNwind.mdf',
> MOVE 'MyNwindLog1' TO 'c:\MSSQL\Data\NewNwind.ldf'
> I do have the database MyNwind already, but it
> it is restored anyway without any problems or warnings. I though that one
> would need to use the REPLACE clause to achieve this.
>

RESTORE WITH REPLACE

Hi all, I am restoring a database just like from BOL
RESTORE DATABASE MyNwind
FROM MyNwind_1
WITH FILE = 1, STATS=10, RECOVERY,
MOVE 'MyNwind' TO 'c:\MSSQL\Data\NewNwind.mdf',
MOVE 'MyNwindLog1' TO 'c:\MSSQL\Data\NewNwind.ldf'
I do have the database MyNwind already, but it
it is restored anyway without any problems or warnings. I though that one
would need to use the REPLACE clause to achieve this.The REPLACE option is not needed when the source and target database names
are the same. From the Books Online:
<Excerpt href="http://links.10026.com/?link=tsqlref.chm::/ts_ra-rz_25rm.htm">
When the REPLACE option is not specified, a safety check occurs (which
prevents overwriting a different database by accident). The safety check
ensures that the RESTORE DATABASE statement will not restore the database to
the current server if:
The database named in the RESTORE statement already exists on the current
server, and
The database name is different from the database name recorded in the backup
set.
REPLACE also allows RESTORE to overwrite an existing file which cannot be
verified as belonging to the database being restored. Normally, RESTORE will
refuse to overwrite pre-existing files.
</Excerpt>
Hope this helps.
Dan Guzman
SQL Server MVP
"Ruski" <Ruski@.discussions.microsoft.com> wrote in message
news:CB543689-E5A9-4253-AF29-01048D208C1C@.microsoft.com...
> Hi all, I am restoring a database just like from BOL
> RESTORE DATABASE MyNwind
> FROM MyNwind_1
> WITH FILE = 1, STATS=10, RECOVERY,
> MOVE 'MyNwind' TO 'c:\MSSQL\Data\NewNwind.mdf',
> MOVE 'MyNwindLog1' TO 'c:\MSSQL\Data\NewNwind.ldf'
> I do have the database MyNwind already, but it
> it is restored anyway without any problems or warnings. I though that one
> would need to use the REPLACE clause to achieve this.
>

RESTORE WITH REPLACE

Hi all, I am restoring a database just like from BOL
RESTORE DATABASE MyNwind
FROM MyNwind_1
WITH FILE = 1, STATS=10, RECOVERY,
MOVE 'MyNwind' TO 'c:\MSSQL\Data\NewNwind.mdf',
MOVE 'MyNwindLog1' TO 'c:\MSSQL\Data\NewNwind.ldf'
I do have the database MyNwind already, but it
it is restored anyway without any problems or warnings. I though that one
would need to use the REPLACE clause to achieve this.The REPLACE option is not needed when the source and target database names
are the same. From the Books Online:
<Excerpt href="http://links.10026.com/?link=tsqlref.chm::/ts_ra-rz_25rm.htm">
When the REPLACE option is not specified, a safety check occurs (which
prevents overwriting a different database by accident). The safety check
ensures that the RESTORE DATABASE statement will not restore the database to
the current server if:
The database named in the RESTORE statement already exists on the current
server, and
The database name is different from the database name recorded in the backup
set.
REPLACE also allows RESTORE to overwrite an existing file which cannot be
verified as belonging to the database being restored. Normally, RESTORE will
refuse to overwrite pre-existing files.
</Excerpt>
Hope this helps.
Dan Guzman
SQL Server MVP
"Ruski" <Ruski@.discussions.microsoft.com> wrote in message
news:CB543689-E5A9-4253-AF29-01048D208C1C@.microsoft.com...
> Hi all, I am restoring a database just like from BOL
> RESTORE DATABASE MyNwind
> FROM MyNwind_1
> WITH FILE = 1, STATS=10, RECOVERY,
> MOVE 'MyNwind' TO 'c:\MSSQL\Data\NewNwind.mdf',
> MOVE 'MyNwindLog1' TO 'c:\MSSQL\Data\NewNwind.ldf'
> I do have the database MyNwind already, but it
> it is restored anyway without any problems or warnings. I though that one
> would need to use the REPLACE clause to achieve this.
>

restore with replace

I was testing a restore using a backup of db1 and
restoring to db2. Both db1 and db2 already exist and have
the same file structure. The restore was also moving the
db1 files to the db2 file locations. I did not specify
with replace. I expected the restore to fail, but it
didn't. What am I missing?Through a job in EM. Below is sql.
restore database SynComp_219
from disk = '\\hfddbms1p\d-
drive\mssql\backup\synygy_1t_1206a_0711.bak'
with
move 'metadata_001' to 'D:\MSSQL$INST1
\Data\metadata_IC_APP\metadata_001.mdf',
move 'datasets_001' to 'D:\MSSQL$INST1
\Data\metadata_IC_APP\datasets_001.ndf',
move 'indexes_001' to 'D:\MSSQL$INST1
\Data\metadata_IC_APP\indexes_001.ndf',
move 'logs_001' to 'E:\MSSQL$INST1\log\logs_001.ldf',
recovery,
stats = 5
>--Original Message--
>GM
>How did you perform restore command ? by T-SQL or EM.
>"GM" <gamaglia@.lnc.com> wrote in message
>news:9cf201c35c29$0ee50350$a001280a@.phx.gbl...
>> I was testing a restore using a backup of db1 and
>> restoring to db2. Both db1 and db2 already exist and
have
>> the same file structure. The restore was also moving the
>> db1 files to the db2 file locations. I did not specify
>> with replace. I expected the restore to fail, but it
>> didn't. What am I missing?
>
>.
>

Wednesday, March 28, 2012

Restore using SQLDMO

I am using SQLDMO for restoring database from back up file . If the back up file version(SQL2000) is differenent than database version(SQL Express) I am trying to restore, does SQLDMO performs upgrade if the backup files are an earlier version. if no how can i handle that situation?It should restore the database on the server, but set it to compatability level 80, so the SQL 2000 functionality will still be there.

Restore transaction log?????

Hi all,
I had been made full backup, differential backup, transaction log backup. I want to create new database from these file backup.
I did it follow:
1. Create new database from full backup file, it is ok. then
2. restore this database use transaction log backup file, an message raise :
"The proceding restore operation did not specify WITH NORECOVERY or WITH STANBY. Restart the restore sequence, specfying WITH NORECOVERY or WITH SATNBY for all but the final step... "
thank for reading.if you're restoring the full backup using gui, then check the box saying something about leaving the database in the loading state...wait...yes, leave database nonoperational but able to restore additional transaction logs...there, that's what it say :)|||Originally posted by ms_sql_dba
if you're restoring the full backup using gui, then check the box saying something about leaving the database in the loading state...wait...yes, leave database nonoperational but able to restore additional transaction logs...there, that's what it say :)

thank you,
i do follow your guide, but it does not work. please show me again
best regard.|||You cannot restore a backup if you will be applying a log or differential backup without specifying it not be in recoverable status.|||Originally posted by rhigdon
You cannot restore a backup if you will be applying a log or differential backup without specifying it not be in recoverable status.

Thanks, but i can not understan what you mean, please show me.
Best regard|||Do you have BOL installed? This is from BOL - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adminsql/ad_bkprst_565v.asp

Try this script to illustrate:
--Add devices
USE master
EXEC sp_addumpdevice 'disk', 'MyFull',
'c:\myfull.dat'
EXEC sp_addumpdevice 'disk', 'MyDiff',
'c:\MyDiff.dat'
EXEC sp_addumpdevice 'disk', 'MyLog',
'c:\MyLog.dat'
--create database
create database blah
--set recovery model
alter database blah set recovery full
--do our backups
backup database blah to MyFull

use blah
create table afterfull(ident int identity(1,1))

BACKUP DATABASE blah TO MyDiff WITH DIFFERENTIAL

use blah
drop table afterfull
create table afterdiff (ident int identity(1,1))

backup log blah to MyLog

--Now start our restores
use master
RESTORE DATABASE blah
FROM MyFull
--The above works, this was the full backup
RESTORE DATABASE blah
FROM MyDiff
--The above does not work as you did the full restore without specifying "with recovery"
RESTORE DATABASE blah
FROM MyFull
with norecovery
RESTORE DATABASE blah
FROM MyDiff
--the above works as we specified norecovery with the full restore
--now try the tran log
RESTORE log blah
FROM MyLog
--Look familiar? We need to use the NORECOVERY with the full and DIFF so we can apply the log backup
RESTORE DATABASE blah
FROM MyFull
with norecovery
RESTORE DATABASE blah
FROM MyDiff
with norecovery
RESTORE log blah
FROM MyLog
--Voila!|||1. Create New Database
2. right click all task and restore database
3. tab options at Recovery completion state select "Leave database read-only and able to restore additional transaction logs"

Restore tranlog backup file

I have 2 questions, and I appreciate if somebody can help me to figure out the good way to do. Thanks a lot.

1/. If I want to restore tranlog backup file from linked server to SQL Server 2000, Is the database online or offline during that time (since I want to make sure db online for users, but not offline)

2/. Can I restore tranlog backup file from SQL Server 2000 to SQL Server 2005 database?1) Your question is not completely clear, you want to restore a tranlog from "linked server to SQL Server 2000"?
But in general to restore a tranlog you will first have to restore a previous FULL BACKUP and all following tranlog backups until the tranlog you wish to restore last. During this whole process the db is in recovery mode, this means it is not possible to connect to this database.

2) Sadly I cannot answer this question for you because I don't know :(|||To the 1st question, I mean I want to restore the last tranlog backup file from Linked Server to SQL Server2000 (that I am using now) since I did backup from Linked Server and want to restore it in the current server.|||Could you explain what you mean by Linked Server. To my knowledge that's just a link between two SQL instances and has nothing to do with log backups.|||Oh, Linked server here I just mean another server (named Enterprise Server)linked to the SQL Server 2000 that I am using now. And I use the tranlog backup file in The Enterprise server to restore in SQL Server 2000. Actually, The Enterprise Server (linked server) does the whole database backup and I want to restore the tranlog backup file in SQL Server 2000.
When you open 'Enterprise Manager' in SQL Server 2000,
click 'Security' in the tree of the sql instance, you will see 'Linked Servers' located.
Thanks for concern|||BACKUP DATABASE [master] TO DISK = N'\\dca-05\sqldumps\Daily\DCA-SIEBDB_master_db_complete.BAK' WITH INIT , NOUNLOAD , NAME = N'master backup', NOSKIP , STATS = 10, NOFORMAT

When this is run as a job I get errors. If i run this from the anlyzer it run fine.|||Agent jobs run under the Agent login privileges and not yours. QA runs under your credentials. If the agent does not have the proper access on both machines, it fails.

Either make the agent account a local admin on both machines (if same domain), a domain admin, or build a trust relationship if different domains.|||Agent jobs run under the Agent login privileges and not yours. QA runs under your credentials. If
Not to undermine the point you're making but the access to the file share goes under the credentials of SQL Server, not the credentials QA is running under.

But we're diverting from the question from jennyphb, this should be a seperate thread!

@.jennyphb: I stand with my first answer that in order to restore a tx-log you will first have to restore a full backup (with NO RECOVERY) and subsequently the tx-log. During this time the db will be inaccessible to anyone.|||Is there anyone who can help me to answer my 2nd question:

"Can I restore tranlog backup file from sql server 2000 to sql server 2005 database? (the same db but just different server since I want to upgrade to sql server 2005)."

Thank you very much.|||Thank you Lexiflex for your 1st answer.|||Sure, This can be done. You should have the same rights and credential as on the other machine.|||Is there anyone who can help me to answer my 2nd question:

"Can I restore tranlog backup file from sql server 2000 to sql server 2005 database? (the same db but just different server since I want to upgrade to sql server 2005)."

Thank you very much.

you can restore a 2k database backup to a 2k5 server but I am not sure and i doubt this would work. I would test it on a database that is not in production.|||I've done this before only with 2000 many times. I haven't done ti with a 2000 backup to restore on 2005. Simple. Just use the DTS utility to bring everything over to setup all the protocals in 2005. Then just load the data.

G That's me|||what do you mean "everything"?
and how do you load the data? detach/attach? ...
thanks|||First of all, calm down. I can see by the number of post this can be a little overwelming. It happen to me to like most people in this industry. Please see attachment screen shoots

Monday, March 26, 2012

Restore to new server

I restored a backup from our main server to a new server. First I copied
that backup file, then executed a script basically Restore with move,
replace (I replaced an empty database I created to test the connection).
It ran for a minute or two, then said successful, but here it is 2 hours
later and the new database is still unavailable and says it's restoring.
The backup file was just shy of 1 GB.
Is this the kind of time frame I should be expecting?
Probably not. What happens if you do a restore databaseName with Recovery?
Does that make the database accessible.
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
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
"Usarian" <noemail@.nojunk.com> wrote in message
news:elcLpnv7GHA.4620@.TK2MSFTNGP02.phx.gbl...
>I restored a backup from our main server to a new server. First I copied
>that backup file, then executed a script basically Restore with move,
>replace (I replaced an empty database I created to test the connection).
> It ran for a minute or two, then said successful, but here it is 2 hours
> later and the new database is still unavailable and says it's restoring.
> The backup file was just shy of 1 GB.
> Is this the kind of time frame I should be expecting?
>

restore to new db restores less data than what is in the source backup file

I am trying to create sql code that restores a backup of a master database to a new database on the same server. It seems to run correctly as no errors are produced. However, the most recent updates to the master database are not present in the new databases. All databases are using the Full recovery model. What is really strange is that if I do (what I think is) the same function in Enterprise Administrator, the restore works fine! For both methods I used the same backup file!



Any and all help is sincerely appreciated.


The master databases from which the backups are made start with MODTRNMaster

The databases which are created from the restores start with M1_ and M2_. (We call them training room databases.)



My script for backing up the master databases:



-- Backup the master training database

backup database MODTRNMaster
to disk = 'f:\bkup\MODTRNMaster.bak'

backup database MODTRNMaster_IMG
to disk = 'f:\bkup\MODTRNMaster_IMG.bak'

backup database MODTRNMaster_MNC
to disk = 'f:\bkup\MODTRNMaster_MNC.bak'

backup database MODTRNMaster_VM
to disk = 'f:\bkup\MODTRNMaster_VM.bak'

go


This is the restore script for restoring the first training room databases. Im hoping that there is just something simple that Im overlooking in these restore statements! J



-- Restore the backup of the master training database into the

-- training room #1 database.

use master
go

drop database M1_MSLH
go

restore database M1_MSLH
from disk = 'f:\bkup\MODTRNMaster.bak'
with move 'DEV5_Data' to 'f:\mssql\data\M1_MLSH.mdf',
move 'MM' to 'f:\mssql\data\M1_MLSH_1.mdf',
move 'AMB' to 'f:\mssql\data\M1_MLSH_2.mdf',
move 'DM' to 'f:\mssql\data\M1_MLSH_3.mdf',
move 'IMM' to 'f:\mssql\data\M1_MLSH_4.mdf',
move 'ED' to 'f:\mssql\data\M1_MLSH_5.mdf',
move 'DEV5_Log' to 'f:\mssql\log\M1_MLSH_log.ldf',
recovery

go



Thanks in advance

:eek:

:eek:that surely sounds like some magic. I do not know off the the top of my head what the problem could be but you should only have one mdf file and the rest of your data files should be ndfs.|||I am trying to create sql code that restores a backup of a master database to a new database on the same server. It seems to run correctly as no errors are produced. However, the most recent updates to the master database are not present in the new databases. All databases are using the Full recovery model. What is really strange is that if I do (what I think is) the same function in Enterprise Administrator, the restore works fine! For both methods I used the same backup file!

Are you sure that the master database is in full recovery mode? I did not think that was possible and/or mattered.

Also, even if it is in full recovery, your restore script indicated that you had restored only the last full backup (.BAK) file and had not restored any transaction logs (.TRN). Without restoring the transaction logs, you will only restore the database to the point in time when the last full backup completed; any transacations performed after that will not get restored.

Finally, I have to ask: why are you restoring the master database? I'm not sure that doing so gets you anything (except maybe practice).

Regards,

hmscott|||sorry. I should have been a little clearer. :o It is not actually THE master database that I'm backing up. We are having some training sessions for users of a new system. The trainer makes his updates in a database named MODTRNMaster (the master database for our purposes). At night I am restoring into 2 individual training databases M1_MLSH and M2_MLSH that the users are accessing.

No transaction log backups are being done. These databases are only being accessed during the day. At night there is no activity in those databases. At night I backup MODTRNMaster and then immediately (attempt to) restore the backup file as M1_MLSH and then again as M2_MLSH.|||You need to add with init to your backup commands, or with file = # to the restore commands. By default, SQL Server will append your backup to the exisiting file (you may have noticed them getting bigger), and restore from the first backup found. Do this and get back to us with the results:

restore headeronly from disk = 'f:\bkup\MODTRNMaster.bak'|||Thanks So much for your suggestion! Adding the "init" parameter to the backup database statement was exactly what was needed!! :D

Restore to different server

If I am restoring a database from a backup file on disk on Server_A to a
database on Server_B, in the restore syntax do I need to specify the "with
move" clause if the data and log files as backed up on Server_A are going to
be restored into differently named directories on Server_B?
Message posted via droptable.com
http://www.droptable.com/Uwe/Forums...erver/200507/1
Here's an example of moving from one location to another.
restore database bar
from disk = 'c:\Program Files\Microsoft SQL Server\MSSQL\Backup\foo.BAK'
with move 'fooData' to 'c:\Program Files\Microsoft SQL
Server\MSSQL\Data\bar.mdf',
move 'fooLog' to 'c:\Program Files\Microsoft SQL
Server\MSSQL\Data\bar_log.ldf',
UNLOAD ,
replace
"Robert Richards via droptable.com" wrote:

> If I am restoring a database from a backup file on disk on Server_A to a
> database on Server_B, in the restore syntax do I need to specify the "with
> move" clause if the data and log files as backed up on Server_A are going to
> be restored into differently named directories on Server_B?
>
> --
> Message posted via droptable.com
> http://www.droptable.com/Uwe/Forums...erver/200507/1
>
|||Hi,
If you are restoring the database into different directories which is
differing to source directory, then you have to say
with MOVE clause in RESTORE DATABASE command.
Syntax:-
RESTORE DATABASE MyNwind FROM Disk='D:\Backup\MyNwind.BAK'
WITH MOVE 'MyNwind' TO 'c:\Program Files\Microsoft SQL
Server\MSSQL\Data\NewNwind.mdf',
MOVE 'MyNwindLog1' TO 'c:\Program Files\Microsoft SQL
Server\MSSQL\Data\NewNwind.ldf', STATS=10
Thanks
Hari
SQL Server MVP
"Robert Richards via droptable.com" <forum@.droptable.com> wrote in message
news:515E51CF9507A@.droptable.com...
> If I am restoring a database from a backup file on disk on Server_A to a
> database on Server_B, in the restore syntax do I need to specify the "with
> move" clause if the data and log files as backed up on Server_A are going
> to
> be restored into differently named directories on Server_B?
>
> --
> Message posted via droptable.com
> http://www.droptable.com/Uwe/Forums...erver/200507/1
|||Just curious, do the data files and such on the originating server remain
usable after the restore to the destination server? That is, I am creating a
backup of production for testing, and I of course want my production database
to remain.
Hari Prasad wrote:[vbcol=seagreen]
>Hi,
>If you are restoring the database into different directories which is
>differing to source directory, then you have to say
>with MOVE clause in RESTORE DATABASE command.
>Syntax:-
>RESTORE DATABASE MyNwind FROM Disk='D:\Backup\MyNwind.BAK'
>WITH MOVE 'MyNwind' TO 'c:\Program Files\Microsoft SQL
>Server\MSSQL\Data\NewNwind.mdf',
> MOVE 'MyNwindLog1' TO 'c:\Program Files\Microsoft SQL
>Server\MSSQL\Data\NewNwind.ldf', STATS=10
>Thanks
>Hari
>SQL Server MVP
Message posted via droptable.com
http://www.droptable.com/Uwe/Forums...erver/200507/1
|||When you do a backup it essentially makes a pseudo copy. Nothing happens to
the original files at all.
Andrew J. Kelly SQL MVP
"Robert Richards via droptable.com" <forum@.droptable.com> wrote in message
news:515FA18FA3868@.droptable.com...
> Just curious, do the data files and such on the originating server remain
> usable after the restore to the destination server? That is, I am creating
> a
> backup of production for testing, and I of course want my production
> database
> to remain.
> Hari Prasad wrote:
>
> --
> Message posted via droptable.com
> http://www.droptable.com/Uwe/Forums...erver/200507/1

Restore to different server

If I am restoring a database from a backup file on disk on Server_A to a
database on Server_B, in the restore syntax do I need to specify the "with
move" clause if the data and log files as backed up on Server_A are going to
be restored into differently named directories on Server_B?
Message posted via droptable.com
http://www.droptable.com/Uwe/Forum...server/200507/1Here's an example of moving from one location to another.
restore database bar
from disk = 'c:\Program Files\Microsoft SQL Server\MSSQL\Backup\foo.BAK'
with move 'fooData' to 'c:\Program Files\Microsoft SQL
Server\MSSQL\Data\bar.mdf',
move 'fooLog' to 'c:\Program Files\Microsoft SQL
Server\MSSQL\Data\bar_log.ldf',
UNLOAD ,
replace
"Robert Richards via droptable.com" wrote:

> If I am restoring a database from a backup file on disk on Server_A to a
> database on Server_B, in the restore syntax do I need to specify the "with
> move" clause if the data and log files as backed up on Server_A are going
to
> be restored into differently named directories on Server_B?
>
> --
> Message posted via droptable.com
> http://www.droptable.com/Uwe/Forum...server/200507/1
>|||Hi,
If you are restoring the database into different directories which is
differing to source directory, then you have to say
with MOVE clause in RESTORE DATABASE command.
Syntax:-
RESTORE DATABASE MyNwind FROM Disk='D:\Backup\MyNwind.BAK'
WITH MOVE 'MyNwind' TO 'c:\Program Files\Microsoft SQL
Server\MSSQL\Data\NewNwind.mdf',
MOVE 'MyNwindLog1' TO 'c:\Program Files\Microsoft SQL
Server\MSSQL\Data\NewNwind.ldf', STATS=10
Thanks
Hari
SQL Server MVP
"Robert Richards via droptable.com" <forum@.droptable.com> wrote in message
news:515E51CF9507A@.droptable.com...
> If I am restoring a database from a backup file on disk on Server_A to a
> database on Server_B, in the restore syntax do I need to specify the "with
> move" clause if the data and log files as backed up on Server_A are going
> to
> be restored into differently named directories on Server_B?
>
> --
> Message posted via droptable.com
> http://www.droptable.com/Uwe/Forum...server/200507/1|||Just curious, do the data files and such on the originating server remain
usable after the restore to the destination server? That is, I am creating a
backup of production for testing, and I of course want my production databas
e
to remain.
Hari Prasad wrote:[vbcol=seagreen]
>Hi,
>If you are restoring the database into different directories which is
>differing to source directory, then you have to say
>with MOVE clause in RESTORE DATABASE command.
>Syntax:-
>RESTORE DATABASE MyNwind FROM Disk='D:\Backup\MyNwind.BAK'
>WITH MOVE 'MyNwind' TO 'c:\Program Files\Microsoft SQL
>Server\MSSQL\Data\NewNwind.mdf',
> MOVE 'MyNwindLog1' TO 'c:\Program Files\Microsoft SQL
>Server\MSSQL\Data\NewNwind.ldf', STATS=10
>Thanks
>Hari
>SQL Server MVP
>
Message posted via droptable.com
http://www.droptable.com/Uwe/Forum...server/200507/1|||When you do a backup it essentially makes a pseudo copy. Nothing happens to
the original files at all.
Andrew J. Kelly SQL MVP
"Robert Richards via droptable.com" <forum@.droptable.com> wrote in message
news:515FA18FA3868@.droptable.com...
> Just curious, do the data files and such on the originating server remain
> usable after the restore to the destination server? That is, I am creating
> a
> backup of production for testing, and I of course want my production
> database
> to remain.
> Hari Prasad wrote:
>
> --
> Message posted via droptable.com
> http://www.droptable.com/Uwe/Forum...server/200507/1sql

Restore to different server

If I am restoring a database from a backup file on disk on Server_A to a
database on Server_B, in the restore syntax do I need to specify the "with
move" clause if the data and log files as backed up on Server_A are going to
be restored into differently named directories on Server_B?
--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/200507/1Here's an example of moving from one location to another.
restore database bar
from disk = 'c:\Program Files\Microsoft SQL Server\MSSQL\Backup\foo.BAK'
with move 'fooData' to 'c:\Program Files\Microsoft SQL
Server\MSSQL\Data\bar.mdf',
move 'fooLog' to 'c:\Program Files\Microsoft SQL
Server\MSSQL\Data\bar_log.ldf',
UNLOAD ,
replace
"Robert Richards via SQLMonster.com" wrote:
> If I am restoring a database from a backup file on disk on Server_A to a
> database on Server_B, in the restore syntax do I need to specify the "with
> move" clause if the data and log files as backed up on Server_A are going to
> be restored into differently named directories on Server_B?
>
> --
> Message posted via SQLMonster.com
> http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/200507/1
>|||Hi,
If you are restoring the database into different directories which is
differing to source directory, then you have to say
with MOVE clause in RESTORE DATABASE command.
Syntax:-
RESTORE DATABASE MyNwind FROM Disk='D:\Backup\MyNwind.BAK'
WITH MOVE 'MyNwind' TO 'c:\Program Files\Microsoft SQL
Server\MSSQL\Data\NewNwind.mdf',
MOVE 'MyNwindLog1' TO 'c:\Program Files\Microsoft SQL
Server\MSSQL\Data\NewNwind.ldf', STATS=10
Thanks
Hari
SQL Server MVP
"Robert Richards via SQLMonster.com" <forum@.SQLMonster.com> wrote in message
news:515E51CF9507A@.SQLMonster.com...
> If I am restoring a database from a backup file on disk on Server_A to a
> database on Server_B, in the restore syntax do I need to specify the "with
> move" clause if the data and log files as backed up on Server_A are going
> to
> be restored into differently named directories on Server_B?
>
> --
> Message posted via SQLMonster.com
> http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/200507/1|||Just curious, do the data files and such on the originating server remain
usable after the restore to the destination server? That is, I am creating a
backup of production for testing, and I of course want my production database
to remain.
Hari Prasad wrote:
>Hi,
>If you are restoring the database into different directories which is
>differing to source directory, then you have to say
>with MOVE clause in RESTORE DATABASE command.
>Syntax:-
>RESTORE DATABASE MyNwind FROM Disk='D:\Backup\MyNwind.BAK'
>WITH MOVE 'MyNwind' TO 'c:\Program Files\Microsoft SQL
>Server\MSSQL\Data\NewNwind.mdf',
> MOVE 'MyNwindLog1' TO 'c:\Program Files\Microsoft SQL
>Server\MSSQL\Data\NewNwind.ldf', STATS=10
>Thanks
>Hari
>SQL Server MVP
>> If I am restoring a database from a backup file on disk on Server_A to a
>> database on Server_B, in the restore syntax do I need to specify the "with
>> move" clause if the data and log files as backed up on Server_A are going
>> to
>> be restored into differently named directories on Server_B?
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/200507/1|||When you do a backup it essentially makes a pseudo copy. Nothing happens to
the original files at all.
--
Andrew J. Kelly SQL MVP
"Robert Richards via SQLMonster.com" <forum@.SQLMonster.com> wrote in message
news:515FA18FA3868@.SQLMonster.com...
> Just curious, do the data files and such on the originating server remain
> usable after the restore to the destination server? That is, I am creating
> a
> backup of production for testing, and I of course want my production
> database
> to remain.
> Hari Prasad wrote:
>>Hi,
>>If you are restoring the database into different directories which is
>>differing to source directory, then you have to say
>>with MOVE clause in RESTORE DATABASE command.
>>Syntax:-
>>RESTORE DATABASE MyNwind FROM Disk='D:\Backup\MyNwind.BAK'
>>WITH MOVE 'MyNwind' TO 'c:\Program Files\Microsoft SQL
>>Server\MSSQL\Data\NewNwind.mdf',
>> MOVE 'MyNwindLog1' TO 'c:\Program Files\Microsoft SQL
>>Server\MSSQL\Data\NewNwind.ldf', STATS=10
>>Thanks
>>Hari
>>SQL Server MVP
>> If I am restoring a database from a backup file on disk on Server_A to a
>> database on Server_B, in the restore syntax do I need to specify the
>> "with
>> move" clause if the data and log files as backed up on Server_A are
>> going
>> to
>> be restored into differently named directories on Server_B?
>
> --
> Message posted via SQLMonster.com
> http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/200507/1

Restore to different file size

My production database files total about 100GB, of which about 35GB is used.
My test machine has about 60GB available, so has plenty of room to
accommodate the entire database. When I try to restore a full backup though,
it screams at me that there is not enough disk space.
I created a new database with 40GB of data files, and that should be enough
to hold all the data. How can I keep the restore process from trying to
create exactly the same file configuration as the original database?
You can't.
The SQL restore process requires the creation of exactly the same file sizes
on the target system as existed on the originating system. I suggest
purchasing an external HDD, restorign to that, shrinking, then moving the
data files.
Geoff N. Hiten
Senior SQL Infrastructure Consultant
Microsoft SQL Server MVP
"Daniel Rimmelzwaan (MVP - Dynamics NAV)" <daniel@.nadaspam.risplus.com>
wrote in message news:Ow$oUoH0HHA.1168@.TK2MSFTNGP02.phx.gbl...
> My production database files total about 100GB, of which about 35GB is
> used. My test machine has about 60GB available, so has plenty of room to
> accommodate the entire database. When I try to restore a full backup
> though, it screams at me that there is not enough disk space.
> I created a new database with 40GB of data files, and that should be
> enough to hold all the data. How can I keep the restore process from
> trying to create exactly the same file configuration as the original
> database?
|||I was afraid of that. Thanks Geoff.
"Geoff N. Hiten" <SQLCraftsman@.gmail.com> wrote in message
news:OcDFQuH0HHA.1208@.TK2MSFTNGP03.phx.gbl...
> You can't.
> The SQL restore process requires the creation of exactly the same file
> sizes on the target system as existed on the originating system. I
> suggest purchasing an external HDD, restorign to that, shrinking, then
> moving the data files.
> --
> Geoff N. Hiten
> Senior SQL Infrastructure Consultant
> Microsoft SQL Server MVP
>
>
> "Daniel Rimmelzwaan (MVP - Dynamics NAV)" <daniel@.nadaspam.risplus.com>
> wrote in message news:Ow$oUoH0HHA.1168@.TK2MSFTNGP02.phx.gbl...
>

Restore to different file size

My production database files total about 100GB, of which about 35GB is used.
My test machine has about 60GB available, so has plenty of room to
accommodate the entire database. When I try to restore a full backup though,
it screams at me that there is not enough disk space.
I created a new database with 40GB of data files, and that should be enough
to hold all the data. How can I keep the restore process from trying to
create exactly the same file configuration as the original database?You can't.
The SQL restore process requires the creation of exactly the same file sizes
on the target system as existed on the originating system. I suggest
purchasing an external HDD, restorign to that, shrinking, then moving the
data files.
--
Geoff N. Hiten
Senior SQL Infrastructure Consultant
Microsoft SQL Server MVP
"Daniel Rimmelzwaan (MVP - Dynamics NAV)" <daniel@.nadaspam.risplus.com>
wrote in message news:Ow$oUoH0HHA.1168@.TK2MSFTNGP02.phx.gbl...
> My production database files total about 100GB, of which about 35GB is
> used. My test machine has about 60GB available, so has plenty of room to
> accommodate the entire database. When I try to restore a full backup
> though, it screams at me that there is not enough disk space.
> I created a new database with 40GB of data files, and that should be
> enough to hold all the data. How can I keep the restore process from
> trying to create exactly the same file configuration as the original
> database?|||I was afraid of that. Thanks Geoff.
"Geoff N. Hiten" <SQLCraftsman@.gmail.com> wrote in message
news:OcDFQuH0HHA.1208@.TK2MSFTNGP03.phx.gbl...
> You can't.
> The SQL restore process requires the creation of exactly the same file
> sizes on the target system as existed on the originating system. I
> suggest purchasing an external HDD, restorign to that, shrinking, then
> moving the data files.
> --
> Geoff N. Hiten
> Senior SQL Infrastructure Consultant
> Microsoft SQL Server MVP
>
>
> "Daniel Rimmelzwaan (MVP - Dynamics NAV)" <daniel@.nadaspam.risplus.com>
> wrote in message news:Ow$oUoH0HHA.1168@.TK2MSFTNGP02.phx.gbl...
>> My production database files total about 100GB, of which about 35GB is
>> used. My test machine has about 60GB available, so has plenty of room to
>> accommodate the entire database. When I try to restore a full backup
>> though, it screams at me that there is not enough disk space.
>> I created a new database with 40GB of data files, and that should be
>> enough to hold all the data. How can I keep the restore process from
>> trying to create exactly the same file configuration as the original
>> database?
>