Tuesday, July 31, 2012

Real men

Real men cook meat wrapped in another type of meat. This is fillet of beef wrapped in bacon.
It was oh so delicious.


Tuesday, July 24, 2012

Meet Nokia - Catching the red mouse

I have been playing around with my GoPro some more. Even though filming a slow motion video is fun and all, I don't know if it is worth the loss in quality.
Take this video for example. The first half of it is filmed at 1080p in 30fps. The second part is in 120fps but my camera only does that it 480p. I even think it looses not only resolution but quality too. 

She is crazy though, the cat. Love it.


Monday, July 23, 2012

Bearscape artist!

First off: I know "Bearscape" isn't a work, but it should be. I would be a great word.

I was at Skansen Zoo in Stockholm Sweden and filming one of thier brown bears doing bear things. What made it mildly funny was the tourist beside me talking to his friend about what the bear did.



Friday, July 20, 2012

nananananananan BATMAN!

When I stare at a performance chart in Oracle Grid Control I sometime see patterns. For example, when i see two spikes a minute a part I like to call "I see the devil in the charts". Because it look like devil horns sticking up:


But as today was the premier of the movie The Dark Knight Rises I am thinking its not the devil in the chart, it has to be Batman himself:

Thursday, July 19, 2012

ORA-00439: feature not enabled: Deferred Segment Creation on datapump import

Short version:
If you get this error on a data pump import:
ORA-39083: Object type TABLE:"SCOTT"."EMP" failed to create with error:
ORA-00439: feature not enabled: Deferred Segment Creation

then add "version=10.2" or "version=11.1" depending on your version of database. This will make IMPDP ignore the "Deferred Segment Creation" feature in 11.2 that causes this issue.

IMPDP system/password DIRECTORY=data_pump_dir DUMPFILE=emp.dmp schemas=emp version=10.2


Long version:
In Oracle version 11.2 there was a new feature called "Deferred Segment Creation". It is a space saver for tables that has no rows since the segments for the table will not be created until the tables actually has rows in it. You can create tables with storage parameters so it will use this feature.
CREATE TABLE emp 
            (emp_id NUMBER, 
             name VARCHAR2(4000)) 
SEGMENT CREATION DEFERRED;


The default way to handle segment creation looks like this:
CREATE TABLE emp 
            (emp_id NUMBER, 
             name VARCHAR2(4000)) 
SEGMENT CREATION IMMEDIATE;  


Default, after 11.2, this feature is turned on with the parameter DEFERRED_SEGMENT_CREATION set too TRUE.

This can cause problems with datapump and might cause this error on import:
ORA-39083: Object type TABLE:"SCOTT"."EMP" failed to create with error:
ORA-00439: feature not enabled: Deferred Segment Creation

This is because the database that is imported to does not have this feature, say like Oracle 10.2 or 11.1. Exactly what the error says.

This is why I was baffled when I got this error whn I exported data from a 11.2.0.1 database into another 11.2.0.1 database. Both databases had DEFERRED_SEGMENT_CREATION set to TRUE. So both should have that feature? Right?
Apparently not, since I got the error.
The only difference was that source database was Enterprise Edition and target database was Standard Edition. This was the cause of the it all even though I can't find any information about this feature being EE only. But it probably is.

Solution:
The solution, or work around, for this it is to force the tables that uses this feature to be created, with IMPDP, without this feature. This is done by adding "version=10.2" or a version lower than 11.2 to your IMP command. In my case it was enough to add "version=11.1" to my import command line:

IMPDP system/password DIRECTORY=data_pump_dir DUMPFILE=emp.dmp schemas=emp version=11.1

This will "fix" this in the sense that the import will work but it will change the property of the table. But if you are importing to a database without this feature you don't really have any choice in the matter.

Wednesday, July 18, 2012

Getting in shape with GSP

