Monday, October 26, 2020

How to find out all the Java versions installed on a linux machine?

 Login to the linux machine as root.

Use the command below to get all the java versions installed.

           update-alternatives --display java

-----------------------------------------------------------------------------------------------------------------



If you have ever asked the questions below, you will benefit from reading this book.
What is the meaning of life?
Why do I have to suffer?
How can I have the life I like to have?
How can I be the person I want to be?
How can I have good and harmonious relations with others?

What is the true meaning of spiritual practice?  Check it out here. 

Tuesday, October 20, 2020

Crystal Reports: ORA-12170: TNS:Connect timeout occurred [Database Vendor Code: 12170]

In the SAP Crystal Reports editor, you open the Database Expert and trying to view/edit the command, after you have entered your database login credentials you received the following error.


This can be caused by several issues. The following are some of the ways to fix it.

1. ping the database machine to make sure you can access that machine.

2.  Check if the database host of your Oracle Instant Client is using the correct IP address. If you are accessing the database on a remote machine, localhost or 127.0.0.1 will not work

       a. Open your Control Panel.

       b. Open the Administrative Tools window.

       c. Right-click on the ODBC Data Sources and open it.

       d. Select the System DSN tab to look for the Driver used by your data source. 

        e. Select the Drivers tab and locate your driver.

       f. Open a file explorer, go to Program Files (x86)\Oracle Instant Client\<your driver>.

       g. Open the tnsnames.ora file in a text editor, change the HOST = <the correct database IP address> 

3. Make sure the firewall is not blocking the connection.

-----------------------------------------------------------------------------------------------------------------


If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book for free here.


Friday, October 9, 2020

ORA-27125: unable to create shared memory segment; Error: 28: No space left on device

 You got the below error when starting up the Oracle database.

SQL> STARTUP

ORA-27125: unable to create shared memory segment

Linux-x86_64 Error: 28: No space left on device

Additional information: 3760

Additional information: 4278190080


This occurs when the Kernel parameter kernel.shmall is too small. 


Follow the steps below to fix the problem.

1. Determine the page size.

> getconf PAGE_SIZE

4096

2. Determine the Total System Global Area (SGA).

SQL> SHOW SGA

Total System Global Area 6442450944 bytes

Fixed Size                  2938792 bytes

Variable Size            3892316248 bytes

Database Buffers         2533359616 bytes

Redo Buffers               13836288 bytes 

3. Calculate the recommended value for shmall.

shmall = SGA / PAGE_SIZE

With SGA = 6 GB and PAGE_SIZE = 4096, the shmall is

shmall = 6 * 1024 * 1024 * 1024 / 4096 = 1572864

4. Update the kernel.shmall parameter.

Login the Linux machine as root.

> vi /etc/sysctl.conf 

Scroll down to find kernel.shmall and change it's value to  1572864.

* If you could not find the SGA at step 2, you may try to double the current value of shmall.

5. Apply the change.

> sysctl -p

6. Verify the value.

> cat /proc/sys/kernel/shmall

1572864

7. Login to the Oracle database as sysdba and start the database.

SQL> STARTUP

ORACLE instance started.

-----------------------------------------------------------------------------------------------------------------
Watch the blessing and loving online channel: SupremeMasterTV live




If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book for free here.


Friday, September 25, 2020

Use clob column in the where clause in an Oracle database; ORA-00932: inconsistent datatypes: expected - got CLOB

There are several ways to fix the ORA-00932: inconsistent datatypes: expected - got CLOB exception.

Let's say you have a clobColumn in the clobTable with the CLOB datatype. You can use it in the WHERE clause of a select, update, or delete statement by one of the following ways.

1. Use the dbms_lob.compare method

           SELECT * from clobTable 

           WHERE dbms_lob.compare(clobColumn, to_clob('<the value of the column>')) = 0

