2021年8月31日 星期二

舊版本SQL Server 2012 Native Client和ODBC Driver 11 for SQL Server資料庫驅動程式不支援TLS 1.2

ODBC Driver for SQL Server最新版已經出到17
https://docs.microsoft.com/zh-tw/sql/connect/odbc/download-odbc-driver-for-sql-server?view=sql-server-ver15


SQL Server Native Client 11 (SNAC)因為已經是時代的眼淚,最新版就是QFE版
https://www.microsoft.com/en-us/download/details.aspx?id=50402


https://docs.microsoft.com/zh-tw/sharepoint/security-for-sharepoint-server/enable-tls-1-1-and-tls-1-2-support-in-sharepoint-server-2016

1.1 - 安裝 ODBC Driver 11 for SQL Server 的 TLS 1.2 支援更新

ODBC Driver 11 for SQL Server (適用於 SQL Server 的 ODBC 驅動程式 11) 預設不支援 TLS 1.1 或 TLS 1.2。您必須安裝 ODBC Driver 11 for SQL Server 的 TLS 1.2 支援更新。

1.2 - 安裝 SQL Server 2012 Native Client 的 TLS 1.2 支援更新

SQL Server 2012 原生用戶預設不支援 TLS 1.1 或 TLS 1.2。您必須安裝 SQL Server 2012 Native Client 的 TLS 1.2 支援更新。



http://net.rex.tw/2021/08/sql-server-2012-native-client-qfetls-12.html
小弟我剛好有用到SQL Server 2012 Native Client,以上這篇文章是整理的一些心得,SQL Server 2012 Native Client 需要新版的QFE版才支援TLS 1.2 

下載Microsoft® SQL Server® 2012 Native Client - QFE (支援TLS 1.2)
https://www.microsoft.com/en-us/download/details.aspx?id=50402

Version:
11.0.7001.0

Date Published:
1/19/2018


KB3135244 - Microsoft SQL Server 的 TLS 1.2 支援(必看!)


CheckClientUpdates.ps1
The PowerShell Script currently supports the following:

Check if SQL Server Native Client can support TLS 1.2
Check if Microsoft ODBC Driver for SQL Server can support TLS 1.2 This script is restricted to work on x64 and x86 platforms


在AP伺服器上檢測SQL Server資料庫驅動程式是否支援TLS 1.2?
支援TLS 1.2


不支援TLS 1.2



2021年4月17日 星期六

2021年3月20日 星期六

Cloud Storage 計價方式

https://cloud.google.com/storage/pricing#pricing-example-detailed

Comparison: AWS Fargate vs. Google Cloud Run vs. Azure Container Instances

https://thenewstack.io/comparison-aws-fargate-vs-google-cloud-run-vs-azure-container-instances/

/opt/python3.7/bin/python3.7: No module named pip

GCP Cloud Functions使用python3.7部署時出現以下錯誤訊息


錯誤訊息:

部署失敗:

Build failed: `pip_install_from_wheels` had stderr output:

/opt/python3.7/bin/python3.7: No module named pip

error: `pip_install_from_wheels` returned code: 1; Error ID: ECB5F712


解決方式:
換成
python3.8

使用者未具備的 iam.serviceAccounts.actAs 權限,因此無法建立函式

使用GCP Cloud Functions部署時出現以下錯誤訊息

錯誤訊息:

使用者未具備「XXXYYY@appspot.gserviceaccount.com」的 iam.serviceAccounts.actAs 權限,因此無法建立函式。如要解決這個問題,請執行以下指令:gcloud iam service-accounts add-iam-policy-binding xxxyyy@appspot.gserviceaccount.com --member=user:<user-email> --role=roles/iam.serviceAccountUser

要求 ID:1128406824938847386


解決方式:
步驟一
在已安裝Google Cloud SDK的開發電腦執行以下指令
gcloud iam service-accounts add-iam-policy-binding 服務帳戶@appspot.gserviceaccount.com --member=user:登入GCP帳號@gmail.com --role=roles/iam.serviceAccountUser --project=您的projectid


步驟二
瀏覽器重新整理GCP console網頁(一定要重新整理頁面!)

步驟三
重新部署

2021年3月17日 星期三

SQL Server全文檢索,CONTAINS和FREETEXT的差異

https://docs.microsoft.com/zh-tw/sql/relational-databases/search/query-with-full-text-search?view=sql-server-ver15

  • 若要比對單字和片語,請使用 CONTAINS 和 CONTAINSTABLE
  • 若要比對意義,而不是確切的用字,請使用 FREETEXT 和 FREETEXTTABLE

搜尋一個單字的「接近」單字

