Showing posts with label apply. Show all posts
Showing posts with label apply. Show all posts

Friday, March 30, 2012

How do I apply a LDF log file to a restored database?

I only have the ldf file and the bak file.

My bak file was current to 3/2/2007

My ldf file was current to 3/25/2007

I do not have the mdf file.

How to I apply the transaction from the ldf file to my resotred database?

Hello David,

According to my knowledge it not is possible to apply a .ldf file but if you are using some external tool like Logexplorer then you can atleast view the transactions in that .ldf file.

|||If this is the case it would seem to negate the purpose of having a log file?|||

The purposes of the log file are:

To facilitate rollback/rollforward when a database is brought online after an unusual shutdown|||

you said you have a .bak file and a log file. My gut feeling is that , this bak file is a full backup of your database. In that case you can restore the database from this back file as on the bak file is created.

YOu have mentioned that you have a ldf file. is it physical file or is it a bakup file. confirm this

run the following command to know what all are the contents inside the bak file

RESTORE FILELISTONLY FROM DISK = 'D:\your bak filename.bak'

if it is a full backup use restore command to restore it. Read about Restore command in BOL

Madhu

|||

No David ,

It would not negate the use of a log file. if you had a .mdf file then you could attach the log file with the .mdf file. .trn files are the log back up file not the .ldf files.

How do I apply a LDF log file to a restored database?

I only have the ldf file and the bak file.

My bak file was current to 3/2/2007

My ldf file was current to 3/25/2007

I do not have the mdf file.

How to I apply the transaction from the ldf file to my resotred database?

Hello David,

According to my knowledge it not is possible to apply a .ldf file but if you are using some external tool like Logexplorer then you can atleast view the transactions in that .ldf file.

|||If this is the case it would seem to negate the purpose of having a log file?|||

The purposes of the log file are:

To facilitate rollback/rollforward when a database is brought online after an unusual shutdown|||

you said you have a .bak file and a log file. My gut feeling is that , this bak file is a full backup of your database. In that case you can restore the database from this back file as on the bak file is created.

YOu have mentioned that you have a ldf file. is it physical file or is it a bakup file. confirm this

run the following command to know what all are the contents inside the bak file

RESTORE FILELISTONLY FROM DISK = 'D:\your bak filename.bak'

if it is a full backup use restore command to restore it. Read about Restore command in BOL

Madhu

|||

No David ,

It would not negate the use of a log file. if you had a .mdf file then you could attach the log file with the .mdf file. .trn files are the log back up file not the .ldf files.

How do i add Pubs database to Sql server 2005

Hi there,
I just want to play with Pubs data base that is available in
Management Studio and apply all the enhancements of T-SQL in SQL '05.
How would i install the PUBs and Northwind databases to the Management
Studio databases?
Thanks
-DDownload and install from MS:
http://www.microsoft.com/downloads/...&DisplayLang=en
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Learner" <pradev@.gmail.com> wrote in message
news:1139932399.753049.165860@.g47g2000cwa.googlegroups.com...
> Hi there,
> I just want to play with Pubs data base that is available in
> Management Studio and apply all the enhancements of T-SQL in SQL '05.
> How would i install the PUBs and Northwind databases to the Management
> Studio databases?
> Thanks
> -D
>|||Hi Tibor,
Yes i got the SQL2000SampleDb.msi already on to my desktop. But i
couldn't find an option to select so that i could install in Sql server
2005 rather than in Sql server 2000.
I also tried backing up the pubs data base from Sql server 2000 and
restroing it in Sql server 2005. It has thrown some error.
Do i need to set up some thing in order to forcebly install in Sql
server 2005 during the installation process of Sql2000SampleDb.msi?
Thanks
-L|||> I also tried backing up the pubs data base from Sql server 2000 and
> restroing it in Sql server 2005. It has thrown some error.
Above work, I've done that several times. But you need to provide us with mo
re information. What
errors? Did you use the MOVE option for the RESTORE command?

