2019年10月24日 星期四

Planning, Decision, Execution, and Assessment (PDEA) Cycle





Planning, Decision, Execution, and Assessment (PDEA) Cycle. The PDEA cycle describes the process the commander and his staff use to plan operations, make accurate and timely decisions, direct effective execution of operations, and assess the results of those operations to attain understanding. It is a framework that supports the commander’s efforts to assimilate information in a chaotic environment to increase tempo through timely and decisive actions. Decisions are made throughout each phase of the PDE&A cycle. Understanding is required to support each decision. The CTF Battle Rhythm and Reports Matrix are developed to facilitate the CCTF’s PDE&A cycle.



參考資訊:
http://hestories.info/chapter-c-8-information-management.html#Planning,_Decision,_Execution,_and_Assessment_(PDEA)_Cycle



The Decision Execution Cycle
https://www.researchgate.net/figure/The-Decision-Execution-Cycle_fig3_235320642

2019年10月21日 星期一

Oracle DB - 價格 Price 試算










  1. Software Update License & Support價格是 License價格的22%。
  2. 1個Processor License的價格等於50個NUP的價格。
  3. 單一Processor授權價格,EE是SE2的2.71倍。
  4. 單一主機授權價格,EE是SE2的9~24倍。
  5. SE2一個Processor License約台幣50萬。
  6. EE一個Processor License約台幣140萬。


簡單計算:
版本NUPSoftware Update
License & Support
Licese:MAProcessor
License
Software Update
License & Support
Licese:MAProcessor:NUP
SE2350770.2217,5003,8500.2250
EE9502090.2247,50010,4500.2250
2.7142857142.714285714
SE2(台幣)10,5002,310525,000115,500
EE(台幣)28,5006,2701,425,000313,500
一台Server with E5-2630v2 2.60GHz (6 Cores) *2來計算 SE2
1,050,000
一台Server with E5-2630v2 2.60GHz (6 Cores) *2來計算 EE
8,550,000
8.142857143倍
一台Server with E5-2640v4 2.40GHz(10 Cores)*2來計算 SE2
1,050,000
一台Server with E5-2640v4 2.40GHz(10 Cores)*2來計算 EE
14,250,000
13.57142857倍








2019年10月18日 星期五

Oracle DB - 修改主機hostname and ip address 之後 DB Control/DB Console (OEM) 無法啟動



將Oracle DB主機 hostname and ip address 修改之後,database and listener可以正常啟動。

但是 DB Control/DB Console (OEM) 無法啟動,錯誤訊息如下:
[oracle@testdb88 ~]$ emctl start dbconsole
OC4J Configuration issue. /u01/app/oracle/product/11.2.0/db_1/oc4j/j2ee/OC4J_DBConsole_testdb88_DB11G not found.



1) Set  $ORACLE_HOSTNAME to the old hostname:

[oracle@testdb88 ~]$ export ORACLE_HOSTNAME=oradb02



2) De-configure the old DB Console:

[oracle@testdb88 ~]$ $ORACLE_HOME/bin/emca -deconfig dbcontrol db

STARTED EMCA at Oct 18, 2019 4:39:26 PM
EM Configuration Assistant, Version 11.2.0.3.0 Production
Copyright (c) 2003, 2011, Oracle.  All rights reserved.

Enter the following information:
Database SID: DB11G

Do you wish to continue? [yes(Y)/no(N)]: Y
Oct 18, 2019 4:39:33 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/DB11G/emca_2019_10_18_16_39_26.log.
Oct 18, 2019 4:39:33 PM oracle.sysman.emcp.EMDBPreConfig performDeconfiguration
Enterprise Manager configuration completed successfully
FINISHED EMCA at Oct 18, 2019 4:39:36 PM



3) Un-set $ORACLE_HOSTNAME:



4) Create the new DB Console:

[oracle@testdb88 ~]$ $ORACLE_HOME/bin/emca -config dbcontrol db -repos recreate

STARTED EMCA at Oct 18, 2019 4:42:21 PM
EM Configuration Assistant, Version 11.2.0.3.0 Production
Copyright (c) 2003, 2011, Oracle.  All rights reserved.

Enter the following information:
Database SID: DB11G
Listener port number: 1521
Listener ORACLE_HOME [ /u01/app/oracle/product/11.2.0/db_1 ]:
Password for SYS user:
Password for DBSNMP user:
Password for SYSMAN user:
Email address for notifications (optional):
Outgoing Mail (SMTP) server for notifications (optional):
-----------------------------------------------------------------

You have specified the following settings

Database ORACLE_HOME ................ /u01/app/oracle/product/11.2.0/db_1

Local hostname ................ testdb88
Listener ORACLE_HOME ................ /u01/app/oracle/product/11.2.0/db_1
Listener port number ................ 1521
Database SID ................ DB11G
Email address for notifications ...............
Outgoing Mail (SMTP) server for notifications ...............