「近接字詞」表示彼此相近的單字或片語。 您也可以指定分隔第一個和最後一個搜尋詞彙之非搜尋詞彙的數目上限。 此外,您可以依任何順序或是您所指定的順序來搜尋字詞或片語。

例如,您要尋找其中有 "ice" 單字接近 "hockey" 單字,或 "ice skating" 片語接近 "ice hockey" 片語的資料列。

CONTAINS 和 CONTAINSTABLE

如需鄰近搜尋的詳細資訊,請參閱使用 NEAR 搜尋靠近另一個單字的字詞

搜尋一個單字的「接近」單字

「近接字詞」表示彼此相近的單字或片語。 您也可以指定分隔第一個和最後一個搜尋詞彙之非搜尋詞彙的數目上限。 此外,您可以依任何順序或是您所指定的順序來搜尋字詞或片語。

例如,您要尋找其中有 "ice" 單字接近 "hockey" 單字,或 "ice skating" 片語接近 "ice hockey" 片語的資料列。

CONTAINS 和 CONTAINSTABLE

如需鄰近搜尋的詳細資訊,請參閱使用 NEAR 搜尋靠近另一個單字的字詞

加權字詞搜尋的詳細資訊

在加權字詞搜尋中,「加權值」是表示每個單字與片語在一組單字與片語中的重要程度。 最小的加權值是 0.0,最大則為 1.0。

例如,在搜尋多個詞彙的查詢中,您可以指派每個搜尋單字的加權值,以指出它與搜尋條件中之其他單字的相對重要性。 這類型之查詢的結果會根據您指派給搜尋單字的相對加權,先傳回最相關的資料列。 結果集包含具有任何指定之詞彙的文件或資料列 (或它們之間的內容)。不過,因為與不同搜尋詞彙相關聯的加權值具有變化,所以某些結果會被視為比其他結果更相關。

CONTAINSTABLE 支援加權字詞搜尋。

2021年3月14日 星期日

利用MySQL全文搜尋的BOOLEAN MODE排除某些字元

目的:
搜尋java字元時,須排除JavaScript和Javanese