> Yes i got the SQL2000SampleDb.msi already on to my desktop. But i
> couldn't find an option to select so that i could install in Sql server
> 2005 rather than in Sql server 2000.
Same procedure. Just follow the readme, and adapt the steps for 2005 (like u
sing SSMS instead of
EM),
Whatever method you chose, remember that the databases will be in 80 compati
bility mode. Change
using sp_dbcmptlevel.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Learner" <pradev@.gmail.com> wrote in message
news:1139933503.450724.203960@.f14g2000cwb.googlegroups.com...
> Hi Tibor,
> Yes i got the SQL2000SampleDb.msi already on to my desktop. But i
> couldn't find an option to select so that i could install in Sql server
> 2005 rather than in Sql server 2000.
> I also tried backing up the pubs data base from Sql server 2000 and
> restroing it in Sql server 2005. It has thrown some error.
> Do i need to set up some thing in order to forcebly install in Sql
> server 2005 during the installation process of Sql2000SampleDb.msi?
> Thanks
> -L
>|||Tibor,
The mssage i got in the final step of restoration process when i
clicked on OK after the adding the pub.bak from
-Microsoft Sql Server
+80
+90
-MS Sql
- BACKUP
-pubs.bak
from Locate Backup file wizard.
The error i got was
TITLE: Microsoft SQL Server Management Studio
--
Restore failed for Server 'DEVI\SQLDM2005'. (Microsoft.SqlServer.Smo)
For help, click:
http://go.microsoft.com/fwlink?Prod...er&LinkId=20476
ADDITIONAL INFORMATION:
System.Data.SqlClient.SqlError: The operating system returned the error
'32(The process cannot access the file because it is being used by
another process.)' while attempting
'RestoreContainer::ValidateTargetForCrea
tion' on 'C:\Program
Files\Microsoft SQL Server\MSSQL\data\pubs.mdf'.
(Microsoft.SqlServer.Smo)
For help, click:
http://go.microsoft.com/fwlink?Prod...>
LinkId=20476
BUTTONS:
OK
--
I am not sure why it is complaining about 'its being used by another
process' I don't have it available under my server explorer.
I can send the word doc of all the snap shots that i documented during
the restoration process if you think that helps.
Thanks
-L|||How many instances of SQL Server are you running? It sounds like the MDF
you are trying to attach is already attached to another instance of SQL
Server...
"Learner" <pradev@.gmail.com> wrote in message
news:1139935089.008898.70290@.o13g2000cwo.googlegroups.com...
> Tibor,
> The mssage i got in the final step of restoration process when i
> clicked on OK after the adding the pub.bak from
> -Microsoft Sql Server
> +80
> +90
> -MS Sql
> - BACKUP
> -pubs.bak
> from Locate Backup file wizard.
> The error i got was
> TITLE: Microsoft SQL Server Management Studio
> --
> Restore failed for Server 'DEVI\SQLDM2005'. (Microsoft.SqlServer.Smo)
> For help, click:
> http://go.microsoft.com/fwlink?Prod...er&LinkId=20476
> --
> ADDITIONAL INFORMATION:
> System.Data.SqlClient.SqlError: The operating system returned the error
> '32(The process cannot access the file because it is being used by
> another process.)' while attempting
> 'RestoreContainer::ValidateTargetForCrea
tion' on 'C:\Program
> Files\Microsoft SQL Server\MSSQL\data\pubs.mdf'.
> (Microsoft.SqlServer.Smo)
> For help, click:
> http://go.microsoft.com/fwlink?Prod...
0&LinkId=20476
> --
> BUTTONS:
> OK
> --
> I am not sure why it is complaining about 'its being used by another
> process' I don't have it available under my server explorer.
> I can send the word doc of all the snap shots that i documented during
> the restoration process if you think that helps.
> Thanks
> -L
>|||Hello,
I have three servers registered in my Registered Servers window.
Devi (Sql server 2000)
Devi\Sqldm2005(Sql server 2005)
Devserver\Sql2005(Sql server 2005)
And i have only instance running under my Object Explorer
Devi\Sqldm2005(Sql server 2005)
I have pubs and Northwind databases by default under the server
Devi(which is sql server 2000).
But i don't have it attached it to my Object Explorer if at all that
makes any difference.
I am not sure if i am answering your question right though.
Tahanks
-D|||Look in Books Online for the syntax of sp_attach_db. You need to provide the
physical file names for
both the mdf and the ldf file.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Learner" <pradev@.gmail.com> wrote in message
news:1139936762.694587.151210@.g47g2000cwa.googlegroups.com...
> Hello,
> I have three servers registered in my Registered Servers window.
> Devi (Sql server 2000)
> Devi\Sqldm2005(Sql server 2005)
> Devserver\Sql2005(Sql server 2005)
> And i have only instance running under my Object Explorer
> Devi\Sqldm2005(Sql server 2005)
> I have pubs and Northwind databases by default under the server
> Devi(which is sql server 2000).
> But i don't have it attached it to my Object Explorer if at all that
> makes any difference.
> I am not sure if i am answering your question right though.
>
> Tahanks
> -D
>|||Tibor,
You mean i need to do it in Management Studio rather than using the
GUI wizards? I will try doing it through Management Studio.
But mean while if you are comfortable with, i just sent over word
document that i have made during the restoring process to your hotmail
account. Could you please suggest me if i did it right?
Thanks
-L|||Yes, I'm referring to write and execute the TSQL commands in stead of using
the GUI dialogs. I never
use the GUI for these things, so I can't be much help there, I'm afraid...
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Learner" <pradev@.gmail.com> wrote in message
news:1139937684.832280.213070@.g47g2000cwa.googlegroups.com...
> Tibor,
> You mean i need to do it in Management Studio rather than using the
> GUI wizards? I will try doing it through Management Studio.
> But mean while if you are comfortable with, i just sent over word
> document that i have made during the restoring process to your hotmail
> account. Could you please suggest me if i did it right?
> Thanks
> -L
>sql

