Friday, March 30, 2012

Restoreing From Log File

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

Restored SQL 6.5 but can only access locally - Need Help

Pardon my long windedness, but I want to provide a full explanation.
I have very limited (next to none) knowledge of SQL Server or NT / 2000
Server.
We had a membership database stored on an SQL Server 6.5 on an NT system.
We accessed it via a custom written Visual Basic program called Member. The
computer crashed, not the drive. Apparently, it was an old single processor
PC. I tried to move the drive into a newer computer and got a HAL.DLL
error. I was able to recover the DAT files using the drive as a second dive
on a newer PC.
I put the drive in a newer computer and upgraded it to Windows 2000. Then I
reinstalled SQL Server 6.5. I created the matching database and database
devices. I then copied the old DAT files over and it worked. I was able to
access the old database files. Hooray!
I reinstalled the Member program, and sure enough the connection strings
work and I can access my data again. Another Hooray!
Now my only problem is that I cannot connect to the database from any of the
network computers, only locally. I have read many pages on the internet and
experimented quite a bit, but I still get an ODBC timeout failure every time
I try to connect from one of the other computers on the network.
It appears that my SQL is running and sharing the information, but only
locally. Or there is some other reason that I cannot access it over the
network? Any ideas? I really need to get this up and running again soon.
Thanks for any help.
TedDid you enabled the TCP/IP protocol while installing the SQL Server 6.5? If
not go to SQL 6.5 Setup program
and check if the TCP/IP is selected; else include that and try connecting.
Its been a long time I have worked with
SQL 6.5.
Thanks
Hari
SQL Server MVP
"Ted Hadley" <thadley@.cypresscoveresort.com> wrote in message
news:3MWdnUKfzpi_r3PZnZ2dnUVZ_oCdnZ2d@.gi
ganews.com...
> Pardon my long windedness, but I want to provide a full explanation.
> I have very limited (next to none) knowledge of SQL Server or NT / 2000
> Server.
> We had a membership database stored on an SQL Server 6.5 on an NT system.
> We accessed it via a custom written Visual Basic program called Member.
> The computer crashed, not the drive. Apparently, it was an old single
> processor PC. I tried to move the drive into a newer computer and got a
> HAL.DLL error. I was able to recover the DAT files using the drive as a
> second dive on a newer PC.
> I put the drive in a newer computer and upgraded it to Windows 2000. Then
> I reinstalled SQL Server 6.5. I created the matching database and
> database devices. I then copied the old DAT files over and it worked. I
> was able to access the old database files. Hooray!
> I reinstalled the Member program, and sure enough the connection strings
> work and I can access my data again. Another Hooray!
> Now my only problem is that I cannot connect to the database from any of
> the network computers, only locally. I have read many pages on the
> internet and experimented quite a bit, but I still get an ODBC timeout
> failure every time I try to connect from one of the other computers on the
> network.
> It appears that my SQL is running and sharing the information, but only
> locally. Or there is some other reason that I cannot access it over the
> network? Any ideas? I really need to get this up and running again soon.
> Thanks for any help.
> Ted
>|||Hi Ted
Just wondering if you changed the name of the server, in which case you may
need to change the connection properties for the application.
John
"Ted Hadley" wrote:

