Showing posts with label transaction. Show all posts
Showing posts with label transaction. Show all posts

Wednesday, March 28, 2012

Restoring/moving model?

Hi
I want to alter Model so that its transaction logs and
datafiles are on different drives,so that new dbs created
on this server get the same configuration.
When I try to restore Model with a with_move option it
says I can't do that.
How can I acheive what I want?
Would remaning Model, and the creating a new db called
Model in the config I want work?Have a look at this old post :-
http://groups.google.co.uk/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=co4joN3eCHA.1308%40cpmsftngxa08
--
HTH
Ryan Waight, MCDBA, MCSE
"felix" <felix@.hotmail.com> wrote in message
news:007a01c38ce8$52b4d570$a301280a@.phx.gbl...
> Hi
> I want to alter Model so that its transaction logs and
> datafiles are on different drives,so that new dbs created
> on this server get the same configuration.
> When I try to restore Model with a with_move option it
> says I can't do that.
> How can I acheive what I want?
> Would remaning Model, and the creating a new db called
> Model in the config I want work?
>|||To move the model database, SQL Server must be started
with trace flag 3608 so that
it does not recover any database except
the master.
NOTE: You will not be able to access any user databases at
this time.
You should not perform any operations
other than the steps below while using
this trace flag.
To add trace flag 3608 as a SQL Server startup
parameter:
After adding trace flag 3608, perform the following
steps:
1. Stop and restart SQL Server.
2. Detach the model database as follows:
use master
go
sp_detach_db 'model'
go
3. Move the Model.mdf and Modellog.ldf files from D:\Mssql7
\Data to
E:\Sqldata(or any other drives).
4. Reattach the model database as follows:
use master
go
sp_attach_db 'model','E:\Sqldata\model.mdf','E:\Sqldata\mod
ellog.ldf'
go
--e:\ or any other drives
5. Remove the -T3608 trace flag from the startup
parameters box in the
Enterprise Manager.
6. Stop and restart SQL Server. You can verify the change
in
file locations using
sp_helpfile:
use model
go
sp_helpfile
go
Koohyar
This posting is provided "AS IS" with no warranties, and
confers no rights.
http://www.microsoft.com/info/cpyright.htm
>--Original Message--
>Hi
>I want to alter Model so that its transaction logs and
>datafiles are on different drives,so that new dbs created
>on this server get the same configuration.
>When I try to restore Model with a with_move option it
>says I can't do that.
>How can I acheive what I want?
>Would remaning Model, and the creating a new db called
>Model in the config I want work?
>.
>|||To add to the other responses, the default location of new database data
and log files is not determined by the model database file locations.
The default file locations can be specified via Enterprise Manager under
server properties --> database settings.
--
Hope this helps.
Dan Guzman
SQL Server MVP
--
SQL FAQ links (courtesy Neil Pike):
http://www.ntfaq.com/Articles/Index.cfm?DepartmentID=800
http://www.sqlserverfaq.com
http://www.mssqlserver.com/faq
--
"felix" <felix@.hotmail.com> wrote in message
news:007a01c38ce8$52b4d570$a301280a@.phx.gbl...
> Hi
> I want to alter Model so that its transaction logs and
> datafiles are on different drives,so that new dbs created
> on this server get the same configuration.
> When I try to restore Model with a with_move option it
> says I can't do that.
> How can I acheive what I want?
> Would remaning Model, and the creating a new db called
> Model in the config I want work?
>|||Thanks Dan,
Much more simple than I thought then! Your suggestion
worked a treat.
Felix
>--Original Message--
>To add to the other responses, the default location of
new database data
>and log files is not determined by the model database
file locations.
>The default file locations can be specified via
Enterprise Manager under
>server properties --> database settings.
>--
>Hope this helps.
>Dan Guzman
>SQL Server MVP
>--
>SQL FAQ links (courtesy Neil Pike):
>http://www.ntfaq.com/Articles/Index.cfm?DepartmentID=800
>http://www.sqlserverfaq.com
>http://www.mssqlserver.com/faq
>--
>"felix" <felix@.hotmail.com> wrote in message
>news:007a01c38ce8$52b4d570$a301280a@.phx.gbl...
>> Hi
>> I want to alter Model so that its transaction logs and
>> datafiles are on different drives,so that new dbs
created
>> on this server get the same configuration.
>> When I try to restore Model with a with_move option it
>> says I can't do that.
>> How can I acheive what I want?
>> Would remaning Model, and the creating a new db called
>> Model in the config I want work?
>
>.
>

Restoring Transaction Logs Into Backups of MDF and LDF

Hello,
Here's a brief outline of my scenario:
I am trying to recover from a database corruption problem. I have a
backup of the db's physical MDF and LDF files from before the
corruption, but no actual backup (ie bak file). I also have daily
transaction log backups right up to today, and my live db is still
operation despite the corruption, so I can take another transaction
log backup when I do the repair.
The problem I have is I don't know how to, or if it's possible to
attach the backup MDF & LDF files and then somehow apply my
transaction log backups to build a new up to date database.
Thanks,
AlexYou would need Attach with NORECOVERY, which currently is not a possibility.
There is a connect item you can vote in for a future feature request.
https://connect.microsoft.com/SQLSe...=2706
51
Geoff N. Hiten
Senior Database Administrator
Microsoft SQL Server MVP
<cosmasdev@.yahoo.com> wrote in message
news:1177078845.141070.271000@.n59g2000hsh.googlegroups.com...
> Hello,
> Here's a brief outline of my scenario:
> I am trying to recover from a database corruption problem. I have a
> backup of the db's physical MDF and LDF files from before the
> corruption, but no actual backup (ie bak file). I also have daily
> transaction log backups right up to today, and my live db is still
> operation despite the corruption, so I can take another transaction
> log backup when I do the repair.
> The problem I have is I don't know how to, or if it's possible to
> attach the backup MDF & LDF files and then somehow apply my
> transaction log backups to build a new up to date database.
> Thanks,
> Alex
>|||Alex,
If you don't mind my asking, what kind of corruption did you get and how did
it happen. We're just moving to SQLServer to avoid corruptions and I'd hate
to find that we did not leave the problem behind.
Regards
Brian Morris
<cosmasdev@.yahoo.com> wrote in message
news:1177078845.141070.271000@.n59g2000hsh.googlegroups.com...
> Hello,
> Here's a brief outline of my scenario:
> I am trying to recover from a database corruption problem. I have a
> backup of the db's physical MDF and LDF files from before the
> corruption, but no actual backup (ie bak file). I also have daily
> transaction log backups right up to today, and my live db is still
> operation despite the corruption, so I can take another transaction
> log backup when I do the repair.
> The problem I have is I don't know how to, or if it's possible to
> attach the backup MDF & LDF files and then somehow apply my
> transaction log backups to build a new up to date database.
> Thanks,
> Alex
>

Restoring Transaction Logs Into Backups of MDF and LDF

Hello,
Here's a brief outline of my scenario:
I am trying to recover from a database corruption problem. I have a
backup of the db's physical MDF and LDF files from before the
corruption, but no actual backup (ie bak file). I also have daily
transaction log backups right up to today, and my live db is still
operation despite the corruption, so I can take another transaction
log backup when I do the repair.
The problem I have is I don't know how to, or if it's possible to
attach the backup MDF & LDF files and then somehow apply my
transaction log backups to build a new up to date database.
Thanks,
AlexYou would need Attach with NORECOVERY, which currently is not a possibility.
There is a connect item you can vote in for a future feature request.
https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=270651
--
Geoff N. Hiten
Senior Database Administrator
Microsoft SQL Server MVP
<cosmasdev@.yahoo.com> wrote in message
news:1177078845.141070.271000@.n59g2000hsh.googlegroups.com...
> Hello,
> Here's a brief outline of my scenario:
> I am trying to recover from a database corruption problem. I have a
> backup of the db's physical MDF and LDF files from before the
> corruption, but no actual backup (ie bak file). I also have daily
> transaction log backups right up to today, and my live db is still
> operation despite the corruption, so I can take another transaction
> log backup when I do the repair.
> The problem I have is I don't know how to, or if it's possible to
> attach the backup MDF & LDF files and then somehow apply my
> transaction log backups to build a new up to date database.
> Thanks,
> Alex
>|||Alex,
If you don't mind my asking, what kind of corruption did you get and how did
it happen. We're just moving to SQLServer to avoid corruptions and I'd hate
to find that we did not leave the problem behind.
Regards
Brian Morris
<cosmasdev@.yahoo.com> wrote in message
news:1177078845.141070.271000@.n59g2000hsh.googlegroups.com...
> Hello,
> Here's a brief outline of my scenario:
> I am trying to recover from a database corruption problem. I have a
> backup of the db's physical MDF and LDF files from before the
> corruption, but no actual backup (ie bak file). I also have daily
> transaction log backups right up to today, and my live db is still
> operation despite the corruption, so I can take another transaction
> log backup when I do the repair.
> The problem I have is I don't know how to, or if it's possible to
> attach the backup MDF & LDF files and then somehow apply my
> transaction log backups to build a new up to date database.
> Thanks,
> Alex
>

Restoring Transaction Logs