Wednesday, March 28, 2012

How do I "apply" a log to a database? Urgent...

Hello!
The database is giving the torn page error.
I have yesterday's backup and today's log file ldf.
How do I apply the log file to database? We didn't backup today's log...
Thanks for your help and attention.
Jorge C.
rdc02271@.yahoo.com
You don't. If you want to recover to a point in time which is between database backups, then you
should have proper operating measures for that requirement. I.e., do log backups. This is what log
backups are for.
What is the recovery mode for your database? If it is simple, then the information needed to recover
is most probably not in the ldf file anymore. If it is full or bulk logged, then you can give any of
the log reader tools a try. I have listed some on my links page.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Jorge C" <rdc02271@.yahoo.com> wrote in message news:uLIyLmbRFHA.204@.TK2MSFTNGP15.phx.gbl...
> Hello!
> The database is giving the torn page error.
> I have yesterday's backup and today's log file ldf.
> How do I apply the log file to database? We didn't backup today's log...
> Thanks for your help and attention.
> Jorge C.
> rdc02271@.yahoo.com
>
>
|||Jorge,
- Backup current transaction log WITH NO_TRUNCATE
- Restore full backup using NORECOVERY clause
- Restore transaction log backup WITH RECOVERY
See "Restoring a Database to a Prior State" in BOL.
AMB
"Jorge C" wrote:

> Hello!
> The database is giving the torn page error.
> I have yesterday's backup and today's log file ldf.
> How do I apply the log file to database? We didn't backup today's log...
> Thanks for your help and attention.
> Jorge C.
> rdc02271@.yahoo.com
>
>
|||Oops. Perhaps I didn't read the OP close enough. Assuming that you do indeed perform regular
transaction log backups as well as regular database backups, see Alejandro's post. (I read it as you
didn't perform transaction log backups *at all*, which is a big difference from not performed
*today's* transaction log backup yet.
You might want to check out:
http://www.karaszi.com/SQLServer/inf...suspect_db.asp
http://www.karaszi.com/SQLServer/inf...eral_times.asp
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in message
news:uDMBL2bRFHA.3880@.tk2msftngp13.phx.gbl...
> You don't. If you want to recover to a point in time which is between database backups, then you
> should have proper operating measures for that requirement. I.e., do log backups. This is what log
> backups are for.
> What is the recovery mode for your database? If it is simple, then the information needed to
> recover is most probably not in the ldf file anymore. If it is full or bulk logged, then you can
> give any of the log reader tools a try. I have listed some on my links page.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Jorge C" <rdc02271@.yahoo.com> wrote in message news:uLIyLmbRFHA.204@.TK2MSFTNGP15.phx.gbl...
>

How do I "apply" a log to a database? Urgent...

Hello!
The database is giving the torn page error.
I have yesterday's backup and today's log file ldf.
How do I apply the log file to database? We didn't backup today's log...
Thanks for your help and attention.
Jorge C.
rdc02271@.yahoo.comYou don't. If you want to recover to a point in time which is between databa
se backups, then you
should have proper operating measures for that requirement. I.e., do log bac
kups. This is what log
backups are for.
What is the recovery mode for your database? If it is simple, then the infor
mation needed to recover
is most probably not in the ldf file anymore. If it is full or bulk logged,
then you can give any of
the log reader tools a try. I have listed some on my links page.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Jorge C" <rdc02271@.yahoo.com> wrote in message news:uLIyLmbRFHA.204@.TK2MSFTNGP15.phx.gbl...

