Oracle DB startup details

After installing Oracle DB 11g R2, we have to create a BD using :

$ dbca

If you don’t have (yet) the environment variables, you have to create at .bash_profile :


After creating the database we have to configure the listener to allow TCP connections :

$ netmgr

After NetManager opens, go to Oracle Net Configuration > Local > Listeners > LISTENER and provide the SID as you defined in the DB creation steps. Save the configuration and close the NetManager.

After that, we have to start the listener as :

$ lsnrctl start && dbstart

Automatic statartup script

Depending on your system, you have to create script at startup scripts; we can create (on Fedora/RedHat) the script /etc/init.d/oracle as :

# /etc/rc.d/init.d/oracle
# Description: Starts and stops the Oracle database, listeners and Enterprise Manager
# See how we were called.
case "$1" in
echo "Starting Oracle"
echo -n "Starting Oracle Databases: "
su angellore -c dbstart >> /tmp/oracle.log
echo "Done."

echo -n "Starting Oracle Listeners: "
su angellore -c "lsnrctl start" >> /tmp/oracle.log
echo "Done."

echo -n "Starting Oracle Enterprise Manager: "
su angellore -c "emctl start dbconsole" >> /tmp/oracle.log
echo "Done."
touch /var/lock/subsys/oracle
echo "Shutting Down Oracle"
echo -n "Shutting Down Oracle Enterprise Manager: "
su angellore -c "emctl stop dbconsole" >> /tmp/oracle.log
echo "Done."

echo -n "Shutting Down Oracle Listeners: "
su angellore -c "lsnrctl stop" >> /tmp/oracle.log
echo "Done."

rm -f /var/lock/subsys/oracle
echo -n "Shutting Down Oracle Databases: "
su angellore -c dbshut >> /tmp/oracle.log
echo "Done."
echo "Usage: oracle {start|stop|restart}"

Finally, in /etc/oratab we have to tell oracle that out instance has to be started up at boot time :

# This file is used by ORACLE utilities. It is created by
# and updated by the Database Configuration Assistant when creating
# a database.

# A colon, ‘:’, is used as the field terminator. A new line terminates
# the entry. Lines beginning with a pound sign, ‘#’, are comments.
# Entries are of the form:
# The first and second fields are the system identifier and home
# directory of the database respectively. The third filed indicates
# to the dbstart utility that the database should , «Y», or should not,
# «N», be brought up at system boot time.
# Multiple entries with the same $ORACLE_SID are not allowed.

If you have problems with the shared memory at startup time, you have to create more shared memory space as :

$ mount -t tmpfs shmfs -o size=4g /dev/shm && echo "shmfs /dev/shm tmpfs size=4g 0" >> /etc/fstab

Anuncio publicitario

Weblogic NodeManager issues

After installing Weblogic Server on many machines in order to create a cluster, we need to create a template in our AdminServer, after that, we have to make a template in order to transfer it to the rest of the servers. There are another way to do this, but I’ll leave this for other post.

Create the template

$ ~/Oracle/Middleware/wlserver_10.3/common/bin/ -managed=false -domain=../maleficarum/ -template=maleficarum.jar -template_name="maleficarum"

Once the template is created, we have to transfer it to the other ManagedServer via ssh, and then, restore the template:

$ ./Oracle/Middleware/wlserver_10.3/common/bin/ -template=maleficarum.jar -domain=./Oracle/Middleware/user_projects/domains/maleficarum

After the replication of the template, we have to tart our AdminServer and enroll out managed server using WSLT :

$ cd ~/Oracle/Middleware/wlserver_10.3/common/bin
$ ./
Initializing WebLogic Scripting Tool (WLST) ...

wls:/offline> connect('weblogic','weblogic','t3://adminserver:7001')

wls:/maleficarum/serverConfig> nmEnroll('/home/usuario/Oracle/Middleware/user_projects/domains/maleficarum','/home/usuario/Oracle/Middleware/wlserver_10.3/common/nodemanager')

Enrolling this machine with the domain directory at /home/usuario/Oracle/Middleware/user_projects/domains/maleficarum ...
Successfully enrolled this machine with the domain directory at /home/usuario/Oracle/Middleware/user_projects/domains/maleficarum.


This will registrer out NodeManager in the cluster, and creates all the needed files; As first parameter pass the domain root directory and the second one is the nodemanager location.

Starting nodemanger

$ cd ~/Oracle/Middleware/wlserver_10.3/common/nodemanager
$ ./

If we get the error «Native version is enabled but nodemanager native library could not be loaded«, we can edit the file as :

$ cd Oracle/Middleware/wlserver_12.1/common/nodemanager/
$ cat >
$ NativeVersionEnabled=false

From AdminServer console we now start all servers (domain > environment > servers > ManagedServer1 > control)

Restfull Groovy Service with Restlet

Looking for lightweight solution for my raspberry-pi, found Restlet; a framework that allows groovy (and java) programmers to implement restfull services without a servlet container or application server.

In this example, we’ll write a small app that routes the requests based on the URL requested pattern; for this, we’ll write two files:


import mx.maleficarum.Status
import org.restlet.Application
import org.restlet.Component
import org.restlet.Restlet
import org.restlet.routing.Router

Application application = new Application() {

public synchronized Restlet createInboundRoot() {
Router router = new Router(getContext());
router.attach(«/sample/status»,Status.class );
return router;

Component component = new Component()
component.getServers().add(Protocol.HTTP, 8080)

This class is the entry point for the application, defining a router for each URL pattern and defining the port-protocolo for our HTTP server.


package mx.maleficarum

import org.restlet.representation.Representation
import org.restlet.representation.StringRepresentation
import org.restlet.resource.Get
import org.restlet.resource.ServerResource

class Status extends ServerResource {

public Representation doGet(){
def msg = «This is our status message!»
return new StringRepresentation(«{\»message\»:${msg}\»}», MediaType.APPLICATION_JSON);

This class is the handler for the URL http://localhost:8080/status, and just returns a JSON message.

Finally we shall run the script as :

groovy -classpath ../lib/org.restlet.jar mx/maleficarum/RestletApplication.groovy

We just need to add to classpath org.restlet.jar.

Weblogic Spring Console

Oracle Weblogic 12c, now includes a spring console to monitoring all spring beans enabled applications. In order to activate this feature you have to follow the next steps.

Activate spring console extension

  • In the preferences panel, extensions tab, select spring-console, using the checkbox, and click ‘Enable’.
  • Restar Weblogic to activate the extension.

Deploy weblogic-spring.jar.

  • Locate weblogic-spring.jar, located in ${WL_HOME}/server/lib
  • Deploy as library the jar using weblogic console.

Enable spring in your application.

  • As all spring enabled application, you have to include the spring listener in web.xml :
<web-app xmlns="" xmlns:xsi=""
  • Add WeblogicSpringApplicationListener in your spring context configuration file in order to generate all MBeans needed to display the beans in the enabled console.

<bean class=»weblogic.spring.monitoring.WeblogicSpringApplicationListener» />

  • Add or change the MANIFEST.MF file with the following lines

Extension-List: WeblogicSpring
WeblogicSpring-Extension-Name: weblogic-spring

  • Deploy your application, and go to deployed app details, and navigate to SpringFramework tab to see the detailed spring configuration information.