Filter content in ERRORLOG log file過濾log檔案的內容

Filter content in ERRORLOG log file 過濾log檔案的內容 1.Create a exclude text file(E:\Temp\Log\exclude.txt) with the contain below. 建立一個文字檔,填入要過濾的關鍵字,例如以下文字(每一行為一組關鍵字) Error: 18456 Login failed for user 2.Start a Command Prompt as an Administrator and run the command below. 執行以下命令產生過濾後的ERRORLOG檔 type E:\Temp\Log\ERRORLOG | findstr /i /v /g:E:\Temp\Log\exclude.txt > E:\Temp\Log\ERRORLOG_Filtered.log Reference: Findstr https://technet.microsoft.com/en-us/library/bb490907.aspx  

0

Use Hyper-V differencing disks

Use Hyper-V differencing disks 使用Hyper-V差異虛擬磁碟 現在安裝個Windows Server虛擬機器(VM)通常要10到20GB的磁碟空間,若再安裝SQL Server則會更大,當我們需要建立多個VM時,可以使用Hyper-V的差異虛擬磁碟來節省磁碟空間。 差異虛擬磁碟(differencing disks)是共用一個parent disk(VHD or VHDX)作為base disk,差異虛擬磁碟只儲存與parent disk的差異,所以,每個VM若使用差異虛擬磁碟,就可以省下大量磁碟空間。 以下我們使用Windows 10 Pro Hyper-V的環境,設定一個Windows 2016 VM的差異parent disk來使用這個功能 1.首先新增一個暫時的VM,這個VM最後會刪除,我們只需要保留VHD檔 2.安裝作業系統,例如Windows Server 2016,可以參考下面這篇 Install Windows Server 2016 3.Windows Update到最新hotfix。 4.安裝其他需要的軟體,例如 7-zip等工具。(之後透過差異磁碟所建立的VM就不需要再安裝一次) 5.執行Sysprep工具,清除SID…等設定,sysprep執行完成後會自動關機。 %windir%\system32\sysprep\sysprep.exe (Enter system out-of-box experience, enable generalize, shutdown option: shutdown) Sysprep (System Preparation) Overview https://technet.microsoft.com/en-us/library/hh825209.aspx 6.刪除這個暫時VM。(Hyper-V的刪除動作只會刪除VM設定檔,所以VHD檔(or VHDX檔)會保留下來) 7.將VHD檔搬移到適當的位置,並設定Properties成唯讀(Read-only)。(此VHD檔(or VHDX檔)將作為差異磁碟的Parent磁碟,所以不可以被修改) 例如,我們將檔案搬移到…

0

Install Windows Server 2016

Install Windows Server 2016 安裝Windows 2016 1.如果是在Hyper-V的VM安裝windows 2016則會先出現這個畫面 2.選擇語系,時間貨幣格式,與輸入法 3.按下Install Now開始安裝 4.選擇Windows版本 PS.若要安裝有GUI管理介面,請選擇(Server with Desktop Experience)的版本 5.選擇安裝類型,若是全新安裝,請選擇第2個選項 Custom: Install Windows only (advanced) 6.選擇要安裝在哪一個硬碟 7.開始安裝 8.安裝完成,自動重新開機之後,輸入一組Administrator自訂密碼,就大功告成了 9.(Option)建議第一件事就是Windows update PS.若是VM,大約會占用17GB。 Reference: Windows Server 2016 https://docs.microsoft.com/en-us/windows-server/windows-server-2016 Install Server with Desktop Experience https://docs.microsoft.com/en-us/windows-server/get-started/getting-started-with-server-with-desktop-experience

0

Create a template VM and Create a new VM from template VM

Create a template VM and Create a new VM from template VM 建立範本虛擬機器,透過範本虛擬機器來建立新的虛擬機器 1.Create a template VM (建立一個範本VM) Install guest OS, enable roles and features and then apply the needed Windows patches and hotfix. 2.Run SYSPREP (執行Sysprep工具) Login VM, then run SYSPREP %windir%\system32\sysprep\sysprep.exe (Enter system out-of-box experience, enable generalize, shutdown option: shutdown) Sysprep (System Preparation)…