I have always joked "Round is also a shape" when ever I talked about getting in shape. But now when I have passed 30 year old and I sit in front of the computer at work all day and don't move much in the evening either, I realize I have to do something to prevent getting the belly my older family members have. I'm not a heavy guy (190cm/6'3" and at the moment 90kg/200lbs) nor do I want to be a heavy guy.

When I was young I played a lot of sports, but stopped before finished school.
In my adult life I have done some half-ass attempts of getting in shape. I owned gym memberships, been out running, played badminton and baseball. But never done anything more then once a week and that don't really make that much difference.

My friend and colleague is much better than me keeping in shape, has more motivation and practise. He has many times tried to motive me, both on his own accord and when I tell him to motivate me. Motivation with different competitions and rewards. Never did anything REALLY motivate me, maybe that's why I never stuck to anything.

The latest thing my friend recommended me was to try is Georges St-Pierre RUSHFIT, a training program with a MMA fighter and made by his trainer Erik Owings. I started it and it is kind of a chock to my routine.
From doing something once a week to following a program six days a week, for eight weeks.

"Fuck no! My lazy ass will never stick with this. I wouldn't be surprised if I quit before the first week is over." is what I said to my friend.

I just finished my THIRD week. This is unprecedented for me. I have never stuck with any training program this long, and I have no intention to quit any time soon. I don't know what it is about the GSP RUSHFIT that fit me so well, but it does.

It might be Erik Owings, the trainer, that make the program so good for me. He says time and again that "It is okay if you need to rest", "It is okay if you do this easier version of this exercise". This really works for me. It gets a bit repetitive but for me it is GOLD. I don't respond well to the "drill sergeant" type of motivation, but a "go at your own pace and do your best" type of motivating works.

About the actual program with the schedule and the exercises and all that I don't know if it is good or not since I have no frame of reference. It works for me because I can do it without any hassle at home with only a simple pair of dumbbells and a soft exercise mat.

I give it a 10/10 for ME. It might not be as good for you so take that rating with a grain of salt.

I had no before-picture taken and wont have after-pictures taken. I am doing it to FEEL better rather than look better. If I FEEL stronger, less tired and more healthy, then I have reached my goal. So far that is the case so I will stick with it for all of the eight weeks.

Tuesday, July 17, 2012

Forgot a few joins

So I wrote a SQL today. It was a rather big one, a few hundred rows big with sub-selects upon sub-selects.
Like I always do I checked the execution plan before running it.
I guess I missed a few joins because I got a rather big cost and some cartesian joins :)
A cost of 5,128,713,457 and the biggest table I queried only had 145 rows in it :)


Needless to say I fixed it and it runs just fine now with <10 in cost.

Size of schemas

Have you ever said to yourself: "Hey Mr. DBA, how big are the schemas in my database?"
I have, a lot. Especially in my test and development environments.

This very simple, and not super accurate, script shows you the size or your schemas in Megabytes ordered by biggest to smallest:
select  
      owner,
      (sum(bytes)/1024/1024) mb_size
from
      dba_segments
group by
      owner
order by
      2 desc;

Monday, July 16, 2012

Shrink data files in Oracle

Oracle is smart and stupid at the same time. Maybe it only smart and it is I that is stupid, but that is not the point.
Oracle has a wonderful function that can auto extend your data files when it need to, when data is growing in your database. Oracle is stupid don't have a built is function to shrink those files once the data is removed and the space is no longer needed. Some may argue that it is smart that oracle has that space allocated for future use. That might be true but I want more function.

I found a script i frequanlty use too shrink my data files on test and development environments:
This will produce a list of command to shrink data files as much as it can without defragging or reorganization the data. It looks for the data block with the highest block_id that contains data and calculates how much space after that block can be removed.

select
  'ALTER DATABASE DATAFILE ''' ||
  file_name ||
  ''' RESIZE ' ||
  ceil ( (nvl (hwm, 1) * 8192) / 1024 / 1024)  ||
  'M;' shrink_datafiles
from
  dba_data_files dbadf,
  (    
    select
      file_id, max (block_id + blocks - 1) hwm
    from
      dba_extents
    group by
      file_id
  )
  dbafs
where  dbadf.file_id = dbafs.file_id(+)
and ceil (blocks * 8192 / 1024 / 1024) - ceil ( (nvl (hwm, 1) * 8192) / 1024 / 1024) > 0;
/



The list look something like this:

SHRINK_DATAFILES
------------------------------------------------------------
ALTER DATABASE DATAFILE 'D:\ORACLE\ORADATA\APXML1PR\SYSTEM01.DBF' RESIZE 742M; 
ALTER DATABASE DATAFILE 'D:\ORACLE\ORADATA\APXML1PR\SYSAUX01.DBF' RESIZE 898M; 
ALTER DATABASE DATAFILE 'D:\ORACLE\ORADATA\APXML1PR\USERS01.DBF' RESIZE 39M; 
ALTER DATABASE DATAFILE 'D:\ORACLE\ORADATA\APXML1PR\UNDOTBS01.DBF' RESIZE 10401M; 
ALTER DATABASE DATAFILE 'D:\ORACLE\ORADATA\APXML1PR\APEX01.DBF' RESIZE 198M; 

Playing around with my GoPro - Meet Nokia Part 2

Part 2 is the cat, Nokia (not the phone), leaping out of light and out of frame.
Filmed @ 120fps and slow down to 12fps (I think) with a bit of motion blur to make it more smooth.


Playing around with my GoPro - Meet Nokia Part 1


So I bought a GoPro Hero 2 camera last year for when I go skiing. Now in the off season I started to play around with it at home as well. It has a mode that can film with 120 frames per second @ 480p resolution. 
My cat got to be the model for this try. 
Half of the reason i did this was also to educate myself in the art of video editing.
This is filmed @ 120fps ans slowed down to 24fps.