Monthly Archives: May 2021
Connect OCI with VNC as GUI
Oracle Instance will be connected with VNC using GUI.
- Configuring OCI server
- Install group “Server with GUI”
- Install tigervnc
- Starting vncserver
- Configuring VNC Client(using MobaXterm as VNC Client)
- Opening new VNC viewer session
- VNC viewer setup
- SSH Gateway setup
Prerequisite
- OCI Instance with VCN Configured
- MobaXterm for VNC Client
- ssh client
In this blog windows powershell will be used. The OCI Instance used is Always free instance created with Oracle Cloud Development kit.
Configuring OCI server

Step : 1 Install group “Server with GUI”
Connect to the server using ssh and change the user to root
[opc@instance20210514111021 ~]$ sudo bash
[root@instance20210514111021 opc]# yum -y groups install "Server with GUI"
Loaded plugins: langpacks, ulninfo
--------
Once the packages are installed then check with the below command
[root@instance20210514111021 opc]# yum -y groups list "Server with GUI"
Loaded plugins: langpacks, ulninfo
Installed Environment Groups:
Server with GUI
Done
Step : 2 Install tigervnc
[root@instance20210514111021 opc]# yum -y install tigervnc-server
Loaded plugins: langpacks, ulninfo
Resolving Dependencies
--> Running transaction check
---> Package tigervnc-server.x86_64 0:1.8.0-22.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================================================
Installing:
tigervnc-server x86_64 1.8.0-22.el7 ol7_latest 211 k
Transaction Summary
=============================================================================================================================================================================================
Install 1 Package
Total download size: 211 k
Installed size: 498 k
Downloading packages:
tigervnc-server-1.8.0-22.el7.x86_64.rpm | 211 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : tigervnc-server-1.8.0-22.el7.x86_64 1/1
Verifying : tigervnc-server-1.8.0-22.el7.x86_64 1/1
Installed:
tigervnc-server.x86_64 0:1.8.0-22.el7
Complete!
Step 3 : Starting vncserver
While starting vncserver it will ask for password. The provided password will be used to connect VNC viewer client.
[root@instance20210514111021 opc]# vncserver
You will require a password to access your desktops.
Password:
Verify:
Would you like to enter a view-only password (y/n)? n
A view-only password is not used
xauth: file /root/.Xauthority does not exist
New 'instance20210514111021:1 (root)' desktop is instance20210514111021:1
Creating default startup script /root/.vnc/xstartup
Creating default config /root/.vnc/config
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/instance20210514111021:1.log
The number that appears after the host address is the display number (it is underlined in red in the image above). By adding this number to 5900, this will give you the port number used to connect your VNC viewer to the VNC session.
For example, if your display number is 4, your port number is 5904. If your display number is 12, your port number is 5912.
The VNC session is now running on the remote Linux host system and is ready to connect with your VNC viewing software.
Configuring VNC Client(using MobaXterm as VNC Client)
Step 4 : Opening new VNC viewer session
In MobaXterm, click on the Session button in the upper left hand corner

Step 5 : VNC viewer setup
In the window that pops up, look for the VNC icon in the top row and click on it
- In the Remote hostname or IP address box, enter localhost
- In the Port box, enter your Port Number. Recall that this is 5900 plus the Display Number that appeared after running the vncserver command

Step 6 : SSH Gateway setup

In the lower area, click on the Network Settings tab, and then click on the SSH gateway (jumphost) button.
In the window that pops up, enter the following
- In the Gateway host box, enter the address of the host machine that your VNC session is running on(Copy the IP address from OCI Instance)
- In the Username box, enter your opc username.
- In Port, leave it set at 22
- Select the ssh key file. Do not check off the box for Use SSH key.
Password will be prompted and once given GUI is connected