> Pardon my long windedness, but I want to provide a full explanation.
> I have very limited (next to none) knowledge of SQL Server or NT / 2000
> Server.
> We had a membership database stored on an SQL Server 6.5 on an NT system.
> We accessed it via a custom written Visual Basic program called Member. T
he
> computer crashed, not the drive. Apparently, it was an old single process
or
> PC. I tried to move the drive into a newer computer and got a HAL.DLL
> error. I was able to recover the DAT files using the drive as a second di
ve
> on a newer PC.
> I put the drive in a newer computer and upgraded it to Windows 2000. Then
I
> reinstalled SQL Server 6.5. I created the matching database and database
> devices. I then copied the old DAT files over and it worked. I was able
to
> access the old database files. Hooray!
> I reinstalled the Member program, and sure enough the connection strings
> work and I can access my data again. Another Hooray!
> Now my only problem is that I cannot connect to the database from any of t
he
> network computers, only locally. I have read many pages on the internet a
nd
> experimented quite a bit, but I still get an ODBC timeout failure every ti
me
> I try to connect from one of the other computers on the network.
> It appears that my SQL is running and sharing the information, but only
> locally. Or there is some other reason that I cannot access it over the
> network? Any ideas? I really need to get this up and running again soon.
> Thanks for any help.
> Ted
>
>|||That was exactly the problem. Thank you Hari. I ran the Setup program,
checked TCP/IP, and restarted SQL. It worked immediately.
You're a lifesaver!
Ted
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:%23Pe%23SG%23xGHA.4576@.TK2MSFTNGP06.phx.gbl...
> Did you enabled the TCP/IP protocol while installing the SQL Server 6.5?
> If not go to SQL 6.5 Setup program
> and check if the TCP/IP is selected; else include that and try connecting.
> Its been a long time I have worked with
> SQL 6.5.
> Thanks
> Hari
> SQL Server MVP
>
> "Ted Hadley" <thadley@.cypresscoveresort.com> wrote in message
> news:3MWdnUKfzpi_r3PZnZ2dnUVZ_oCdnZ2d@.gi
ganews.com...
>|||Thats a good news..
Thanks
Hari
SQL Server MVP
"Ted Hadley" <thadley@.cypresscoveresort.com> wrote in message
news:6a-dnUP6fbGi53LZnZ2dnUVZ_sydnZ2d@.giganews.com...
> That was exactly the problem. Thank you Hari. I ran the Setup program,
> checked TCP/IP, and restarted SQL. It worked immediately.
> You're a lifesaver!
> Ted
> "Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
> news:%23Pe%23SG%23xGHA.4576@.TK2MSFTNGP06.phx.gbl...
>sql

Restored SQL 6.5 but can only access locally - Need Help

