2019年11月15日 星期五
Oracle DB - linux based ORACLE_SID 大小寫區分 case sensitivity
[root@testdb88 build]# su - oracle
[oracle@testdb88 ~]$ env|grep ORA
ORACLE_UNQNAME=DB11G
ORACLE_SID=DB11G
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=testdb88
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
[oracle@testdb88 ~]$ export ORACLE_SID=db11g
[oracle@testdb88 ~]$ env|grep ORA
ORACLE_UNQNAME=DB11G
ORACLE_SID=db11g
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=testdb88
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
[oracle@testdb88 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Fri Nov 15 13:05:01 2019
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> exit
Disconnected
[oracle@testdb88 ~]$ export ORACLE_SID=DB11G
[oracle@testdb88 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Fri Nov 15 13:05:26 2019
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Release 11.2.0.4.0 - 64bit Production
SQL> exit
Disconnected from Oracle Database 11g Release 11.2.0.4.0 - 64bit Production
Perl script 錯誤訊息 Can't locate Mail/Sendmail.pm 解決辦法
在新的Linux Server(Oracle Enterprise Linux Server 6.8))上配置tablespace空間告警的perl script後,測試時報錯如下
[oracle@testdb88 ~]$ ~/perl/mailTableSpaceSize.pl bypass
Can't locate Mail/Sendmail.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /home/oracle/perl/mailTableSpaceSize.pl line 6.
BEGIN failed--compilation aborted at /home/oracle/perl/mailTableSpaceSize.pl line 6.
Perl腳本mailTableSpaceSize.pl如下所示,其中使用了Mail::Sendmail郵件模塊。
#!/usr/bin/perl
use DBI;
use Mail::Sendmail;
use MIME::QuotedPrint;
use MIME::Base64;
use Encode;
use Number::Format qw(:subs);
use DateTime qw();
出現這個錯誤是因為Perl沒有安裝Mail::Sendmail模組,安裝此模組問題即可解決,可以使用下面幾種方式安裝。 (使用cpan安裝,Server要能夠連上網路,否則無法下載相關package。
perl -MCPAN -e shell
install Mail::Sendmail
cpanm
cpanm Mail::Sendmail
make
make test
make install
https://metacpan.org/pod/Mail::Sendmail
How to install CPAN modules
https://www.cpan.org/modules/INSTALL.html
Perl 教程
https://www.runoob.com/perl/perl-tutorial.html
[oracle@testdb88 ~]$ ~/perl/mailTableSpaceSize.pl bypass
Can't locate Mail/Sendmail.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /home/oracle/perl/mailTableSpaceSize.pl line 6.
BEGIN failed--compilation aborted at /home/oracle/perl/mailTableSpaceSize.pl line 6.
Perl腳本mailTableSpaceSize.pl如下所示,其中使用了Mail::Sendmail郵件模塊。
#!/usr/bin/perl
use DBI;
use Mail::Sendmail;
use MIME::QuotedPrint;
use MIME::Base64;
use Encode;
use Number::Format qw(:subs);
use DateTime qw();
出現這個錯誤是因為Perl沒有安裝Mail::Sendmail模組,安裝此模組問題即可解決,可以使用下面幾種方式安裝。 (使用cpan安裝,Server要能夠連上網路,否則無法下載相關package。
[Best]
CPAN shellperl -MCPAN -e shell
install Mail::Sendmail
cpanm
cpanm Mail::Sendmail
[Traditional]
perl Makefile.PLmake
make test
make install
[Manual]
Copy Sendmail.pm to Mail/ in your Perl lib directory.參考資訊:
Neil Bowers / Mail-Sendmail-0.80 ++ / Mail::Sendmailhttps://metacpan.org/pod/Mail::Sendmail
How to install CPAN modules
https://www.cpan.org/modules/INSTALL.html
Perl 教程
https://www.runoob.com/perl/perl-tutorial.html
2019年11月12日 星期二
Oracle Database Offerings 版本與縮寫 Oracle Multitenant - # of PDBs 多租戶
Oracle數據庫19c | 每個CDB最多3個PDB,無需許可多租戶
- 對於所有產品,如果您沒有獲得Oracle Multitenant的許可,則給定容器數據庫中隨時可以有多達3個用戶創建的PDB。
- EE:額外費用選項; 如果您已獲得Oracle Multitenant的許可,則最多可以創建252個PDB。
- EE-ES:額外費用選項; 如果您已獲得Oracle Multitenant的許可,則最多可以創建4096個PDB
- DBCS EE-HP,DBCS EE-EP和ExaCS:包含選項; 您最多可以創建4096個PDB。
Oracle Database Offerings
| Offering | 提供型態 | 縮寫 | 說明 |
| Oracle Database Standard Edition 2 | On-Premises | SE2 | Oracle數據庫標準版2包含開發工作組,部門級和Web應用程序所必需的功能。 |
| Oracle Database Enterprise Edition | On-Premises | EE | Oracle數據庫企業版為開發應用程序提供了性能,可用性,可擴展性和安全性,例如大容量在線事務處理(OLTP)應用程序,查詢密集型數據倉庫和要求苛刻的Internet應用程序。
可以通過購買Oracle數據庫選件和Oracle管理包來增強Oracle數據庫企業版。 |
| Oracle Database Enterprise Edition on Engineered Systems | On-Premises | EE-ES | 在本地工程系統(Oracle數據庫雲服務器或Oracle數據庫機)上安裝的Oracle數據庫企業版軟件。
包括Oracle數據庫的所有組件。您可以通過購買Oracle數據庫選件和Oracle管理包來進一步增強此功能。 EE-ES的許可策略取決於它是安裝在Oracle數據庫雲服務器還是Oracle數據庫機上。請務必注意這些差異,這些差異將在本指南的後續部分中進行記錄。 |
| Oracle Database Personal Edition | On-Premises | PE | Oracle數據庫個人版支持單用戶開發和部署環境,這些環境要求與Oracle數據庫標準版2和Oracle數據庫企業版完全兼容。
包括Enterprise Edition隨附的所有組件以及所有Oracle Database選項,但Oracle RAC One Node和Oracle Real Application Clusters選項無法與Personal Edition一起使用。 Personal Edition僅在Linux和Windows平台上可用。 Oracle管理包不能與個人版一起使用。 |
| Offering | 提供型態 | 縮寫 | 說明 |
| Oracle Database Cloud
Service Standard Edition | Cloud | DBCS SE | 包括Oracle數據庫標準版2軟件。 |
| Oracle Database Cloud
Service Enterprise Edition | Cloud | DBCS EE | 包括Oracle數據庫企業版軟件。 |
| Oracle Database Cloud
Service Enterprise Edition - High Performance | Cloud | DBCS EE-HP | 包括Oracle數據庫企業版軟件以及許多Oracle數據庫選件和Oracle管理包。 |
| Oracle Database Cloud
Service Enterprise Edition - Extreme Performance | Cloud | DBCS EE-EP | 包括Oracle數據庫企業版軟件以及適用於Oracle數據庫雲服務的所有Oracle數據庫選件和Oracle管理包。 |
| Oracle Database Exadata
Cloud Service | Cloud | ExaCS | 包括Oracle數據庫企業版軟件以及適用於Oracle數據庫數據庫雲服務器的所有Oracle數據庫選件和Oracle管理包。 ExaCS的許可政策也適用於客戶的Oracle Database Exadata Cloud。 |
2019年10月31日 星期四
常見的誤解 - 人不為己天誅地滅
節錄自 https://linriva.pixnet.net/blog/post/62534027-%E5%8D%97%E6%87%B7%E7%91%BE%EF%BC%9A%E3%80%8C%E4%BA%BA%E4%B8%8D%E7%82%BA%E5%B7%B1%EF%BC%8C%E5%A4%A9%E8%AA%85%E5%9C%B0%E6%BB%85%E3%80%8D%E5%8E%9F%E4%BE%86%E6%98%AF%E9%80%99%E5%80%8B
我一直以為,這句話的意思是:人如果不為自己謀利、謀權、謀色,就要招到天地誅殺。其實,這是誤解。
現在才知道,「人不為己天誅地滅」,出處是《佛說十善業道經》第二十四集::人生為己,天經地義,人不為己,天誅地滅。佛家的意思是:不殺生、不偷盜、不邪淫、不妄語、不兩舌、不绮語、不惡口、不貪欲、不嗔恚、不邪見,才是「為自己」。不為自己製造新的惡果,不為自己造成新的災禍,這才是「為自己」。只有這樣才不會天誅地滅。
2019年10月25日 星期五
SAP - Profile Administration (transaction RZ10) 參數設定
SAP建議使用事務T-CODE RZ10調整SAP配置文件。 但是,例如,如果由於錯誤的配置而無法再啟動SAP系統,則可以在文件系統級別上更改相應文件中的SAP參數。
下方例子
1. 修改參數 login/min_password_lng
2. 新增參數 login/min_password_digits
When using the helper file, remember to reload the profiles with transaction RZ10 afterwards! Utilities → Import profiles → Of active servers
a) First look up the current values of the profile parameters you want to change. Go to transaction RZ11 and enter the Param. Name, for example login/min_password_lng. Choose Display. Note the Current value. Repeat this for the other parameters you want to change.
b) To change the parameters in the SAP system, go to transaction RZ10. By using the F4 help select DEFAULT as Profile, select Extended Maintenance and choose Change.
c) To change an already existing parameter, for example login/min_password_lng, simply click into this row and choose Change
d) Enter the new value in the Parameter val. field, for example 8. Choose Copy and Back.
e) To add a new parameter choose Create. Enter the Parameter name, for example login/min_password_digits. Enter the Parameter val., for example 1. Choose Copy twice and Back.
f) In the parameter list choose Copy and Back.
g) Choose Save and in the popup choose No. In the Activate profile popup choose Yes. Then Continue twice.
h) Now restart your SAP system. First stop the Dialog Instance and afterwards the Central Instance. Start in the opposite order. Log on to operating system level of your SAP system and double click the desktop shortcut SAP Management Console. In the new window right click on one instance of your system and choose Stop. After it is stopped, right click and choose Start.
i) After the system is started again, log on and change your password in transaction SU3. If you set parameter login/password_compliance_to_current_ policy to 1 you may need to change your password directly after logging on. Try to violate any parameter you set. You successfully changed some password parameters of your AS ABAP based SAP system.
login/min_password_diff = 3
--Defines the minimum number of characters that must be different in the new password compared to the old password.
login/password_expiration_time = 90
#login/password_expiration_time 密碼有效期
#Default: 0
#Permissible values: 0 - 1000
login/min_password_lng = 6
--Default: 6
--Permissible values: 3 - 40
--Defines the minimum length of the password.
login/failed_user_auto_unlock = 0
--Defines whether user locks due to unsuccessful logon attempts are automatically removed at midnight.
login/no_automatic_user_sapstar = 0
--login/no_automatic_user_sapstar 用戶SAP* 能不能登錄, 0代表SAP*可以登錄,1代表SAP*不能登陸!
login/fails_to_user_lock = 6
--login/fails_to_user_lock 密碼輸錯多少次後鎖定
login/min_password_letters = 2
--Defines the minimum number of letters (A-Z) in passwords.
login/min_password_digits = 2
--Defines the minimum number of digits (0-9) in passwords.
login/system_client = 800
--login/system_client 登錄時默認的Client號
2019年10月24日 星期四
Oracle DB - Creating Linux Services for DB auto-start auto-stop Oracle 19c On OEL7
創建 Linux Services - dbora
Create a new service to automatically start/stop an Oracle database. This assumes the Oracle database is not using Oracle Restart and the "start_all.sh" and "stop_all.sh" scripts are already present.
# vi /lib/systemd/system/dbora.service
[Unit]
Description=The Oracle Database Service
After=syslog.target network.target
[Service]
# systemd ignores PAM limits, so set any necessary limits in the service.
# Not really a bug, but a feature.
# https://bugzilla.redhat.com/show_bug.cgi?id=754285
LimitMEMLOCK=infinity
LimitNOFILE=65535
#Type=simple
# idle: similar to simple, the actual execution of the service binary is delayed
# until all jobs are finished, which avoids mixing the status output with shell output of services.
RemainAfterExit=yes
User=oracle
Group=oinstall
Restart=no
ExecStart=/bin/bash -c '/home/oracle/scripts/start_all.sh'
ExecStop=/bin/bash -c '/home/oracle/scripts/stop_all.sh'
[Install]
WantedBy=multi-user.target
Reload systemd so it can see the new service.
# systemctl daemon-reload
Start the service and enable so it is automatically restarted on reboot.
# systemctl start dbora.service
# systemctl enable dbora.service
# systemctl status dbora.service
參考資訊:
Linux Services (systemd, systemctl)
Oracle DB - 安裝Oracle Database 19c 在 Oracle Linux 7
下載軟體
Download the Oracle software from OTN or MOS depending on your support status.OTN: Oracle Database 19c (19.3) Software (64-bit)
edelivery: Oracle Database 19c (19.3) Software (64-bit)
修改 Hosts File
“ /etc/hosts”文件必須包含服務器的標準名稱。安裝前置作業
[root@testdb81 ~]# yum install -y oracle-database-preinstall-19cLoaded plugins: langpacks, ulninfo
ol7_latest | 2.7 kB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package oracle-database-preinstall-19c.x86_64 0:1.0-1.el7 will be installed
--> Processing Dependency: ksh for package: oracle-database-preinstall-19c-1.0-1.el7.x86_64
--> Processing Dependency: libaio-devel for package: oracle-database-preinstall-19c-1.0-1.el7.x86_64
--> Running transaction check
---> Package ksh.x86_64 0:20120801-139.0.1.el7 will be installed
---> Package libaio-devel.x86_64 0:0.3.109-13.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================================================================
Package Arch Version Repository Size
================================================================================================================================
Installing:
oracle-database-preinstall-19c x86_64 1.0-1.el7 ol7_latest 18 k
Installing for dependencies:
ksh x86_64 20120801-139.0.1.el7 ol7_latest 883 k
libaio-devel x86_64 0.3.109-13.el7 ol7_latest 12 k
Transaction Summary
================================================================================================================================
Install 1 Package (+2 Dependent packages)
Total download size: 913 k
Installed size: 3.2 M
Downloading packages:
warning: /var/cache/yum/x86_64/7Server/ol7_latest/packages/libaio-devel-0.3.109-13.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Public key for libaio-devel-0.3.109-13.el7.x86_64.rpm is not installed
(1/3): libaio-devel-0.3.109-13.el7.x86_64.rpm | 12 kB 00:00:00
(2/3): ksh-20120801-139.0.1.el7.x86_64.rpm | 883 kB 00:00:00
(3/3): oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm | 18 kB 00:00:02
--------------------------------------------------------------------------------------------------------------------------------
Total 328 kB/s | 913 kB 00:00:02
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
Importing GPG key 0xEC551F03:
Userid : "Oracle OSS group (Open Source Software group) <build@oss.oracle.com>"
Fingerprint: 4214 4123 fecf c55b 9086 313d 72f9 7b74 ec55 1f03
Package : 7:oraclelinux-release-7.6-1.0.15.el7.x86_64 (@anaconda/7.6)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : ksh-20120801-139.0.1.el7.x86_64 1/3
Installing : libaio-devel-0.3.109-13.el7.x86_64 2/3
Installing : oracle-database-preinstall-19c-1.0-1.el7.x86_64 3/3
Verifying : libaio-devel-0.3.109-13.el7.x86_64 1/3
Verifying : ksh-20120801-139.0.1.el7.x86_64 2/3
Verifying : oracle-database-preinstall-19c-1.0-1.el7.x86_64 3/3
Installed:
oracle-database-preinstall-19c.x86_64 0:1.0-1.el7
Dependency Installed:
ksh.x86_64 0:20120801-139.0.1.el7 libaio-devel.x86_64 0:0.3.109-13.el7
Complete!
如果用 RHEL7 or CentOS7, 可以安裝 OL7 repository. It will pull the dependencies from your normal repositories.
# yum install -y https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
Additional Setup
Set the password for the "oracle" user.passwd oracle
Set secure Linux to permissive by editing the "/etc/selinux/config" file, making sure the SELINUX flag is set as follows.
SELINUX=permissive
Once the change is complete, restart the server or run the following command.
# setenforce Permissive
If you have the Linux firewall enabled, you will need to disable or configure it, as shown here or here. To disable it, do the following.
# systemctl stop firewalld
# systemctl disable firewalld
Create the directories in which the Oracle software will be installed.
mkdir -p /u01/app/oracle/product/19.0.0/dbhome_1
mkdir -p /u02/oradata
chown -R oracle:oinstall /u01 /u02
chmod -R 775 /u01 /u02
Create a "scripts" directory.
mkdir /home/oracle/scripts
Create an environment file called "setEnv.sh". The "$" characters are escaped using "\". If you are not creating the file with the cat command, you will need to remove the escape characters.
cat > /home/oracle/scripts/setEnv.sh <<EOF
# Oracle Settings
export TMP=/tmp
export TMPDIR=\$TMP
export ORACLE_HOSTNAME=testdb81
export ORACLE_UNQNAME=cdb1
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\$ORACLE_BASE/product/19.0.0/dbhome_1
export ORA_INVENTORY=/u01/app/oraInventory
export ORACLE_SID=cdb1
export PDB_NAME=pdb1
export DATA_DIR=/u02/oradata
export PATH=/usr/sbin:/usr/local/bin:\$PATH
export PATH=\$ORACLE_HOME/bin:\$PATH
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib
EOF
Add a reference to the "setEnv.sh" file at the end of the "/home/oracle/.bash_profile" file.
echo ". /home/oracle/scripts/setEnv.sh" >> /home/oracle/.bash_profile
Create a "start_all.sh" and "stop_all.sh" script that can be called from a startup/shutdown service. Make sure the ownership and permissions are correct.
cat > /home/oracle/scripts/start_all.sh <<EOF
#!/bin/bash
. /home/oracle/scripts/setEnv.sh
export ORAENV_ASK=NO
. oraenv
export ORAENV_ASK=YES
dbstart \$ORACLE_HOME
EOF
cat > /home/oracle/scripts/stop_all.sh <<EOF
#!/bin/bash
. /home/oracle/scripts/setEnv.sh
export ORAENV_ASK=NO
. oraenv
export ORAENV_ASK=YES
dbshut \$ORACLE_HOME
EOF
chown -R oracle:oinstall /home/oracle/scripts
chmod u+x /home/oracle/scripts/*.sh
Installation 安裝
# xhost +cd $ORACLE_HOME
unzip -oq /path/to/software/LINUX.X64_193000_db_home.zip
DISPLAY=0.0:0; export DISPLAY
# Silent mode.
./runInstaller -ignorePrereq -waitforcompletion -silent \
-responseFile ${ORACLE_HOME}/install/response/db_install.rsp \
oracle.install.option=INSTALL_DB_SWONLY \
ORACLE_HOSTNAME=${ORACLE_HOSTNAME} \
UNIX_GROUP_NAME=oinstall \
INVENTORY_LOCATION=${ORA_INVENTORY} \
SELECTED_LANGUAGES=en,en_GB \
ORACLE_HOME=${ORACLE_HOME} \
ORACLE_BASE=${ORACLE_BASE} \
oracle.install.db.InstallEdition=SE2 \
oracle.install.db.OSDBA_GROUP=dba \
oracle.install.db.OSBACKUPDBA_GROUP=dba \
oracle.install.db.OSDGDBA_GROUP=dba \
oracle.install.db.OSKMDBA_GROUP=dba \
oracle.install.db.OSRACDBA_GROUP=dba \
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false \
DECLINE_SECURITY_UPDATES=true
Database Creation
dbca
# Silent mode.
dbca -silent -createDatabase \
-templateName General_Purpose.dbc \
-gdbname ${ORACLE_SID} -sid ${ORACLE_SID} -responseFile NO_VALUE \
-characterSet AL32UTF8 \
-sysPassword SysPassword1 \
-systemPassword SysPassword1 \
-createAsContainerDatabase true \
-numberOfPDBs 1 \
-pdbName ${PDB_NAME} \
-pdbAdminPassword PdbPassword1 \
-databaseType MULTIPURPOSE \
-automaticMemoryManagement false \
-totalMemory 1500 \
-storageType FS \
-datafileDestination "${DATA_DIR}" \
-redoLogFileSize 50 \
-emConfiguration NONE \
-ignorePreReqs
收尾
Edit the "/etc/oratab" file setting the restart flag for each instance to 'Y'.
cdb1:/u01/app/oracle/product/19.0.0/db_1:Y
Enable Oracle Managed Files (OMF) and make sure the PDB starts when the instance starts.
sqlplus / as sysdba <<EOF
alter pluggable database ${PDB_NAME} save state;
exit;
EOF
參考資訊:
Oracle Database 19c Installation On Oracle Linux 7 (OL7)
Multitenant : Connecting to Container Databases (CDB) and Pluggable Databases (PDB) in Oracle Database 12c Release 1 (12.1)
Multitenant : Startup and Shutdown Container Databases (CDB) and Pluggable Databases (PDB) in Oracle Database 12c Release 1 (12.1)
訂閱:
文章 (Atom)
