1. Login as oracle:
su - oracle or sudo su - oracle
2. check listener status:
lsnrctl status
lsnrctl start
lsnrctl stop
Friday, August 30, 2013
Windows: launch computer properties (check if Windows is activated) from command line
Let say you just installed a new Windows version on your pc and wanted to check if it's activated.
The easies way to is to click on Start > Computer > Right click > Properties.
However, you can use this command line to get there
control system
Note: don't be mistaken this computer properties with another computer properties launched by this command:
sysdm.cpl
The easies way to is to click on Start > Computer > Right click > Properties.
However, you can use this command line to get there
control system
Note: don't be mistaken this computer properties with another computer properties launched by this command:
sysdm.cpl
Wednesday, August 28, 2013
Oracle SQLPlus and SQL Developer connection
In order to connect to Oracle DB from SQL Developer, a user must be created.
First, launch slqplus:
sqlplus /nolog
Second, connect to ORACLE_SID
connect $ORACLE_SID as sysdba
(when prompting for password, just hit Enter)
Third, create a user;
CREATE USER your_username IDENTIFIED BY your_password;
(if you try to connect with Oracle db at this point, you'll get an error since no session has been granted to this user yet)
Fourth, grant session to the newly-created user
grant create session your_username;
Now Oracle db is ready for connection from SQL Developer.
However, this user have read-only privilege. In order to get write privilge, e.g creating table. You need to grant this privilege to the user.
5. grant write prilivige to the user:
grant create table, create sequence, create database to your_username;
(you can add all other stuff in between: create view, create cluster, create synonym, etc.)
6. grant unlimited space:
grant create unlimited tablespace to your_username;
Note: you have to log in as oracle user in order to execute sqlplus commands.
First, launch slqplus:
sqlplus /nolog
Second, connect to ORACLE_SID
connect $ORACLE_SID as sysdba
(when prompting for password, just hit Enter)
Third, create a user;
CREATE USER your_username IDENTIFIED BY your_password;
(if you try to connect with Oracle db at this point, you'll get an error since no session has been granted to this user yet)
Fourth, grant session to the newly-created user
grant create session your_username;
Now Oracle db is ready for connection from SQL Developer.
However, this user have read-only privilege. In order to get write privilge, e.g creating table. You need to grant this privilege to the user.
5. grant write prilivige to the user:
grant create table, create sequence, create database to your_username;
(you can add all other stuff in between: create view, create cluster, create synonym, etc.)
6. grant unlimited space:
grant create unlimited tablespace to your_username;
Note: you have to log in as oracle user in order to execute sqlplus commands.
Monday, August 19, 2013
Weblogic Datasource Configuration
I was trying to configure a datasource on Weblogic for a Webapp using Spring and Hibernate.
And here is the working configuration:
java:comp/env/jdbc/rqc_db-ds is not working.
In this process I have learned two things:
1. Make sure Weblogic talks to the DB via JNDI
2. Make sure the deployed app talks to JNDI
Note:
rqc_db-ds is just name. Yours could be different.
And here is the working configuration:
java:comp/env/jdbc/rqc_db-ds is not working.
In this process I have learned two things:
1. Make sure Weblogic talks to the DB via JNDI
2. Make sure the deployed app talks to JNDI
Note:
rqc_db-ds is just name. Yours could be different.
Wednesday, August 14, 2013
Weblogic: Deployment State New Issue
When I tried to deploy an demo app to my newly set up Weblogic, I encountered a weird situation where the deployment state is New/Prepare, not Active as expected.
After first, I thought there were something wrong with the app itself. Then I thought there was something wrong with the deployment method: I tried auto deploy, web console.
However, it turned out that the managed server (TestServer) that I tried to deploy the app on was NOT RUNNING!
To check out, go Environment (under Domain Structure) > Servers (on the right side)
Solution: You can turn it on from command line/scripts or from the web GUI console
From the web GUI console, Environment (under Domain Structure) > Servers (on the right side) >
Control (next to Configuration tab) > Check the one you would like to start > Start
Now I can get my app deployment state back to Active again!
After first, I thought there were something wrong with the app itself. Then I thought there was something wrong with the deployment method: I tried auto deploy, web console.
However, it turned out that the managed server (TestServer) that I tried to deploy the app on was NOT RUNNING!
To check out, go Environment (under Domain Structure) > Servers (on the right side)
Solution: You can turn it on from command line/scripts or from the web GUI console
From the web GUI console, Environment (under Domain Structure) > Servers (on the right side) >
Control (next to Configuration tab) > Check the one you would like to start > Start
Now I can get my app deployment state back to Active again!
Weblogic: Failed to start the sip service, shutting down
After I run config.sh to set up Weblogic admin server and managed server. I was unable to start the managed server from the command line. Here's the error message I got:
Failed to start the sip service, shutting down
Solution: While the admin server, go to the web GUI and remove the manage server from SIP Server
(SipServer > Targets > SIP Server Targets
Now I can start managed server from command line or script!
Failed to start the sip service, shutting down
Solution: While the admin server, go to the web GUI and remove the manage server from SIP Server
(SipServer > Targets > SIP Server Targets
Now I can start managed server from command line or script!
Tuesday, August 13, 2013
Install and Set up Weblogic 10.3.2 in Linux
1. Unzip the tar into your choosen dir, e.g.
/opt/weblogic
2. Execute configure.sh script, e.g.
/opt/weblogic/wl10.3.5.0/wlserver_10.3/common/bin/config.sh
3. Follow the instruction in the console: creating username, password, domain name, admin server name, managed server name, port number...
/opt/weblogic
2. Execute configure.sh script, e.g.
/opt/weblogic/wl10.3.5.0/wlserver_10.3/common/bin/config.sh
3. Follow the instruction in the console: creating username, password, domain name, admin server name, managed server name, port number...
That's it. Now you have Weblogic AdminServer running!
If you wish to customize start and stop Weblogic scripts, you may try as folllow.
4. Create dirs for scripts: e.g. /opt/yourcompany/yourproject/weblogic/scripts
Under Scripts, create admin, managed, all
scripts/admin
scripts/managed
scripts/all
5. Start script for admin server: start-admin.sh
e.g. your company name: abc and your project/app: xyz
#!/bin/bash
DATE=`date +%A" "%d-%b-%Y-%X`
DATESTAMP=`date +%d-%b-%Y-%T`
echo " ** Oracle Weblogic 10.3.2 startup script **"
echo " ** "$DATE" **"
export DOMAIN_HOME=/opt/abc/xyz/weblogic/xyzdomain
export XYZ_LOG_HOME=/var/abc/xyz/app/logs
export XYZ_ADMIN_LOG_NAME=xyzadmin.log
ADMIN_PORT=9090
admin_num=`netstat -nl|grep "$ADMIN_PORT" |grep -v grep |awk 'END{print NR}'`
if [ $admin_num -gt 0 ]
then
echo "WebLogic Admin Server Already RUNNING."
else
echo "."
cd $DOMAIN_HOME/bin
echo "Starting WebLogic Admin Server...."
nohup ./startWebLogic.sh > $XYZ_LOG_HOME/$YOURPROJECT_ADMIN_LOG_NAME 2>&1 &
admin_run=`grep -i RUNNING $YOURPROJECT_LOG_HOME/$XZY_ADMIN_LOG_NAME |grep -v grep |awk 'END{print NR}'`
while [ $admin_run -eq 0 ]
do
sleep 2;
admin_run=`grep -i RUNNING $YOURPROJECT_LOG_HOME/$YOURPROJECT_ADMIN_LOG_NAME |grep -v grep |awk 'END{print NR}'`
echo -n "."
done
echo -n "\n"
echo "Started Oracle Weblogic 10.3.2 admin server at port:"$ADMIN_PORT
fi
DATE=`date +%A" "%d-%b-%Y-%X`
DATESTAMP=`date +%d-%b-%Y-%T`
echo " ** Oracle Weblogic 10.3.2 startup script **"
echo " ** "$DATE" **"
export DOMAIN_HOME=/opt/abc/xyz/weblogic/xyzdomain
export XYZ_LOG_HOME=/var/abc/xyz/app/logs
export XYZ_ADMIN_LOG_NAME=xyzadmin.log
ADMIN_PORT=9090
admin_num=`netstat -nl|grep "$ADMIN_PORT" |grep -v grep |awk 'END{print NR}'`
if [ $admin_num -gt 0 ]
then
echo "WebLogic Admin Server Already RUNNING."
else
echo "."
cd $DOMAIN_HOME/bin
echo "Starting WebLogic Admin Server...."
nohup ./startWebLogic.sh > $XYZ_LOG_HOME/$YOURPROJECT_ADMIN_LOG_NAME 2>&1 &
admin_run=`grep -i RUNNING $YOURPROJECT_LOG_HOME/$XZY_ADMIN_LOG_NAME |grep -v grep |awk 'END{print NR}'`
while [ $admin_run -eq 0 ]
do
sleep 2;
admin_run=`grep -i RUNNING $YOURPROJECT_LOG_HOME/$YOURPROJECT_ADMIN_LOG_NAME |grep -v grep |awk 'END{print NR}'`
echo -n "."
done
echo -n "\n"
echo "Started Oracle Weblogic 10.3.2 admin server at port:"$ADMIN_PORT
fi
6. Stop script for Admin Server: stop-admin.sh
#!/bin/bash
DATE=`date +%A" "%d-%b-%Y-%X`
DATESTAMP=`date +%d-%b-%Y-%T`
echo " ** Oracle Weblogic 10.3.2 start/stop script **"
echo " ** "$DATE" **"
export DOMAIN_HOME=/opt/yourcompany/yourproject/weblogic/yourdomain
export YOURPROJECT_LOG_HOME=/var/yourcompany/yourproject/app/logs
ADMIN_PORT=8098
admin_num=`netstat -nl|grep "$ADMIN_PORT" |grep -v grep |awk 'END{print NR}'`
if [ $admin_num -eq 0 ];
then
echo "WebLogic Admin Server not RUNNING."
exit 0
else
echo "."
cd $DOMAIN_HOME/bin
echo "Stopping WebLogic Admin Server...."
cd $DOMAIN_HOME/bin
./stopWebLogic.sh
cd $DOMAIN_HOME
echo "Stopped Oracle Weblogic 10.3.2 admin server at port:"$ADMIN_PORT
fi
DATE=`date +%A" "%d-%b-%Y-%X`
DATESTAMP=`date +%d-%b-%Y-%T`
echo " ** Oracle Weblogic 10.3.2 start/stop script **"
echo " ** "$DATE" **"
export DOMAIN_HOME=/opt/yourcompany/yourproject/weblogic/yourdomain
export YOURPROJECT_LOG_HOME=/var/yourcompany/yourproject/app/logs
ADMIN_PORT=8098
admin_num=`netstat -nl|grep "$ADMIN_PORT" |grep -v grep |awk 'END{print NR}'`
if [ $admin_num -eq 0 ];
then
echo "WebLogic Admin Server not RUNNING."
exit 0
else
echo "."
cd $DOMAIN_HOME/bin
echo "Stopping WebLogic Admin Server...."
cd $DOMAIN_HOME/bin
./stopWebLogic.sh
cd $DOMAIN_HOME
echo "Stopped Oracle Weblogic 10.3.2 admin server at port:"$ADMIN_PORT
fi
7. Start script for Managed Server: start-managed.sh
#!/bin/bash
DATE=`date +%A" "%d-%b-%Y-%X`
DATESTAMP=`date +%d-%b-%Y-%T`
echo " ** Oracle Weblogic 10.3.2 managed server start script **"
echo " ** "$DATE" **"
export DOMAIN_HOME=/opt/abc/xyz/weblogic/xyzdomain
export XYZ_LOG_HOME=/var/abc/xyz/app/logs
ADMIN_URL=t3://url.com
ADMIN_PORT=9090
MANAGED_SERVER_NAME=TestServer
MANAGED_SERVER_PORT=9091
admin_num=`netstat -nl|grep "$ADMIN_PORT" |grep -v grep |awk 'END{print NR}'`
if [ $admin_num -gt 0 ]
then
echo "WebLogic Admin Server is RUNNING."
managed_server_num=`netstat -nl|grep "$MANAGED_SERVER_PORT" |grep -v grep |awk 'END{print NR}'`
if [ $managed_server_num -gt 0 ]
then
echo "WebLogic Managed Server Already RUNNING."
exit 0
else
echo "."
cd $DOMAIN_HOME/bin
echo "Starting WebLogic Managed Server...."
nohup ./startManagedWebLogic.sh $MANAGED_SERVER_NAME > $XYZ_LOG_HOME/$MANAGED_SERVER_NAME.log 2>&1 &
managed_server_run=`grep -i "Server started in RUNNING mode" $XYZ_LOG_HOME/$MANAGED_SERVER_NAME.log |grep -v grep |awk 'END{print NR}'`
while [ $managed_server_run -eq 0 ]
do
sleep 2;
managed_server_run=`grep -i "Server started in RUNNING mode" $XYZ_LOG_HOME/$MANAGED_SERVER_NAME.log |grep -v grep |awk 'END{print NR}'`
echo -n "."
done
echo "Started Oracle Weblogic 10.3.2 managed server at port:"$MANAGED_SERVER_PORT
fi
else
sleep 10
echo "WebLogic Admin Server is not RUNNING."
exit 0
fi
DATE=`date +%A" "%d-%b-%Y-%X`
DATESTAMP=`date +%d-%b-%Y-%T`
echo " ** Oracle Weblogic 10.3.2 managed server start script **"
echo " ** "$DATE" **"
export DOMAIN_HOME=/opt/abc/xyz/weblogic/xyzdomain
export XYZ_LOG_HOME=/var/abc/xyz/app/logs
ADMIN_URL=t3://url.com
ADMIN_PORT=9090
MANAGED_SERVER_NAME=TestServer
MANAGED_SERVER_PORT=9091
admin_num=`netstat -nl|grep "$ADMIN_PORT" |grep -v grep |awk 'END{print NR}'`
if [ $admin_num -gt 0 ]
then
echo "WebLogic Admin Server is RUNNING."
managed_server_num=`netstat -nl|grep "$MANAGED_SERVER_PORT" |grep -v grep |awk 'END{print NR}'`
if [ $managed_server_num -gt 0 ]
then
echo "WebLogic Managed Server Already RUNNING."
exit 0
else
echo "."
cd $DOMAIN_HOME/bin
echo "Starting WebLogic Managed Server...."
nohup ./startManagedWebLogic.sh $MANAGED_SERVER_NAME > $XYZ_LOG_HOME/$MANAGED_SERVER_NAME.log 2>&1 &
managed_server_run=`grep -i "Server started in RUNNING mode" $XYZ_LOG_HOME/$MANAGED_SERVER_NAME.log |grep -v grep |awk 'END{print NR}'`
while [ $managed_server_run -eq 0 ]
do
sleep 2;
managed_server_run=`grep -i "Server started in RUNNING mode" $XYZ_LOG_HOME/$MANAGED_SERVER_NAME.log |grep -v grep |awk 'END{print NR}'`
echo -n "."
done
echo "Started Oracle Weblogic 10.3.2 managed server at port:"$MANAGED_SERVER_PORT
fi
else
sleep 10
echo "WebLogic Admin Server is not RUNNING."
exit 0
fi
Monday, August 12, 2013
Eclipse RCP & RAP Bundle org.eclipse.ui
I created just a "hello world" app for RCP project. It compiled and ran just fine. However, right after I created a RAP project in the same workspace in the Eclipse (RAP target platform was also installed since this is the very first time a RAP project is created), now all the sudden the RCP project threw compliation error like it's missing some dependencies:
MANIFEST.MF error
It turned out that RAP and RCP use different target platforms!!!?? as shown in Eclipse:
So what happened is Eclipse switched to RAP target platform when I created a RAP project!
Solution: Window > Preferences > Plug-in Development > Target Platform > Running Platform > Apply > Ok
MANIFEST.MF error
It turned out that RAP and RCP use different target platforms!!!?? as shown in Eclipse:
So what happened is Eclipse switched to RAP target platform when I created a RAP project!
Solution: Window > Preferences > Plug-in Development > Target Platform > Running Platform > Apply > Ok
Thursday, August 8, 2013
Java Web Start HelloWorld
Java Web Start is new technology to me. As I was trying to do research on Eclipse RCP, I encounter this technology. It uses JNLP (Java Network Launch Protocol).
I tried to build a HelloWorld app using this technology, but keep getting this error.
Error: unable to launch the application
launch Java Control Panel: path/to/jre/bin/javacpl
config network setting
I tried to build a HelloWorld app using this technology, but keep getting this error.
Error: unable to launch the application
launch Java Control Panel: path/to/jre/bin/javacpl
config network setting
Subscribe to:
Posts (Atom)