24.3.17

Java Vs Nodejs


In the history of computing, 1995 was a crazy time. First Java appeared, then close on its heels came JavaScript. The names made them seem like conjoined twins newly detached, but they couldn't be more different. One of them compiled and statically typed; the other interpreted and dynamically typed. That's only the beginning of the technical differences between these two wildly distinct languages that have since shifted onto a collision course of sorts, thanks to Node.js.
If you’re old enough to have been around back then, you might remember Java’s early, epic peak. It left the labs, and its hype meter pinned. Everyone saw it as a revolution that would stop at nothing less than a total takeover of computing. That prediction ended up being only partially correct. Today, Java dominates Android phones, enterprise computing, and some embedded worlds like Blu-ray disks.


For all its success, though, Java never established much traction on the desktop or in the browser. People touted the power of applets and Java-based tools, but gunk always glitched up these combinations. Servers became Java’s sweet spot.
Meanwhile, what programmers initially mistook as the dumb twin has come into its own. Sure, JavaScript tagged along for a few years as HTML and the Web pulled a Borg on the world. But that changed with AJAX. Suddenly, the dumb twin had power.


Then Node.js was spawned, turning developers’ heads with its speed. Not only was JavaScript faster on the server than anyone had expected, but it was often faster than Java and other options. Its steady diet of small, quick, endless requests for data have since made Node.js more common, as Web pages have grown more dynamic.
While it may have been unthinkable 20 years ago, the quasi-twins are now locked in a battle for control of the programming world. On one side are the deep foundations of solid engineering and architecture. On the other side are simplicity and ubiquity. Will the old-school compiler-driven world of Java hold its ground, or will the speed and flexibility of Node.js help JavaScript continue to gobble up everything in its path?

Where Java wins: Rock-solid foundation

I can hear the developers laughing. Some may even be dying of heart failure. Yes, Java has glitches and bugs, but relatively speaking, it's the Rock of Gibraltar. The same faith in Node.js is many years off. In fact, it may be decades before the JavaScript crew writes nearly as many regression tests as Sun/Oracle developed to test the Java Virtual Machine. When you boot up a JVM, you get 20 years of experience from a solid curator determined to dominate the enterprise server. When you start up JavaScript, you get the work of an often cantankerous coalition that sometimes wants to collaborate and sometimes wants to use the JavaScript standard to launch passive-aggressive attacks.

Where Node wins: Ubiquity

Thanks to Node.js, JavaScript finds a home on the server and in the browser. Code you write for one will more than likely run the same way on both. Nothing is guaranteed in life, but this is as close as it gets in the computer business. It's much easier to stick with JavaScript for both sides of the client/server divide than it is to write something once in Java and again in JavaScript, which you would likely need to do if you decided to move business logic you wrote in Java for the server to the browser. Or maybe the boss will insist that the logic you built for the browser be moved to the server. In either direction, Node.js and JavaScript make it much easier to migrate code.


Where Java wins: Better IDEs

Java developers have Eclipse, NetBeans, or IntelliJ, three top-notch tools that are well-integrated with debuggers, decompilers, and servers. Each has years of development, dedicated users, and solid ecosystems filled with plug-ins.
Meanwhile, most Node.js developers type words into the command line and code into their favorite text editor. Some use Eclipse or Visual Studio, both of which support Node.js. Of course, the surge of interest in Node.js means new tools are arriving, some of which, like IBM’s Node-RED offer intriguing approaches, but they're still a long way from being as complete as Eclipse. WebStorm, for instance, is a solid commercial tool from JetBrains, linking in many command-line build tools.
Of course, if you're looking for an IDE that edits and juggles tools, the new tools that support Node.js are good enough. But if you ask your IDE to let you edit while you operate on the running source code like a heart surgeon slices open a chest, well, Java tools are much more powerful. It's all there, and it's all local.

Where Node wins: Build process simplified by using same language

Complicated build tools like Ant and Maven have revolutionized Java programming. But there's only one issue. You write the specification in XML, a data format that wasn't designed to support programming logic. Sure, it's relatively easy to express branching with nested tags, but there's still something annoying about switching gears from Java to XML merely to build something.

