Thursday, September 27, 2018

How To Install Python3 and OCI SDK In Different Location of Linux

Requirement

Default Oracle Linux has python2 installed, right rising of python3, we would like to use python3 for new projects while no touching on existing python2 environment
Get  source cod from python official website
wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tar.xz
Put it to local /u02/storage

Install Extra,Configure and Make the binaries

Run as root
make -o /u01/python3
cd /u02/storage
tar xf Python-3.6.6.tar.xz
cd Python-3.6.6
yum install openssl-devel
yum install zlib-devel     ---- install zlib to avoid error 
./configure --prefix=/u01/python3
make
make install
alias pip='/u01/python3/bin/pip3'
alias python='/u01/python3/bin/python3'

Install and Config OCI SDK for Python

If your hosts are behind firewall, you need to tell python proxy details:
export https_proxy=http://www-proxy.us.test.com:80/
pip install oci 
see more details Oracle OCI SDK doc 

Output

the successful output is like:
.......
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Successfully installed pip-10.0.1 setuptools-39.0.1

Error

If you see such error
zipimport.ZipImportError: can't decompress data; zlib not available python
yum install zlib-devel    -------- to fix the zlib missing error

Sunday, September 23, 2018

Crontab Job Is Not Executed As Expected

Symptom

   We have a crontab job as below,  it does not run as expected. The /var/log/cron shows  the cron daemon has invoke it. But no log output.  Manual run is fine but not in crontab job

30 22 * * 1 /almjira_shared/monitor_scripts/lusi/atlassianlabs-lusi-aa6116a95ea3/lusi.sh /u01/app/atlassian/admin/jira/caches/indexes > /almjira_shared/monitor_scripts/lusi/atlassianlabs-lusi-aa6116a95ea3/`hostname -s`-$(date +%F_%R)-output.txt &

Solution:

   The crontab daemon can't recognize  %  in the command line.  We need to escapte % to make it work.  So the correct format is :

30 22 * * 1 /almjira_shared/monitor_scripts/lusi/atlassianlabs-lusi-aa6116a95ea3/lusi.sh /u01/app/atlassian/admin/jira/caches/indexes > /almjira_shared/monitor_scripts/lusi/atlassianlabs-lusi-aa6116a95ea3/`hostname -s`-$(date +\%F_\%R)-output.txt &

Wednesday, September 19, 2018

ORA-28014: cannot drop administrative users on Oracle 18.3

Symptom:

  We would like to drop ORDS schemas and reinstall ORDS in 18.3 DB

SQL>  drop user ORDS_PUBLIC_USER cascade;
 drop user ORDS_PUBLIC_USER cascade
*
ERROR at line 1:
ORA-28014: cannot drop administrative users

Solution:


SQL> alter session set "_oracle_script"=true;

SQL>  drop user ORDS_PUBLIC_USER cascade;

User dropped.

SQL>  drop user ORDS_METADATA  cascade;

User dropped.

Tuesday, September 18, 2018

How to Set Debug for ORDS ( Oracle Rest Data Service)

Symptom:

     We need to debug into ORDS ( Oracle Rest Data Service) to see any further error stack

Solution:

     Find defaults.xml file in ORDS home. ie /opt/ords_config_dir/ords/defaults.xml

     Add below two entry to true. Bounce ORDS, then you see the error stack on your browser.

<entry key="debug.debugger">true</entry>

<entry key="debug.printDebugToScreen">true</entry>

Monday, September 17, 2018

How To Set Env Variable in GI/CRS

Symptom:

    Sometimes we need to set env variables in CRS for Database .  For example, we need to set ORACLE_UNQNAME  for a few Databases. So each database can get its unique name from this variable. We can add other variable for different usages

Solution:

test0024!oracle (bash) /u01/app/oracle/product/12.1.0.2/dbhome_2/network/admin
testdb1% srvctl getenv database -db testdb
testdb:

test0024!oracle (bash) /u01/app/oracle/product/12.1.0.2/dbhome_2/network/admin
testdb1 % srvctl setenv database -db testdb -env "ORACLE_UNQNAME=testdb"

test0024!oracle (bash) /u01/app/oracle/product/12.1.0.2/dbhome_2/network/admin
testdb1% srvctl getenv database -db testdb
testdb:
ORACLE_UNQNAME=testdb