> Hello!
> The database is giving the torn page error.
> I have yesterday's backup and today's log file ldf.
> How do I apply the log file to database? We didn't backup today's log...
> Thanks for your help and attention.
> Jorge C.
> rdc02271@.yahoo.com
>
>|||Jorge,
- Backup current transaction log WITH NO_TRUNCATE
- Restore full backup using NORECOVERY clause
- Restore transaction log backup WITH RECOVERY
See "Restoring a Database to a Prior State" in BOL.
AMB
"Jorge C" wrote:

> Hello!
> The database is giving the torn page error.
> I have yesterday's backup and today's log file ldf.
> How do I apply the log file to database? We didn't backup today's log...
> Thanks for your help and attention.
> Jorge C.
> rdc02271@.yahoo.com
>
>|||Oops. Perhaps I didn't read the OP close enough. Assuming that you do indeed
perform regular
transaction log backups as well as regular database backups, see Alejandro's
post. (I read it as you
didn't perform transaction log backups *at all*, which is a big difference f
rom not performed
*today's* transaction log backup yet.
You might want to check out:
http://www.karaszi.com/SQLServer/in..._suspect_db.asp
http://www.karaszi.com/SQLServer/in...veral_times.asp
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message
news:uDMBL2bRFHA.3880@.tk2msftngp13.phx.gbl...
> You don't. If you want to recover to a point in time which is between data
base backups, then you
> should have proper operating measures for that requirement. I.e., do log b
ackups. This is what log
> backups are for.
> What is the recovery mode for your database? If it is simple, then the inf
ormation needed to
> recover is most probably not in the ldf file anymore. If it is full or bul
k logged, then you can
> give any of the log reader tools a try. I have listed some on my links pag
e.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Jorge C" <rdc02271@.yahoo.com> wrote in message news:uLIyLmbRFHA.204@.TK2MS
FTNGP15.phx.gbl...
>sql

How do I "apply" a log to a database? Urgent...

Hello!
The database is giving the torn page error.
I have yesterday's backup and today's log file ldf.
How do I apply the log file to database? We didn't backup today's log...
Thanks for your help and attention.
Jorge C.
rdc02271@.yahoo.comYou don't. If you want to recover to a point in time which is between database backups, then you
should have proper operating measures for that requirement. I.e., do log backups. This is what log
backups are for.
What is the recovery mode for your database? If it is simple, then the information needed to recover
is most probably not in the ldf file anymore. If it is full or bulk logged, then you can give any of
the log reader tools a try. I have listed some on my links page.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Jorge C" <rdc02271@.yahoo.com> wrote in message news:uLIyLmbRFHA.204@.TK2MSFTNGP15.phx.gbl...
> Hello!
> The database is giving the torn page error.
> I have yesterday's backup and today's log file ldf.
> How do I apply the log file to database? We didn't backup today's log...
> Thanks for your help and attention.
> Jorge C.
> rdc02271@.yahoo.com
>
>|||Jorge,
- Backup current transaction log WITH NO_TRUNCATE
- Restore full backup using NORECOVERY clause
- Restore transaction log backup WITH RECOVERY
See "Restoring a Database to a Prior State" in BOL.
AMB
"Jorge C" wrote:
> Hello!
> The database is giving the torn page error.
> I have yesterday's backup and today's log file ldf.
> How do I apply the log file to database? We didn't backup today's log...
> Thanks for your help and attention.
> Jorge C.
> rdc02271@.yahoo.com
>
>|||Oops. Perhaps I didn't read the OP close enough. Assuming that you do indeed perform regular
transaction log backups as well as regular database backups, see Alejandro's post. (I read it as you
didn't perform transaction log backups *at all*, which is a big difference from not performed
*today's* transaction log backup yet.
You might want to check out:
http://www.karaszi.com/SQLServer/info_corrupt_suspect_db.asp
http://www.karaszi.com/SQLServer/info_restore_log_several_times.asp
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in message
news:uDMBL2bRFHA.3880@.tk2msftngp13.phx.gbl...
> You don't. If you want to recover to a point in time which is between database backups, then you
> should have proper operating measures for that requirement. I.e., do log backups. This is what log
> backups are for.
> What is the recovery mode for your database? If it is simple, then the information needed to
> recover is most probably not in the ldf file anymore. If it is full or bulk logged, then you can
> give any of the log reader tools a try. I have listed some on my links page.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Jorge C" <rdc02271@.yahoo.com> wrote in message news:uLIyLmbRFHA.204@.TK2MSFTNGP15.phx.gbl...
>> Hello!
>> The database is giving the torn page error.
>> I have yesterday's backup and today's log file ldf.
>> How do I apply the log file to database? We didn't backup today's log...
>> Thanks for your help and attention.
>> Jorge C.
>> rdc02271@.yahoo.com
>>
>