2. If the clobColumn value is less than 4000 characters, you can use the to_char function.

          SELECT * from clobTable 

           WHERE to_char(clobColumn) = '<the value of the column>';

3. Use like instead of equal.

         SELECT * from clobTable 

           WHERE clobColumn like '<the value of the column>';

-----------------------------------------------------------------------------------------------------------------
Watch the blessing and loving online channel: SupremeMasterTV live




If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book for free here.



Sunday, September 20, 2020

java.sql.SQLException: Listener refused the connection with the following error: ORA-12505, TNS:listener does not currently know of SID given in connect descriptor

 You received such a error when you started to connect to your Oracle database via JDBC.

java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
 
        at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:673)
        at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:715)
        at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:385)
        at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:30)
        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:564)
        at java.sql.DriverManager.getConnection(DriverManager.java:664)
        at java.sql.DriverManager.getConnection(DriverManager.java:247)
        at com.tds.db.DB.connectToDB(DB.java:118)


This means that the TNS listener is running, but it cannot connect you to the database. It may due to:

  • the database has not been started up,
  • the database has not registered with the listener, e.g. because the database was started before the listener. (When the database starts, it registers itself with a listener if it is already running. If the listener isn't running, the database doesn't register itself, and if the listener starts, it doesn't go looking for databases that might register with it.)
To fix the problem:

1. login as the oracle user
      >$ su - oracle
           enter your oracle user password

2. Execute the below command
      >$ lsnrctl status

     If you see these in your output:
          Services Summary...
          Service "your database service" has 1 instance(s).
          Instance "your database service", status READY, has 1 handler(s) for this service...

      It means that your database is up and running. 

3. Login to sqlplus as sysdba
      >$ sqlplus /NOLOG
      SQL> connect / as sysdba;

4. If your database is not running according to step 2, start the database.
          SQL> STARTUP

5. Register the listener
          SQL> conn system
          SQL> alter system set local_listener = 'ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)' scope = both;
          SQL> alter system register;
          SQL> quit

6. Check to see if things are right.
          $ lsnrctl status

          You should see something like below.
          
LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 18-SEP-2020 17:32:34

Copyright (c) 1991, 2014, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date                02-SEP-2020 16:12:28
Uptime                    16 days 1 hr. 20 min. 6 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /12c/app/oracle/product/12.1.0/db_1/network/admin/listener.ora
Listener Log File         /12c/app/oracle/diag/tnslsnr/oraclelog/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracleserver)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=oracleserver)(PORT=5500))(Security=(my_wallet_directory=/12c/app/oracle/admin/db/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "your database service" has 1 instance(s).
  Instance "your database service", status READY, has 1 handler(s) for this service...
Service "oracleXDB" has 1 instance(s).
  Instance "your database service", status READY, has 1 handler(s) for this service...
The command completed successfully

-----------------------------------------------------------------------------------------------------------------
Watch the blessing and loving online channel: SupremeMasterTV live




If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book for free here.

Monday, July 6, 2020

git in NetBeans: Contains files that are in conflict - Solved


After you switch to a different branch, you notice that there is a red cylinder mark next to the project icon. When you hover over it, a message shows up and it says "Contains files that are in conflict".



To fix it, right-click on the project, choose Git, then Resolve Conflict.


In the pop-up window, choose either Remove File From Index or Keep Current File Content.

-----------------------------------------------------------------------------------------------------------------
Watch the blessing and loving online channel: SupremeMasterTV live




If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book for free here.

Wednesday, July 1, 2020

PostgreSQL: add an interval of days represented by a variable to a date

We know that if you want to add 4 days to a date, you do the following.

      <your date> + interval '4 days'

However, if you have

      int x = 4;
   
It will not work by:

      <your date> + interval 'x days'

The way to make it work is:

      <your date> + x * (interval '1 day')


-----------------------------------------------------------------------------------------------------------------
Watch the blessing and loving online channel: SupremeMasterTV live




If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book for free here.