Where Java wins: Remote debugging

Java boasts incredible tools for monitoring clusters of machines. There are deep hooks into the JVM and elaborate profiling tools to help identify bottlenecks and failures. The Java enterprise stack runs some of the most sophisticated servers on the planet, and the companies that use those servers have demanded the very best in telemetry. All of these monitoring and debugging tools are quite mature and ready for you to deploy.

Where Node wins: Database queries

Queries for some of the newer databases, like CouchDB, are written in JavaScript. Mixing Node.js and CouchDB requires no gear-shifting, let alone any need to remember syntax differences.
Meanwhile, many Java developers use SQL. Even when they use the Java DB (formerly Derby), a database written in Java for Java developers, they write their queries in SQL. You would think they would simply call Java methods, but you’d be wrong. You have to write your database code in SQL, then let Derby parse the SQL. It's a nice language, but it's completely different and many development teams need different people to write SQL and Java.

Where Java wins: Libraries

There is a huge collection of libraries available in Java, and they offer some of the most serious work around. Text indexing tools like Lucene and computer vision toolkits like OpenCV are two examples of great open source projects that are ready to be the foundation of a serious project. There are plenty of libraries written in JavaScript and some of them are amazing, but the depth and quality of the Java code base is superior.

Where Node wins: JSON

When databases spit out answers, Java goes to elaborate lengths to turn the results into Java objects. Developers will argue for hours about POJO mappings, Hibernate, and other tools. Configuring them can take hours or even days. Eventually, the Java code gets Java objects after all of the conversion.
Many Web services and databases return data in JSON, a natural part of JavaScript. The format is now so common and useful that many Java developers use the JSON formats, so a number of good JSON parsers are available as Java libraries as well. But JSON is part of the foundation of JavaScript. You don't need libraries. It's all there and ready to go.

Where Java wins: Solid engineering

It's a bit hard to quantify, but many of the complex packages for serious scientific work are written in Java because Java has strong mathematical foundations. Sun spent a long time sweating the details of the utility classes and it shows. There are BigIntegers, elaborate IO routines, and complex Date code with implementations of both Gregorian and Julian calendars.
JavaScript is fine for simple tasks, but there’s plenty of confusion in the guts. One easy way to see this is in JavaScript’s three different results for functions that don't have answers: undefinedNaN, and null. Which is right? Well, each has its role -- one of which is to drive programmers nuts trying to keep them straight. Issues about the weirder corners of the language rarely cause problems for simple form work, but they don't feel like a good foundation for complex mathematical and type work.

Where Node wins: Speed

People love to praise the speed of Node.js. The data comes in and the answers come out like lightning. Node.js doesn't mess around with setting up separate threads with all of the locking headaches. There's no overhead to slow down anything. You write simple code and Node.js takes the right step as quickly as possible.
This praise comes with a caveat. Your Node.js code better be simple and it better work correctly. If it deadlocks, the entire server could lock up. Operating system developers have pulled their hair out creating safety nets that can withstand programming mistakes, but Node.js throws away these nets.

Where Java wins: Threads

Fast code is great, but it's usually more important that it be correct. Here is where Java’s extra features make sense.
Java's Web servers are multithreaded. Creating multiple threads may take time and memory, but it pays off. If one thread deadlocks, the others continue. If one thread requires longer computation, the other threads aren’t starved for attention (usually).
If one Node.js request runs too slowly, everything slows down. There's only one thread in Node.js, and it will get to your event when it's good and ready. It may look superfast, but underneath it uses the same architecture as a one-window post office in the week before Christmas.
There have been decades of work devoted to building smart operating systems that can juggle many different processes at the same time. Why go back in time to the ’60s when computers could handle only one thread?

Where Node wins: Momentum

Yes, all of our grandparents' lessons about thrift are true. Waste not; want not. It can be painful to watch Silicon Valley’s foolish devotion to the “new” and “disruptive,” but sometimes cleaning out the cruft makes the most sense. Yes, Java can keep up, but there's old code everywhere. Sure, Java has new IO routines, but it also has old IO routines. Plenty of appletand util classes can get in the way.

