четверг, 20 августа 2009 г.
SQL-ссылки (Восстановление базы без log-файла)
http://weblogs.asp.net/gunnarpeipman/archive/2009/07/21/attaching-sql-server-database-without-log-file.aspx
I needed to attach SQL Server 2008 database to server. There was no log file, just mdf. I don’t know why but it is not very easy to get this database online. After some digging in internet I found solution.
I suggest you to read and try out example by Paul S. Randal TechEd Demo: Creating, detaching, re-attaching, and fixing a suspect database. I also suggest you to bookmark this posting, you never know…. I found simplest solution from stackoverflow: How to recover database from MDF in SQL Server 2005? It works also for SQL Server 2008.
Create database with same name as MDF file you have.
Stop SQL Server and swap MDF files. Make sure you also keep new database you just created.
Start SQL Server. Database will be now in suspect state because log file is not correct.
Run the following script:
USE [master]
GO
ALTER DATABASE [MyDatabase] SET EMERGENCY
GO
ALTER DATABASE [MyDatabase] SET SINGLE_USER
GO
DBCC CHECKDB ([MyDatabase], REPAIR_ALLOW_DATA_LOSS)
GO
ALTER DATABASE [MyDatabase] SET MULTI_USER
GO
ALTER DATABASE [MyDatabase] SET ONLINE
GO
I needed to attach SQL Server 2008 database to server. There was no log file, just mdf. I don’t know why but it is not very easy to get this database online. After some digging in internet I found solution.
I suggest you to read and try out example by Paul S. Randal TechEd Demo: Creating, detaching, re-attaching, and fixing a suspect database. I also suggest you to bookmark this posting, you never know…. I found simplest solution from stackoverflow: How to recover database from MDF in SQL Server 2005? It works also for SQL Server 2008.
Create database with same name as MDF file you have.
Stop SQL Server and swap MDF files. Make sure you also keep new database you just created.
Start SQL Server. Database will be now in suspect state because log file is not correct.
Run the following script:
USE [master]
GO
ALTER DATABASE [MyDatabase] SET EMERGENCY
GO
ALTER DATABASE [MyDatabase] SET SINGLE_USER
GO
DBCC CHECKDB ([MyDatabase], REPAIR_ALLOW_DATA_LOSS)
GO
ALTER DATABASE [MyDatabase] SET MULTI_USER
GO
ALTER DATABASE [MyDatabase] SET ONLINE
GO
суббота, 1 августа 2009 г.
SQL-ссылки (Send Email from SQL Server Express Using a CLR Stored Procedure)
http://www.mssqltips.com/tip.asp?tip=1795
Imports System.Net
Imports System.Net.Mail
Public Class StoredProcedure
_
Public Shared Sub spSendMail(ByVal recipients As String, ByVal subject As String, ByVal from As String, ByVal body As String)
Dim mySmtpClient As SmtpClient
Using myMessage As New MailMessage(from, recipients)
myMessage.Subject = subject
myMessage.Body = body
myMessage.IsBodyHtml = True
mySmtpClient = New SmtpClient("mail.yourservername.com")
mySmtpClient.Credentials = New NetworkCredential("email@domain", "yourPassword")
mySmtpClient.Send(myMessage)
End Using
End Sub
End Class
Imports System.Net
Imports System.Net.Mail
Public Class StoredProcedure
Public Shared Sub spSendMail(ByVal recipients As String, ByVal subject As String, ByVal from As String, ByVal body As String)
Dim mySmtpClient As SmtpClient
Using myMessage As New MailMessage(from, recipients)
myMessage.Subject = subject
myMessage.Body = body
myMessage.IsBodyHtml = True
mySmtpClient = New SmtpClient("mail.yourservername.com")
mySmtpClient.Credentials = New NetworkCredential("email@domain", "yourPassword")
mySmtpClient.Send(myMessage)
End Using
End Sub
End Class
как отследить присутсвие юзера за компом
как отследить присутсвие юзера за компом
есть программа которая должна переключать режим своей работы если юзер отошел от компа
надо проверять движение мышкой и нажатие на клавиатуру
http://stackoverflow.com/questions/19185/is-there-a-way-to-check-to-see-if-the-user-is-currently-idle
есть программа которая должна переключать режим своей работы если юзер отошел от компа
надо проверять движение мышкой и нажатие на клавиатуру
http://stackoverflow.com/questions/19185/is-there-a-way-to-check-to-see-if-the-user-is-currently-idle
Подписаться на:
Сообщения (Atom)