unstylish, unattractive, or socially inept person: especially: one slavishly devoted to intellectual or academic pursuits
Monday, December 5, 2011
powershell script to scan all files in a folder (and subfolders) and get string containing
$filename = "*.txt"
$temp=Get-ChildItem -Recurse $dir | Where-Object {$_.Name -like $filename} | Select-Object -Property Fullname, Name
"Starting File " | Out-File "c:\test.txt"
" "
foreach($tmp in $temp)
{
$tmp.Name.SubString(0,5) | Out-File "c:\test.txt" -append
get-content -path $tmp.FullName | Select-string "interface | ip address " | Out-File "c:\test.txt" -append
}
Tuesday, February 22, 2011
XMLSerializer Error? XmlSerializerPreCompiler to the rescue
Wednesday, February 16, 2011
Mount Windows on Linux
Monday, February 7, 2011
Restoring SQL for mirroring
If the path of the mirror database differs from the path of the principal database (for instance, their drive letters differ), creating the mirror database requires that the restore operation include a MOVE clause.
Important |
---|
If the path names of the principal and mirror databases differ, you cannot add a file. This is because on receiving the log for the add file operation, the mirror server instance attempts to place the new file in the location used by the principal database. |
For example, the following command restores a backup of a principal database residing in C:\Program Files\Microsoft SQL Server\MSSQL.n\MSSQL\Data\ to a different location, D:\Program Files\Microsoft SQL Server\MSSQL.n\MSSQL\Data\, where the mirror database is to reside.
RESTORE DATABASE AdventureWorks2008R2 FROM DISK='C:\AdventureWorks2008R2.bak' WITH NORECOVERY, MOVE 'AdventureWorks2008R2_Data' TO 'D:\Program Files\Microsoft SQL Server\MSSQL.n\MSSQL\Data\AdventureWorks2008R2_Data.mdf', MOVE 'AdventureWorks2008R2_Log' TO 'D:\Program Files\Microsoft SQL Server\MSSQL.n\MSSQL\Data\AdventureWorks2008R2_Log.ldf'; GO
The above path is for reference only, check the correct path on the mirror database and repeat the process for full backup and transactional backup.