Summary of differences between Java versions?

Java 8 (a.k.a 1.8)

Language changes:
  • lambda expressions (JSR 335, includes method handles)
  • continuation of Project Coin (small language improvements)
  • annotations on Java types
Library changes:

Java 7 (a.k.a 1.7)

Language changes:
Library changes:
Platform changes:

Java 6 (a.k.a 1.6)

Mostly incremental improvements to existing libraries, no new language features (except for the @Override snafu).

Java 5 (a.k.a 1.5)

Language Changes:
  • generics (that's the big one)
  • annotations
  • enum types
  • varargs, enhanced for loops (for-each)
Library changes:
  • concurrency utilities in java.util.concurrent

Java 1.4

Language changes:
Library changes:

Java 1.3

Mostly minor improvements, really.
Platform changes:
  • HotSpot JVM: improvement over the original JIT

Java 1.2

Language changes:
Library changes:
Platform changes
  • a real JIT, greatly improving speed

Java 1.1

Language changes:
  • inner classes
Library changes:
  • AWT event changes
  • JDBC, RMI
  • reflection

Java 1.0

Initial release, everything is new ;-)

11.3.17

How to create users in oracle Database ?

I have seen one Post on facebook in Oracle DB group that someone is asking, How to create user in oracle database. I know it's very silly question but it happens if you are new to Oracle. So I am only writing this post for those people how do not want to study the books. 

So here are the steps to create user in Oracle database. Theses steps will be same in 10g,11g and 12c. I will discuss two scenarios here :-

  1. create simple user 
  2. create user with attributes 

  1. Create simple user

Step1 :- You can connect to database with sysdba privileges. 

      e.g.  sql > conn / as sysdba 


Step2:- After connecting to sysdba, you need to use “CREATE USER” command to create new user. “ALTER USER”  is used to modify the properties of the users like password, profile etc. Please note that users name should be unique. You cannot create user wit the same name.

     e.g.  sql >  create user test identified by test;

Step 3:- With above command your database user created, But now you cannot connect to the database with this user, WHY? because you haven’t granted this user to connect to database and create the session. 
You need to grant your user as below:- 

e.g.  sql > grant create session to  test; 
       sql > grant connect to test; 

Now you can connect to the database by this user test. 
e.g. conn test/test@TNSNAME



  1. create user with attributes

creating user with attributes means you assign properties at the time of creation e.g. suppose we need to create a user and we need to specify its tablespace with quota and also want to assign a profile to this user. 

below is the example:-
sql> create user test identified by test default tablespace test temporary tablespace temp quota unlimited on test profile test;

This will create a user test with password test tablespace test and profile test. 

Keep Sharing :) 

What is JAVA ?

Java was originally developed by Sun Microsystems which and was initiated by James Gosling and released in 1995 as core component .
The latest version of the Java Standard Edition is Java SE 8. With the widespread popularity, multiple configurations were built to suit for various types of platforms. e.g.: J2EE for Enterprise Applications, J2ME for Mobile Applications.
There is new J2 versions were renamed as Java SE, Java EE, and Java ME respectively. As we know Java is guaranteed to be Write Once, Run Anywhere :).


So what is java? 

Java is a Technology :) Below are the features − 
  • Object Oriented − For Java and in JAVA everything is an Object. So ItJ can be easily extended because it is based on the Object model.
  • Platform Independent (WOW) − SO like many other programming languages like C and C++, when Java is compiled, it is not compiled into platform specific machine That's why its called Platform independent language, It is compiled into platform independent byte code. This code is distributed and interpreted by the Virtual Machine (JVM) .
  • Simple and Portable  − Actully Java is designed to be easy to learn to all that's the reason it's very famous among all. All you need to is to master the concepts of OOP Java.It's also very easily portable because it has no implementaion dependency. 
  • Secure Like anything −  Java is  secure and it's security feature  enables to develop a virus-free and temper free systems. 
  • Robust −  So Java Checks for the error on the compile time and also on runtime checking.

    Multithreaded − It means  with this feature of JAVA, You can write a code to perform multiple tasks at same time.  
  • High Performance − Java uses Just-In-Time compilers,So that automatically enables high performance.
  • Distributed − Java is mainly designed for the distributed environment of the internet.
  • Dynamic − Java more dynamic than C or C++.


    Keep Sharing :)

