2020年8月25日 星期二

version or edition consideration when SQL Server migrate or upgrade

version or edition consideration when SQL Server migrate or upgrade


如果SQL Server 2000並採用資料庫備份還原來移轉Migration,步驟如下

1.restore to SQL 2008 R2

2.changet db's compatibility level from 80 to 100

3.take a backup

4.restore the backup on SQL Servre 2022 


如果採用原機升級 Upgrade in-place

Supported version & edition upgrades (SQL Server 2019)

https://docs.microsoft.com/en-us/sql/database-engine/install-windows/supported-version-and-edition-upgrades-version-15?view=sql-server-ver15

Upgrades from Earlier Versions to SQL Server 2019 (15.x)

SQL Server 2019 (15.x) supports upgrade from the following versions of SQL Server:

  • SQL Server 2012 (11.x) SP4 or later
  • SQL Server 2014 (12.x) SP3 or later
  • SQL Server 2016 (13.x) SP2 or later
  • SQL Server 2017 (14.x)


Supported version & edition upgrades (SQL Server 2017)

https://docs.microsoft.com/en-us/sql/database-engine/install-windows/supported-version-and-edition-upgrades-2017?view=sql-server-ver15

SQL Server 2017 (14.x) supports upgrade from the following versions of SQL Server:

  • SQL Server 2008 SP4 or later
  • SQL Server 2008 R2 SP3 or later
  • SQL Server 2012 SP2 or later
  • SQL Server 2014 or later
  • SQL Server 2016 or later


Supported version & edition upgrades (SQL Server 2016)

https://docs.microsoft.com/en-us/sql/database-engine/install-windows/supported-version-and-edition-upgrades?view=sql-server-ver15

SQL Server 2016 supports upgrade from the following versions of SQL Server:

  • SQL Server 2008 SP4 or later
  • SQL Server 2008 R2 SP3 or later
  • SQL Server 2012 (11.x) SP2 or later
  • SQL Server 2014 (12.x) or later





2020年8月22日 星期六

Azure Storage Queue, Service Bus, Event Hub, Event Grid

Azure IoT Hub、Storage Queue、Service Bus、Event Hub、Event Grid


IoT


  1. IoT Hub:IaaS,可在您的 IoT 應用程式與其所管理裝置之間進行高度安全兼可靠的通訊。
    • Collect IoT Message
    • Connect Other Services
      • Queue
      • Service Bus
  2. IoT Central:SaaS,大規模連線、監視並管理您的物聯網 (IoT) 資產。
    • Collect IoT Message
    • Master/Process



Queue


  1. Storage Queue:單一Message size上限64KB
  2. Service Bus:
    • Service Bus queue,單一Message size上限 Standard tier: 256KB,Premier tier: 1MB
    • Service Bus topic,處理message前做filter篩選
  3. Event Hub:處理巨量Message
  4. Event Grid:能夠收集並處理Message

ServicePurposeTypeWhen to use
Event GridReactive programmingEvent distribution (discrete)React to status changes
Event HubsBig data pipelineEvent streaming (series)Telemetry and distributed data streaming
Service BusHigh-value enterprise messagingMessageOrder processing and financial transaction

Storage queues and Service Bus queues - compared and contrasted
https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-azure-and-service-bus-queues-compared-contrasted

Choose between Azure Queue services – Queue Storage, Service Bus Queue, Service Bus Topics
https://ramanisandeep.wordpress.com/2020/06/11/choose-between-azure-queue-services-queue-storage-service-bus-queue-service-bus-topics/

Choose Service Bus Topics if
you need multiple receivers to handle each message

Choose Service Bus queues if
You need an At-Most-Once delivery guarantee.
You need a FIFO guarantee.
You need to group messages into transactions.
You want to receive messages without polling the queue.
You need to provide a role-based access model to the queues.
You need to handle messages larger than 64 KB but less than 256 KB.
Your queue size will not grow larger than 80 GB.
You would like to be able to publish and consume batches of messages.

Queue storage isn’t quite as feature-rich, but if you don’t need any of those features, it can be a simpler choice. In addition, it’s the best solution if your app has any of the following requirements.

Choose Queue storage if
You need an audit trail of all messages that pass through the queue.
You expect the queue to exceed 80 GB in size.
You want to track progress for processing a message inside of the queue.

A queue is a simple, temporary storage location for messages sent between the components of a distributed application. Use a queue to organize messages and gracefully handle unpredictable surges in demand.

Summary
Use Storage queues when you want a simple and easy-to-code queue system. For more advanced needs, use Service Bus queues. If you have multiple destinations for a single message, but need queue-like behavior, use topics.

Azure IoT中樞

Azure IoT Central

Choose between Azure messaging services - Event Grid, Event Hubs, and Service Bus

2020年7月14日 星期二