Show Values in the Sourcing Actions Drop down – Oracle Apps
In Sourcing Module we usually need to customize the page based on the Customer Requirement so I felt that the below code snippet will be useful to show the Values.
As a first step the Root Controller Class file has to be Extended
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processRequest(pageContext, webBean);
OAApplicationModule rootam=null;
rootam=(OAApplicationModule)pageContext.getRootApplicationModule();
OAViewObject actionListVO =null;
actionListVO = (OAViewObject)rootam.findViewObject("ActionListVO");
AuctionHeadersAllVOImpl auctionVO = (AuctionHeadersAllVOImpl)rootam.findViewObject("AuctionHeadersAllVO");
auctionVO.reset();
if (auctionVO.hasNext()) {
AuctionHeadersAllVORowImpl auctionRow = (AuctionHeadersAllVORowImpl)auctionVO.next();
Number auctionHeaderId = auctionRow.getAuctionHeaderId();
pageContext.writeDiagnostics(this, "Inside XXAttachCO PR AuctionId: "+auctionHeaderId, 4);
}
pageContext.writeDiagnostics(this, "Inside XXAttachCO PR Before iterating the Action Code and Action Meaning ", 4);
if (actionListVO != null) {
int actionListVORowCount = actionListVO.getRowCount();
int counter =0;
if (actionListVORowCount > 0) {
actionListVO.setRangeSize(actionListVORowCount);
Row[] actionListVORows = actionListVO.getAllRowsInRange();
for (int i = 0; i < actionListVORows.length; i++) {
Row actionListVORow = actionListVORows[i];
String actionCode = (String)actionListVORow.getAttribute("Code");
String actioMeaning = (String)actionListVORow.getAttribute("Meaning");
pageContext.writeDiagnostics(this, "Inside XXAttachCO PR getting actionCode= " + actionCode, 4);
pageContext.writeDiagnostics(this, "Inside XXAttachCO PR getting actioMeaning= " + actioMeaning, 4);
}
}
}
}
Accessing Oracle Free Tier Instance using SQLcl
Here in these steps I have used the Oracle Free tier Compute Instance and Oracle Free tier Database. I have connected my local machine by ssh to Compute Instance VM running Oracle server 7.9. To move the Instance Wallet file I have used Winscp. After downloading the ssh key file I have used Puttygen to create .ppk file and mapped the .ppk file to authenticate in Winscp.
As SQLcl is already Installed and will directly go to the steps
- Download the Instance Wallet
- Open sqlcl
- Issue command set cloudconfig <downloaded_zip_file>
- Issue show tns
- Connect to available tns and move on.
Step – 1: Download the Instance Wallet
Once the Instance is created then click on DB connection to download the Wallet file.