20.2.17

AD online patching in Oracle EBS R12.2

ADOP – Applications DBA Online Patching Tool 


Oracle introduced ADOP in Oracle E-Business R12.2 . This is a new patching mechanism (online patching) that allow the application of patches while your environment is up and running.You don't need to stop the application or put it on maintains mode as we use to do before. 

ADOP phases:

1) Prepare – This will prepare the instance for patch application.
2) Apply – This will apply patches .
3) Finalize – This will get ready the instance for cutover.
4) Cutover – This will make the patch edition the new run edition (fs1 to fs2).
5) Cleanup – This will drop obsolete objects and data from old editions.

Steps to apply patch on R12.2 using ADOP:

1) Download and unzip the patch

2) Read the readme carefully

3) run the environment as below in new cmd prompt.

$ source <run APPL_TOP path>/APPS<CONTEXT_NAME>.env

4) confirm the staus of adop by below command.

$ adop -status

5) start from first phase by Preparing the system for patching.

$ adop phase=prepare

6) NOw apply the patch to patch edition.

$ adop phase=apply patches=<patch number>,workers=<number_of_worker>
e.g adop phase=apply patches=1111,2222 workers=6

7) check for the logs and complete the rest of the phases as below:-

$ adop phase=finalize
$ adop phase=cutover
$ adop phase=cleanup

8) We have to Synchronize the file system, which copy the new run edition code and configuration to the patch file system.

$ adop phase=fs_clone


Note:- You can use in one go  "adop phase=prepare,apply,finalize,cutover,cleanup patches=<patch_number1>,<patch_number2>"

 Thanks ;)

10.2.17

ORA-04030: out of process memory when trying to allocate bytes (,)

 ORA-04030: out of process memory when trying to allocate  bytes (,)

In logs, We you see below error

>Instance terminated by CKPT, pid = 6172 with below errors in alert log . Other errors are found in log files are also listed below

1) ORA-04030: out of process memory when trying to allocate 4096 bytes (PLS non-lib hp,pdzdM80_Allocate_Block)
2) ORA-04030: out of process memory when trying to allocate 8148 bytes (kxs-heap-w,qesaQBInit:buffer)
3) ORA-04030: out of process memory when trying to allocate 16408 bytes (session heap,kxsFrame16kPage)
4) ORA-27300: OS system dependent operation:CreateThread failed with status: 8
5) ORA-27301: OS failure message: Not enough storage is available to process this command.
6) ORA-04030: out of process memory when trying to allocate  bytes (,)

Cause :- This may occurs if system is not having the enough memory to handle new jobs. In our case, system lacked the necessary resources to create another process. In Event logs, You can also see that system was unable to begin another thread.

Action :- Please check the virtual memory(Swap Memory) of the OS and set virtual memory to recommended memory or near to the value. You need outage to change this value as you have to  restart the DB server after changing this value.

20.1.17

How to reset the AdminServer Password in WebLogic 11g and 12c


In weblogic server which is very much in use now a days and promoted by oracle in every product. As a DBA its not easy that You forget your weblogic password. But Yes if you want to reset the password follow below easy five steps to reset the password :-


1. Stop the WebLogic server.

  You can stop weblogic sever by using "stopWebLogic.sh" or by killing the process. I recomnd to use "stopWebLogic.sh"

2.Delete directory data from mentioned location .

In Your DOMAIN_HOME, you can find the "data" folder at location servers->adminserver. You can delete or move to other name using mv or rm -rf.
Make sure Weblogic admin server is completly stoped.

3. run weblogic.security.utils.AdminAccount 

"weblogic.security.utils.AdminAccount" will reset the the password  for admin server . go to $DOMAIN_HOME->security
and run below command