Pardon my long windedness, but I want to provide a full explanation.
I have very limited (next to none) knowledge of SQL Server or NT / 2000
Server.
We had a membership database stored on an SQL Server 6.5 on an NT system.
We accessed it via a custom written Visual Basic program called Member. The
computer crashed, not the drive. Apparently, it was an old single processor
PC. I tried to move the drive into a newer computer and got a HAL.DLL
error. I was able to recover the DAT files using the drive as a second dive
on a newer PC.
I put the drive in a newer computer and upgraded it to Windows 2000. Then I
reinstalled SQL Server 6.5. I created the matching database and database
devices. I then copied the old DAT files over and it worked. I was able to
access the old database files. Hooray!
I reinstalled the Member program, and sure enough the connection strings
work and I can access my data again. Another Hooray!
Now my only problem is that I cannot connect to the database from any of the
network computers, only locally. I have read many pages on the internet and
experimented quite a bit, but I still get an ODBC timeout failure every time
I try to connect from one of the other computers on the network.
It appears that my SQL is running and sharing the information, but only
locally. Or there is some other reason that I cannot access it over the
network? Any ideas? I really need to get this up and running again soon.
Thanks for any help.
TedDid you enabled the TCP/IP protocol while installing the SQL Server 6.5? If
not go to SQL 6.5 Setup program
and check if the TCP/IP is selected; else include that and try connecting.
Its been a long time I have worked with
SQL 6.5.
Thanks
Hari
SQL Server MVP
"Ted Hadley" <thadley@.cypresscoveresort.com> wrote in message
news:3MWdnUKfzpi_r3PZnZ2dnUVZ_oCdnZ2d@.giganews.com...
> Pardon my long windedness, but I want to provide a full explanation.
> I have very limited (next to none) knowledge of SQL Server or NT / 2000
> Server.
> We had a membership database stored on an SQL Server 6.5 on an NT system.
> We accessed it via a custom written Visual Basic program called Member.
> The computer crashed, not the drive. Apparently, it was an old single
> processor PC. I tried to move the drive into a newer computer and got a
> HAL.DLL error. I was able to recover the DAT files using the drive as a
> second dive on a newer PC.
> I put the drive in a newer computer and upgraded it to Windows 2000. Then
> I reinstalled SQL Server 6.5. I created the matching database and
> database devices. I then copied the old DAT files over and it worked. I
> was able to access the old database files. Hooray!
> I reinstalled the Member program, and sure enough the connection strings
> work and I can access my data again. Another Hooray!
> Now my only problem is that I cannot connect to the database from any of
> the network computers, only locally. I have read many pages on the
> internet and experimented quite a bit, but I still get an ODBC timeout
> failure every time I try to connect from one of the other computers on the
> network.
> It appears that my SQL is running and sharing the information, but only
> locally. Or there is some other reason that I cannot access it over the
> network? Any ideas? I really need to get this up and running again soon.
> Thanks for any help.
> Ted
>|||Hi Ted
Just wondering if you changed the name of the server, in which case you may
need to change the connection properties for the application.
John
"Ted Hadley" wrote:
> Pardon my long windedness, but I want to provide a full explanation.
> I have very limited (next to none) knowledge of SQL Server or NT / 2000
> Server.
> We had a membership database stored on an SQL Server 6.5 on an NT system.
> We accessed it via a custom written Visual Basic program called Member. The
> computer crashed, not the drive. Apparently, it was an old single processor
> PC. I tried to move the drive into a newer computer and got a HAL.DLL
> error. I was able to recover the DAT files using the drive as a second dive
> on a newer PC.
> I put the drive in a newer computer and upgraded it to Windows 2000. Then I
> reinstalled SQL Server 6.5. I created the matching database and database
> devices. I then copied the old DAT files over and it worked. I was able to
> access the old database files. Hooray!
> I reinstalled the Member program, and sure enough the connection strings
> work and I can access my data again. Another Hooray!
> Now my only problem is that I cannot connect to the database from any of the
> network computers, only locally. I have read many pages on the internet and
> experimented quite a bit, but I still get an ODBC timeout failure every time
> I try to connect from one of the other computers on the network.
> It appears that my SQL is running and sharing the information, but only
> locally. Or there is some other reason that I cannot access it over the
> network? Any ideas? I really need to get this up and running again soon.
> Thanks for any help.
> Ted
>
>|||That was exactly the problem. Thank you Hari. I ran the Setup program,
checked TCP/IP, and restarted SQL. It worked immediately.
You're a lifesaver!
Ted
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:%23Pe%23SG%23xGHA.4576@.TK2MSFTNGP06.phx.gbl...
> Did you enabled the TCP/IP protocol while installing the SQL Server 6.5?
> If not go to SQL 6.5 Setup program
> and check if the TCP/IP is selected; else include that and try connecting.
> Its been a long time I have worked with
> SQL 6.5.
> Thanks
> Hari
> SQL Server MVP
>
> "Ted Hadley" <thadley@.cypresscoveresort.com> wrote in message
> news:3MWdnUKfzpi_r3PZnZ2dnUVZ_oCdnZ2d@.giganews.com...
>> Pardon my long windedness, but I want to provide a full explanation.
>> I have very limited (next to none) knowledge of SQL Server or NT / 2000
>> Server.
>> We had a membership database stored on an SQL Server 6.5 on an NT system.
>> We accessed it via a custom written Visual Basic program called Member.
>> The computer crashed, not the drive. Apparently, it was an old single
>> processor PC. I tried to move the drive into a newer computer and got a
>> HAL.DLL error. I was able to recover the DAT files using the drive as a
>> second dive on a newer PC.
>> I put the drive in a newer computer and upgraded it to Windows 2000.
>> Then I reinstalled SQL Server 6.5. I created the matching database and
>> database devices. I then copied the old DAT files over and it worked. I
>> was able to access the old database files. Hooray!
>> I reinstalled the Member program, and sure enough the connection strings
>> work and I can access my data again. Another Hooray!
>> Now my only problem is that I cannot connect to the database from any of
>> the network computers, only locally. I have read many pages on the
>> internet and experimented quite a bit, but I still get an ODBC timeout
>> failure every time I try to connect from one of the other computers on
>> the network.
>> It appears that my SQL is running and sharing the information, but only
>> locally. Or there is some other reason that I cannot access it over the
>> network? Any ideas? I really need to get this up and running again
>> soon.
>> Thanks for any help.
>> Ted
>|||Thats a good news..
Thanks
Hari
SQL Server MVP
"Ted Hadley" <thadley@.cypresscoveresort.com> wrote in message
news:6a-dnUP6fbGi53LZnZ2dnUVZ_sydnZ2d@.giganews.com...
> That was exactly the problem. Thank you Hari. I ran the Setup program,
> checked TCP/IP, and restarted SQL. It worked immediately.
> You're a lifesaver!
> Ted
> "Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
> news:%23Pe%23SG%23xGHA.4576@.TK2MSFTNGP06.phx.gbl...
>> Did you enabled the TCP/IP protocol while installing the SQL Server 6.5?
>> If not go to SQL 6.5 Setup program
>> and check if the TCP/IP is selected; else include that and try
>> connecting. Its been a long time I have worked with
>> SQL 6.5.
>> Thanks
>> Hari
>> SQL Server MVP
>>
>> "Ted Hadley" <thadley@.cypresscoveresort.com> wrote in message
>> news:3MWdnUKfzpi_r3PZnZ2dnUVZ_oCdnZ2d@.giganews.com...
>> Pardon my long windedness, but I want to provide a full explanation.
>> I have very limited (next to none) knowledge of SQL Server or NT / 2000
>> Server.
>> We had a membership database stored on an SQL Server 6.5 on an NT
>> system. We accessed it via a custom written Visual Basic program called
>> Member. The computer crashed, not the drive. Apparently, it was an old
>> single processor PC. I tried to move the drive into a newer computer
>> and got a HAL.DLL error. I was able to recover the DAT files using the
>> drive as a second dive on a newer PC.
>> I put the drive in a newer computer and upgraded it to Windows 2000.
>> Then I reinstalled SQL Server 6.5. I created the matching database and
>> database devices. I then copied the old DAT files over and it worked.
>> I was able to access the old database files. Hooray!
>> I reinstalled the Member program, and sure enough the connection strings
>> work and I can access my data again. Another Hooray!
>> Now my only problem is that I cannot connect to the database from any of
>> the network computers, only locally. I have read many pages on the
>> internet and experimented quite a bit, but I still get an ODBC timeout
>> failure every time I try to connect from one of the other computers on
>> the network.
>> It appears that my SQL is running and sharing the information, but only
>> locally. Or there is some other reason that I cannot access it over the
>> network? Any ideas? I really need to get this up and running again
>> soon.
>> Thanks for any help.
>> Ted
>>
>

