docker 安裝 restyaboard (一種看板軟體)

**安裝前必須先安裝postgres (因為restyaboard是docker安裝, 因此postgres也建議用docker安裝)

也必須先行建立資料庫 restyaboard , 存取的使用者,與密碼 ,

docker run --rm -d -e POSTGRES_DB='restyaboard' \
-e POSTGRES_HOST='postgres' \
--link <docker postgres名稱>:postgres \
-e POSTGRES_PASSWORD='admin' \
-e POSTGRES_USER='admin' \
-p 8080:80 \
--name restyaboard restyaplatform/restyaboard:dev

完成後, 可以http登入8080 ,

輸入預設帳號admin , 密碼restya

docker安裝postgres

安裝很簡單, 預設的管理者帳號是 postgres , 密碼就是底下所設定的密碼

docker volume create postgres-data 
docker run --name postgres -v postgres-data:/var/lib/postgresql/data -e POSTGRES_PASSWORD=<密碼> -d postgres

如何登入

docker exec -it postgres  bash

登入後輸入 su – postgres

變身成 postgres之後, 

再下psql 就可以進入postgres世界了

但是指令就很不習慣,只能列出一些剛剛用到的,以後想到再補上

$ sudo -u postgres psql
-- List all databases via \l (or \list), or \l+ for more details
postgres=# \l Name | ... -----------+----------- postgres | ... template0 | ... template1 | ... postgres=# CREATE DATABASE mytest; $ sudo -u postgres createuser --login --pwprompt testuser Enter password for new role: xxxx # Create a new database called testdb, owned by testuser. $ sudo -u postgres createdb --owner=testuser testdb

 

MSSQL的日期(Date)欄位如何加上指定的小時數

公司某天刷臉機器因停電造成時間錯誤, IT人員未即時更新(因為週六), 導致少數加班人員吃飯刷卡紀錄錯誤,少了11小時, 因此必須加回去原本的資料庫 , 可使用 dateadd(hour, 預加或減的小時數字, 欄位名稱) 的方式處理.

update dbo.KQZ_Card set CardTime= dateadd(hour,11,KQZ_card.CardTime) where DevID=9 and year(CardTime)=2019 and Month(CardTime)=4 and day(CardTime)=27;

安裝於linux的oracle 11g , 如何設定instance啟用方式

oracle 11g是很久的資料庫, 當時是配合鼎新tiptop 5.1 GP版本安裝, 安裝於centos 5.5 final ,
tiptop系統分成topprod, topstd , 與toptest , 但是到最後很少用到 topstd與toptest,

所以可以預設停用這兩個用不到的instance,

我們可以修改 /etc/oratab 這個檔案, 長得如下:

toptest:/u2/oracle/product/11.2.0/db_1:Y
topstd:/u2/oracle/product/11.2.0/db_1:Y
topprod:/u2/oracle/product/11.2.0/db_1:Y

請停掉database後, 把Y改成N, 以後重啟就不會啟動用不到的instance

mysql(mariadb)新增資料庫(UTF-8)與使用者權限

每次都會忘記, 而且之前一點都不在意把使用者與root權限分開,但資安還是要顧著.

MariaDB>CREATE DATABASE 資料庫名稱 CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

新增使用者,密碼與權限

MariaDB> create database 資料庫名稱;
MariaDB> create user 使用者帳號@localhost identified by '使用者登入密碼';
MariaDB> grant all privileges on 資料庫名稱.* to 使用者帳號@localhost;
MariaDB> flush privileges;
MariaDB> quit

將老舊DBF資料檔案轉成Excel

以往讀取老舊DBF資料檔案 , 只要透過ODBC , 搭配MSQRY這隻程式就可以下SQL指令完成任務.

可是這些常用的工具漸漸地不再支援, 連java 8之後也不內含JdbcOdbc, 簡單的說若你有老系統的資料要讀取, 已經是非常困擾的一件事情, 因此有必要將這些資料都導出來, 方便查閱.

因此偶找到一些好用的函式庫(jdbf), 再簡單寫一個GUI程式, 可將DBF轉成Excel, 最後就再也用不到這些老舊的檔案了.  程式可在此下載

1. Windows 7 64bits or above or Ubuntu 16.04 64bits or above

2. java 8 or above

1 2 3