$ java weblogic.security.utils.AdminAccount weblogic test .

By default username is weblogic and we setting password to test.

4. Update boot.properties

We have changed the password but we need to update boot.properties file becuase when adminserver will start it will read boot.properties file.
go to $DOMAIN_HOME -> servers ->AdminServer->security  and edit boot.properties with new username test and pssword test.shown below.

username=weblogic
password=test

5. Start the WebLogic domain.

go to $DOMAIN_HOME->bin and run startWebLogic.sh  to start the weblogic.

18.1.17

How to solve Oracle Intelligent Agent Executable encountered

How to solve Oracle Intelligent Agent Executable encountered


We have this error from Oracle 9i, and actually this is not a major issue, So you can avoid it. You may see this if you have changed hostname or IP of the database server.

Oracle Intelligent agent is a service, that is used to communicate between EM (enterprise manager ) and database.And if you are not using EM for databases than you can avoid it. While you have changed the IP or hostname, Oracle was up and running and agent tries shake hands between EM and Database but the communication channel was broken for that particular time. So you have this notification.

So for the solution, you can do one of the following :-

 1) If you are not using EM than You can disable the agent service from services.msc
                            Administrative Tasks>Services
2) Delete all files that end with q under below path and restart the agent on the line (found on internet) :-
                         $ORACLE_HOME/network/agent/ *q

 For me. I used solution 1 because we are not using EM for our databases.


 Keep troubleshooting and keep Sharing :)

16.1.17

Archiving Mode in Oracle Database 12c

How to change Archiving Mode in Oracle Database 12c ? 


This process is same for Oracle database  11g  and Oracle database 12C, . Means you can follow the below steps for 11g and 12C as well.

As we know to change the archiving mode in the 11g we use ALTER DATABASE statement. Same statement we use to change archive mode of your 12C database .

We also know that to do the same, we need to connect to the database with SYSDBA privileges.

Ok, let's change the archive mode. Please follow below steps:-

I have assumed that your DB is in NOARCHIVELOG mode. You can check the status of your database with below command. Please make sure you are connected with SYSDBA privileges.

SQL> conn sys@XXXXXX as sysdba
Enter password:XXXXXX
Connected.

Now you can run "archive log list;" to check your database. Below is output :-

SQL>  archive log list;
XXXXX            No Archive Mode
XXXXX          Disabled
XXXXX            USE_DB_RECOVERY_FILE_DEST
XXXXX     18001
XXXXX          18003

Database log mode showing that database is in No Archive Mode. :)

Please follow the below steps to put your 12C Database in archive log:-

1. Complete Shutdown your database instance. 


We cannot change mode of Database when it is up and running. So we need to stop the database 12c.

SQL> SHUTDOWN IMMEDIATE

The main point is you cannot change ARCHIVELOG to NOARCHIVELOG if any data files need media recovery. This is recomannded by Oracle.


2. Take Backup the database.


Although this step is recomended by Oracle, It is not nessesry. Taking backup before doing any changes to database is good practise. If you are new to Oracle
Please take backup of your database. Take cold backup of your DB i.e. copy everything to diffenet location. Easy but time taking process, again it depends on the size of your database.



3. Startup instance with mount option 

You need to startup the database again in mount mount. No need to open the database yet. BEcause we are going to change somoe parameters in the database.

SQL> STARTUP MOUNT


4. Change archiving mode

Now we can set the archiving mode for our 12C database. After that we need to open the database.

SQL> ALTER DATABASE ARCHIVELOG;

SQL> ALTER DATABASE OPEN;


5. Shut down the database. 

After changing the ARCHIVELOG in oracle database 12c you need to restart the database after taking the cold backup again.

SQL>SHUTDOWN IMMEDIATE


6. Back up the database

Take Cold backup of your oracle database 12c as control file information is also changed fro previous backup. Now you need to use this backup as your BASE backup.



7. Start the database 

After backup, just start the backup
SQL>STARTUP



Now your oracle database 12c is in ARCHIVELOG.

Keep ARCHIVING, Keep Posting :)