0

Virtual Machine software and image file

Virtual Machine host software 虛擬機器軟體與虛擬機器映像檔 1.Microsoft 微軟虛擬化軟體 Windows Virtualization Software 虛擬化軟體 Windows 7 Windows Virtual PC https://www.microsoft.com/zh-tw/download/details.aspx?id=3702需要下載後安裝 Windows 8 Windows 8.1 Windows 2012 Windows 2012 R2 Step-By-Step: Enabling Hyper-V for use on Windows 8.1 https://blogs.technet.microsoft.com/canitpro/2014/03/10/step-by-step-enabling-hyper-v-for-use-on-windows-8-1/內建功能,直接在控制台>程式與功能>開啟或關閉 Windows 功能,勾選[Hyper-V] Install Hyper-V and create a virtual machine https://technet.microsoft.com/en-us/library/hh846766(v=ws.11).aspx   Windows 10 在 Windows 10 上安裝 Hyper-V https://docs.microsoft.com/zh-tw/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v內建功能,直接在控制台>程式與功能>開啟或關閉 Windows…

0

SQL Server Tools default Location

SQL Server Tools default Location SQL Server工具預設位置   Tools SQL Server versions Location sqlcmd.exe, bcp.exe SQL 2008 R2 C:\Program Files\Microsoft SQL Server\100\Tools\Binn\ SQL 2012 C:\Program Files\Microsoft SQL Server\110\Tools\Binn\ SQL 2014 C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\ SQL 2016 C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\ Integration Services component dtexec.exe SQL 2008 R2 C:\Program Files\Microsoft SQL Server\100\ DTS\Binn\ C:\Program…

0

SQL Server Managment Studio default locations

SQL Server Managment Studio default locations SQL Server Managment Studio 執行檔預設路徑與位置 SQL Server 2014 C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\Ssms.exe SQL Server 2012 C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\Ssms.exe SQL Server 2008 R2 C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe SQL Server 2005 C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\SqlWb.exe

0

How to reset forgotten sa password

How to reset forgotten sa password 如何重設sa密碼  或 忘記sa密碼的情況下加入一個SQL管理員帳戶 如果忘記sa密碼,有2個方法解決 方法一 不需要重啟SQL Server服務,但Login裡面必須要原本就有NT AUTHORITY\SYSTEM帳戶,且此帳戶要有sysadmin Role 1.下載Sysinternals的psexec.exe工具 https://technet.microsoft.com/en-us/sysinternals/bb897553.aspx 2.啟動命令提示字元,用psexec.exe來啟動SSMS,就可以用NT SERVICE\SYSTEM身分Windows驗證登入 PsExec.exe -s -i “C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe” SQL Server Managment Studio default locations 方法二 處理過程會有downtime,因為需重新啟動SQL Server服務。 1.停止SQL Server服務 2.啟動第1個命令提示字元,以Single user mode啟動SQL Server Start the SQL Server instance using single user mode (or minimal configuration which…

0

SQL Server Management Studio Keyboard Shortcuts

SQL Server Management Studio Keyboard Shortcuts 常用快速鍵 SQL Server Management Studio Keyboard Shortcuts https://msdn.microsoft.com/en-us/library/ms174205.aspx Action SQL Server 2016 SQL Server 2008 R2 Select text from the cursor to the beginning of the document CTRL+SHIFT+ HOME CTRL+SHIFT+ HOME Select text from the cursor to the end of the document CTRL+SHIFT+END CTRL+SHIFT+END Select text from the cursor…

0

SQL Server Physical Joins

SQL Server Physical Join (Nested Loops joins, Merge joins, Hash joins) Advanced Query Tuning Concepts https://technet.microsoft.com/en-us/library/ms191426(v=sql.105).aspx SQL Server employs three types of join operations: Nested loops joins Merge joins Hash joins   Nest Loops Joins If one join input is small (fewer than 10 rows) and the other join input is fairly large and indexed…

0