<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>database &#8211; 記下來</title>
	<atom:link href="https://noter.tw/tag/database-2/feed/" rel="self" type="application/rss+xml" />
	<link>https://noter.tw</link>
	<description>一路上踩到的坑、遇到的問題，一點一滴記下來，希望能幫助到需要的人~</description>
	<lastBuildDate>Tue, 23 Jan 2024 05:07:30 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.3</generator>

<image>
	<url>https://noter.tw/wp-content/uploads/cropped-old-1130742_1920-1-32x32.jpg</url>
	<title>database &#8211; 記下來</title>
	<link>https://noter.tw</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>MariaDB JSON_EXTRACT: 從 JSON 欄位取值</title>
		<link>https://noter.tw/12503/mariadb-json_extract-%e5%be%9e-json-%e6%ac%84%e4%bd%8d%e5%8f%96%e5%80%bc/</link>
					<comments>https://noter.tw/12503/mariadb-json_extract-%e5%be%9e-json-%e6%ac%84%e4%bd%8d%e5%8f%96%e5%80%bc/#respond</comments>
		
		<dc:creator><![CDATA[黃小蛙]]></dc:creator>
		<pubDate>Sun, 14 Jan 2024 10:56:23 +0000</pubDate>
				<category><![CDATA[資料庫]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[讀取 json 欄位]]></category>
		<category><![CDATA[JSON_EXTRACT]]></category>
		<category><![CDATA[JSON 欄位排序]]></category>
		<category><![CDATA[搜尋 JSON]]></category>
		<category><![CDATA[JSON KEY]]></category>
		<category><![CDATA[查詢條件]]></category>
		<category><![CDATA[排序條件]]></category>
		<category><![CDATA[mariadb]]></category>
		<guid isPermaLink="false">https://noter.tw/?p=12503</guid>

					<description><![CDATA[<p>根據 JSON 路徑取得儲存在 MariaDB 資料庫中的 JSON 欄位的值，JSON_EXTRACT 可以用在 SELECT 欄位、WHERE 條件及 ORDER BY 排序 &#8230; 等。&#46;&#46;&#46;</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/12503/mariadb-json_extract-%e5%be%9e-json-%e6%ac%84%e4%bd%8d%e5%8f%96%e5%80%bc/" data-wpel-link="internal">MariaDB JSON_EXTRACT: 從 JSON 欄位取值</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>根據 JSON 路徑取得儲存在 MariaDB 資料庫中的 JSON 欄位的值，JSON_EXTRACT 可以用在 SELECT 欄位、WHERE 條件及 ORDER BY 排序 &#8230; 等。</p>



<span id="more-12503"></span>



<h2 class="wp-block-heading para">JSON_EXTRACT</h2>



<h3 class="wp-block-heading para">語法</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="sql" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">JSON_EXTRACT(json_doc, path[, path] ...)</pre>



<h3 class="wp-block-heading para">說明</h3>



<p>從 JSON <span style="text-decoration: underline;">欄位</span>中讀取資料，讀取的依據是<span style="text-decoration: underline;">路徑參數</span>相符的部分，函數將回傳所有符合的值；如果回傳值為多個值，則結果會按符合的順序自動包裝為陣列，如果沒有路徑匹配或任何參數為 NULL，則傳回 NULL。</p>



<p>如果<span style="text-decoration: underline;">路徑參數</span>不是有效路徑，或者 json_doc 參數不是有效的 JSON 文檔，則會發生錯誤。路徑表達式是 MariaDB 支援的 <a href="https://mariadb.com/kb/en/jsonpath-expressions/" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">JSONPath 表達式<span class="wpel-icon wpel-image wpel-icon-6"></span></a>。 (<a href="https://mariadb.com/kb/en/json_extract/" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right">參考資料<span class="wpel-icon wpel-image wpel-icon-6"></span></a>)</p>



<h3 class="wp-block-heading para">範例</h3>



<p>用在 ORDER BY 排序</p>



<pre class="EnlighterJSRAW" data-enlighter-language="sql" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">SELECT * FROM `tender` ORDER BY JSON_EXTRACT(`json`, '$.create_date') DESC;</pre>



<p>用在搜尋欄位</p>



<pre class="EnlighterJSRAW" data-enlighter-language="sql" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">SELECT * FROM `tender` WHERE JSON_EXTRACT(`json`, '$.title') = '公告';</pre>



<p>用在欄位取得</p>



<pre class="EnlighterJSRAW" data-enlighter-language="sql" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">SELECT `id`, JSON_EXTRACT(`json`, '$.title') AS `title` FROM `tender`;</pre>



<p>延伸閱讀：<br></p>



<p><strong>MySQL / MariaDB / Oracle 相關文章：</strong></p>



<ul class="my-li bg-darkblue wp-block-list">
<li><a href="https://noter.tw/12503/mariadb-json_extract-%e5%be%9e-json-%e6%ac%84%e4%bd%8d%e5%8f%96%e5%80%bc/" data-wpel-link="internal">MariaDB JSON_EXTRACT: 從 JSON 欄位取值</a></li>



<li><a href="https://noter.tw/12015/oracle-%e5%88%86%e7%b5%84%e7%b7%a8%e8%99%9f%e8%88%87%e5%85%a8%e6%8e%92%e5%ba%8f%e7%b7%a8%e8%99%9f-row_number-over-partition-by/" data-wpel-link="internal">Oracle, MySQL 分組編號與全排序編號 row_number, over, partition by</a></li>



<li><a href="https://noter.tw/3929/mysql-error-2003-hy000-%E7%84%A1%E6%B3%95%E9%81%A0%E7%AB%AF%E9%80%A3%E7%B7%9A/" data-wpel-link="internal">MySQL ERROR 2003 (HY000) 無法遠端連線</a></li>



<li><a href="https://noter.tw/2889/jsp-%E9%80%A3%E7%B5%90-mysql/" data-wpel-link="internal">JSP 連結 MySQL</a></li>



<li><a href="https://noter.tw/2883/java-%E9%80%A3%E7%B5%90-mysql/" data-wpel-link="internal">Java 連結 MySQL</a></li>



<li><a href="https://noter.tw/2306/mysql%E6%8E%92%E7%A8%8Bevent-scheduler/" data-wpel-link="internal">MySQL 排程(Event Scheduler)</a></li>



<li><a href="https://noter.tw/1988/java%E9%80%A3%E7%B5%90%E9%81%A0%E7%AB%AFmysql/" data-wpel-link="internal">Java 連結遠端 MySQL</a></li>



<li><a href="https://noter.tw/4508/mariadb-replication-%E8%A8%AD%E5%AE%9A/" data-wpel-link="internal">MariaDB Replication 設定</a></li>



<li><a href="https://noter.tw/122/java-php-%E6%8F%92%E5%85%A5-emoji-%E8%B3%87%E6%96%99%E5%88%B0-mariadb/" data-wpel-link="internal">Java / PHP 插入 emoji 資料到 MariaDB</a></li>
</ul>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/12503/mariadb-json_extract-%e5%be%9e-json-%e6%ac%84%e4%bd%8d%e5%8f%96%e5%80%bc/" data-wpel-link="internal">MariaDB JSON_EXTRACT: 從 JSON 欄位取值</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://noter.tw/12503/mariadb-json_extract-%e5%be%9e-json-%e6%ac%84%e4%bd%8d%e5%8f%96%e5%80%bc/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>MariaDB Replication 設定</title>
		<link>https://noter.tw/4508/mariadb-replication-%e8%a8%ad%e5%ae%9a/</link>
					<comments>https://noter.tw/4508/mariadb-replication-%e8%a8%ad%e5%ae%9a/#respond</comments>
		
		<dc:creator><![CDATA[黃小蛙]]></dc:creator>
		<pubDate>Sat, 09 Mar 2019 07:50:44 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[mariadb]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[資料庫]]></category>
		<category><![CDATA[replication]]></category>
		<category><![CDATA[master]]></category>
		<category><![CDATA[slave]]></category>
		<category><![CDATA[資料庫同步]]></category>
		<category><![CDATA[2019]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<guid isPermaLink="false">https://noter.tw/?p=4508</guid>

					<description><![CDATA[<p>從上次買了 KVM 的虛擬主機之後，一直到現在都還沒時間處理好，這幾天終於撥出一點時間處理，這篇記錄下設定的經過。 本篇內容主要參考 MariaDB : Replication Setting 加上自&#46;&#46;&#46;</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/4508/mariadb-replication-%e8%a8%ad%e5%ae%9a/" data-wpel-link="internal">MariaDB Replication 設定</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>從上次買了 KVM 的虛擬主機之後，一直到現在都還沒時間處理好，這幾天終於撥出一點時間處理，這篇記錄下設定的經過。</p>



<span id="more-4508"></span>



<p>本篇內容主要參考 <a href="https://www.server-world.info/en/note?os=Ubuntu_18.04&amp;p=mariadb&amp;f=4" target="_blank" rel="noopener nofollow external noreferrer" data-wpel-link="external" class="wpel-icon-right">MariaDB : Replication Setting<span class="wpel-icon wpel-image wpel-icon-6"></span></a> 加上自己的註解，一方面備份文章及過程，如果英文不錯或需要更詳細內容的，可以直接到那邊看！</p>



<h2 class="para wp-block-heading">緣由</h2>



<p>小蛙的機器都是三更半夜進行一次備份，並且自動把備份 sync 到 Google Drive 上，可參考 <a rel="noreferrer noopener" aria-label="一個腳本每天自動備份 (在新分頁中開啟)" href="https://noter.tw/436/%E4%B8%80%E5%80%8B%E8%85%B3%E6%9C%AC%E6%AF%8F%E5%A4%A9%E8%87%AA%E5%8B%95%E5%82%99%E4%BB%BD/" target="_blank" data-wpel-link="internal">一個腳本每天自動備份</a>、<a rel="noreferrer noopener" aria-label="gdirve 讓你在 Linux 文字介面也能好好使用 Google Drive (在新分頁中開啟)" href="https://noter.tw/4267/gdirve-%E8%AE%93%E4%BD%A0%E5%9C%A8-linux-%E6%96%87%E5%AD%97%E4%BB%8B%E9%9D%A2%E4%B9%9F%E8%83%BD%E5%A5%BD%E5%A5%BD%E4%BD%BF%E7%94%A8-google-drive/" target="_blank" data-wpel-link="internal">gdirve 讓你在 Linux 文字介面也能好好使用 Google Drive</a> 這兩篇。前陣子多買了一台 KVM 虛擬主機想要來玩 docker，一直遲遲沒有進展，這一兩天有一點時間，決定讓 MariaDB 同步寫入兩台資料庫中，這樣如果 Master DB 掛掉或出問題的話，馬上切到 Slave DB 上，跟之前備份的差別在於，備份的時間是在每天深夜，如果壞掉還原的資料時間點也是在該時刻，換成 Replication 的方式的話，就可以回到掛掉前的時間點。(小蛙的內容也沒有常常更新拉，只是想玩看看 MariaDB Replication 而已 &#8230;)</p>



<h2 class="para wp-block-heading">開始之前</h2>



<p>開始之前先確認一些概念</p>



<ul class="my-li bg-darkblue wp-block-list"><li>會有一台主要的資料庫 master (廢話)</li><li>會有一台次要的資料庫 slave (廢話 again)</li><li>主要的寫入都是在 master 裡面</li><li>slave 不提供資料寫入</li><li>當 master 有資料寫入時，會自動觸發寫入 slave</li></ul>



<p>這樣看起來應該沒問題吧！接著會進行的步驟大概是：</p>



<ul class="my-li bg-darkblue wp-block-list"><li>編輯 master 設定檔</li><li>在 master 建立一個供 slave 連線的使用者</li><li>記下 master 的連線及同步設定</li><li>匯出 master 的所有資料</li><li>編輯 slave 設定檔</li><li>匯入資料到 slave</li><li>在 slave 上設定 master 的連線資訊</li><li>檢查是否正常運作</li></ul>



<h2 class="para wp-block-heading">設定 Master </h2>



<p>修改 MariaDB 設定</p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code"># 使用文字編輯器修改設定檔
vim /etc/mysql/mariadb.conf.d/50-server.cnf
# 搜尋 bind-address 並修改成自己連線的 IP
bind-address = 10.0.0.1
# 搜尋 server-id，修改成自己想要設定的 ID
# 可以隨便設定，只要每一台都不同即可
server-id = 101
# 搜尋 log_bin，取消註解
log_bin = /var/log/mysql/mysql-bin.log
# 離開文字編輯器
:wq!
# 重啟 mariadb
systemctl restart mariadb</pre>



<p>進入資料庫建立一個供 slave 連線的使用者</p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code"># 登入 mariadb
mysql -u root -p
# 進入 mariadb 之後建立 slave 使用者
# 這邊要注意 
# a. '%' 表示任意主機，也可限定主機名稱或 IP 較安全
# b. 'your password' 改成從 slave 要連線過來的密碼          
MariaDB [(none)]&gt; grant replication slave on *.* to replica@'%' identified by 'your password'; 
# 讓上述設定生效
MariaDB [(none)]&gt; flush privileges;</pre>



<p>把 master lock 住，取得 master 的資訊</p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code"># 把資料表鎖住，避免匯出的當下有資料變動
MariaDB [(none)]&gt; flush tables with read lock; 
# 查看 master 的狀態，把 File 跟 Position 記下來
MariaDB [(none)]&gt; show master status; 
# 離開 mariadb
MariaDB [(none)]&gt; exit;</pre>



<p>開始匯出 master 所有資料</p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code"># 匯出所有資料
mysqldump -u root -p --all-databases --lock-all-tables --events &gt; mysql_dump.sql 
# 再進入 mariadb 把 lock 狀態解除
mysql -u root -p
MariaDB [(none)]&gt; unlock tables; 
MariaDB [(none)]&gt; exit; </pre>



<p>到這邊 master 的設定差不多就完成了。(這邊記錄的順序跟原文不太一樣，不過達成的目的都相同)</p>



<h2 class="wp-block-heading" id="mce_31">設定 Slave</h2>



<p>進入 slave 後，一樣先設定 mariadb 設定檔</p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code"># 使用文字編輯器修改設定檔
vim /etc/mysql/mariadb.conf.d/50-server.cnf
# 搜尋 bind-address 並修改成自己連線的 IP
bind-address = 10.0.0.2
# 搜尋 server-id，修改成自己想要設定的 ID
# 可以隨便設定，只要每一台都不同即可
server-id = 102
# 搜尋 log_bin，取消註解
log_bin = /var/log/mysql/mysql-bin.log
# 加入惟獨的屬性
read_only=1
# 設定 hostname
report-host=xxxx.abc.net
# 離開文字編輯器
:wq!
# 重啟 mariadb
systemctl restart mariadb</pre>



<p>把剛剛 master 匯出的資料抓回來</p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code"># 用法 rsync -avzh 來源 目的地
# 我們從 slave 把檔案從 master 拉過來，
# 因此 rsync -avzh master的連線資訊+檔案 slave的位置
rsync -avzh root@test:/root/mysql_dump.sql ./</pre>



<p>把所有資料匯入到資料庫中</p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code"># 將 master dump 出來的資料匯入到資料庫中
mysql -u root -p &lt; /root/mysql_dump.sql</pre>



<p>設定 master 連線資訊</p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code"># 進入 mariadb
mysql -u root -p 
# 設定 master 連線資訊
MariaDB [(none)]&gt; change master to 
    -&gt; master_host='10.0.0.1',               # master IP
    -&gt; master_user='replica',                # 剛剛設定的帳號
    -&gt; master_password='yourpassword',       # 剛剛設定的密碼
    -&gt; master_log_file='mysql-bin.000001',   # 上面得到的 File
    -&gt; master_log_pos=311;                   # 上面得到的 Position</pre>



<p>啟動 slave</p>



<pre class="wp-block-preformatted wp-block-syntaxhighlighter-code"># 啟動 slave
MariaDB [(none)]&gt; start slave;
# 查看 slave 狀態
MariaDB [(none)]&gt; show slave status\G 
# Slave_IO_State: Waiting for master to send event
# 如果顯示這樣表示連線成功，正在等待資料更新
# 有可能會有其他錯誤，連線錯誤、無法登入錯誤 ... 等</pre>



<h2 class="para wp-block-heading">後記</h2>



<p>show slave status\G 可以看到目前同步的狀態，Read_Master_Log_Pos 基本上會跟 show master status; 的 Position 一樣，也可以從 Last_Error 看到目前同步是否發生什麼錯誤。</p>



<p><strong>MySQL / MariaDB / Oracle 相關文章：</strong></p>



<ul class="my-li bg-darkblue wp-block-list">
<li><a href="https://noter.tw/12503/mariadb-json_extract-%e5%be%9e-json-%e6%ac%84%e4%bd%8d%e5%8f%96%e5%80%bc/" data-wpel-link="internal">MariaDB JSON_EXTRACT: 從 JSON 欄位取值</a></li>



<li><a href="https://noter.tw/12015/oracle-%e5%88%86%e7%b5%84%e7%b7%a8%e8%99%9f%e8%88%87%e5%85%a8%e6%8e%92%e5%ba%8f%e7%b7%a8%e8%99%9f-row_number-over-partition-by/" data-wpel-link="internal">Oracle, MySQL 分組編號與全排序編號 row_number, over, partition by</a></li>



<li><a href="https://noter.tw/3929/mysql-error-2003-hy000-%E7%84%A1%E6%B3%95%E9%81%A0%E7%AB%AF%E9%80%A3%E7%B7%9A/" data-wpel-link="internal">MySQL ERROR 2003 (HY000) 無法遠端連線</a></li>



<li><a href="https://noter.tw/2889/jsp-%E9%80%A3%E7%B5%90-mysql/" data-wpel-link="internal">JSP 連結 MySQL</a></li>



<li><a href="https://noter.tw/2883/java-%E9%80%A3%E7%B5%90-mysql/" data-wpel-link="internal">Java 連結 MySQL</a></li>



<li><a href="https://noter.tw/2306/mysql%E6%8E%92%E7%A8%8Bevent-scheduler/" data-wpel-link="internal">MySQL 排程(Event Scheduler)</a></li>



<li><a href="https://noter.tw/1988/java%E9%80%A3%E7%B5%90%E9%81%A0%E7%AB%AFmysql/" data-wpel-link="internal">Java 連結遠端 MySQL</a></li>



<li><a href="https://noter.tw/4508/mariadb-replication-%E8%A8%AD%E5%AE%9A/" data-wpel-link="internal">MariaDB Replication 設定</a></li>



<li><a href="https://noter.tw/122/java-php-%E6%8F%92%E5%85%A5-emoji-%E8%B3%87%E6%96%99%E5%88%B0-mariadb/" data-wpel-link="internal">Java / PHP 插入 emoji 資料到 MariaDB</a></li>
</ul>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/4508/mariadb-replication-%e8%a8%ad%e5%ae%9a/" data-wpel-link="internal">MariaDB Replication 設定</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://noter.tw/4508/mariadb-replication-%e8%a8%ad%e5%ae%9a/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>官方 Client &#8211; Oracle SQL Developer 安裝教學</title>
		<link>https://noter.tw/2714/%e5%ae%98%e6%96%b9-client-oracle-sql-developer-%e5%ae%89%e8%a3%9d%e6%95%99%e5%ad%b8/</link>
					<comments>https://noter.tw/2714/%e5%ae%98%e6%96%b9-client-oracle-sql-developer-%e5%ae%89%e8%a3%9d%e6%95%99%e5%ad%b8/#respond</comments>
		
		<dc:creator><![CDATA[黃小蛙]]></dc:creator>
		<pubDate>Wed, 13 Mar 2013 07:04:03 +0000</pubDate>
				<category><![CDATA[資料庫]]></category>
		<category><![CDATA[gui]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[SQL Developer]]></category>
		<category><![CDATA[database]]></category>
		<guid isPermaLink="false">http://wazai.net/?p=2714</guid>

					<description><![CDATA[<p>之前大多使用 PL/SQL Dev 這套軟體，有些單位並沒有這套付費軟體，而且 Oracle 官方出的 Oracle SQL Developer 就已經很好用了，該有的功能都有，重點是免費的！這篇文章&#46;&#46;&#46;</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/2714/%e5%ae%98%e6%96%b9-client-oracle-sql-developer-%e5%ae%89%e8%a3%9d%e6%95%99%e5%ad%b8/" data-wpel-link="internal">官方 Client &#8211; Oracle SQL Developer 安裝教學</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>之前大多使用 PL/SQL Dev 這套軟體，有些單位並沒有這套付費軟體，而且 Oracle 官方出的 Oracle SQL Developer 就已經很好用了，該有的功能都有，重點是免費的！這篇文章介紹怎麼安裝跟設定 Oracle SQL Developer。 </p>



<span id="more-2714"></span>



<p>下載&nbsp;Oracle SQL Developer (<a rel="noreferrer noopener nofollow external" aria-label="http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html (在新分頁中開啟)" href="http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html" target="_blank" data-wpel-link="external" class="wpel-icon-right">http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html<span class="wpel-icon wpel-image wpel-icon-6"></span></a>)</p>



<h2 class="para wp-block-heading"><strong>電腦裡已安裝 JDK</strong></h2>



<p><a rel="noreferrer noopener nofollow external" href="http://download.oracle.com/otn/java/sqldeveloper/sqldeveloper-3.1.07.42-no-jre.zip" target="_blank" data-wpel-link="external" class="wpel-icon-right"><strong>Oracle SQL Developer for 32-bit Windows</strong><span class="wpel-icon wpel-image wpel-icon-6"></span></a>&nbsp;(This zip&nbsp;<em>does not</em>&nbsp;include a JDK)<br>To install and run:<br>&#8211; Ensure you have a JDK installed, if not, download&nbsp;<a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html" target="_blank" rel="noopener nofollow external noreferrer" data-wpel-link="external" class="wpel-icon-right">here<span class="wpel-icon wpel-image wpel-icon-6"></span></a><br>(click the Download for JDK 6 Update &lt;xx&gt;, where &lt;xx&gt; is the latest update)<br>&#8211; Download the file above<br>&#8211; Extract sqldeveloper.zip into any folder, using folder names<br>&#8211; Within that folder, open the sqldeveloper folder<br>&#8211; Double-click sqldeveloper.exe</p>



<h2 class="para wp-block-heading"><strong>未安裝 JDK</strong></h2>



<p><a href="http://download.oracle.com/otn/java/sqldeveloper/sqldeveloper-3.1.07.42.zip" target="_blank" rel="noreferrer noopener nofollow external" data-wpel-link="external" class="wpel-icon-right"><strong>Oracle SQL Developer for 32-bit Windows</strong><span class="wpel-icon wpel-image wpel-icon-6"></span></a>&nbsp;(This zip file&nbsp;<em>includes</em>&nbsp;the JDK1.6.0_11)<br>To install and run:<br>&#8211; Download the file above<br>&#8211; Extract sqldeveloper.zip into any folder, using folder names<br>&#8211; Within that folder, open the sqldeveloper folder<br>&#8211; Double-click sqldeveloper.exe

</p>



<p>解壓縮 Oracle SQL Developer 後執行 <strong>sqldeveloper.exe</strong>。 </p>


<div class="wp-block-image">
<figure class="aligncenter"><a href="http://lh6.ggpht.com/-70Si7Tf2lyI/UT_8eUENwaI/AAAAAAAAHdI/tu6-7n-tA_o/clip_image002.jpg" target="_blank" rel="noopener nofollow external noreferrer" data-wpel-link="external"><img decoding="async" src="//lh6.ggpht.com/-70Si7Tf2lyI/UT_8eUENwaI/AAAAAAAAHdI/tu6-7n-tA_o/clip_image002.jpg" alt="clip_image002.jpg" title="官方 Client - Oracle SQL Developer 安裝教學"></a></figure></div>


<p>如果剛剛下載的是第一個的話(不包含JDK)，第一次執行會要求指定JDK的位置(一定要選JDK的，選JRE的會有問題)，點選Browse…會跳出視窗供選取位置(下下圖)。 </p>


<div class="wp-block-image">
<figure class="aligncenter"><a href="http://lh3.ggpht.com/-bsB70mmb6xs/UT_8eaGe4-I/AAAAAAAAHdE/xuuCJ1ytyRI/clip_image003.jpg" target="_blank" rel="noopener nofollow external noreferrer" data-wpel-link="external"><img decoding="async" src="//lh3.ggpht.com/-bsB70mmb6xs/UT_8eaGe4-I/AAAAAAAAHdE/xuuCJ1ytyRI/clip_image003.jpg" alt="clip_image003.jpg" title="官方 Client - Oracle SQL Developer 安裝教學"></a></figure></div>

<div class="wp-block-image">
<figure class="aligncenter"><a href="http://lh5.ggpht.com/-r9Tv5yWfxE4/UT_8ekrXleI/AAAAAAAAHdY/oK8areaPaJM/clip_image004.jpg" target="_blank" rel="noopener nofollow external noreferrer" data-wpel-link="external"><img decoding="async" src="//lh5.ggpht.com/-r9Tv5yWfxE4/UT_8ekrXleI/AAAAAAAAHdY/oK8areaPaJM/clip_image004.jpg" alt="clip_image004.jpg" title="官方 Client - Oracle SQL Developer 安裝教學"></a></figure></div>


<p>完成後會開啟軟體，這以下畫面直接點選<strong>確定</strong>即可。 </p>


<div class="wp-block-image">
<figure class="aligncenter"><a href="http://lh5.ggpht.com/-uJ6rcJccp4M/UT_8e4--EYI/AAAAAAAAHes/oJgsSBDmdB4/clip_image005.jpg" target="_blank" rel="noopener nofollow external noreferrer" data-wpel-link="external"><img decoding="async" src="//lh5.ggpht.com/-uJ6rcJccp4M/UT_8e4--EYI/AAAAAAAAHes/oJgsSBDmdB4/clip_image005.jpg" alt="clip_image005.jpg" title="官方 Client - Oracle SQL Developer 安裝教學"></a></figure></div>


<p>點選連線下方的「<strong>+</strong>」後，選擇「<strong>資料庫連線</strong>」。 </p>


<div class="wp-block-image">
<figure class="aligncenter"><a href="http://lh3.ggpht.com/-3i5s_Ia_jnk/UT_8e8Kw9HI/AAAAAAAAHek/0Bx0TL35ixc/clip_image006.jpg" target="_blank" rel="noopener nofollow external noreferrer" data-wpel-link="external"><img decoding="async" src="//lh3.ggpht.com/-3i5s_Ia_jnk/UT_8e8Kw9HI/AAAAAAAAHek/0Bx0TL35ixc/clip_image006.jpg" alt="clip_image006.jpg" title="官方 Client - Oracle SQL Developer 安裝教學"></a></figure></div>


<p>輸入資訊，點選「<strong>測試</strong>」，左下角出現「成功」字樣。<strong>儲存</strong>後點選<strong>連線</strong>。<br>IP: 輸入您的資料庫位址<br>SID: 輸入您的資料庫 SID<br>username : 資料庫帳戶<br>password : 資料庫密碼 </p>


<div class="wp-block-image">
<figure class="aligncenter"><a href="http://lh3.ggpht.com/-lv2t66fJaQ4/UT_8fYYKjyI/AAAAAAAAHd0/GPvhbO9PpwA/clip_image007.jpg" target="_blank" rel="noopener nofollow external noreferrer" data-wpel-link="external"><img decoding="async" src="//lh3.ggpht.com/-lv2t66fJaQ4/UT_8fYYKjyI/AAAAAAAAHd0/GPvhbO9PpwA/clip_image007.jpg" alt="clip_image007.jpg" title="官方 Client - Oracle SQL Developer 安裝教學"></a></figure></div>


<p>管理介面如下圖：點選左邊的「<strong>表格</strong>」-&gt;右邊的「<strong>資料</strong>」頁籤，可以看到該表格所有資料。 </p>


<div class="wp-block-image">
<figure class="aligncenter"><a href="http://lh4.ggpht.com/-B9oWs0EuxRo/UT_8fpfSCdI/AAAAAAAAHeE/HekCfN6_JTA/clip_image008.jpg" target="_blank" rel="noopener nofollow external noreferrer" data-wpel-link="external"><img decoding="async" src="//lh4.ggpht.com/-B9oWs0EuxRo/UT_8fpfSCdI/AAAAAAAAHeE/HekCfN6_JTA/clip_image008.jpg" alt="clip_image008.jpg" title="官方 Client - Oracle SQL Developer 安裝教學"></a></figure></div>


<p>可以直接在<strong>篩選條件</strong>輸入需要的條件。 </p>


<div class="wp-block-image">
<figure class="aligncenter"><a href="http://lh6.ggpht.com/-FxplXsmZtl8/UT_8frF8N9I/AAAAAAAAHd4/qvL7UKzKnBk/clip_image009.jpg" target="_blank" rel="noopener nofollow external noreferrer" data-wpel-link="external"><img decoding="async" src="//lh6.ggpht.com/-FxplXsmZtl8/UT_8frF8N9I/AAAAAAAAHd4/qvL7UKzKnBk/clip_image009.jpg" alt="clip_image009.jpg" title="官方 Client - Oracle SQL Developer 安裝教學"></a></figure></div>


<p>在左方資料庫上點選<strong>右鍵</strong>，選擇「<strong>開啟SQL工作表</strong>」，可開啟手動輸入SQL功能。 </p>


<div class="wp-block-image">
<figure class="aligncenter"><a href="http://lh3.ggpht.com/-E9EXSLtAPHw/UT_8gG63Z6I/AAAAAAAAHds/d-pQt4zMcJg/clip_image010.jpg" target="_blank" rel="noopener nofollow external noreferrer" data-wpel-link="external"><img decoding="async" src="//lh3.ggpht.com/-E9EXSLtAPHw/UT_8gG63Z6I/AAAAAAAAHds/d-pQt4zMcJg/clip_image010.jpg" alt="clip_image010.jpg" title="官方 Client - Oracle SQL Developer 安裝教學"></a></figure></div>


<p>自行輸入SQL畫面。 </p>


<div class="wp-block-image">
<figure class="aligncenter"><a href="http://lh6.ggpht.com/-RavLI2g4dSE/UT_8gpdYbaI/AAAAAAAAHd8/NCVNaKPX_K8/clip_image011.jpg" target="_blank" rel="noopener nofollow external noreferrer" data-wpel-link="external"><img decoding="async" src="//lh6.ggpht.com/-RavLI2g4dSE/UT_8gpdYbaI/AAAAAAAAHd8/NCVNaKPX_K8/clip_image011.jpg" alt="clip_image011.jpg" title="官方 Client - Oracle SQL Developer 安裝教學"></a></figure></div>


<p>如果在執行的時候出現了下圖的錯誤，請參考<a rel="noreferrer noopener nofollow external" href="http://sharedderrick.blogspot.tw/2012/01/sql-developer-windows-server-2008-r2.html" target="_blank" data-wpel-link="external" class="wpel-icon-right">這裡<span class="wpel-icon wpel-image wpel-icon-6"></span></a>。 </p>


<div class="wp-block-image">
<figure class="aligncenter"><a href="http://lh6.ggpht.com/-24RofihoS4o/UUAkB9fmulI/AAAAAAAAHe8/lw4zo9oNlpg/aa.png" target="_blank" rel="noopener nofollow external noreferrer" data-wpel-link="external"><img decoding="async" src="//lh6.ggpht.com/-24RofihoS4o/UUAkB9fmulI/AAAAAAAAHe8/lw4zo9oNlpg/aa.png" alt="aa.png" title="官方 Client - Oracle SQL Developer 安裝教學"></a></figure></div>


<h2 class="para wp-block-heading">參考資料 </h2>



<ol class="my-li bg-darkblue wp-block-list"><li><a href="http://sharedderrick.blogspot.tw/2012/01/sql-developer-windows-server-2008-r2.html" target="_blank" rel="noopener nofollow external noreferrer" data-wpel-link="external" class="wpel-icon-right">德瑞克：SQL Server 學習筆記 @ 影片：下載、安裝與組態 SQL Developer，以 Windows Server 2008 R2 + Oracle 11g R2為例<span class="wpel-icon wpel-image wpel-icon-6"></span></a></li><li><a href="http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html" target="_blank" rel="noopener nofollow external noreferrer" data-wpel-link="external" class="wpel-icon-right">Oracle SQL Developer @ Oracle<span class="wpel-icon wpel-image wpel-icon-6"></span></a></li></ol>



<p><strong>Oracle 系列文章：</strong></p>



<ul class="my-li bg-darkblue wp-block-list"><li><a href="https://noter.tw/11178/%e4%bf%ae%e6%94%b9-oracle-sequence/" data-wpel-link="internal">修改 Oracle Sequence</a><a href="https://noter.tw/2371/oracle-%e5%8c%af%e5%85%a5-sql-%e6%aa%94%e6%a1%88/" data-wpel-link="internal"></a></li><li><a href="https://noter.tw/2371/oracle-sqlplus-import-sql-file/" data-wpel-link="internal">Oracle 使用 sqlplus 匯入 SQL 檔案</a></li><li><a href="https://noter.tw/9109/oracle-sqlplus-export-results-to-file/" data-wpel-link="internal">使用 Oracle sqlplus 將查詢結果匯出到檔案</a></li><li><a href="https://noter.tw/2714/%e5%ae%98%e6%96%b9-client-oracle-sql-developer-%e5%ae%89%e8%a3%9d%e6%95%99%e5%ad%b8/" data-wpel-link="internal">官方 Client – Oracle SQL Developer 安裝教學</a></li><li><a href="https://noter.tw/2711/oracle-%e5%8c%af%e5%85%a5%e5%8c%af%e5%87%ba-excel-%e9%80%8f%e9%81%8e-sql-developer/" data-wpel-link="internal">Oracle 匯入/匯出 Excel (透過 SQL Developer)</a></li></ul>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/2714/%e5%ae%98%e6%96%b9-client-oracle-sql-developer-%e5%ae%89%e8%a3%9d%e6%95%99%e5%ad%b8/" data-wpel-link="internal">官方 Client &#8211; Oracle SQL Developer 安裝教學</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://noter.tw/2714/%e5%ae%98%e6%96%b9-client-oracle-sql-developer-%e5%ae%89%e8%a3%9d%e6%95%99%e5%ad%b8/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