ORA-01722: invalid number

Causes for ORA-01722: invalid number?

ORA-01722 ("invalid number") error occurs when we try to convert a character string to a number & that cannot be converted into a valid number. As we know Valid numbers contain the digits '0' through '9'.There are many situations where this will occur with you.Like, Numeric column may be the object of an INSERT or an UPDATE statement. Or may be you have used numeric in part of where clause.Or if there is no numeric columns appear in the mentioned statement.

Examples : - 













How to fix it


You need to check expression which caused the problem for you.For the solution, Always keep in mind that this may be caused by the simple typo with query or in the program logic. In many cases, we found that this occurs due to bad data.

I will update this post again. I have copied this from other blog and after doing the practical, I will update with the solution. I am working on this blog.


Keep sharing :)

What is a Nagios ?

Nagios is open source  monitoring engine and very powerful tool that provides you with instant awareness of your organization’s mission-critical IT infrastructure.
In Other words, Nagios will help you to know about your infrastructure in a very detail way. It  allows you to detect and repair problems and mitigate future issues before they affect end-users and customers. For an example, If you are dealing with the hundreds of servers. And you want ease in life so this is perfect solution for you. It will help you know about your n/w failure or your H/w failure and many more.

Benefits of Nagios:-- 


Plan for infrastructure upgrades before outdated systems cause failures

Respond to issues at the first sign of a problem

Automatically fix problems when they are detected

Coordinate technical team responses

Ensure your organization’s SLAs are being met

Ensure IT infrastructure outages have a minimal effect on your organization’s bottom line

Monitor your entire infrastructure and business processes


How it Works:--


1) Monitoring : IT staff configure Nagios to monitor critical IT infrastructure components, including system metrics, network protocols, applications, services, servers, and network infrastructure.

2) Response : IT staff can acknowledge alerts and begin resolving outages and investigating security alerts immediately. Alerts can be escalated to different groups if alerts are not acknowledged in a timely manner.

3) Maintenance : Scheduled downtime prevents alerts during scheduled maintenance and upgrade windows.

4) Alerting : Nagios sends alerts when critical infrastructure components fail and recover, providing administrators with notice of important events. Alerts can be delivered via email, SMS, or custom script.

5) Reporting : Reports provide a historical record of outages, events, notifications, and alert response for later review. Availability reports help ensure your SLAs are being met.

6)Planning : Trending and capacity planning graphs and reports allow you to identify necessary infrastructure upgrades before failures occur.


Keep Sharing :)

13.1.17

DBA_SCHEDULER_JOB_RUN_DETAILS and PURGE_LOG

How to purge DBA_SCHEDULER_JOB_RUN_DETAILS?


Manually deleting from DBA_SCHEDULER_JOB_RUN_DETAILS is not recommended by oracle.DBA_SCHEDULER_JOB_RUN_DETAILS is a view that is using two master tables (scheduler$_job_run_details and scheduler$_event_log) and display the information about jobs history.

As there is one procedure named PURGE_LOG and Oracle have Scheduler for this procedure. It will purges all rows in the job log that are older than 30 days.This is the default behavior of this procedure. You can change this to any number of days you want by setting the attribute "SET_SCHEDULER_ATTRIBUTE". e.g.

exec DBMS_SCHEDULER.SET_SCHEDULER_ATTRIBUTE('log_history','15');

It will purge all logs older than 15days and it will maintain the history of 15days.

But If you want manually purge these logs, you can use below solution:-

exec DBMS_SCHEDULER.PURGE_LOG(log_history => 15, which_log => 'JOB_LOG');

It will purge all entries from the jog log that are older than fifteen days.

Keep posting :)

12.1.17

How to Change the Date and Time in Linux



It's very simple to change the time of liunx machines. Some times you need to change the time of your oracle database server that is running on Linux.

Just follow the below steps:-
1) type command "date"
 it will show you the current date and time.
2) now type below command:-
    date --set=" Thu Jan 12 15:04:32 HKT 2017 "

It will give you error some times but if you check the date again you will find the value that is changed by you.