在 CentOS 7 上安裝 Oracle 資料庫 12c


主要內容同以下網址,此文增加一些註解與注意事項
在 CentOS 7 上安裝 Oracle 資料庫 12c




1. 引言

本指南介紹如何在 CentOS 7.1(64 位元)上利用快速安裝的功能部署 Oracle 資料庫 12c(12.1.0.2.0)。

參考系統:

[root@centos7 ~]# hostnamectl
   Static hostname: centos7.example.com
         Icon name: computer
           Chassis: n/a
        Machine ID: 583b4d69eaea465ea4bb96ac3b891e15
           Boot ID: 931ed1af622046ebbde071a87844a7d5
    Virtualization: kvm
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-229.11.1.el7.x86_64
      Architecture: x86_64

2. 先決條件

成功安裝操作系統後,請確認主機名稱並在你的 DNS 上登記它。你也可選擇在 /etc/hosts 內加入你的主機名稱/IP。

[root@centos7 ~]# cat /etc/hostname
centos7.example.com

將 SELinux 維持在 enforcing 模式,並啟用防火牆

[root@centos7 ~]# sestatus
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   enforcing
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      28

[root@centos7 ~]# firewall-cmd --state
running

把 CentOS 系統更新至最新套件

[root@centos7 ~]# yum update -y

下載 Oracle 資料庫 12c 的 Linux x86-64 版本:

http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html

3. 安裝步驟

為 Oracle 資料庫建立所須的操作系統用戶及群組。

[root@centos7 ~]# groupadd oinstall
[root@centos7 ~]# groupadd dba
[root@centos7 ~]# useradd -g oinstall -G dba oracle
[root@centos7 ~]# passwd oracle

在 /etc/sysctl.conf 加入下列內核參數

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 1987162112
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586

檢查並運用新的數值。

[root@centos7 ~]# sysctl -p
[root@centos7 ~]# sysctl -a

在 /etc/security/limits.conf 為 oracle 用戶設定上限

oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536

將 Oracle 資料庫軟件的 zip 檔案(linuxamd64_12102_database_1of2.zip, linuxamd64_12102_database_2of2.zip)解壓至 /stage 目錄。

[root@centos7 ~]# yum install -y zip unzip
[root@centos7 ~]# unzip linuxamd64_12102_database_1of2.zip -d /stage/
[root@centos7 ~]# unzip linuxamd64_12102_database_2of2.zip -d /stage/

修改 /stage 的權限

[root@centos7 ~]# chown -R oracle:oinstall /stage/

為 Oracle 軟件建立 /u01 目錄,及為資料庫檔案建立 /u02 目錄。

[root@centos7 ~]# mkdir /u01
[root@centos7 ~]# mkdir /u02
[root@centos7 ~]# chown -R oracle:oinstall /u01
[root@centos7 ~]# chown -R oracle:oinstall /u02
[root@centos7 ~]# chmod -R 775 /u01
[root@centos7 ~]# chmod -R 775 /u02
[root@centos7 ~]# chmod g+s /u01
[root@centos7 ~]# chmod g+s /u02

安裝所須套件:

[root@centos7 ~]# yum install -y binutils.x86_64 compat-libcap1.x86_64 gcc.x86_64 gcc-c++.x86_64 glibc.i686 glibc.x86_64 \
glibc-devel.i686 glibc-devel.x86_64 ksh compat-libstdc++-33 libaio.i686 libaio.x86_64 libaio-devel.i686 libaio-devel.x86_64 \
libgcc.i686 libgcc.x86_64 libstdc++.i686 libstdc++.x86_64 libstdc++-devel.i686 libstdc++-devel.x86_64 libXi.i686 libXi.x86_64 \
libXtst.i686 libXtst.x86_64 make.x86_64 sysstat.x86_64

還有安裝 X Window System 套件群組。

[root@centos7 ~]# yum groupinstall -y "X Window System"

由於 Oracle 的安裝採用圖像介面,你可透過以下兩個簡單的方法進行。

方案 1

透過 SSH 從一台圖像化 Linux 電腦遠端登入。

ssh -X oracle@centos7.example.com


若使用MobaXterm,預設有勾選X11-forwarding,若Linux有啟用成功,SSH登入後會有下方的綠色勾勾




方案 2

利用一台擁有 SSH 客戶端(PuTTY)及 X-Windows 終端機模擬器(Xming)的微軟 Windows 桌面。

以下文檔描述如何在 Windows 系統上安裝 Xming。

* Xming —— 微軟 Windows 電腦下的 X-Windows 終端機模擬器

請採用上述的方案登入為 oracle 用戶,然後執行 Oracle 安裝程式:

[oracle@centos7 ~]$ /stage/database/runInstaller
Starting Oracle Universal Installer...

如果出現swapfile問題