-----------------------------------------------------------------
----------------------------------------------------------------------
WARNING : While repository is dropped the database will be put in quiesce mode.
----------------------------------------------------------------------
Do you wish to continue? [yes(Y)/no(N)]: Y
Oct 18, 2019 4:43:34 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/DB11G/emca_2019_10_18_16_42_21.log.
Oct 18, 2019 4:43:35 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Dropping the EM repository (this may take a while) ...
Oct 18, 2019 4:44:36 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully dropped
Oct 18, 2019 4:44:37 PM oracle.sysman.emcp.EMReposConfig createRepository
INFO: Creating the EM repository (this may take a while) ...
Oct 18, 2019 4:48:05 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully created
Oct 18, 2019 4:48:07 PM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository
INFO: Uploading configuration data to EM repository (this may take a while) ...
Oct 18, 2019 4:48:53 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Uploaded configuration data successfully
Oct 18, 2019 4:48:55 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Securing Database Control (this may take a while) ...
Oct 18, 2019 4:49:01 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Database Control secured successfully.
Oct 18, 2019 4:49:01 PM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) ...
Oct 18, 2019 4:49:34 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: Database Control started successfully
Oct 18, 2019 4:49:34 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: >>>>>>>>>>> The Database Control URL is https://testdb88:1158/em <<<<<<<<<<<
Oct 18, 2019 4:49:36 PM oracle.sysman.emcp.EMDBPostConfig invoke
WARNING:
************************  WARNING  ************************

Management Repository has been placed in secure mode wherein Enterprise Manager data will be encrypted.  The encryption key has been placed in the file: /u01/app/oracle/product/11.2.0/db_1/testdb88_DB11G/sysman/config/emkey.ora. Ensure this file is backed up as the encrypted data will become unusable if this file is lost.

***********************************************************
Enterprise Manager configuration completed successfully
FINISHED EMCA at Oct 18, 2019 4:49:36 PM



4) 確認 dbconsole已經正常啟動:

[oracle@testdb88 ~]$ emctl status dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.4.0
Copyright (c) 1996, 2013 Oracle Corporation.  All rights reserved.
https://testdb88:1158/em/console/aboutApplication
Oracle Enterprise Manager 11g is running.
------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/product/11.2.0/db_1/testdb88_DB11G/sysman/log





2019年10月16日 星期三

Oracle DB - 修改資料庫參數 memory_max_target 重啟DB遭遇錯誤



修改資料庫參數 memory_max_target 之後重啟DB遭遇錯誤

1. ORA-00845: MEMORY_TARGET not supported on this system










SQL> ALTER SYSTEM SET memory_max_target = 1887436800 SCOPE=SPFILE;

System altered.

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> startup
ORA-00845: MEMORY_TARGET not supported on this system

[解決方式]
從alert log 可以看到類似的警告訊息。
WARNING: You are trying to use the MEMORY_TARGET feature. This feature requires the /dev/shm file system to be mounted for at least 1996488704 bytes. /dev/shm is either not mounted or is mounted with available space less than this size. Please fix this so that MEMORY_TARGET can work as expected. Current available is 1936601088 and used is 237568 bytes. Ensure that the mount point is /dev/shm for this directory.
memory_target needs larger /dev/shm




1. vi /etc/fstab

tmpfs                   /dev/shm                tmpfs   defaults,size=96g        0 0

2. reboot os




3. startup database

2. ORA-27102: out of memory








SQL> ALTER SYSTEM SET memory_max_target ='16G' SCOPE=SPFILE;

System altered.

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> startup
ORA-27102: out of memory
Linux-x86_64 Error: 12: Cannot allocate memory
Additional information: 26
Additional information: 327685
Additional information: 1711276032



[解決方式]
 memory_max_target 不可超過 實體記憶體 + Swap Space。

$ free
             total       used       free     shared    buffers     cached
Mem:       3782888    1674632    2108256     232144      34832     914080
-/+ buffers/cache:     725720    3057168
Swap:     10239996          0   10239996


1. 把  memory_max_target 調整到適合大小,再 startup database
2. 增加實體記憶體或swap space,,再 startup database

3. 其他注意事項








If AMM is enabled.

(Do not)勿調整SGA_MAX_SIZE

SGA_MAX_SIZE會自動調整成和MEMORY_MAX_TARGET相同值。





If AMM is disabled.

(Do not)勿調整SGA_MAX_SIZE超過 MEMORY_MAX_TARGET

SQL> startup
ORA-00843: Parameter not taking MEMORY_MAX_TARGET into account

ORA-00849: SGA_TARGET 12884901888 cannot be set to more than MEMORY_MAX_TARGET 2013265920.

2019年10月1日 星期二

在 Red Hat Enterprise Linux/CentOS 7 上安裝 Zabbix Server 4.2


Install Zabbix 4.2 在 RHEL7 

常見的開源監控軟體,有Zabbix、Nagios、Prometheus.......。
其中 Zabbix Server非常容易安裝,參考原廠安裝手冊,以下分享整個安裝過程與詳細指令。一個小時內可以完成安裝設定。




安裝元件介紹

使用標準的LAMP組合


  1. RHEL7
  2. Apache
  3. MySQL (Mariadb 5.5)
  4. PHP
  5. zabbix-4.2-2.el7 rpm pacakge


關閉Linux防火牆