Restored Full with NORECOVERY and db reads dbName (Restoring...)

Can anyone help me with this issue? I restored a full backup with NORECOVERY because I need to restore the differentials as well but I have not been able to access the db. No matter what I seem to try i receive the following error:

System.Data.SqlClient.SqlError: This differential backup cannot be restored because the database has not been restored to the correct earlier state. (Microsoft.SqlServer.Smo)

Does anyone know what I need to do?

Thank you in advance.

Julio

Yes I do I don't know what but the Restore process is not working like 2000 so you still need to run restore with recovery code before your restore will complete. Here was my situation I got a database from someone created on E drive SQL Server refused to restore it without dump devices in the Master. I did that and end up with your problem, so I started again and added restore with recovery code making about four sets of code and it was restored. The link below are some of the code you need, make sure you have the .bak delete the restoring and start fresh with the code in the link below. Hope this helps.

http://wvmitchell.blogspot.com/search?q=backup+restore

|||do you have anyother full backup other than what you restored with norecovery option.........may be you might have restored another set of full backup rather than the one which you took b4 differential backup was taken..........this differential wud only have the changes which you made after the most recent full backup was taken.........so restore the last full backup taken before the differential backup was taken....may be that mite be the problem........

Restored Full with NORECOVERY and db reads dbName (Restoring...)

Can anyone help me with this issue? I restored a full backup with NORECOVERY because I need to restore the differentials as well but I have not been able to access the db. No matter what I seem to try i receive the following error:

System.Data.SqlClient.SqlError: This differential backup cannot be restored because the database has not been restored to the correct earlier state. (Microsoft.SqlServer.Smo)

Does anyone know what I need to do?

Thank you in advance.

Julio

Yes I do I don't know what but the Restore process is not working like 2000 so you still need to run restore with recovery code before your restore will complete. Here was my situation I got a database from someone created on E drive SQL Server refused to restore it without dump devices in the Master. I did that and end up with your problem, so I started again and added restore with recovery code making about four sets of code and it was restored. The link below are some of the code you need, make sure you have the .bak delete the restoring and start fresh with the code in the link below. Hope this helps.

http://wvmitchell.blogspot.com/search?q=backup+restore

|||do you have anyother full backup other than what you restored with norecovery option.........may be you might have restored another set of full backup rather than the one which you took b4 differential backup was taken..........this differential wud only have the changes which you made after the most recent full backup was taken.........so restore the last full backup taken before the differential backup was taken....may be that mite be the problem........

Restored Database/Diagrams Support/SQL-Server 2005

Hello,

I have restored a database from SQL-server 2000 into SQL-server 2005 and
when I try to install diagram support, I receive this error:

TITLE: Microsoft SQL Server Management Studio
Database diagram support objects cannot be installed because this database
does not have a valid owner. To continue, first use the Files page of the
Database Properties dialog box or the ALTER AUTHORIZATION statement to set
the database owner to a valid login, then add the database diagram support
objects.

Section 5.8.1 of the SQL 2005 Readme file says:
The installation of these support objects can fail on a database that has
been attached or restored from another instance of SQL Server. This can occur
when the database owner name (stored in the database) is not a valid logon
for the instance of SQL Server the database is being attached or restored to.

Changing the owner with the line below did not solve the problem:
ALTER AUTHORIZATION ON DATABASE::databaseTest TO userTest