I have a customer that needs to restore a database to
midnite on 12/31. They have a full database backup at
3pm, 2 transaction log without truncate backups and a
transaction log with truncate at midnite. I would assume
that you would run a restore on the full database backup
and then run a restore on the midnite trans log with
truncate with recover database selected. Would it be
necessary to include any of the transaction logs without
tuncate in the restore?
What is confusing to me is the transaction log backups
keep decreasing in size. I would think that if you don't
truncate, the sizes of the transaction log backups would
keep increasing until you truncated. Any help would be
appriciated.
ZackIn principle you will need to restore the most recent full db backup, =then ALL log backups since the full backup. The cause of your confusion =is (I guess) that backing up a log makes the space available for re-use, =The final log backup (that you describe as "transaction log with =truncate at midnite" is I expect not really a log backup at all, can you =confirm if this was taken via the SQL statement BACKUP LOG ... WITH =TRUNCATE ONLY, if so it has truncated the log not backed it up. In which =case the best you can get is to restore the full backup (WITH =NORECOVERY), the first log (WITH NORECOVERY) and the second log (WITH =RECOVERY).
If youre midnight log backup is a 'TRUNCATE ONLY" you are expposed from =a recovery point of view until 3pm the following day, since once the log =has been truncated it cannot be used to rollforward transactions until =the next full backup has been taken.
Hope that helps
Mike John
"Zack Godwin" <zgodwin@.freightsystemsinc.com> wrote in message =news:052b01c3d46b$0a7254c0$a001280a@.phx.gbl...
> I have a customer that needs to restore a database to > midnite on 12/31. They have a full database backup at > 3pm, 2 transaction log without truncate backups and a > transaction log with truncate at midnite. I would assume > that you would run a restore on the full database backup > and then run a restore on the midnite trans log with > truncate with recover database selected. Would it be > necessary to include any of the transaction logs without > tuncate in the restore? > > What is confusing to me is the transaction log backups > keep decreasing in size. I would think that if you don't > truncate, the sizes of the transaction log backups would > keep increasing until you truncated. Any help would be > appriciated.
> > Zack

Restoring Transaction log

Hi everyone,
First off, any help will be appreciated.
The scenario is that a chunk of data from one of the tables in a
database have been mistakenly deleted. I have done a complete backup of
the database and the backed up the log. I attempted restoring the
Database first with teh Norecpvery option and that worked. when I tried
restoring the log file with the STOPAT clause I get an error. I am
reproducing the script at the error below. Please help if you can
'Restoring the Database - Successful, with message shown below
RESTORE DATABASE MatriEdu2006
FROM DISK = 'C:\EducMatri06.db' WITH NORECOVERY,
MOVE 'EduMatri_Data' TO 'C:\MatriEdu2006.mdf',
MOVE 'EduMatri_Log' TO 'C:\MatriEdu2006.ldf'
Processed 920 pages for database 'MatriEdu2006', file 'Edu_Data' on
file 1.
Processed 1 pages for database 'MatriEdu2006', file 'Edu_Log' on file
1.
RESTORE DATABASE successfully processed 921 pages in 1.114 seconds
(6.766 MB/sec).
'Restore Log - Failed, with error message shown below
RESTORE LOG MatriEdu2006
FROM DISK = 'C:\EducationMatrix_Log'
WITH RECOVERY, STOPAT = 'Dec 11, 2006 03:14 PM'
Server: Msg 4326, Level 16, State 1, Line 1
The log in this backup set terminates at LSN 537000000112000001, which
is too early to apply to the database. A more recent log backup that
includes LSN 553000000066000001 can be restored.
Server: Msg 3013, Level 16, State 1, Line 1
RESTORE LOG is terminating abnormally.
>>> On 12/10/2006 at 5:40 PM, in message
<1165797639.616739.281890@.80g2000cwy.googlegroups. com>,
highflier<nbarnard@.au.loreal.com> wrote:
> Server: Msg 4326, Level 16, State 1, Line 1
> The log in this backup set terminates at LSN 537000000112000001,
> which
> is too early to apply to the database. A more recent log backup that
> includes LSN 553000000066000001 can be restored.
> Server: Msg 3013, Level 16, State 1, Line 1
> RESTORE LOG is terminating abnormally.
You need to find a full backup made *before* the data loss, along with
all the logs made between that full and the time of the data loss.
|||This also indicates that something else is wrong here. If an LSN terminates
with a number that precedes the LSN of an earlier transaction log, that
transaction log needs to be skipped during a restore.
In your case below, the 537000000112000001 does exactly this so figure out
which TRN this is and when you run the restore and it comes time to restore
from this TRN log, skip it and go on to the next one. The database choked
on a transaction before one log completed but fixed itself during the next
one so all the stuff in that log is not needed as the transaction completed
during the execution of the next log.
Regards,
Jamie
"highflier" wrote:

> Hi everyone,
> First off, any help will be appreciated.
> The scenario is that a chunk of data from one of the tables in a
> database have been mistakenly deleted. I have done a complete backup of
> the database and the backed up the log. I attempted restoring the
> Database first with teh Norecpvery option and that worked. when I tried
> restoring the log file with the STOPAT clause I get an error. I am
> reproducing the script at the error below. Please help if you can
> 'Restoring the Database - Successful, with message shown below
> RESTORE DATABASE MatriEdu2006
> FROM DISK = 'C:\EducMatri06.db' WITH NORECOVERY,
> MOVE 'EduMatri_Data' TO 'C:\MatriEdu2006.mdf',
> MOVE 'EduMatri_Log' TO 'C:\MatriEdu2006.ldf'
> Processed 920 pages for database 'MatriEdu2006', file 'Edu_Data' on
> file 1.
> Processed 1 pages for database 'MatriEdu2006', file 'Edu_Log' on file
> 1.
> RESTORE DATABASE successfully processed 921 pages in 1.114 seconds
> (6.766 MB/sec).
>
> 'Restore Log - Failed, with error message shown below
> RESTORE LOG MatriEdu2006
> FROM DISK = 'C:\EducationMatrix_Log'
> WITH RECOVERY, STOPAT = 'Dec 11, 2006 03:14 PM'
> Server: Msg 4326, Level 16, State 1, Line 1
> The log in this backup set terminates at LSN 537000000112000001, which
> is too early to apply to the database. A more recent log backup that
> includes LSN 553000000066000001 can be restored.
> Server: Msg 3013, Level 16, State 1, Line 1
> RESTORE LOG is terminating abnormally.
>
sql

Restoring Transaction log

Hi everyone,
First off, any help will be appreciated.
The scenario is that a chunk of data from one of the tables in a
database have been mistakenly deleted. I have done a complete backup of
the database and the backed up the log. I attempted restoring the
Database first with teh Norecpvery option and that worked. when I tried
restoring the log file with the STOPAT clause I get an error. I am
reproducing the script at the error below. Please help if you can
'Restoring the Database - Successful, with message shown below
RESTORE DATABASE MatriEdu2006
FROM DISK = 'C:\EducMatri06.db' WITH NORECOVERY,
MOVE 'EduMatri_Data' TO 'C:\MatriEdu2006.mdf',
MOVE 'EduMatri_Log' TO 'C:\MatriEdu2006.ldf'
Processed 920 pages for database 'MatriEdu2006', file 'Edu_Data' on
file 1.
Processed 1 pages for database 'MatriEdu2006', file 'Edu_Log' on file
1.
RESTORE DATABASE successfully processed 921 pages in 1.114 seconds
(6.766 MB/sec).
'Restore Log - Failed, with error message shown below
RESTORE LOG MatriEdu2006
FROM DISK = 'C:\EducationMatrix_Log'
WITH RECOVERY, STOPAT = 'Dec 11, 2006 03:14 PM'
Server: Msg 4326, Level 16, State 1, Line 1
The log in this backup set terminates at LSN 537000000112000001, which
is too early to apply to the database. A more recent log backup that
includes LSN 553000000066000001 can be restored.
Server: Msg 3013, Level 16, State 1, Line 1
RESTORE LOG is terminating abnormally.>>> On 12/10/2006 at 5:40 PM, in message
<1165797639.616739.281890@.80g2000cwy.googlegroups.com>,
highflier<nbarnard@.au.loreal.com> wrote:
> Server: Msg 4326, Level 16, State 1, Line 1
> The log in this backup set terminates at LSN 537000000112000001,
> which
> is too early to apply to the database. A more recent log backup that
> includes LSN 553000000066000001 can be restored.
> Server: Msg 3013, Level 16, State 1, Line 1
> RESTORE LOG is terminating abnormally.
You need to find a full backup made *before* the data loss, along with
all the logs made between that full and the time of the data loss.|||This also indicates that something else is wrong here. If an LSN terminates
with a number that precedes the LSN of an earlier transaction log, that
transaction log needs to be skipped during a restore.
In your case below, the 537000000112000001 does exactly this so figure out
which TRN this is and when you run the restore and it comes time to restore
from this TRN log, skip it and go on to the next one. The database choked
on a transaction before one log completed but fixed itself during the next
one so all the stuff in that log is not needed as the transaction completed
during the execution of the next log.
Regards,
Jamie
"highflier" wrote:

> Hi everyone,
> First off, any help will be appreciated.
> The scenario is that a chunk of data from one of the tables in a
> database have been mistakenly deleted. I have done a complete backup of
> the database and the backed up the log. I attempted restoring the
> Database first with teh Norecpvery option and that worked. when I tried
> restoring the log file with the STOPAT clause I get an error. I am
> reproducing the script at the error below. Please help if you can
> 'Restoring the Database - Successful, with message shown below
> RESTORE DATABASE MatriEdu2006
> FROM DISK = 'C:\EducMatri06.db' WITH NORECOVERY,
> MOVE 'EduMatri_Data' TO 'C:\MatriEdu2006.mdf',
> MOVE 'EduMatri_Log' TO 'C:\MatriEdu2006.ldf'
> Processed 920 pages for database 'MatriEdu2006', file 'Edu_Data' on
> file 1.
> Processed 1 pages for database 'MatriEdu2006', file 'Edu_Log' on file
> 1.
> RESTORE DATABASE successfully processed 921 pages in 1.114 seconds
> (6.766 MB/sec).
>
> 'Restore Log - Failed, with error message shown below
> RESTORE LOG MatriEdu2006
> FROM DISK = 'C:\EducationMatrix_Log'
> WITH RECOVERY, STOPAT = 'Dec 11, 2006 03:14 PM'
> Server: Msg 4326, Level 16, State 1, Line 1
> The log in this backup set terminates at LSN 537000000112000001, which
> is too early to apply to the database. A more recent log backup that
> includes LSN 553000000066000001 can be restored.
> Server: Msg 3013, Level 16, State 1, Line 1
> RESTORE LOG is terminating abnormally.
>

Restoring Transaction log

Hi everyone,
First off, any help will be appreciated.
The scenario is that a chunk of data from one of the tables in a
database have been mistakenly deleted. I have done a complete backup of
the database and the backed up the log. I attempted restoring the
Database first with teh Norecpvery option and that worked. when I tried
restoring the log file with the STOPAT clause I get an error. I am
reproducing the script at the error below. Please help if you can
'Restoring the Database - Successful, with message shown below
RESTORE DATABASE MatriEdu2006
FROM DISK = 'C:\EducMatri06.db' WITH NORECOVERY,
MOVE 'EduMatri_Data' TO 'C:\MatriEdu2006.mdf',
MOVE 'EduMatri_Log' TO 'C:\MatriEdu2006.ldf'
Processed 920 pages for database 'MatriEdu2006', file 'Edu_Data' on
file 1.
Processed 1 pages for database 'MatriEdu2006', file 'Edu_Log' on file
1.
RESTORE DATABASE successfully processed 921 pages in 1.114 seconds
(6.766 MB/sec).
'Restore Log - Failed, with error message shown below
RESTORE LOG MatriEdu2006
FROM DISK = 'C:\EducationMatrix_Log'
WITH RECOVERY, STOPAT = 'Dec 11, 2006 03:14 PM'
Server: Msg 4326, Level 16, State 1, Line 1
The log in this backup set terminates at LSN 537000000112000001, which
is too early to apply to the database. A more recent log backup that
includes LSN 553000000066000001 can be restored.
Server: Msg 3013, Level 16, State 1, Line 1
RESTORE LOG is terminating abnormally.>> On 12/10/2006 at 5:40 PM, in message
<1165797639.616739.281890@.80g2000cwy.googlegroups.com>,
highflier<nbarnard@.au.loreal.com> wrote:
> Server: Msg 4326, Level 16, State 1, Line 1
> The log in this backup set terminates at LSN 537000000112000001,
> which
> is too early to apply to the database. A more recent log backup that
> includes LSN 553000000066000001 can be restored.
> Server: Msg 3013, Level 16, State 1, Line 1
> RESTORE LOG is terminating abnormally.
You need to find a full backup made *before* the data loss, along with
all the logs made between that full and the time of the data loss.

Monday, March 26, 2012

Restoring the master database

Hello,
I am going throught my disaster recovery. I am at the point where I have a
nightly databases backup and I am backing up the transaction logs frequently
during the day.
I am having the problem that i am trying to restore the backedup master
database, but every time I restore it, I cannot get SQL to run again, so I
have to re-build the master database. I have tried doing it with Enterprise
manager and with Querry analizer, in both cases I get the message 'master
database succesfully recover and then it is shutting donw the service right
away, at this point I cannot re-start the service, am I missing something?
Please help
Joe HernandezMy guess is that the master database you have restored specifies that tempdb
and/or model should be
located on some other place compared to where they are on your restored syst
em.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Joe Hernandez" <JoeHernandez@.discussions.microsoft.com> wrote in message
news:046BF402-C476-4489-9773-15DB290E4FC9@.microsoft.com...
> Hello,
> I am going throught my disaster recovery. I am at the point where I have a
> nightly databases backup and I am backing up the transaction logs frequent
ly
> during the day.
> I am having the problem that i am trying to restore the backedup master
> database, but every time I restore it, I cannot get SQL to run again, so I
> have to re-build the master database. I have tried doing it with Enterpris
e
> manager and with Querry analizer, in both cases I get the message 'master
> database succesfully recover and then it is shutting donw the service righ
t
> away, at this point I cannot re-start the service, am I missing something?
> Please help
> Joe Hernandez|||Please look at the error log , what error you found in it?
Regards
Amish|||Hello,
I am very new at SQL, can you tell me how to look up the error log?
"amish" wrote:

> Please look at the error log , what error you found in it?
> Regards
> Amish
>|||I dont know how would I tell that.
So do I need to restore the tempdb and the model before I restore the
masterdb?
thanks,
Joe H
"Tibor Karaszi" wrote:

> My guess is that the master database you have restored specifies that temp
db and/or model should be
> located on some other place compared to where they are on your restored sy
stem.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "Joe Hernandez" <JoeHernandez@.discussions.microsoft.com> wrote in message
> news:046BF402-C476-4489-9773-15DB290E4FC9@.microsoft.com...
>|||Check sysdatabases on the old installation for the original path for those d
atabases. Or the
errorlog file. You can then create a directory as the original and have copy
the files of those
databases so that they exist in the original location. Then use KB 224071 to
move those databases to
the desired location. Some articles that might be helpful:
Have a look at this list compiled by Andrew Kelly:
Moving DB's between Servers
http://www.support.microsoft.com/?id=314546
Moving SQL Server Databases to a New Location with Detach/Attach
http://www.support.microsoft.com/?id=224071
Using WITH MOVE in a Restore
http://support.microsoft.com/?id=221465
How To Transfer Logins and Passwords Between SQL Servers
http://www.support.microsoft.com/?id=246133
Mapping Logins & SIDs after a Restore
http://www.support.microsoft.com/?id=298897
Utility to map logins to users
http://www.dbmaint.com/SyncSql Logins.asp
User Logon and/or Permission Errors After Restoring Dump
http://www.support.microsoft.com/?id=168001
How to Resolve Permission Issues When a Database Is Moved Between SQL
Servers
http://www.support.microsoft.com/?id=240872
Restoring a .mdf
http://www.sqlservercentral.com/scr...sp?scriptid=599
Disaster Recovery Articles for SQL Server
http://www.support.microsoft.com/?id=307775
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Joe Hernandez" <JoeHernandez@.discussions.microsoft.com> wrote in message
news:6F9B255A-7822-4B8D-976C-1C04E44E2374@.microsoft.com...[vbcol=seagreen]
>I dont know how would I tell that.
> So do I need to restore the tempdb and the model before I restore the
> masterdb?
> thanks,
> Joe H
> "Tibor Karaszi" wrote:
>|||Tibor,
Thanks for all your help.
Do you know if it makes a difference if I am using 2 different instaces
names? should I have the same instance name on my production server as well
as my test server?
Thanks,
Joe Hernandez
"Tibor Karaszi" wrote:

> Check sysdatabases on the old installation for the original path for those
databases. Or the
> errorlog file. You can then create a directory as the original and have co
py the files of those
> databases so that they exist in the original location. Then use KB 224071
to move those databases to
> the desired location. Some articles that might be helpful:
> Have a look at this list compiled by Andrew Kelly:
> Moving DB's between Servers
> http://www.support.microsoft.com/?id=314546
> Moving SQL Server Databases to a New Location with Detach/Attach
> http://www.support.microsoft.com/?id=224071
> Using WITH MOVE in a Restore
> http://support.microsoft.com/?id=221465
> How To Transfer Logins and Passwords Between SQL Servers
> http://www.support.microsoft.com/?id=246133
> Mapping Logins & SIDs after a Restore
> http://www.support.microsoft.com/?id=298897
> Utility to map logins to users
> http://www.dbmaint.com/SyncSql Logins.asp
> User Logon and/or Permission Errors After Restoring Dump
> http://www.support.microsoft.com/?id=168001
> How to Resolve Permission Issues When a Database Is Moved Between SQL
> Servers
> http://www.support.microsoft.com/?id=240872
> Restoring a .mdf
> http://www.sqlservercentral.com/scr...sp?scriptid=599
> Disaster Recovery Articles for SQL Server
> http://www.support.microsoft.com/?id=307775
>
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "Joe Hernandez" <JoeHernandez@.discussions.microsoft.com> wrote in message
> news:6F9B255A-7822-4B8D-976C-1C04E44E2374@.microsoft.com...
>|||For 2000, the instance name is part for the directory structure for SQL Serv
er. So, it will probably
be easier of you have the same instance name, more likely that you will have
the same directory
structure.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Joe Hernandez" <JoeHernandez@.discussions.microsoft.com> wrote in message
news:0C55B74D-03E2-4A73-BAD4-FA8E72BA27EE@.microsoft.com...[vbcol=seagreen]
> Tibor,
> Thanks for all your help.
> Do you know if it makes a difference if I am using 2 different instaces
> names? should I have the same instance name on my production server as wel
l
> as my test server?
> Thanks,
> Joe Hernandez
> "Tibor Karaszi" wrote:
>|||you will find it in log folder in the directory where you installed
microsoft sql server.
Open the file Errorlog in notepad. It will show you the error why sql
server not starts.
Post it here to identify the reason why Services not starting.
Regards
Amish|||Tibor,
After I changed the instance name in SQL200, I had no problems restoring the
master database and right after was able to re-start server, took it off fro
m
single user mode, have restore all my other databases and I am running full
boat on the test server.
I want to thank you all that helped me and hope that others can benefit from
this issue.
Joe Hernandez
"Tibor Karaszi" wrote:

> For 2000, the instance name is part for the directory structure for SQL Se
rver. So, it will probably
> be easier of you have the same instance name, more likely that you will ha
ve the same directory
> structure.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "Joe Hernandez" <JoeHernandez@.discussions.microsoft.com> wrote in message
> news:0C55B74D-03E2-4A73-BAD4-FA8E72BA27EE@.microsoft.com...
>

Restoring the master database

Hello,
I am going throught my disaster recovery. I am at the point where I have a
nightly databases backup and I am backing up the transaction logs frequently
during the day.
I am having the problem that i am trying to restore the backedup master
database, but every time I restore it, I cannot get SQL to run again, so I
have to re-build the master database. I have tried doing it with Enterprise
manager and with Querry analizer, in both cases I get the message 'master
database succesfully recover and then it is shutting donw the service right
away, at this point I cannot re-start the service, am I missing something?
Please help
Joe Hernandez
My guess is that the master database you have restored specifies that tempdb and/or model should be
located on some other place compared to where they are on your restored system.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Joe Hernandez" <JoeHernandez@.discussions.microsoft.com> wrote in message
news:046BF402-C476-4489-9773-15DB290E4FC9@.microsoft.com...
> Hello,
> I am going throught my disaster recovery. I am at the point where I have a
> nightly databases backup and I am backing up the transaction logs frequently
> during the day.
> I am having the problem that i am trying to restore the backedup master
> database, but every time I restore it, I cannot get SQL to run again, so I
> have to re-build the master database. I have tried doing it with Enterprise
> manager and with Querry analizer, in both cases I get the message 'master
> database succesfully recover and then it is shutting donw the service right
> away, at this point I cannot re-start the service, am I missing something?
> Please help
> Joe Hernandez
|||Please look at the error log , what error you found in it?
Regards
Amish
|||Hello,
I am very new at SQL, can you tell me how to look up the error log?
"amish" wrote:

> Please look at the error log , what error you found in it?
> Regards
> Amish
>
|||I dont know how would I tell that.
So do I need to restore the tempdb and the model before I restore the
masterdb?
thanks,
Joe H
"Tibor Karaszi" wrote:

> My guess is that the master database you have restored specifies that tempdb and/or model should be
> located on some other place compared to where they are on your restored system.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "Joe Hernandez" <JoeHernandez@.discussions.microsoft.com> wrote in message
> news:046BF402-C476-4489-9773-15DB290E4FC9@.microsoft.com...
>
|||Check sysdatabases on the old installation for the original path for those databases. Or the
errorlog file. You can then create a directory as the original and have copy the files of those
databases so that they exist in the original location. Then use KB 224071 to move those databases to
the desired location. Some articles that might be helpful:
Have a look at this list compiled by Andrew Kelly:
Moving DB's between Servers
http://www.support.microsoft.com/?id=314546
Moving SQL Server Databases to a New Location with Detach/Attach
http://www.support.microsoft.com/?id=224071
Using WITH MOVE in a Restore
http://support.microsoft.com/?id=221465
How To Transfer Logins and Passwords Between SQL Servers
http://www.support.microsoft.com/?id=246133
Mapping Logins & SIDs after a Restore
http://www.support.microsoft.com/?id=298897
Utility to map logins to users
http://www.dbmaint.com/SyncSql Logins.asp
User Logon and/or Permission Errors After Restoring Dump
http://www.support.microsoft.com/?id=168001
How to Resolve Permission Issues When a Database Is Moved Between SQL
Servers
http://www.support.microsoft.com/?id=240872
Restoring a .mdf
http://www.sqlservercentral.com/scri...p?scriptid=599
Disaster Recovery Articles for SQL Server
http://www.support.microsoft.com/?id=307775
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Joe Hernandez" <JoeHernandez@.discussions.microsoft.com> wrote in message
news:6F9B255A-7822-4B8D-976C-1C04E44E2374@.microsoft.com...[vbcol=seagreen]
>I dont know how would I tell that.
> So do I need to restore the tempdb and the model before I restore the
> masterdb?
> thanks,
> Joe H
> "Tibor Karaszi" wrote:
|||Tibor,
Thanks for all your help.
Do you know if it makes a difference if I am using 2 different instaces
names? should I have the same instance name on my production server as well
as my test server?
Thanks,
Joe Hernandez
"Tibor Karaszi" wrote:

> Check sysdatabases on the old installation for the original path for those databases. Or the
> errorlog file. You can then create a directory as the original and have copy the files of those
> databases so that they exist in the original location. Then use KB 224071 to move those databases to
> the desired location. Some articles that might be helpful:
> Have a look at this list compiled by Andrew Kelly:
> Moving DB's between Servers
> http://www.support.microsoft.com/?id=314546
> Moving SQL Server Databases to a New Location with Detach/Attach
> http://www.support.microsoft.com/?id=224071
> Using WITH MOVE in a Restore
> http://support.microsoft.com/?id=221465
> How To Transfer Logins and Passwords Between SQL Servers
> http://www.support.microsoft.com/?id=246133
> Mapping Logins & SIDs after a Restore
> http://www.support.microsoft.com/?id=298897
> Utility to map logins to users
> http://www.dbmaint.com/SyncSql Logins.asp
> User Logon and/or Permission Errors After Restoring Dump
> http://www.support.microsoft.com/?id=168001
> How to Resolve Permission Issues When a Database Is Moved Between SQL
> Servers
> http://www.support.microsoft.com/?id=240872
> Restoring a .mdf
> http://www.sqlservercentral.com/scri...p?scriptid=599
> Disaster Recovery Articles for SQL Server
> http://www.support.microsoft.com/?id=307775
>
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "Joe Hernandez" <JoeHernandez@.discussions.microsoft.com> wrote in message
> news:6F9B255A-7822-4B8D-976C-1C04E44E2374@.microsoft.com...
>
|||For 2000, the instance name is part for the directory structure for SQL Server. So, it will probably
be easier of you have the same instance name, more likely that you will have the same directory
structure.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Joe Hernandez" <JoeHernandez@.discussions.microsoft.com> wrote in message
news:0C55B74D-03E2-4A73-BAD4-FA8E72BA27EE@.microsoft.com...[vbcol=seagreen]
> Tibor,
> Thanks for all your help.
> Do you know if it makes a difference if I am using 2 different instaces
> names? should I have the same instance name on my production server as well
> as my test server?
> Thanks,
> Joe Hernandez
> "Tibor Karaszi" wrote:
|||you will find it in log folder in the directory where you installed
microsoft sql server.
Open the file Errorlog in notepad. It will show you the error why sql
server not starts.
Post it here to identify the reason why Services not starting.
Regards
Amish
|||Tibor,
After I changed the instance name in SQL200, I had no problems restoring the
master database and right after was able to re-start server, took it off from
single user mode, have restore all my other databases and I am running full
boat on the test server.
I want to thank you all that helped me and hope that others can benefit from
this issue.
Joe Hernandez
"Tibor Karaszi" wrote:

> For 2000, the instance name is part for the directory structure for SQL Server. So, it will probably
> be easier of you have the same instance name, more likely that you will have the same directory
> structure.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "Joe Hernandez" <JoeHernandez@.discussions.microsoft.com> wrote in message
> news:0C55B74D-03E2-4A73-BAD4-FA8E72BA27EE@.microsoft.com...
>

Restoring the master database

Hello,
I am going throught my disaster recovery. I am at the point where I have a
nightly databases backup and I am backing up the transaction logs frequently
during the day.
I am having the problem that i am trying to restore the backedup master
database, but every time I restore it, I cannot get SQL to run again, so I
have to re-build the master database. I have tried doing it with Enterprise
manager and with Querry analizer, in both cases I get the message 'master
database succesfully recover and then it is shutting donw the service right
away, at this point I cannot re-start the service, am I missing something?
Please help
Joe HernandezMy guess is that the master database you have restored specifies that tempdb and/or model should be
located on some other place compared to where they are on your restored system.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Joe Hernandez" <JoeHernandez@.discussions.microsoft.com> wrote in message
news:046BF402-C476-4489-9773-15DB290E4FC9@.microsoft.com...
> Hello,
> I am going throught my disaster recovery. I am at the point where I have a
> nightly databases backup and I am backing up the transaction logs frequently
> during the day.
> I am having the problem that i am trying to restore the backedup master
> database, but every time I restore it, I cannot get SQL to run again, so I
> have to re-build the master database. I have tried doing it with Enterprise
> manager and with Querry analizer, in both cases I get the message 'master
> database succesfully recover and then it is shutting donw the service right
> away, at this point I cannot re-start the service, am I missing something?
> Please help
> Joe Hernandez|||Please look at the error log , what error you found in it?
Regards
Amish|||Hello,
I am very new at SQL, can you tell me how to look up the error log?
"amish" wrote:
> Please look at the error log , what error you found in it?
> Regards
> Amish
>|||I dont know how would I tell that.
So do I need to restore the tempdb and the model before I restore the
masterdb?
thanks,
Joe H
"Tibor Karaszi" wrote:
> My guess is that the master database you have restored specifies that tempdb and/or model should be
> located on some other place compared to where they are on your restored system.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "Joe Hernandez" <JoeHernandez@.discussions.microsoft.com> wrote in message
> news:046BF402-C476-4489-9773-15DB290E4FC9@.microsoft.com...
> > Hello,
> >
> > I am going throught my disaster recovery. I am at the point where I have a
> > nightly databases backup and I am backing up the transaction logs frequently
> > during the day.
> >
> > I am having the problem that i am trying to restore the backedup master
> > database, but every time I restore it, I cannot get SQL to run again, so I
> > have to re-build the master database. I have tried doing it with Enterprise
> > manager and with Querry analizer, in both cases I get the message 'master
> > database succesfully recover and then it is shutting donw the service right
> > away, at this point I cannot re-start the service, am I missing something?
> >
> > Please help
> >
> > Joe Hernandez
>|||Check sysdatabases on the old installation for the original path for those databases. Or the
errorlog file. You can then create a directory as the original and have copy the files of those
databases so that they exist in the original location. Then use KB 224071 to move those databases to
the desired location. Some articles that might be helpful:
Have a look at this list compiled by Andrew Kelly:
Moving DB's between Servers
http://www.support.microsoft.com/?id=314546
Moving SQL Server Databases to a New Location with Detach/Attach
http://www.support.microsoft.com/?id=224071
Using WITH MOVE in a Restore
http://support.microsoft.com/?id=221465
How To Transfer Logins and Passwords Between SQL Servers
http://www.support.microsoft.com/?id=246133
Mapping Logins & SIDs after a Restore
http://www.support.microsoft.com/?id=298897
Utility to map logins to users
http://www.dbmaint.com/SyncSql Logins.asp
User Logon and/or Permission Errors After Restoring Dump
http://www.support.microsoft.com/?id=168001
How to Resolve Permission Issues When a Database Is Moved Between SQL
Servers
http://www.support.microsoft.com/?id=240872
Restoring a .mdf
http://www.sqlservercentral.com/scripts/scriptdetails.asp?scriptid=599
Disaster Recovery Articles for SQL Server
http://www.support.microsoft.com/?id=307775
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Joe Hernandez" <JoeHernandez@.discussions.microsoft.com> wrote in message
news:6F9B255A-7822-4B8D-976C-1C04E44E2374@.microsoft.com...
>I dont know how would I tell that.
> So do I need to restore the tempdb and the model before I restore the
> masterdb?
> thanks,
> Joe H
> "Tibor Karaszi" wrote:
>> My guess is that the master database you have restored specifies that tempdb and/or model should
>> be
>> located on some other place compared to where they are on your restored system.
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://www.solidqualitylearning.com/
>> Blog: http://solidqualitylearning.com/blogs/tibor/
>>
>> "Joe Hernandez" <JoeHernandez@.discussions.microsoft.com> wrote in message
>> news:046BF402-C476-4489-9773-15DB290E4FC9@.microsoft.com...
>> > Hello,
>> >
>> > I am going throught my disaster recovery. I am at the point where I have a
>> > nightly databases backup and I am backing up the transaction logs frequently
>> > during the day.
>> >
>> > I am having the problem that i am trying to restore the backedup master
>> > database, but every time I restore it, I cannot get SQL to run again, so I
>> > have to re-build the master database. I have tried doing it with Enterprise
>> > manager and with Querry analizer, in both cases I get the message 'master
>> > database succesfully recover and then it is shutting donw the service right
>> > away, at this point I cannot re-start the service, am I missing something?
>> >
>> > Please help
>> >
>> > Joe Hernandez
>>|||Tibor,
Thanks for all your help.
Do you know if it makes a difference if I am using 2 different instaces
names? should I have the same instance name on my production server as well
as my test server?
Thanks,
Joe Hernandez
"Tibor Karaszi" wrote:
> Check sysdatabases on the old installation for the original path for those databases. Or the
> errorlog file. You can then create a directory as the original and have copy the files of those
> databases so that they exist in the original location. Then use KB 224071 to move those databases to
> the desired location. Some articles that might be helpful:
> Have a look at this list compiled by Andrew Kelly:
> Moving DB's between Servers
> http://www.support.microsoft.com/?id=314546
> Moving SQL Server Databases to a New Location with Detach/Attach
> http://www.support.microsoft.com/?id=224071
> Using WITH MOVE in a Restore
> http://support.microsoft.com/?id=221465
> How To Transfer Logins and Passwords Between SQL Servers
> http://www.support.microsoft.com/?id=246133
> Mapping Logins & SIDs after a Restore
> http://www.support.microsoft.com/?id=298897
> Utility to map logins to users
> http://www.dbmaint.com/SyncSql Logins.asp
> User Logon and/or Permission Errors After Restoring Dump
> http://www.support.microsoft.com/?id=168001
> How to Resolve Permission Issues When a Database Is Moved Between SQL
> Servers
> http://www.support.microsoft.com/?id=240872
> Restoring a .mdf
> http://www.sqlservercentral.com/scripts/scriptdetails.asp?scriptid=599
> Disaster Recovery Articles for SQL Server
> http://www.support.microsoft.com/?id=307775
>
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "Joe Hernandez" <JoeHernandez@.discussions.microsoft.com> wrote in message
> news:6F9B255A-7822-4B8D-976C-1C04E44E2374@.microsoft.com...
> >I dont know how would I tell that.
> >
> > So do I need to restore the tempdb and the model before I restore the
> > masterdb?
> >
> > thanks,
> >
> > Joe H
> >
> > "Tibor Karaszi" wrote:
> >
> >> My guess is that the master database you have restored specifies that tempdb and/or model should
> >> be
> >> located on some other place compared to where they are on your restored system.
> >>
> >> --
> >> Tibor Karaszi, SQL Server MVP
> >> http://www.karaszi.com/sqlserver/default.asp
> >> http://www.solidqualitylearning.com/
> >> Blog: http://solidqualitylearning.com/blogs/tibor/
> >>
> >>
> >> "Joe Hernandez" <JoeHernandez@.discussions.microsoft.com> wrote in message
> >> news:046BF402-C476-4489-9773-15DB290E4FC9@.microsoft.com...
> >> > Hello,
> >> >
> >> > I am going throught my disaster recovery. I am at the point where I have a
> >> > nightly databases backup and I am backing up the transaction logs frequently
> >> > during the day.
> >> >
> >> > I am having the problem that i am trying to restore the backedup master
> >> > database, but every time I restore it, I cannot get SQL to run again, so I
> >> > have to re-build the master database. I have tried doing it with Enterprise
> >> > manager and with Querry analizer, in both cases I get the message 'master
> >> > database succesfully recover and then it is shutting donw the service right
> >> > away, at this point I cannot re-start the service, am I missing something?
> >> >
> >> > Please help
> >> >
> >> > Joe Hernandez
> >>
> >>
>|||For 2000, the instance name is part for the directory structure for SQL Server. So, it will probably
be easier of you have the same instance name, more likely that you will have the same directory
structure.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Joe Hernandez" <JoeHernandez@.discussions.microsoft.com> wrote in message
news:0C55B74D-03E2-4A73-BAD4-FA8E72BA27EE@.microsoft.com...
> Tibor,
> Thanks for all your help.
> Do you know if it makes a difference if I am using 2 different instaces
> names? should I have the same instance name on my production server as well
> as my test server?
> Thanks,
> Joe Hernandez
> "Tibor Karaszi" wrote:
>> Check sysdatabases on the old installation for the original path for those databases. Or the
>> errorlog file. You can then create a directory as the original and have copy the files of those
>> databases so that they exist in the original location. Then use KB 224071 to move those databases
>> to
>> the desired location. Some articles that might be helpful:
>> Have a look at this list compiled by Andrew Kelly:
>> Moving DB's between Servers
>> http://www.support.microsoft.com/?id=314546
>> Moving SQL Server Databases to a New Location with Detach/Attach
>> http://www.support.microsoft.com/?id=224071
>> Using WITH MOVE in a Restore
>> http://support.microsoft.com/?id=221465
>> How To Transfer Logins and Passwords Between SQL Servers
>> http://www.support.microsoft.com/?id=246133
>> Mapping Logins & SIDs after a Restore
>> http://www.support.microsoft.com/?id=298897
>> Utility to map logins to users
>> http://www.dbmaint.com/SyncSql Logins.asp
>> User Logon and/or Permission Errors After Restoring Dump
>> http://www.support.microsoft.com/?id=168001
>> How to Resolve Permission Issues When a Database Is Moved Between SQL
>> Servers
>> http://www.support.microsoft.com/?id=240872
>> Restoring a .mdf
>> http://www.sqlservercentral.com/scripts/scriptdetails.asp?scriptid=599
>> Disaster Recovery Articles for SQL Server
>> http://www.support.microsoft.com/?id=307775
>>
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://www.solidqualitylearning.com/
>> Blog: http://solidqualitylearning.com/blogs/tibor/
>>
>> "Joe Hernandez" <JoeHernandez@.discussions.microsoft.com> wrote in message
>> news:6F9B255A-7822-4B8D-976C-1C04E44E2374@.microsoft.com...
>> >I dont know how would I tell that.
>> >
>> > So do I need to restore the tempdb and the model before I restore the
>> > masterdb?
>> >
>> > thanks,
>> >
>> > Joe H
>> >
>> > "Tibor Karaszi" wrote:
>> >
>> >> My guess is that the master database you have restored specifies that tempdb and/or model
>> >> should
>> >> be
>> >> located on some other place compared to where they are on your restored system.
>> >>
>> >> --
>> >> Tibor Karaszi, SQL Server MVP
>> >> http://www.karaszi.com/sqlserver/default.asp
>> >> http://www.solidqualitylearning.com/
>> >> Blog: http://solidqualitylearning.com/blogs/tibor/
>> >>
>> >>
>> >> "Joe Hernandez" <JoeHernandez@.discussions.microsoft.com> wrote in message
>> >> news:046BF402-C476-4489-9773-15DB290E4FC9@.microsoft.com...
>> >> > Hello,
>> >> >
>> >> > I am going throught my disaster recovery. I am at the point where I have a
>> >> > nightly databases backup and I am backing up the transaction logs frequently
>> >> > during the day.
>> >> >
>> >> > I am having the problem that i am trying to restore the backedup master
>> >> > database, but every time I restore it, I cannot get SQL to run again, so I
>> >> > have to re-build the master database. I have tried doing it with Enterprise
>> >> > manager and with Querry analizer, in both cases I get the message 'master
>> >> > database succesfully recover and then it is shutting donw the service right
>> >> > away, at this point I cannot re-start the service, am I missing something?
>> >> >
>> >> > Please help
>> >> >
>> >> > Joe Hernandez
>> >>
>> >>
>>|||you will find it in log folder in the directory where you installed
microsoft sql server.
Open the file Errorlog in notepad. It will show you the error why sql
server not starts.
Post it here to identify the reason why Services not starting.
Regards
Amish|||Tibor,
After I changed the instance name in SQL200, I had no problems restoring the
master database and right after was able to re-start server, took it off from
single user mode, have restore all my other databases and I am running full
boat on the test server.
I want to thank you all that helped me and hope that others can benefit from
this issue.
Joe Hernandez
"Tibor Karaszi" wrote:
> For 2000, the instance name is part for the directory structure for SQL Server. So, it will probably
> be easier of you have the same instance name, more likely that you will have the same directory
> structure.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "Joe Hernandez" <JoeHernandez@.discussions.microsoft.com> wrote in message
> news:0C55B74D-03E2-4A73-BAD4-FA8E72BA27EE@.microsoft.com...
> > Tibor,
> >
> > Thanks for all your help.
> >
> > Do you know if it makes a difference if I am using 2 different instaces
> > names? should I have the same instance name on my production server as well
> > as my test server?
> >
> > Thanks,
> >
> > Joe Hernandez
> >
> > "Tibor Karaszi" wrote:
> >
> >> Check sysdatabases on the old installation for the original path for those databases. Or the
> >> errorlog file. You can then create a directory as the original and have copy the files of those
> >> databases so that they exist in the original location. Then use KB 224071 to move those databases
> >> to
> >> the desired location. Some articles that might be helpful:
> >>
> >> Have a look at this list compiled by Andrew Kelly:
> >>
> >> Moving DB's between Servers
> >> http://www.support.microsoft.com/?id=314546
> >>
> >> Moving SQL Server Databases to a New Location with Detach/Attach
> >> http://www.support.microsoft.com/?id=224071
> >>
> >> Using WITH MOVE in a Restore
> >> http://support.microsoft.com/?id=221465
> >>
> >> How To Transfer Logins and Passwords Between SQL Servers
> >> http://www.support.microsoft.com/?id=246133
> >>
> >> Mapping Logins & SIDs after a Restore
> >> http://www.support.microsoft.com/?id=298897
> >>
> >> Utility to map logins to users
> >> http://www.dbmaint.com/SyncSql Logins.asp
> >>
> >> User Logon and/or Permission Errors After Restoring Dump
> >> http://www.support.microsoft.com/?id=168001
> >>
> >> How to Resolve Permission Issues When a Database Is Moved Between SQL
> >> Servers
> >> http://www.support.microsoft.com/?id=240872
> >>
> >> Restoring a .mdf
> >> http://www.sqlservercentral.com/scripts/scriptdetails.asp?scriptid=599
> >>
> >> Disaster Recovery Articles for SQL Server
> >> http://www.support.microsoft.com/?id=307775
> >>
> >>
> >>
> >> --
> >> Tibor Karaszi, SQL Server MVP
> >> http://www.karaszi.com/sqlserver/default.asp
> >> http://www.solidqualitylearning.com/
> >> Blog: http://solidqualitylearning.com/blogs/tibor/
> >>
> >>
> >> "Joe Hernandez" <JoeHernandez@.discussions.microsoft.com> wrote in message
> >> news:6F9B255A-7822-4B8D-976C-1C04E44E2374@.microsoft.com...
> >> >I dont know how would I tell that.
> >> >
> >> > So do I need to restore the tempdb and the model before I restore the
> >> > masterdb?
> >> >
> >> > thanks,
> >> >
> >> > Joe H
> >> >
> >> > "Tibor Karaszi" wrote:
> >> >
> >> >> My guess is that the master database you have restored specifies that tempdb and/or model
> >> >> should
> >> >> be
> >> >> located on some other place compared to where they are on your restored system.
> >> >>
> >> >> --
> >> >> Tibor Karaszi, SQL Server MVP
> >> >> http://www.karaszi.com/sqlserver/default.asp
> >> >> http://www.solidqualitylearning.com/
> >> >> Blog: http://solidqualitylearning.com/blogs/tibor/
> >> >>
> >> >>
> >> >> "Joe Hernandez" <JoeHernandez@.discussions.microsoft.com> wrote in message
> >> >> news:046BF402-C476-4489-9773-15DB290E4FC9@.microsoft.com...
> >> >> > Hello,
> >> >> >
> >> >> > I am going throught my disaster recovery. I am at the point where I have a
> >> >> > nightly databases backup and I am backing up the transaction logs frequently
> >> >> > during the day.
> >> >> >
> >> >> > I am having the problem that i am trying to restore the backedup master
> >> >> > database, but every time I restore it, I cannot get SQL to run again, so I
> >> >> > have to re-build the master database. I have tried doing it with Enterprise
> >> >> > manager and with Querry analizer, in both cases I get the message 'master
> >> >> > database succesfully recover and then it is shutting donw the service right
> >> >> > away, at this point I cannot re-start the service, am I missing something?
> >> >> >
> >> >> > Please help
> >> >> >
> >> >> > Joe Hernandez
> >> >>
> >> >>
> >>
> >>
>

Friday, March 23, 2012

Restoring SQL2000 Transaction Logs to SQL2005

Hey all,

Just went through migrating to SQL 2005 as well and we have a need to apply log shipping between SQL 2000 and SQL 2005. Well not shipping per say in the automated fashion that SQL 2005 offers but rather we need to apply SQL 2000 transaction logs to a SQL 2005 instance. Though the database is still in SQL 2000 version 80 and the secondary database needs to be available in read only. (STANDBY MODE)

When I attempt to restore either a FULL backup or transaction log I get the error:

RESTORE DATABASE is terminating abnormally. This backup cannot be restored using WITH STANDBY because a database upgrade is needed. Reissue the RESTORE without WITH STANDBY

The only way I could restore the FULL was by using the WITH RECOVERY OR NORECOVERY option during the restore process. The issue with this is I need the database in standby by mode in order to continue to append transaction logs.

Anybody have any thoughts how I might be able to get around this?

Thanks

Eric

The physical structure of the database has changed between SQL2000 and SQL 2005. Since the transaction logs contain low-level data, you cannot apply SQL 2000 transaction logs to a SQL 2005 database, or vice-versa

|||

Bummer, ya figure MS would build the 2005 transactional restore with a backward compatibility method, (in the since of restoring a database in STANDYBY mode) though what’s the point of keeping a database in (80) SQL 2000 mode if it truly is a semi-upgraded 2005 database.
Please correct me if I am wrong here. but I understand the reason why the 2000 versioned database is it can't be restored in stand by mode without created a log of is own during the upgrade.( not to repeat myself but if the destination database is in SQL 2000 format yet is attached to a SQL 2005 instance) it shouldn't have a issue, that is if SQL 2005 was truly backward compatible.

Thanks

|||

OK, There are several things here, and I'll try to address them all.

First off, there is a common misconception about compatibility modes and what they are.

Setting a compatibility mode governs how TSQL is interpereted and behaves, but does NOT have any impact to the physical structure of the database itself. So, a SQL 2005 database in 80 compatibility mode will have a SQL 2005 structure in the database files, but will respond to TSQL as if it were a SQL 2000 database. Meaning that any deprecated/removed keywords will be honored, and any behaviors which have been changed will act as they did in SQL 2000.

When you upgrade to SQL 2005, the database structures are upgraded at the point in time when the database is recovered.

So, you can continue to apply SQL 2000-based logs to the database as long as it is never recovered. Unfortunately, you cannot access it for any purpose other than applying logs. You cannot put it in standby mode, as that implies recovering the database, which triggers the update. You also cannot create a database snapshot without recovering/upgrading the database.

|||

Hmm, well that make since. i was a little shady on the compatibility modes though if the database structure does not change, they whats the big deal with attaching a once sql 2000 database to a 2005 instance and restoring a sql 2000 transaction file to it. ( during the attach process does the database automatically get upgraded?)

Thanks

|||

Part of attaching a database involves recovering it. This triggers the upgrading of the structures.

There is currently not a CREATE DATABASE FOR ATTACH WITH NORECOVERY.

Wednesday, March 21, 2012

restoring single table

Hi All,
I am taking transaction log backup every six hours. Now i want to restore just one particular table before 2 hrs of now.
How can i go about pls help me as its very urgent.
TIA
RegardsRESTORE

bcp out|||hi thanks for the reply

Can u be more specific as i am very new to this database

TIA
Regards|||You can restore the database to a second instance of the database and then DTS or use BCP to send the table over to your live database. If you are new I would reccomend using the DTS import/export wizard (remember to delete destination rows).

The other way is you could buy a third party tool called lumigent log explorer that would allow you to do this without restoring.

HTH

restoring one particular table

Hi All,
I am taking transaction log backup every six hours. How do
i restore one particular transaction log from which i can
get the table back.How can i go about pls help me as its
very urgent.
TIA
RegardsYou can't restore a single table from a transaction log backup. Is that
specifcally what you're asking to do? You might want to look at LogExplorer
from www.lumigent.com if you need to reconstruct a single table...
--
Brian Moran
Principal Mentor
Solid Quality Learning
SQL Server MVP
http://www.solidqualitylearning.com
"Adil" <anonymous@.discussions.microsoft.com> wrote in message
news:03ea01c3baaf$2c6e38d0$a301280a@.phx.gbl...
> Hi All,
> I am taking transaction log backup every six hours. How do
> i restore one particular transaction log from which i can
> get the table back.How can i go about pls help me as its
> very urgent.
> TIA
> Regards
>|||Without the third party tool that Brian mentioned, you would typically
restore the database to a second location (different database name) and DTS
the table you want back into production.
HTH
--
Ray Higdon MCSE, MCDBA, CCNA
--
"Adil" <anonymous@.discussions.microsoft.com> wrote in message
news:03ea01c3baaf$2c6e38d0$a301280a@.phx.gbl...
> Hi All,
> I am taking transaction log backup every six hours. How do
> i restore one particular transaction log from which i can
> get the table back.How can i go about pls help me as its
> very urgent.
> TIA
> Regards
>

Restoring of a table

Hi All,
I am taking transaction log backup every six hours. Which
backup should i use to restore so that i can get the table
which i want. How can i go about pls help me as its very
urgent.
TIA
RegardsITS GROUNDHOG DAY!!!
If you didnt do filegroup backups, you cant restore just
one table. You can however restore the whole db to a new
name and export that table back into your db.
>--Original Message--
>Hi All,
>I am taking transaction log backup every six hours. Which
>backup should i use to restore so that i can get the
table
>which i want. How can i go about pls help me as its very
>urgent.
>TIA
>Regards
>
>.
>

Tuesday, March 20, 2012

Restoring of a table

Hi All,
I am taking transaction log backup every six hours. Which
backup should i use to restore so that i can get the table
which i want. How can i go about pls help me as its very
urgent.
TIA
RegardsHi
Restore your last full backup and all the tx logs in order since the full backup until you get to the log backup where you want restore from. On the restore screen you will be able to select a point in time within the tx log if you want. Restore this full backup and subsequent tx log backups to a different database name (this is very important, do not overwrite your production database!!). Then use "DTS Export Data" to export your table from the restored database over the production table.(Do this by right clicking on your restored database and saying export data...follow the wizard)
All the best
J

Restoring multiple TRN files to another computer

I have a backup process that does full backups
periodically with transaction logs backed up every 5
minutes. In the event that I need to restore the backup
and apply a large number of TRN files on another computer
(for example if the server dies), is there an easy way?
If I do the restore on the original server, the interface
is easy because it knows about all the recent backups,
but when I do the restore to another server, the backups
are not listed in the interface so it seems I have to
choose "restore from device" and then select the backup
file and each TRN file individually which is very tedious.
Rick Harrison.In EM 2000, you can generate backup history from the contents of the backup
device. I've never used it (I prefer to do RESTORE though TSQL command), but
my guess that the feature was put there for this type of situations.
--
Tibor Karaszi, SQL Server MVP
Archive at:
http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"rick@.knowware.com" <anonymous@.discussions.microsoft.com> wrote in message
news:0bd901c3bb52$2cbc0da0$a501280a@.phx.gbl...
> I have a backup process that does full backups
> periodically with transaction logs backed up every 5
> minutes. In the event that I need to restore the backup
> and apply a large number of TRN files on another computer
> (for example if the server dies), is there an easy way?
> If I do the restore on the original server, the interface
> is easy because it knows about all the recent backups,
> but when I do the restore to another server, the backups
> are not listed in the interface so it seems I have to
> choose "restore from device" and then select the backup
> file and each TRN file individually which is very tedious.
> Rick Harrison.|||We recently recovered from a total disk array failure to
another SQL server. We were fortunate enough to have all
the .BAK & .TRN files on tape. But without a little
program I wrote to automate the restore, it would have
taken an unreasonable amount of time to apply each TLog
using the GUI.
If you're interested, I can send you some VB code. It
uses the SQL DMO objects to restore DB's & files. I still
need to finalize some things, because I had to step
through the code & make minor adjustments to restore
everything. But I'm supposed to finalize the tool soon.
If you have VB knowledge, or someone at your company does,
you could take what I have now & make alterations to suit
your needs. Just let me know,
Gene Daigle
>--Original Message--
>I have a backup process that does full backups
>periodically with transaction logs backed up every 5
>minutes. In the event that I need to restore the backup
>and apply a large number of TRN files on another computer
>(for example if the server dies), is there an easy way?
>If I do the restore on the original server, the interface
>is easy because it knows about all the recent backups,
>but when I do the restore to another server, the backups
>are not listed in the interface so it seems I have to
>choose "restore from device" and then select the backup
>file and each TRN file individually which is very tedious.
> Rick Harrison.
>.
>

Restoring multiple transaction logs on another server

Dear knowledgeable people,
Is there a simple way to restore the latest full backup, plus all the transaction
log backups on to another server. I know you can on the same server, 'cause
all the backup history is there in MSDB. But how many people back msdb up
every 15 minutes?
Consider the case:
Full Backup of Database @. 0300 each day
T.log backups every 15 minutes
Crash at 19:00 takes out entire server, but not the backup files 'cause
you cunningly configured File Replication Service to copy them elsewhere.
When restoring, do you really have to type 60+ "restore log ... with no recovery"
commands (without typos) to get the database back?
i.e Should I polish up the following script ( error handling / differential backups ...)
and/or write my own .exe to intelligently parse a backup directory, or am I
totally missing the point? ( Me programmer not normally sysadmin ).
Regards
AJ
CREATE procedure spAJGRestoreAsFarAsYouCan
(
@.Path varchar(200) = 'c:\mssql\backup\',
@.DBName varchar(30) = 'ALC',
@.DoItOrJustPrint char(1) = 'Y'
)
as
set nocount on
-- Get list of files in directory
declare @.SqlCmd varchar(300)
set @.SqlCmd = 'dir ' + @.Path + '*.* /a-d /o:d /t:c /n /B'
create table #DirList
(
RowID int identity,
FileOnly varchar(400)
)
insert #DirList ( FileOnly )
exec master..xp_cmdshell @.SqlCmd
-- Last full backup ( .bak )
declare @.FullBackup varchar(300)
declare @.CurrentID int
Select top 1
@.CurrentID = RowID,
@.FullBackup = @.Path + FileOnly
from #DirList
where patindex( '%.bak%', FileOnly) > 0
order by RowID desc
-- if @.FullBackup is NULL return -1
Set @.SqlCmd = 'restore database [' + @.DBName + '] from disk = ''' + @.FullBackup + ''' with norecovery'
print @.SQlCmd
if @.DoItOrJustPrint = 'Y'
exec(@.SQLCmd)
Declare @.TransLog varchar(300)
Set @.TransLog = 'dummy'
While @.TransLog is Not NULL
Begin
Set @.TransLog = NULL
Select top 1
@.TransLog = @.Path + FileOnly,
@.CurrentID = RowID
from #DirList
where patindex( '%.trn%', FileOnly) > 0
and RowID > @.CurrentID
order by RowID
if @.TransLog is not NULL
Begin
Set @.SqlCmd = 'restore log [' + @.DBName + '] from disk = ''' + @.TransLog + ''' with norecovery'
print @.SQlCmd
if @.DoItOrJustPrint = 'Y'
exec(@.SQLCmd)
End
End
Set @.SqlCmd = 'restore database [' + @.DBName + '] with recovery'
print @.SQlCmd
if @.DoItOrJustPrint = 'Y'
exec(@.SQLCmd)
drop table #DirList
return (0)I'd just polish the script. I'd like to point out the following, though:
* You may want to change dir /t:c to dir /t:w
* If your directory may have files other than the database/log backup files,
you may want to check
each file with RESTORE HEADERONLY to make sure that it's a backup file
* Instead of relying on the file date/time to determine the order of the
restore, you can also use
RESTORE HEADERONLY to make sure that the order is correct.
* Using RESTORE HEADERONLY, you can even determine whether you have gaps in
your log
backups by inspecting the LSN's (log sequence numbers)
--
Linchi Shea
linchi_shea@.NOSPAMml.com
"Andrew John" <aj@.DELETEmistrose.com> wrote in message
news:O5yClz$fDHA.616@.TK2MSFTNGP11.phx.gbl...
> Dear knowledgeable people,
> Is there a simple way to restore the latest full backup, plus all the
transaction
> log backups on to another server. I know you can on the same server,
'cause
> all the backup history is there in MSDB. But how many people back msdb up
> every 15 minutes?
> Consider the case:
> Full Backup of Database @. 0300 each day
> T.log backups every 15 minutes
> Crash at 19:00 takes out entire server, but not the backup files 'cause
> you cunningly configured File Replication Service to copy them elsewhere.
> When restoring, do you really have to type 60+ "restore log ... with no
recovery"
> commands (without typos) to get the database back?
> i.e Should I polish up the following script ( error handling /
differential backups ...)
> and/or write my own .exe to intelligently parse a backup directory, or am
I
> totally missing the point? ( Me programmer not normally sysadmin ).
> Regards
> AJ
> CREATE procedure spAJGRestoreAsFarAsYouCan
> (
> @.Path varchar(200) = 'c:\mssql\backup\',
> @.DBName varchar(30) = 'ALC',
> @.DoItOrJustPrint char(1) = 'Y'
> )
> as
> set nocount on
> -- Get list of files in directory
> declare @.SqlCmd varchar(300)
> set @.SqlCmd = 'dir ' + @.Path + '*.* /a-d /o:d /t:c /n /B'
> create table #DirList
> (
> RowID int identity,
> FileOnly varchar(400)
> )
> insert #DirList ( FileOnly )
> exec master..xp_cmdshell @.SqlCmd
> -- Last full backup ( .bak )
> declare @.FullBackup varchar(300)
> declare @.CurrentID int
> Select top 1
> @.CurrentID = RowID,
> @.FullBackup = @.Path + FileOnly
> from #DirList
> where patindex( '%.bak%', FileOnly) > 0
> order by RowID desc
> -- if @.FullBackup is NULL return -1
> Set @.SqlCmd = 'restore database [' + @.DBName + '] from disk = ''' +
@.FullBackup + ''' with norecovery'
> print @.SQlCmd
> if @.DoItOrJustPrint = 'Y'
> exec(@.SQLCmd)
> Declare @.TransLog varchar(300)
> Set @.TransLog = 'dummy'
> While @.TransLog is Not NULL
> Begin
> Set @.TransLog = NULL
> Select top 1
> @.TransLog = @.Path + FileOnly,
> @.CurrentID = RowID
> from #DirList
> where patindex( '%.trn%', FileOnly) > 0
> and RowID > @.CurrentID
> order by RowID
> if @.TransLog is not NULL
> Begin
> Set @.SqlCmd = 'restore log [' + @.DBName + '] from disk = ''' +
@.TransLog + ''' with norecovery'
> print @.SQlCmd
> if @.DoItOrJustPrint = 'Y'
> exec(@.SQLCmd)
> End
> End
>
> Set @.SqlCmd = 'restore database [' + @.DBName + '] with recovery'
> print @.SQlCmd
> if @.DoItOrJustPrint = 'Y'
> exec(@.SQLCmd)
> drop table #DirList
> return (0)
>|||Andrew
Yeh, you need to be prepared for such situations.
I would write stored procedure that accept tree parameters
(dbname,from_hour,to_hour)
You need to keep transaction backups with appropriatte file name like
my_log1200 ,next my_log1215.
"Andrew John" <aj@.DELETEmistrose.com> wrote in message
news:O5yClz$fDHA.616@.TK2MSFTNGP11.phx.gbl...
> Dear knowledgeable people,
> Is there a simple way to restore the latest full backup, plus all the
transaction
> log backups on to another server. I know you can on the same server,
'cause
> all the backup history is there in MSDB. But how many people back msdb up
> every 15 minutes?
> Consider the case:
> Full Backup of Database @. 0300 each day
> T.log backups every 15 minutes
> Crash at 19:00 takes out entire server, but not the backup files 'cause
> you cunningly configured File Replication Service to copy them elsewhere.
> When restoring, do you really have to type 60+ "restore log ... with no
recovery"
> commands (without typos) to get the database back?
> i.e Should I polish up the following script ( error handling /
differential backups ...)
> and/or write my own .exe to intelligently parse a backup directory, or am
I
> totally missing the point? ( Me programmer not normally sysadmin ).
> Regards
> AJ
> CREATE procedure spAJGRestoreAsFarAsYouCan
> (
> @.Path varchar(200) = 'c:\mssql\backup\',
> @.DBName varchar(30) = 'ALC',
> @.DoItOrJustPrint char(1) = 'Y'
> )
> as
> set nocount on
> -- Get list of files in directory
> declare @.SqlCmd varchar(300)
> set @.SqlCmd = 'dir ' + @.Path + '*.* /a-d /o:d /t:c /n /B'
> create table #DirList
> (
> RowID int identity,
> FileOnly varchar(400)
> )
> insert #DirList ( FileOnly )
> exec master..xp_cmdshell @.SqlCmd
> -- Last full backup ( .bak )
> declare @.FullBackup varchar(300)
> declare @.CurrentID int
> Select top 1
> @.CurrentID = RowID,
> @.FullBackup = @.Path + FileOnly
> from #DirList
> where patindex( '%.bak%', FileOnly) > 0
> order by RowID desc
> -- if @.FullBackup is NULL return -1
> Set @.SqlCmd = 'restore database [' + @.DBName + '] from disk = ''' +
@.FullBackup + ''' with norecovery'
> print @.SQlCmd
> if @.DoItOrJustPrint = 'Y'
> exec(@.SQLCmd)
> Declare @.TransLog varchar(300)
> Set @.TransLog = 'dummy'
> While @.TransLog is Not NULL
> Begin
> Set @.TransLog = NULL
> Select top 1
> @.TransLog = @.Path + FileOnly,
> @.CurrentID = RowID
> from #DirList
> where patindex( '%.trn%', FileOnly) > 0
> and RowID > @.CurrentID
> order by RowID
> if @.TransLog is not NULL
> Begin
> Set @.SqlCmd = 'restore log [' + @.DBName + '] from disk = ''' +
@.TransLog + ''' with norecovery'
> print @.SQlCmd
> if @.DoItOrJustPrint = 'Y'
> exec(@.SQLCmd)
> End
> End
>
> Set @.SqlCmd = 'restore database [' + @.DBName + '] with recovery'
> print @.SQlCmd
> if @.DoItOrJustPrint = 'Y'
> exec(@.SQLCmd)
> drop table #DirList
> return (0)
>|||Thank you all for your comments.
I'm glad to see I wasn't completely off track.
I am a bit surprised with t:c vs t:w. Wouldn't that
cause issues if the full backup took more than 15minutes ?
( It wont in my case - but I did think of that ).
What I am trying to write is something that can be run
in the wee hours of the morning, by some overstressed
service technician, without a microscopic examination of
file names and a touch typing course.
Pretty please Mr Microsoft - It wouldn't be too hard to put
some MSDB data into the T.Log backups would it?
Thanks Again
AJ
"Linchi Shea" <linchi_shea@.NOSPAMml.com> wrote in message news:uygo6aAgDHA.1648@.TK2MSFTNGP09.phx.gbl...
> I'd just polish the script. I'd like to point out the following, though:
> * You may want to change dir /t:c to dir /t:w
> * If your directory may have files other than the database/log backup files,
> you may want to check
> each file with RESTORE HEADERONLY to make sure that it's a backup file
> * Instead of relying on the file date/time to determine the order of the
> restore, you can also use
> RESTORE HEADERONLY to make sure that the order is correct.
> * Using RESTORE HEADERONLY, you can even determine whether you have gaps in
> your log
> backups by inspecting the LSN's (log sequence numbers)
> --
> Linchi Shea
> linchi_shea@.NOSPAMml.com
>
> "Andrew John" <aj@.DELETEmistrose.com> wrote in message
> news:O5yClz$fDHA.616@.TK2MSFTNGP11.phx.gbl...
> > Dear knowledgeable people,
> >
> > Is there a simple way to restore the latest full backup, plus all the
> transaction
> > log backups on to another server. I know you can on the same server,
> 'cause
> > all the backup history is there in MSDB. But how many people back msdb up
> > every 15 minutes?
> >
> > Consider the case:
> >
> > Full Backup of Database @. 0300 each day
> > T.log backups every 15 minutes
> > Crash at 19:00 takes out entire server, but not the backup files 'cause
> > you cunningly configured File Replication Service to copy them elsewhere.
> >
> > When restoring, do you really have to type 60+ "restore log ... with no
> recovery"
> > commands (without typos) to get the database back?
> >
> > i.e Should I polish up the following script ( error handling /
> differential backups ...)
> > and/or write my own .exe to intelligently parse a backup directory, or am
> I
> > totally missing the point? ( Me programmer not normally sysadmin ).
> >
> > Regards
> > AJ
> >
> > CREATE procedure spAJGRestoreAsFarAsYouCan
> > (
> > @.Path varchar(200) = 'c:\mssql\backup\',
> > @.DBName varchar(30) = 'ALC',
> > @.DoItOrJustPrint char(1) = 'Y'
> > )
> > as
> >
> > set nocount on
> > -- Get list of files in directory
> > declare @.SqlCmd varchar(300)
> > set @.SqlCmd = 'dir ' + @.Path + '*.* /a-d /o:d /t:c /n /B'
> >
> > create table #DirList
> > (
> > RowID int identity,
> > FileOnly varchar(400)
> > )
> >
> > insert #DirList ( FileOnly )
> > exec master..xp_cmdshell @.SqlCmd
> >
> > -- Last full backup ( .bak )
> > declare @.FullBackup varchar(300)
> > declare @.CurrentID int
> >
> > Select top 1
> > @.CurrentID = RowID,
> > @.FullBackup = @.Path + FileOnly
> > from #DirList
> > where patindex( '%.bak%', FileOnly) > 0
> > order by RowID desc
> >
> > -- if @.FullBackup is NULL return -1
> >
> > Set @.SqlCmd = 'restore database [' + @.DBName + '] from disk = ''' +
> @.FullBackup + ''' with norecovery'
> > print @.SQlCmd
> > if @.DoItOrJustPrint = 'Y'
> > exec(@.SQLCmd)
> >
> > Declare @.TransLog varchar(300)
> > Set @.TransLog = 'dummy'
> > While @.TransLog is Not NULL
> > Begin
> >
> > Set @.TransLog = NULL
> > Select top 1
> > @.TransLog = @.Path + FileOnly,
> > @.CurrentID = RowID
> > from #DirList
> > where patindex( '%.trn%', FileOnly) > 0
> > and RowID > @.CurrentID
> > order by RowID
> >
> > if @.TransLog is not NULL
> > Begin
> > Set @.SqlCmd = 'restore log [' + @.DBName + '] from disk = ''' +
> @.TransLog + ''' with norecovery'
> > print @.SQlCmd
> > if @.DoItOrJustPrint = 'Y'
> > exec(@.SQLCmd)
> > End
> > End
> >
> >
> > Set @.SqlCmd = 'restore database [' + @.DBName + '] with recovery'
> > print @.SQlCmd
> > if @.DoItOrJustPrint = 'Y'
> > exec(@.SQLCmd)
> >
> > drop table #DirList
> >
> > return (0)
> >
> >
>|||> I always like using backup / restore for version control as it
> controls dev data versions along with schema objects etc.
IMHO, DDL (and selected DML) belongs in a version control system. This
facilitates new application installs as well as upgrades. Test data can
also be stored but its not as important to keep that under version
control.
--
Hope this helps.
Dan Guzman
SQL Server MVP
--
SQL FAQ links (courtesy Neil Pike):
http://www.ntfaq.com/Articles/Index.cfm?DepartmentID=800
http://www.sqlserverfaq.com
http://www.mssqlserver.com/faq
--
"Greg Linwood" <g_linwood@.hotmail.com> wrote in message
news:eWKx7SAgDHA.1748@.TK2MSFTNGP10.phx.gbl...
> Hi Andrew.
> I regularly need to do this on software dev projects for testing,
release
> etc.. I always like using backup / restore for version control as it
> controls dev data versions along with schema objects etc. So, it
sounds like
> my needs are similar to yours. (c:
> My approach is to use similar scripts / app logic, but there's a fair
bit of
> complexity as there's a full app with additional features not relevant
to
> your question, so I can't easily post scripts as such.
> The feature that I use though is to restore file headers, extract LSNs
&
> apply in order, which works whether the files are .bak, .diff or .trn.
I've
> found that use of .diffs mitigate your "60+ retore log statements"
problem
> significantly. Perhaps you could adjust your script to include .diff,
> restore headers & retore log / diff / db in LSN order?
> HTH
> Regards,
> Greg Linwood
> SQL Server MVP
> "Andrew John" <aj@.DELETEmistrose.com> wrote in message
> news:O5yClz$fDHA.616@.TK2MSFTNGP11.phx.gbl...
> > Dear knowledgeable people,
> >
> > Is there a simple way to restore the latest full backup, plus all
the
> transaction
> > log backups on to another server. I know you can on the same
server,
> 'cause
> > all the backup history is there in MSDB. But how many people back
msdb up
> > every 15 minutes?
> >
> > Consider the case:
> >
> > Full Backup of Database @. 0300 each day
> > T.log backups every 15 minutes
> > Crash at 19:00 takes out entire server, but not the backup files
'cause
> > you cunningly configured File Replication Service to copy them
elsewhere.
> >
> > When restoring, do you really have to type 60+ "restore log ...
with no
> recovery"
> > commands (without typos) to get the database back?
> >
> > i.e Should I polish up the following script ( error handling /
> differential backups ...)
> > and/or write my own .exe to intelligently parse a backup directory,
or am
> I
> > totally missing the point? ( Me programmer not normally sysadmin ).
> >
> > Regards
> > AJ
> >
> > CREATE procedure spAJGRestoreAsFarAsYouCan
> > (
> > @.Path varchar(200) = 'c:\mssql\backup\',
> > @.DBName varchar(30) = 'ALC',
> > @.DoItOrJustPrint char(1) = 'Y'
> > )
> > as
> >
> > set nocount on
> > -- Get list of files in directory
> > declare @.SqlCmd varchar(300)
> > set @.SqlCmd = 'dir ' + @.Path + '*.* /a-d /o:d /t:c /n /B'
> >
> > create table #DirList
> > (
> > RowID int identity,
> > FileOnly varchar(400)
> > )
> >
> > insert #DirList ( FileOnly )
> > exec master..xp_cmdshell @.SqlCmd
> >
> > -- Last full backup ( .bak )
> > declare @.FullBackup varchar(300)
> > declare @.CurrentID int
> >
> > Select top 1
> > @.CurrentID = RowID,
> > @.FullBackup = @.Path + FileOnly
> > from #DirList
> > where patindex( '%.bak%', FileOnly) > 0
> > order by RowID desc
> >
> > -- if @.FullBackup is NULL return -1
> >
> > Set @.SqlCmd = 'restore database [' + @.DBName + '] from disk = ''' +
> @.FullBackup + ''' with norecovery'
> > print @.SQlCmd
> > if @.DoItOrJustPrint = 'Y'
> > exec(@.SQLCmd)
> >
> > Declare @.TransLog varchar(300)
> > Set @.TransLog = 'dummy'
> > While @.TransLog is Not NULL
> > Begin
> >
> > Set @.TransLog = NULL
> > Select top 1
> > @.TransLog = @.Path + FileOnly,
> > @.CurrentID = RowID
> > from #DirList
> > where patindex( '%.trn%', FileOnly) > 0
> > and RowID > @.CurrentID
> > order by RowID
> >
> > if @.TransLog is not NULL
> > Begin
> > Set @.SqlCmd = 'restore log [' + @.DBName + '] from disk = ''' +
> @.TransLog + ''' with norecovery'
> > print @.SQlCmd
> > if @.DoItOrJustPrint = 'Y'
> > exec(@.SQLCmd)
> > End
> > End
> >
> >
> > Set @.SqlCmd = 'restore database [' + @.DBName + '] with recovery'
> > print @.SQlCmd
> > if @.DoItOrJustPrint = 'Y'
> > exec(@.SQLCmd)
> >
> > drop table #DirList
> >
> > return (0)
> >
> >
>|||> I also advocate using VSS, this is really just supplemental dev team
> procedure.
I see what you mean now. Backup / restore certainly has its place for
taking snapshots to aid iterative testing. I'm not a big fan of VSS but
there are other better, albeit much more expensive, source control
products out there.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Greg Linwood" <g_linwood@.hotmail.com> wrote in message
news:e3v3LvEgDHA.4024@.TK2MSFTNGP11.phx.gbl...
> Experience has made me (slightly) weary of VSS which is enough to
warrant
> extra protection! So, on my projects, I have been supplementing
version
> control of database objects by implementing fully logged backups (with
> transaction log marks in sql2k or timestamps in earlier versions).
With this
> approach you get bullet-proof backup & recoverability of all db source
/
> objects and data thrown in as well. This approach works on any
platform.
> Assuming the project doesn't have massive test / dev data
requirements, it's
> easy to store these on tape or ide media or just mix into a business's
> normal backup procedures.
> Being able to easily restore dev / test environments to marks or
specific
> points in time is a powerful technique for regression testing. As a
side
> benefit you also get early indications of capacity requirements for
backup /
> restore which a data tier architect will find useful when documenting
> capacity expectations.
> I also advocate using VSS, this is really just supplemental dev team
> procedure.
> Regards,
> Greg Linwood
> SQL Server MVP
> "Dan Guzman" <danguzman@.nospam-earthlink.net> wrote in message
> news:ez8u7kEgDHA.3896@.tk2msftngp13.phx.gbl...
> > > I always like using backup / restore for version control as it
> > > controls dev data versions along with schema objects etc.
> >
> > IMHO, DDL (and selected DML) belongs in a version control system.
This
> > facilitates new application installs as well as upgrades. Test data
can
> > also be stored but its not as important to keep that under version
> > control.
> >
> > --
> > Hope this helps.
> >
> > Dan Guzman
> > SQL Server MVP
> >
> > --
> > SQL FAQ links (courtesy Neil Pike):
> >
> > http://www.ntfaq.com/Articles/Index.cfm?DepartmentID=800
> > http://www.sqlserverfaq.com
> > http://www.mssqlserver.com/faq
> > --
> >
> > "Greg Linwood" <g_linwood@.hotmail.com> wrote in message
> > news:eWKx7SAgDHA.1748@.TK2MSFTNGP10.phx.gbl...
> > > Hi Andrew.
> > >
> > > I regularly need to do this on software dev projects for testing,
> > release
> > > etc.. I always like using backup / restore for version control as
it
> > > controls dev data versions along with schema objects etc. So, it
> > sounds like
> > > my needs are similar to yours. (c:
> > >
> > > My approach is to use similar scripts / app logic, but there's a
fair
> > bit of
> > > complexity as there's a full app with additional features not
relevant
> > to
> > > your question, so I can't easily post scripts as such.
> > >
> > > The feature that I use though is to restore file headers, extract
LSNs
> > &
> > > apply in order, which works whether the files are .bak, .diff or
.trn.
> > I've
> > > found that use of .diffs mitigate your "60+ retore log statements"
> > problem
> > > significantly. Perhaps you could adjust your script to include
.diff,
> > > restore headers & retore log / diff / db in LSN order?
> > >
> > > HTH
> > >
> > > Regards,
> > > Greg Linwood
> > > SQL Server MVP
> > >
> > > "Andrew John" <aj@.DELETEmistrose.com> wrote in message
> > > news:O5yClz$fDHA.616@.TK2MSFTNGP11.phx.gbl...
> > > > Dear knowledgeable people,
> > > >
> > > > Is there a simple way to restore the latest full backup, plus
all
> > the
> > > transaction
> > > > log backups on to another server. I know you can on the same
> > server,
> > > 'cause
> > > > all the backup history is there in MSDB. But how many people
back
> > msdb up
> > > > every 15 minutes?
> > > >
> > > > Consider the case:
> > > >
> > > > Full Backup of Database @. 0300 each day
> > > > T.log backups every 15 minutes
> > > > Crash at 19:00 takes out entire server, but not the backup files
> > 'cause
> > > > you cunningly configured File Replication Service to copy them
> > elsewhere.
> > > >
> > > > When restoring, do you really have to type 60+ "restore log ...
> > with no
> > > recovery"
> > > > commands (without typos) to get the database back?
> > > >
> > > > i.e Should I polish up the following script ( error handling /
> > > differential backups ...)
> > > > and/or write my own .exe to intelligently parse a backup
directory,
> > or am
> > > I
> > > > totally missing the point? ( Me programmer not normally
sysadmin ).
> > > >
> > > > Regards
> > > > AJ
> > > >
> > > > CREATE procedure spAJGRestoreAsFarAsYouCan
> > > > (
> > > > @.Path varchar(200) = 'c:\mssql\backup\',
> > > > @.DBName varchar(30) = 'ALC',
> > > > @.DoItOrJustPrint char(1) = 'Y'
> > > > )
> > > > as
> > > >
> > > > set nocount on
> > > > -- Get list of files in directory
> > > > declare @.SqlCmd varchar(300)
> > > > set @.SqlCmd = 'dir ' + @.Path + '*.* /a-d /o:d /t:c /n /B'
> > > >
> > > > create table #DirList
> > > > (
> > > > RowID int identity,
> > > > FileOnly varchar(400)
> > > > )
> > > >
> > > > insert #DirList ( FileOnly )
> > > > exec master..xp_cmdshell @.SqlCmd
> > > >
> > > > -- Last full backup ( .bak )
> > > > declare @.FullBackup varchar(300)
> > > > declare @.CurrentID int
> > > >
> > > > Select top 1
> > > > @.CurrentID = RowID,
> > > > @.FullBackup = @.Path + FileOnly
> > > > from #DirList
> > > > where patindex( '%.bak%', FileOnly) > 0
> > > > order by RowID desc
> > > >
> > > > -- if @.FullBackup is NULL return -1
> > > >
> > > > Set @.SqlCmd = 'restore database [' + @.DBName + '] from disk =''' +
> > > @.FullBackup + ''' with norecovery'
> > > > print @.SQlCmd
> > > > if @.DoItOrJustPrint = 'Y'
> > > > exec(@.SQLCmd)
> > > >
> > > > Declare @.TransLog varchar(300)
> > > > Set @.TransLog = 'dummy'
> > > > While @.TransLog is Not NULL
> > > > Begin
> > > >
> > > > Set @.TransLog = NULL
> > > > Select top 1
> > > > @.TransLog = @.Path + FileOnly,
> > > > @.CurrentID = RowID
> > > > from #DirList
> > > > where patindex( '%.trn%', FileOnly) > 0
> > > > and RowID > @.CurrentID
> > > > order by RowID
> > > >
> > > > if @.TransLog is not NULL
> > > > Begin
> > > > Set @.SqlCmd = 'restore log [' + @.DBName + '] from disk = '''
+
> > > @.TransLog + ''' with norecovery'
> > > > print @.SQlCmd
> > > > if @.DoItOrJustPrint = 'Y'
> > > > exec(@.SQLCmd)
> > > > End
> > > > End
> > > >
> > > >
> > > > Set @.SqlCmd = 'restore database [' + @.DBName + '] with recovery'
> > > > print @.SQlCmd
> > > > if @.DoItOrJustPrint = 'Y'
> > > > exec(@.SQLCmd)
> > > >
> > > > drop table #DirList
> > > >
> > > > return (0)
> > > >
> > > >
> > >
> > >
> >
> >
>