systemctl stop firewalld
systemctl disable firewalld

SELinux

To do this edit the "/etc/selinux/config" file, making sure the SELINUX flag is set as follows.
If SELinux is configured after installation, the server will need a reboot for the change to take effect.

SELINUX=permissive

getenforce
setenforce permissive
getenforce

Frontend installation prerequisites

Zabbix frontend requires additional packages not available in basic installation. You need to enable repository of optional rpms in the system you will run Zabbix frontend on:

ll /etc/yum.repos.d/
vi public-yum-ol7.repo

[root@aot-zbx02 yum.repos.d]# vi public-yum-ol7.repo
[ol7_optional_latest]
name=Oracle Linux $releasever Optional Latest ($basearch)
baseurl=https://yum.oracle.com/repo/OracleLinux/OL7/optional/latest/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1


安裝MariaDB

yum repolist
yum list mariadb*
yum install mariadb*


安裝 php, httpd

yum install nmap httpd policycoreutils-python net-snmp net-snmp-utils php-bcmath php-mbstring php-xml curl curl-devel net-snmp-devel perl-DBI
yum install php php-gd php-ldap php-mysql php-odbc php-pdo php-pear php-pecl-memcache php-soap php-xmlrpc


Start MariaDB

systemctl start mariadb
systemctl enable mariadb
systemctl status mariadb


修改資料庫root密碼 (選用)

mysqladmin -uroot password 1234qwer


Adding Zabbix repository

rpm -Uvh http://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-release-4.2-2.el7.noarch.rpm


Install Zabbix Server, Zabbix Forntend and Zabbix Agent

yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent


Creating database

MySQL - Character set utf8 and utf8_bin collation is required for Zabbix server to work properly with MySQL database.

mysql -uroot
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';


Importing data

zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -pzabbix zabbix

mysql -uzabbix -pzabbix zabbix

mysql> SELECT
table_name AS `Table`,
round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
FROM information_schema.TABLES
WHERE table_schema = "zabbix";


Configure database for Zabbix server

vi /etc/zabbix/zabbix_server.conf

LogFileSize=10
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix


Starting Zabbix server process

systemctl start zabbix-server
systemctl enable zabbix-server
systemctl status zabbix-server


Zabbix frontend configuration

For RHEL 7 and later the Apache configuration file for Zabbix frontend is located in /etc/httpd/conf.d/zabbix.conf.

vi /etc/httpd/conf.d/zabbix.conf

        # php_value date.timezone Europe/Riga
        php_value date.timezone Asia/Taipei


systemctl start httpd
systemctl enable httpd


Frontend installation steps 

Allow you to access your newly installed Zabbix.
Note that a Zabbix proxy does not have a frontend; it communicates with Zabbix server only.

http://zabbix-frontend-hostname/zabbix

Enter password of zabbix




Configure and start Zabbix Agent


vi /etc/zabbix/zabbix_agentd.conf
LogFileSize=10
Server=127.0.0.1
ServerActive=127.0.0.1
Hostname=Zabbix server


systemctl start zabbix-agent
systemctl status zabbix-agent
systemctl enable zabbix-agent


All jobs are completed 


Zabbix frontend is available at http://zabbix-frontend-hostname/zabbix in the browser. Default username/password is Admin/zabbix.



參考資訊~~原廠手冊 

https://www.zabbix.com/documentation/4.2/manual/installation/install_from_packages/rhel_centos

2019年9月27日 星期五

Oracle DB - 如何restore被意外刪除(drop)的stored procedure?


某甲: 剛剛發現一隻stored procedure不見了,請協助從備份檔案restore。

DBA看了一下技術文件,只能搖搖頭。RMAN可以做database, tablespace 的 restore,但無法只挑某支store procedure進行還原。

Restoring Files with RMAN
Use the RMAN RESTORE command to restore the following types of files from disk or other media:

Database (all datafiles)
Tablespaces
Control files
Archived redo logs
Server parameter files

某甲: 是否可以restore database到testing db,然後從完整還原的資料庫中,去把該stored procesure撈出來恢復到production db?

DBA內心OS: 阿娘喂。

DWP01目前快要3TB的size,RMAN recovery取一個stored procedure。,突然想到

《紅樓夢·第九一回》
寶玉呆了半晌,忽然大笑道:『任憑弱水三千,我只取一瓢飲。』



精神不佳的時候,很容易發生這種誤刪除 stored procedure 的狀況。
如何簡單的查詢,並且做一個"復原的動作" ?

--查現在
select text from dba_source where owner = 'APPUSER' and name='APP_PROC_AABBCC';

--connect / as sysdba
--查六小時前
select text from dba_source as of timestamp sysdate-6/24 where owner = 'APPUSER' and name='APP_PROC_AABBCC' order by line;

PL/SQL Developer 自動記憶帳號 username and 密碼 password




1 記憶帳號 username

 Configure -->  Preferences -> User Interface - Options

勾選 Autosave username --> OK






2 記憶密碼 password

Configure --> Preferences -->  Oracle  --> Logon History  -> Definition

勾選 Store history 和Store with password  --> OK