Can anyone help me with this issue?

Thanks
/Ershad

you're missing just a few steps...

ALTER AUTHORIZATION ON DATABASE::[databaseTest] TO userTest
go
use [databaseTest]
go
EXECUTE AS USER = N'dbo' REVERT
go

|||You answer was very helpful. Thank you very much! I only nedded to execute the following before I could run you statements

EXEC sp_dbcmptlevel 'databaseTest', '90';

|||Just in case anyone else experiences the same problem as I did I'll add one more comment. If your login is a domain account and you are working offline you may get this message until you connect to the domain.|||

Yeah!

It really works! but can I know why?

|||

It appears that the database must be converted to the compatibility level 90 (2005).. I tried all the other recommended commands, while retaining the SQL2000 compatibility level, and it would not work.

I will usually keep a dev data base at the compatibility level of the server it is hosted on, not automatically convert it to the level of my dev machine, but it looks like this is not going to be possible.. Someone please correct me if I am wrong as I would like to be able to continue doing this..

|||

????

?? ???????? ??? ??????.

??? ?? ????? ??????

|||

"Clint" reports an alternative in a thread on this topic at http://geekswithblogs.net/takenote/archive/2006/02/06/68381.aspx:

Actually, you can just go to the database properties, go to the Options page, and change the compatibility to SQL Server 2005.

This seems to have worked for me.

Either way, be advised that this change is not trouble-free for everyone: in the same thread, Harry Chou recommends a SQL Server 2005 Books Online topic that covers a variety of possible incompatibilities between SQL Server 2005 and previous versions: ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/508c686d-2bd4-41ba-8602-48ebca266659.htm. These incompatibilities would become issues in a database after one of these approaches is used to make it compatible with SQL Server 2005.

I don't know if the Upgrade Wizard checks for these incompatibilities.

sql

Restored Database/Diagrams Support/SQL-Server 2005

Hello,

I have restored a database from SQL-server 2000 into SQL-server 2005 and
when I try to install diagram support, I receive this error:

TITLE: Microsoft SQL Server Management Studio
Database diagram support objects cannot be installed because this database
does not have a valid owner. To continue, first use the Files page of the
Database Properties dialog box or the ALTER AUTHORIZATION statement to set
the database owner to a valid login, then add the database diagram support
objects.

Section 5.8.1 of the SQL 2005 Readme file says:
The installation of these support objects can fail on a database that has
been attached or restored from another instance of SQL Server. This can occur
when the database owner name (stored in the database) is not a valid logon
for the instance of SQL Server the database is being attached or restored to.

Changing the owner with the line below did not solve the problem:
ALTER AUTHORIZATION ON DATABASE::databaseTest TO userTest

Can anyone help me with this issue?

Thanks
/Ershad

you're missing just a few steps...

ALTER AUTHORIZATION ON DATABASE::[databaseTest] TO userTest
go
use [databaseTest]
go
EXECUTE AS USER = N'dbo' REVERT
go

|||You answer was very helpful. Thank you very much! I only nedded to execute the following before I could run you statements

EXEC sp_dbcmptlevel 'databaseTest', '90';

|||Just in case anyone else experiences the same problem as I did I'll add one more comment. If your login is a domain account and you are working offline you may get this message until you connect to the domain.|||

Yeah!

It really works! but can I know why?

|||

It appears that the database must be converted to the compatibility level 90 (2005).. I tried all the other recommended commands, while retaining the SQL2000 compatibility level, and it would not work.

I will usually keep a dev data base at the compatibility level of the server it is hosted on, not automatically convert it to the level of my dev machine, but it looks like this is not going to be possible.. Someone please correct me if I am wrong as I would like to be able to continue doing this..

|||

????

?? ???????? ??? ??????.

??? ?? ????? ??????

|||

"Clint" reports an alternative in a thread on this topic at http://geekswithblogs.net/takenote/archive/2006/02/06/68381.aspx:

Actually, you can just go to the database properties, go to the Options page, and change the compatibility to SQL Server 2005.

This seems to have worked for me.

Either way, be advised that this change is not trouble-free for everyone: in the same thread, Harry Chou recommends a SQL Server 2005 Books Online topic that covers a variety of possible incompatibilities between SQL Server 2005 and previous versions: ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/508c686d-2bd4-41ba-8602-48ebca266659.htm. These incompatibilities would become issues in a database after one of these approaches is used to make it compatible with SQL Server 2005.

I don't know if the Upgrade Wizard checks for these incompatibilities.