Step – 2: Open sqlcl
[opc@oracle-linux ~]$ /opt/oracle/sqlcl/bin/sql /nolog
SQLcl: Release 21.1 Production on Sat May 01 13:08:45 2021
Copyright (c) 1982, 2021, Oracle. All rights reserved.
SQL>
Step – 3: Issue command set cloudconfig <downloaded_zip_file>
SQL> set cloudconfig Wallet_testdb.zip
Operation is successfully completed.
Operation is successfully completed.
Using temp directory:/tmp/oracle_cloud_config8749035398540414270
Step – 4: Issue show tns
SQL> select * from dual;
SP2-0640: Not connected
SQL> show tns
TNS Lookup locations
--------------------
1. Third Party Path
/tmp/oracle_cloud_config8749035398540414270
2. USER Home dir
/home/opc
Location used:
-------------
/tmp/oracle_cloud_config8749035398540414270
Available TNS Entries
---------------------
testdb_high
testdb_low
testdb_medium
testdb_tp
testdb_tpurgent
Step – 5: Connect to available tns and move on.
SQL> connect admin@testdb_medium
Password? (**********?) ***************
Connected.
SQL> select * from dual;
DUMMY
________
X
SQL>
SQLcl Issue in Oracle Linux
I have Installed SQLcl In Oracle Server 7.9 using yum which in-turn java 8 was installed as a dependency. I had already java 16 version in the server. Now while executing the SQLcl I was getting the below Error.
$ sudo yum install sqlcl
While trying to launch SQLCL in Oracle server I was getting the below Error.
[opc@oracle-linux bin]$ /opt/oracle/sqlcl/bin/sql /nolog
Error occurred during initialization of VM
java.nio.charset.IllegalCharsetNameException: utf-8nLC_ALL=en_US
at java.nio.charset.Charset.checkName(java.base/Charset.java:305)
at java.nio.charset.Charset.lookup2(java.base/Charset.java:479)
at java.nio.charset.Charset.lookup(java.base/Charset.java:459)
at java.nio.charset.Charset.defaultCharset(java.base/Charset.java:605)
at java.io.OutputStreamWriter.<init>(java.base/OutputStreamWriter.java:110)
at java.io.PrintStream.<init>(java.base/PrintStream.java:110)
at java.io.PrintStream.<init>(java.base/PrintStream.java:152)
at java.lang.System.newPrintStream(java.base/System.java:1918)
at java.lang.System.initPhase1(java.base/System.java:2012)
I had two versions of Java Installed in the machine.
[opc@oracle-linux bin]$ alternatives --config java
There are 2 programs which provide 'java'.
Selection Command
-----------------------------------------------
1 /home/opc/soft/jdk/bin/java
*+ 2 /usr/java/jdk1.8.0_291-amd64/bin/java
Enter to keep the current selection[+], or type selection number:
[opc@oracle-linux bin]$ echo $JAVA_HOME
/home/opc/soft/jdk
[opc@oracle-linux bin]$ java --version
openjdk 16 2021-03-16
OpenJDK Runtime Environment (build 16+36-2231)
OpenJDK 64-Bit Server VM (build 16+36-2231, mixed mode, sharing)
While checking the java is still referrring to java 17 in the above path. Now we need to change path by the below command
[opc@oracle-linux jdk1.8.0_291-amd64]$ export JAVA_HOME=/usr/java/jdk1.8.0_291-amd64
[opc@oracle-linux jdk1.8.0_291-amd64]$ export PATH=$JAVA_HOME/bin:$PATH
Here in the above code, JAVA_HOME path was added to first line to new path and in the next command we are appending to PATH
[opc@oracle-linux jdk1.8.0_291-amd64]$ echo $PATH
/usr/java/jdk1.8.0_291-amd64/bin:/usr/java/jdk1.8.0_291-amd64/bin:/home/opc/soft/bat:/home/opc/soft/apache-maven-3.6.3/bin:/home/opc/soft:/home/opc/soft/jdk/bin/:/home/opc/soft:/home/opc/soft/apache-maven-3.6.3/bin:/home/opc/soft/bin:/home/opc/soft/bat:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/opc/.local/bin:/home/opc/bin[opc@oracle-linux
[opc@oracle-linux jdk1.8.0_291-amd64]$ java -version
java version "1.8.0_291"
Java(TM) SE Runtime Environment (build 1.8.0_291-b32)
Java HotSpot(TM) 64-Bit Server VM (build 25.291-b32, mixed mode)
Now while running sqlcl again was getting the same Error so I was stuck for some time. I have then executed man and it gave the Issue
[opc@oracle-linux ~]$ man sql
man: can't set the locale; make sure $LC_* and $LANG are correct
No manual entry for sql
[opc@oracle-linux ~]$ locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.utf-8nLC_ALL=en_US.utf-8n
LC_CTYPE="en_US.utf-8nLC_ALL=en_US.utf-8n"
LC_NUMERIC="en_US.utf-8nLC_ALL=en_US.utf-8n"
LC_TIME="en_US.utf-8nLC_ALL=en_US.utf-8n"
LC_COLLATE="en_US.utf-8nLC_ALL=en_US.utf-8n"
LC_MONETARY="en_US.utf-8nLC_ALL=en_US.utf-8n"
LC_MESSAGES="en_US.utf-8nLC_ALL=en_US.utf-8n"
LC_PAPER="en_US.utf-8nLC_ALL=en_US.utf-8n"
LC_NAME="en_US.utf-8nLC_ALL=en_US.utf-8n"
LC_ADDRESS="en_US.utf-8nLC_ALL=en_US.utf-8n"
LC_TELEPHONE="en_US.utf-8nLC_ALL=en_US.utf-8n"
LC_MEASUREMENT="en_US.utf-8nLC_ALL=en_US.utf-8n"
LC_IDENTIFICATION="en_US.utf-8nLC_ALL=en_US.utf-8n"
LC_ALL=
Now when I checked with root user I did not face any locale Issue.
[opc@oracle-linux ~]$ sudo su - Last login: Sat May 1 12:03:55 GMT 2021 on pts/3 [root@oracle-linux ~]# locale LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL=
Now when running with root user sqlcl works for me as with opc user there were some problems with locale
[root@oracle-linux ~]# java -version java version "1.8.0_291" Java(TM) SE Runtime Environment (build 1.8.0_291-b32) Java HotSpot(TM) 64-Bit Server VM (build 25.291-b32, mixed mode) [root@oracle-linux ~]# /opt/oracle/sqlcl/bin/sql /nolog SQLcl: Release 21.1 Production on Sat May 01 12:06:59 2021 Copyright (c) 1982, 2021, Oracle. All rights reserved. SQL> exit
After searching then executed the below command. Now locale Issue is solved.
$ export LC_ALL="en_US.UTF-8"
[opc@oracle-linux ~]$ export LC_ALL="en_US.UTF-8"
[opc@oracle-linux ~]$ locale
LANG=en_US.utf-8nLC_ALL=en_US.utf-8n
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8
[opc@oracle-linux ~]$
Now again I was getting the Error so probably i will solve this Error and let you know
[opc@oracle-linux ~]$ /opt/oracle/sqlcl/bin/sql /nolog
Error occurred during initialization of VM
java.nio.charset.IllegalCharsetNameException: utf-8nLC_ALL=en_US
at java.nio.charset.Charset.checkName(java.base/Charset.java:305)
at java.nio.charset.Charset.lookup2(java.base/Charset.java:479)
at java.nio.charset.Charset.lookup(java.base/Charset.java:459)
at java.nio.charset.Charset.defaultCharset(java.base/Charset.java:605)
at java.io.OutputStreamWriter.<init>(java.base/OutputStreamWriter.java:110)
at java.io.PrintStream.<init>(java.base/PrintStream.java:110)
at java.io.PrintStream.<init>(java.base/PrintStream.java:152)
at java.lang.System.newPrintStream(java.base/System.java:1918)
at java.lang.System.initPhase1(java.base/System.java:2012)
[opc@oracle-linux ~]$ man sql
No manual entry for sql
Now Issuing the below command was working
[opc@oracle-linux ~]$ LANG=en_US.UTF-8
[opc@oracle-linux ~]$ /opt/oracle/sqlcl/bin/sql /nolog
SQLcl: Release 21.1 Production on Sat May 01 12:28:09 2021
Copyright (c) 1982, 2021, Oracle. All rights reserved.
SQL>
In a summary changing the java from openjdk to oracle-jdk dependent version and below two commands resolved this Error.
LANG=en_US.UTF-8
export LC_ALL=”en_US.UTF-8″
Thank you for reading. If you have any suggestions please let me know.
References

