Archives For March 2013

... still waiting
Advertisements

today I quickly wanted a visual representation of an oracle schema and remembered that oracle provides sql developer data modeler which will do this for me. headed over to the download page, wanted to download … ups, only a rpm available for linux.

but, there is alien and this makes the conversion from a rpm to a deb package straightforward and easy:

$sudo apt-get install alien
$sudo alien datamodeler-3.3.0.744-1.noarch.rpm
  Warning: Skipping conversion of scripts in package datamodeler: postinst
  Warning: Use the --scripts parameter to include the scripts.
  datamodeler_3.3.0.744-2_all.deb generated

done. installed:

$sudo dpkg -i datamodeler_3.3.0.744-2_all.deb
  Selecting previously unselected package datamodeler.
  (Reading database ... 150737 files and directories currently installed.)
  Unpacking datamodeler (from datamodeler_3.3.0.744-2_all.deb) ...
  Setting up datamodeler (3.3.0.744-2) ...

ready to use:

$which datamodeler
/usr/local/bin/datamodeler
$ datamodeler 

Oracle SQL Developer Data Modeler
 Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 

data modeler

some time ago I blogged about the managed tablespace privilege and pointed out that there is either a software or documentation bug as this privilege also allows renaming tablespaces. according to oracle support this is a documentation issue and not a software bug. additionally these operations are allowed, too, if you grant the privilege:

alter tablespace nologging;
alter tablespace logging;
alter tablespace force logging;
alter tablespace no force logging;

just a little hint that there is another option than top, which is htop. pre-compiled packages are available for the most distributions.

htop.sourceforge.net/htop-1.0.2-io.png

check htop’s sourceforge page for a tiny comparison between htop and top.

(still) waiting for spring

if you want to play with the latest postgresql development snapshot here is a very simple makefile which does the work for you ( given that you have installed all the dependencies required for building postgresql ):

PGBASEVER=9.3
PG=http://ftp.postgresql.org/pub/snapshot/dev/postgresql-snapshot.tar.bz2
PGFILE=postgresql-snapshot.tar.bz2
CURRDIR=$(shell pwd)
DATADIR=$(CURRDIR)/data

fromscratch: reset download buildpg initdb startdb

reset: stopdb
        rm -rf build
        rm -rf install
        rm -rf data
        mkdir build
        mkdir install
        mkdir data

download:
        wget ${PG}
        mv ${PGFILE} build/

buildpg:
        ( cd build && tar -axf ${PGFILE} )
        ( cd build/postgresql-${PGBASEVER}* && ./configure --prefix=${CURRDIR}/install )
        ( cd build/postgresql-${PGBASEVER}* && make )
        ( cd build/postgresql-${PGBASEVER}* && make check )
        ( cd build/postgresql-${PGBASEVER}* && make install )

initdb:
        ( cd install/bin && ./initdb -D ${DATADIR} )

startdb:
        ( install/bin/pg_ctl -D ${DATADIR} start ) 

stopdb:
        if [ -f ${DATADIR}/postmaster.pid ]; then \
                ( install/bin/pg_ctl -D ${DATADIR} stop -m fast ) \
        fi

copy this to a directory where you are the owner of, name the file “Makefile” and execute:

make fromscratch

this will create the directories, download the latest snapshot, compile the source and start the postgresql database ( this takes 4 minutes on my mint workstation ). once the script finished you may connect to the database and start playing:

install/bin/psql postgres
psql (9.3devel)
Type "help" for help.

postgres=# \h create materialized view
Command:     CREATE MATERIALIZED VIEW
Description: define a new materialized view
Syntax:
CREATE [ UNLOGGED ] MATERIALIZED VIEW table_name
    [ (column_name [, ...] ) ]
    [ WITH ( storage_parameter [= value] [, ... ] ) ]
    [ TABLESPACE tablespace_name ]
    AS query
    [ WITH [ NO ] DATA ]

postgres=# 

of course you may put this in a shell script, too. but this way it was more fun :)

some day