參考以下這邊文章
https://medium.com/@changhengliou/%E7%94%A8mysql-fulltext-search%E5%BB%BA%E7%AB%8B%E7%B0%A1%E6%98%93%E6%90%9C%E5%B0%8B%E5%BC%95%E6%93%8E-80659c28ec19
先到https://dumps.wikimedia.org/enwiki/latest/下載enwiki-latest-pages-articles.xml.bz2
(繁中 https://dumps.wikimedia.org/zhwiki/latest/ )
使用bzip2 -d enwiki-latest-pages-articles.xml.bz2指令解壓縮後
再用wikiextractor匯出成json格式(需要執行很久)
指令wikiextractor --json /wikidump/rawdata/enwiki-latest-pages-articles.xml
再用原作者的工具sqlgen匯入MySQL資料庫(需要執行很久)








SELECT `url` ,`title` , `text`
FROM `PagesArticles20210302`
WHERE MATCH(`title`, `text`) AGAINST ('Java' IN NATURAL LANGUAGE MODE)
AND
MATCH(`title`, `text`) AGAINST ('>eclipse >netbean -javaese -javanese -JavaScript'  IN BOOLEAN MODE);
-- 說明: -javanese:表示排除這個字元;>eclipse表示增加這個字元權重;< xxyy表示減少這個字元權重

ref:
https://dev.mysql.com/doc/refman/8.0/en/fulltext-boolean.html

2021年3月4日 星期四

MySQL 8.0預設密碼加密方式由原本mysql_native_password 改成 caching_sha2_password

# MySQL 8.0預設密碼加密方式由原本mysql_native_password 改成 caching_sha2_password
# 怕Client端連線有問題,先設定為IDENTIFIED WITH mysql_native_password

ALTER USER 'mysqluser1'@'%' IDENTIFIED WITH mysql_native_password BY '自訂密碼';
GRANT ALL ON *.* TO 'mysqluser1'@'%';

CREATE USER 'mysqluser2'@'%' IDENTIFIED WITH mysql_native_password BY '自訂密碼';
GRANT ALL ON *.* TO 'mysqluser2'@'%';

FLUSH PRIVILEGES;


調整前Client端連線的錯誤訊息:
Retrieval of the RSA public key is not enabled for insecure connections.

使用podman指令建立Persistent Storage的MySQL容器資料庫,並藉由systemctl設為Host重開機自動啟動

環境:RHEL 8.3
目的:透過podman建立一個Persistent Storage的MySQL 8.0資料庫,並藉由systemctl設為Host重開機自動啟動
備註1:podman run指令不支援--restart=always(因為podman有別於Docker架構,不使用Daemon機制(daemonless Container),無法透過Daemon機制去自動重啟)
參考資料 https://igene.tw/podman-intro
備註2:如果rm刪除容器重新建立,需要重新產生 podman generate systemd --name mysql-80-persist > mysql80-container.service

2021年3月3日 星期三

Hello podman

大部分指令和docker一樣
但是podman run指令不支援--restart=always(因為podman有別於Docker架構,不使用Daemon機制(daemonless Container),無法透過Daemon機制去自動重啟)
只能藉由systemctl設為Host重開機自動啟動
參考資料 https://igene.tw/podman-intro

sudo podman run ubi7/ubi:7.7 echo 'Hello!'

在容器內執行指令
sudo podman run -it ubi7/ubi:7.7 /bin/bash 
退出
exit

列出所有執行中的容器
sudo podman ps 

列出所有的容器(包含非執行中)
sudo podman ps -a

刪除容器
sudo podman rm

刪除容器Base Image
sudo podman rmi

2021年2月18日 星期四

RHEL各種.iso 檔的差別

 https://access.redhat.com/solutions/104063

  • boot.iso
  • Binary DVD
  • WinSync Installer
  • Source DVD
  • P2V ISO
  • KVM Guest Image
  • ISO Images for Older Releases

Binary DVD

The discs required to install and use Red Hat Enterprise Linux. Can also be used to enter Rescue Mode.

Source DVD

Source code (human-readable programming language instructions) for Red Hat Enterprise Linux, provided in compliance with the GNU General Public License which Red Hat Enterprise Linux is created under. There is no documentation for the source DVDs. These can be used to compile or develop your own software based off the Red Hat version.

P2V ISO

This ISO is used for converting your Physical RHEL system to a Virtual RHEL system

KVM Guest Image

You can use a ready RHEL KVM guest qcow2 image, as these images are configured with cloud-init and must take advantage of ec2-compatible metadata services for provisioning SSH keys in order to function properly. For more information see the Openstack Platform Guide


下載舊版ISO檔、Supplementary、virt-p2v、KVM Guest Image、原始碼等(以RHEL 7.5為例)
https://access.redhat.com/downloads/content/69/ver=/rhel---7/7.5/x86_64/product-software

2021年1月3日 星期日

SQL Server 2019資料庫設定TDE加密後,導致備份檔bak過大

如果不想額外特別加MAXTRANSFERSIZE 參數
必須安裝SQL Server 2019 CU(Cumulative Update) 5 以上
因為微軟官網已經不提供CU5下載
可以安裝最新版的CU8 (KB4577194)

Cumulative Update 8 for SQL Server 2019
https://support.microsoft.com/en-us/help/4577194/cumulative-update-8-for-sql-server-2019

下載Cumulative Update Package 8 for SQL Server 2019 - KB4577194
https://www.microsoft.com/en-us/download/details.aspx?id=100809

SELECT @@VERSION結果
<安裝CU8之前>

Microsoft SQL Server 2019 (RTM-GDR) (KB4517790) - 15.0.2070.41 (X64)   Oct 28 2019 19:56:59   Copyright (C) 2019 Microsoft Corporation  Developer Edition (64-bit) on Windows Server 2019 Standard 10.0 <X64> (Build 17763: ) (Hypervisor)

<安裝CU8之後>
Microsoft SQL Server 2019 (RTM-CU8) (KB4577194) - 15.0.4073.23 (X64)   Sep 23 2020 16:03:08   Copyright (C) 2019 Microsoft Corporation  Developer Edition (64-bit) on Windows Server 2019 Standard 10.0 <X64> (Build 17763: ) (Hypervisor)


https://support.microsoft.com/en-us/help/4552255/kb4552255-cumulative-update-5-for-sql-server-2019
Bug Reference:13495908
KB article number:4561915
Improvement: MAXTRANSFERSIZE no longer required to enable backup compression on TDE encrypted databases


ref:
https://www.sqlshack.com/backup-compression-in-tde-enabled-databases-in-sql-server-always-on-availability-groups/

https://www.mssqltips.com/sqlservertip/4522/backup-compression-performance-enhancements-for-sql-server-2016-tde-enabled-databases/

台廠通過FIDO U2F & FIDO2認證的硬體:GoTrust Idem Key 動信安全金鑰

https://24h.pchome.com.tw/prod/DGAG76-A900ASZE9

一個820元
試過gmail和github都可以使用
網拍賣的其他FIDO水貨硬體比較貴

還可以跟手機配對用來登入Windows
https://www.youtube.com/watch?v=i8Z3-FKHTHc&t=81s

ref:
多奇技術分享會:漫談雙因子驗證與多階段驗證
https://www.facebook.com/watch/live/?v=241187464032358