Checking swap space: 0 MB available, 150 MB required. Failed


解決方法: 設定或變更 swapfile大小


swapoff /swapfile

rm /swapfile

fallocate -l 1G /swapfile

sudo dd if=/dev/zero of=/swapfile bs=1024 count=1048576

chmod 600 /swapfile

mkswap /swapfile

swapon /swapfile

nano /etc/fstab

在最下方加入以下文字

/swapfile swap swap defaults 0 0

swapon --show

top


若使用MobaXterm會出現以下畫面

4. Oracle 安裝程式畫面

第一步 —— 安全性更新

假若你不想接收來自 Oracle 支援部的電郵,請取消勾選該項目並按 Next。

在新開啟的視窗按 YES。

第二步 —— 安裝選項

選擇 Create and configure a database 並按 Next

第三步 —— 系統級別

選擇 Desktop Class 進行預設的簡便 Oracle 資料庫安裝。

第四步 —— 典型安裝

在 Typical Install Configuration 畫面,設定以下功能。

Oracle base

/u01/app/oracle

Software location

/u01/app/oracle/product/12.1.0/dbhome_1

Database file location

/u02

Global database name

orcl.example.com

另外請設定合適的 Database edition(資料庫版本)及 Character set(字集)。請為資料庫的管理訂立一個安全的密碼,最後請取消勾選 Create as Container database 項目。


第五步 —— 建立庫存

接納預設的 /u01/app/oraInventory 並按 Next。

第六步 —— 檢查先決條件 Prerequisite

安裝程式會自動檢查所有必須的操作系統套件及內核設定。


如果出現Soft Limit maximum stack size的status狀態是failed

Soft Limit: maximum stack size - This is a prerequisite condition to test whether the soft limit for maximum stack size is set correctly. Details: 

PRVG-0449 : Proper soft limit for maximum stack size was not found on node "ora12c" [Expected >= "10240" ; Found = "8192"].  - Cause:  The Cluster Verification Utility determined that the setting for the indicated soft limit did not meet Oracle''s recommendations for proper operation on the indicated nodes.  - Action:  Modify the resource limits to meet the requirement and take operating system specific measures to ensure that the corrected value takes effect for the current user before retrying this check. 


sudo vi /etc/security/limits.conf

增加 兩行

oracle soft stack 10240

oracle hard stack 32768


關閉安裝程式,退出ssh,再登入一次,重新啟動安裝程式

logout and login again 



第七步 —— 摘要

這是編輯安裝特點的最後機會。請按 Install。

第八步 —— 執行設置腳本

當詢問視窗出現時,請登入成為 root 並執行兩個腳本:

[root@centos7 ~]# /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.

[root@centos7 ~]# /u01/app/oracle/product/12.1.0/dbhome_1/root.sh
Performing root user operation.
The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/12.1.0/dbhome_1
Enter the full pathname of the local bin directory: [/usr/local/bin]: <PRESS ENTER>
   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...
Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
You can follow the installation in a separated window.

這兩個腳本都必須以 root 的身份來執行。

第九步 —— 安裝進度

一個顯示安裝進度的視窗將會出現。請勿關閉這個視窗。

第十步 —— 順利完成安裝

最後一個畫面將會通知你安裝已經完成並顯示 Oracle 企業級管理員的 URL。

https://localhost:5500/em

請按 OK 來關閉安裝程式。

5. 安裝後的任務

5.1. 防火牆

請登入成為 root 並檢查已啟動的區域

[root@centos7 ~]# firewall-cmd --get-active-zones
public
  interfaces: eth0

開啟相關的連接埠

[root@centos7 ~]# firewall-cmd --zone=public --add-port=1521/tcp --add-port=5500/tcp --add-port=5520/tcp --add-port=3938/tcp \ 
--permanent
success

[root@centos7 ~]# firewall-cmd --reload
success

[root@centos7 ~]# firewall-cmd --list-ports
1521/tcp 3938/tcp 5500/tcp 5520/tcp

5.2. Oracle 工作環境

請登入為 oracle 用戶並在 /home/oracle/.bash_profile 內加入下列數值

TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/12.1.0/dbhome_1; export ORACLE_HOME
ORACLE_SID=orcl; export ORACLE_SID
PATH=$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/lib64; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

重新載入 bash_profile 來運用新設定值:

[oracle@centos7 ~]$ . .bash_profile

5.3. 登入資料庫

最後請登入資料庫:

[oracle@centos7 ~]$ sqlplus system@orcl
... output omitted ...
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL>

請利用 Oracle 企業級管理員來管理資料庫:

https://<主機名稱>:5500/em




Reference:

How to Add Swap Space on CentOS 7

https://linuxize.com/post/how-to-add-swap-space-on-centos-7/


資料治理實施

資料治理實施