일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- 자바스크립트
- 포트
- js
- jquery
- vscode
- 핑
- MYSQL
- 목차만들기
- 정규표현식
- MSSQL
- 핑테스트
- 문자열
- 더존ERP
- ping
- 유효성
- sp_who
- port
- crontab
- pingtest
- 트랜젝션
- python
- JavaScript
- sendmail
- codeigniter
- erp
- 정규식
- 메일
- php
- 이메일주소
- 리눅스
Archives
- Today
- Total
ioerror
SQL Server 라이선스 키 확인 방법 본문
반응형
본 문서는 아래의 사이트를 참고하였다.
https://www.easeus.co.kr/pc-transfer/find-microsoft-sql-server-product-key.html
상황
MSSQL 서버를 옮겨야 하는 상황이 발생했다.
그런데 문제는 MSSQL 설치 파일이 없다는 것이다. 또한 라이선스 키도 없는 정말 레거시중 레거시다.
하지만 구글신께서 알려주신 사이트에서 방법을 알아냈고, 내 상황에 맞게 수정하니 라이선스 키를 확인할 수 있었다.
방법 1. 레지스터 편집기 활용방법
1. 레지스터 편집기(regedit)를 열고서 아래의 경로로 접수한다.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\Setup
해당 경로에 ProductCode 값을 더블클릭하면 SQL Server 키를 확인하 수 있다.
방법 2. Powershell의 함수를 생성하여 확인하는 방법
레지스터 편집기 활용 방법은 오래된 버전에서만 확인 가능하다.
아마 2012 버전 이후부터는 안될 가능성이 높다.
그런 경우 아래의 함수를 powershell에 붙여 넣기 한 후 실행(GetSqlServerProductKey)하면 확인 가능할 수 있다.
다만 버전에 따라 레지스터 경로 등을 수정해야 할 수도 있다.
1) 2012 버전에서 5행과 16행을 다음과 같이 바꿔야 한다.
- $regPath = "SOFTWARE\Microsoft\Microsoft SQL Server\110\Tools\Setup"
- $binArray = ($data.uValue)[0.. 16]
2) 2014 버전의 경우 DigitalProductID를 레지스터리의 실제 인스턴스 이름을 바꾸고 5행을 아래와 같이 바꾼다.
- $regPath = "SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL12. [실제 SQL 인스턴스 이름]\Setup"
3) 나의 경우 2016 버전인데 $regPath와 $binArray 값을 변경해 줘야 했다.
- $regPath = "SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL13.MSSQLSERVER\Setup"
- $binArray = ($data.uValue)[0.. 16]
function GetSqlServerProductKey {
## function to retrieve the license key of a SQL 2008 Server.
param ($targets = ".")
$hklm = 2147483650
$regPath = "SOFTWARE\Microsoft\Microsoft SQL Server\100\Tools\Setup"
$regValue1 = "DigitalProductId"
$regValue2 = "PatchLevel"
$regValue3 = "Edition"
Foreach ($target in $targets) {
$productKey = $null
$win32os = $null
$wmi = [WMIClass]"\\$target\root\default:stdRegProv"
$data = $wmi.GetBinaryValue($hklm,$regPath,$regValue1)
[string]$SQLver = $wmi.GetstringValue($hklm,$regPath,$regValue2).svalue
[string]$SQLedition = $wmi.GetstringValue($hklm,$regPath,$regValue3).svalue
$binArray = ($data.uValue)[52..66]
$charsArray = "B","C","D","F","G","H","J","K","M","P","Q","R","T","V","W","X","Y","2","3","4","6","7","8","9"
## decrypt base24 encoded binary data
For ($i = 24; $i -ge 0; $i--) {
$k = 0
For ($j = 14; $j -ge 0; $j--) {
$k = $k * 256 -bxor $binArray[$j]
$binArray[$j] = [math]::truncate($k / 24)
$k = $k % 24
}
$productKey = $charsArray[$k] + $productKey
If (($i % 5 -eq 0) -and ($i -ne 0)) {
$productKey = "-" + $productKey
}
}
$win32os = Get-WmiObject Win32_OperatingSystem -computer $target
$obj = New-Object Object
$obj | Add-Member Noteproperty Computer -value $target
$obj | Add-Member Noteproperty OSCaption -value $win32os.Caption
$obj | Add-Member Noteproperty OSArch -value $win32os.OSArchitecture
$obj | Add-Member Noteproperty SQLver -value $SQLver
$obj | Add-Member Noteproperty SQLedition -value $SQLedition
$obj | Add-Member Noteproperty ProductKey -value $productkey
$obj
}
}
function GetSqlServerProductKey {
## function to retrieve the license key of a SQL 2008 Server.
param ($targets = ".")
$hklm = 2147483650
$regPath = "SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL13.MSSQLSERVER\Setup"
$regValue1 = "DigitalProductId"
$regValue2 = "PatchLevel"
$regValue3 = "Edition"
Foreach ($target in $targets) {
$productKey = $null
$win32os = $null
$wmi = [WMIClass]"\\$target\root\default:stdRegProv"
$data = $wmi.GetBinaryValue($hklm,$regPath,$regValue1)
[string]$SQLver = $wmi.GetstringValue($hklm,$regPath,$regValue2).svalue
[string]$SQLedition = $wmi.GetstringValue($hklm,$regPath,$regValue3).svalue
$binArray = ($data.uValue)[0..16]
$charsArray = "B","C","D","F","G","H","J","K","M","P","Q","R","T","V","W","X","Y","2","3","4","6","7","8","9"
## decrypt base24 encoded binary data
For ($i = 24; $i -ge 0; $i--) {
$k = 0
For ($j = 14; $j -ge 0; $j--) {
$k = $k * 256 -bxor $binArray[$j]
$binArray[$j] = [math]::truncate($k / 24)
$k = $k % 24
}
$productKey = $charsArray[$k] + $productKey
If (($i % 5 -eq 0) -and ($i -ne 0)) {
$productKey = "-" + $productKey
}
}
$win32os = Get-WmiObject Win32_OperatingSystem -computer $target
$obj = New-Object Object
$obj | Add-Member Noteproperty Computer -value $target
$obj | Add-Member Noteproperty OSCaption -value $win32os.Caption
$obj | Add-Member Noteproperty OSArch -value $win32os.OSArchitecture
$obj | Add-Member Noteproperty SQLver -value $SQLver
$obj | Add-Member Noteproperty SQLedition -value $SQLedition
$obj | Add-Member Noteproperty ProductKey -value $productkey
$obj
}
}
반응형
'DataBase' 카테고리의 다른 글
MYSQL 8 에서 PASSWORD 함수 사용하기 (0) | 2021.11.26 |
---|---|
MSSQL 최적화, Block 하고 있는 쿼리 찾기(병목현상을 잡아라) (0) | 2021.01.23 |
MySQL 최적화(Optimize) 및 복구(refair) 자동화 쉘스크립트 (0) | 2020.10.17 |
MSSQL 프로세스 확인 (0) | 2020.10.16 |
MySql 의 MyISAM 이 깨졌을때?! (0) | 2020.06.06 |
Comments