2020年12月10日 星期四

MSSQL 2008 安裝、設定

Windows Server 2012安裝前,需要在新增功能 ".NET Framework 3.5功能",並將安裝目錄導向 Windows Server 2012光碟片中的 Source\sxs 目錄,即可進行安裝:








SQL 2008 安裝及設定:https://drive.google.com/file/d/1UGXex52cU3dWf7B9pVQhNnAfrOS6gf03/view?usp=sharing

  • 防火牆 bat 批次設定:

netsh advfirewall firewall add rule name="Open Port 80" dir=in action=allow protocol=TCP localport=80 @echo ========= SQL Server Ports =================== @echo Enabling SQLServer default instance port 1433 netsh advfirewall firewall add rule name="SQL Server" dir=in action=allow protocol=TCP localport=1433 @echo Enabling Dedicated Admin Connection port 1434 netsh advfirewall firewall add rule name="SQL Admin Connection" dir=in action=allow protocol=TCP localport=1434 @echo Enabling Conventional SQL Server Service Broker port 4022 netsh advfirewall firewall add rule name="SQL Service Broker" dir=in action=allow protocol=TCP localport=4022 @echo Enabling Transact SQL/RPC port 135 netsh advfirewall firewall add rule name="SQL Debugger/RPC" dir=in action=allow protocol=TCP localport=135 @echo ========= Analysis Services Ports ============== @echo Enabling SSAS Default Instance port 2383 netsh advfirewall firewall add rule name="Analysis Services" dir=in action=allow protocol=TCP localport=2383 @echo Enabling SQL Server Browser Service port 2382 netsh advfirewall firewall add rule name="SQL Browser" dir=in action=allow protocol=TCP localport=2382 @echo ========= Misc Applications ============== @echo Enabling HTTP port 80 netsh advfirewall firewall add rule name="HTTP" dir=in action=allow protocol=TCP localport=80 @echo Enabling SSL port 443 netsh advfirewall firewall add rule name="SSL" dir=in action=allow protocol=TCP localport=443 @echo Enabling port for SQL Server Browser Service's 'Browse' Button netsh advfirewall firewall add rule name="SQL Browser" dir=in action=allow protocol=UDP localport=1434 @echo Allowing multicast broadcast response on UDP (Browser Service Enumerations OK) netsh firewall set multicastbroadcastresponse ENABLE

還原資料庫,若是發生Error 3154,則可以用指令選原:

restore database MyDatabase from disk = 'C:\MyDatabaseBackup\MyDatabase.BAK' with replace

用以上指令不需要先建立 MyDatabase 資料庫,
有可能還會發生一些錯誤,如沒有建立相對的目錄,建完後再執行指令即可。1

2020年5月12日 星期二

【Office】讓 Excel 不再卡卡 - 文字、圖片物件移除

當開啟 Excel 時,常常因為某些關係,而造成檔案中愈存愈多的物件檔,當物件檔一多時,Excel 2007 的版本又無法直接刪除物件,而造成開檔存檔非常卡,
現在就用 Excel 巨集來清除物件:


按下 alt+F11 開啟巨集,然後在左上角This WorkBook用滑鼠點兩下,出現程式碼視窗後,把程式碼貼上:

Sub DeleteTextShape()
Dim sp As Shape
  For Each sp In ActiveWorkbook.ActiveSheet.Shapes
    If sp.Name Like "Text Box *" Then sp.Delete
  Next sp
End Sub

Sub DeletePictureShape()
Dim sp As Shape
  For Each sp In ActiveWorkbook.ActiveSheet.Shapes
    If sp.Name Like "Picture *" Then sp.Delete
  Next sp
End Sub

之後切回到 Excel 中,按下 alt+F8 來執行程式碼,選擇 "ThisWorkBook.DeleteTextShape" 然後選擇 "執行" ,稍等一小段時間,就可以把文字物件清除掉;
若還是覺得卡卡的,可以再按下 alt+F8 選擇 "ThisWorkBook.DeletePictureShape" 然後選擇 "執行" 來刪除圖片物件 (會清除所有圖片,要注意)。

刪完後存檔,下次開啟會很多了!