Sunday, May 27, 2012

Finding objects in Oracle via user_objects

When working with Oracle databases in within a large company with multiple customers (departments or external customers) you will also be faced with the situation that not all databases are alike. Some databases will have a strict datamodel and a strict documentation policy. From those databases you will know exactly what is in the datamodel and you will be able to find all documentation of it. This is normally the case with all production databases and the associated D(evelopment), T(est) and A(cceptance) environments. However when it comes to the "play" environments and the environments used for research and development you are not always that lucky. Specially when you are looking into a database which is used by multiple developers to work on small coding projects and using it to learn new tricks of the trade.

In those cases it is not uncommon that you have to reverse engineer some parts of the code and from time to time find lost objects. Someone stating something like "yes I have stored that in a table a year ago and called in something like HELP" is not uncommon. In those cases you will have to start looking for the object and to do so your best friend is the USER_OBJECT table in the Oracle database.

The USER_OBJECT table holds information on all the objects available tot the users. This will help you finding the table you are looking for. Some people like to directly use CAT and do something like;

This however will only give you the table name (HELP) and the table_type (TABLE). Secondly you will have limited options to search. You can imagine that the person stating that the table name was HELP might have some mistaken as it is more than a year ago he created it. It might very well be that the table name is USERHELP and it might also very well be that a lot of objects have the "HELP" in their name. I do personally think that using USER_OBJECTS gives you just that extra power above CAT to find the correct object quickly.

Below you see a describe of the USER_OBJECTS table:
Name           Null Type          
-------------- ---- ------------- 
OBJECT_NAME         VARCHAR2(128) 
OBJECT_ID           NUMBER        
OBJECT_TYPE         VARCHAR2(19)  
CREATED             DATE          
LAST_DDL_TIME       DATE          
TIMESTAMP           VARCHAR2(19)  
STATUS              VARCHAR2(7)   
TEMPORARY           VARCHAR2(1)   
GENERATED           VARCHAR2(1)   
SECONDARY           VARCHAR2(1)   
NAMESPACE           NUMBER        
it might be wise to give the USER_OBJECTS table a good look and play arround with it some more to understand it correctly. For example it will be able to show you all the objects and it is not limited to tables only for example.
you can find out what kind of objects are used within the database by executing the below query. This will give you a list of used user_objects.

back to question of the "HELP" table. You know for example that you are looking for a table so you can filter on object_type to only show you the table objects. Secondly you know that it most likely has "HELP" in the name so you can filter for all objects having "HELP" as part of the object_name and secondly you know it is created 11 or more months ago so you can use this as a filer on the created date field. As you can see, it gives you just a little more options then using the CAT option in your Oracle database.

Wednesday, May 23, 2012

Children will be the early adopters of 3D printing

Supermarkets are currently using children and the gathering behavior of humans to lure customers into their shops. By giving a collectable by every $20 of groceries to the customer for the children to collect they create an emotional buy-in. Children collect them, the swop them at school and you are not considered cool and part of the “inner crowd” when you cannot share in the fun of collecting and swapping. Parents always do want their children to fit in and for this reason they might even change their normal supermarket for another when their children are begging them for the latest collectable toys they get for free.

Looking at the way 3D printing is going we might see in the near future very affordable 3D printers. You can feed your 3D printer with a model and it will print it for you. If we combine this trend with the toys children get we will see in the near future that children will not get the toy itself however will get a QR code corresponding with a one-time print job for a 3D printer. Once scanned the model will be downloaded via a one-time download link and printed directly. After that the QR code will become invalid.

The impact of not giving away toys but giving away the model will make supermarkets and other vendors a whole new business model. It will also enable supermarkets adopt more and more this strategy because the only investment will be a downloadable 3D model and a QR code printed to a small coupon. The production and shipping of the toys is no longer on the costs of the supermarket but rather on the parents who will bring the QR code to their children and who will have to pay for the raw material for the 3D printer.

As soon as 3D printing becomes only a little bit more mainstream we will see that companies will adopt this and by doing so promote the purchase of 3D printing. Even though 3D printing is promising it is currently in its first stages of developing. However we will see this picked up in the coming years and not only merchandise will be printed, within the near future the business model of the “make industry” will change and we will see a lot more products which you can download from the net and print it yourself.

While this is considered a good deal for some it will also have its impact on other parts of the market and the industry. The make industry will notice this at first in the products which are produced cheaply in low price countries. The merchandise industry and the low end consumer products will see a shift of making them somewhere in China to downloading and printing it themselves. This has not only an impact on the production part of the chain but also on the logistical part of the chain as the products no longer need to be shipped.

This is something that will reshape the make industry and where we will see a lot of chains in currently standard ways of doing business. However, the road to adoption is via children and the merchandise from supermarkets.

Friday, May 18, 2012

Oracle NoSQL configuration

The Oracle NoSQL database is a very simple to deploy NoSQL key-value store which requires almost no setup. However keep in mind the almost part. There are some things that you have to configure. You can configure this via the commandline or by deploying it with a correct config.xml file. If you have not configured the NoSQL database and/or did not deploy a correct config.xml file you will end up with an error message like the one below. What you can see in this error message is that we are trying to start the NoSQL KVstore and that it is looking for the config.xml file however is unable to locate it.

05-05-12 12:20:16:09 CEST INFO [snaService] Starting, configuration file: /home/nosql/kv-1.2.123/config.xml
05-05-12 12:20:16:42 CEST SEVERE [snaService] Failed to start SNA: IOException parsing file: /home/nosql/kv-1.2.123/config.xml: /home/nosql/kv-1.2.123/config.xml (No such file or directory)
java.lang.IllegalStateException: IOException parsing file: /home/nosql/kv-1.2.123/config.xml: /home/nosql/kv-1.2.123/config.xml (No such file or directory)
    at oracle.kv.impl.param.LoadParameters.load(
    at oracle.kv.impl.param.LoadParameters.getParameters(
    at oracle.kv.impl.util.ConfigUtils.getBootstrapParams(
    at oracle.kv.impl.sna.StorageNodeAgent.start(
    at oracle.kv.impl.sna.StorageNodeAgentImpl.main(
    at oracle.kv.impl.util.KVStoreMain$
    at oracle.kv.impl.util.KVStoreMain.main(

This means that the issue can be resolved quite easy by deploying a config.xml file. You can create one and deploy it by using something like VI. The file should look like the one below:

<config version="1">
<component name="bootstrapParams" type="bootstrapParams">
<property name="hostingAdmin" value="false" type="BOOLEAN"/>
<property name="adminHttpPort" value="5001" type="INT"/>
<property name="storageNodeId" value="0" type="INT"/>
<property name="hostname" value="" type="STRING"/>
<property name="registryPort" value="5000" type="INT"/>
<property name="haPortRange" value="5010,5020" type="STRING"/>

if you are not that comfortable with building your own config.xml you can use the makebootconfig command to build the xml file for you as shown in the example below:

java -jar ./lib/kvstore-1.2.123.jar makebootconfig -root /home/nosql/kv-1.2.123/ -port 5000 -admin 5001 -host -harange 5010,5020