Jan 132011
 

Just made a small update to my little namegenerator-service. You can generate more than 1 name and it is possible to use the “random” parameter for country and gender. Choose between xml or csv output (plain text is not available any more).

I added some more names (see the statistics), namegenerator can generate more than 800.000 spanish names.

Oct 042010
 

Yeah! Started a cool little service today – a random name generator. Just checkout namegenerator.juergenbouche.de. This service was written for my Ufo/X-Com like to create names for new soldiers, scientists and engineers, but I will open the service for free to everyone. You can add names, and generate some random real names.

You can use the name generator as a webservice, just look at the syntax.

Have fun creating random names!

PS: The generator will be expanded to provide cool alien names in future.

Aug 162010
 

This is a template of an easy environment script for Oracle Database. Just create it with your favorite texteditor (I’m using vi), make it executable and fit the variables to your needs.

cd /home/oracle
vi mydb.env 

Copy the following lines to the file:

export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=${ORACLE_BASE}/product/11.2.0/dbhome_1
export ORACLE_SID=mydb

export PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/oracle/bin:${ORACLE_HOME}/bin

Make it executable:

chmod 750 mydb.env

And run it as the oracle user:

. mydb.env

Now you can use the “env” command to see the changes in your linux environment.

Aug 132010
 

With nls_length_semantics set to BYTE (default), Oracle reservers a fix number of bytes for the column. 10 means 10 Byte, so the column can store 10 1Byte-Characters but only 5 2Byte-Characters. That means that the maximum length of the column dependents on the text you like to insert. If you choose to use CHAR instead of BYTE, Oracle reserves enough bytes to store at least the amount of characters you like as your column maximum.

Set the default semantic to CHAR:

ALTER SYSTEM SET nls_length_semantics='CHAR' SCOPE=both;

Change all VARCHAR2 BYTE columns of a schema to VARCHAR2 CHAR columns:

SELECT 'ALTER TABLE ' || owner || '.' || table_name || ' MODIFY ("' ||  column_name || '" VARCHAR2(' || DATA_LENGTH || ' CHAR));' FROM dba_tab_columns  WHERE owner='<schema>' AND data_type='VARCHAR2' AND char_used!='C';
Aug 122010
 

Apex 4.0 showing some real problems when working with tables over a database link. Apex is just unable to get the table columns in the wizards and much more because it is adding the wrong table owner via a PL/SQL function. We tried using synonyms but this also won’t work. The solution is easy but you have to put a little extra afford into it. Just create a view of the remote table by using:

CREATE VIEW myremotetable AS SELECT * FROM myremotetable@remotedatabase.world.com

Don’t forget to refresh the views if you update the remote table!

Aug 112010
 

Connect via SQLPLUS as sys.

To create a SPFILE from a PFILE use the following command:

CREATE SPFILE='/path_to_my_spfile/spfilemydb.ora' FROM  PFILE='/path_to_my_pfile/initmydb.ora';

You can also create a PFILE from your SPFILE:

CREATE PFILE='/path_to_my_pfile/initmydb.ora' FROM  SPFILE='/path_to_my_spfile/spfilemydb.ora';

More cool commands about PFILE’s and SPFILE’s can be found on psoug.org: http://psoug.org/reference/init_dot_ora.html

Aug 042010
 

A small script for taking cold backups of an Oracle Database with RMAN. You have to shutdown your database before running this script. You can use “shutdown immediate” for Single Instances or “srvctl stop database -d mydb” for RAC environments. After the script finished execution the database must be started.

#!/bin/bash

rman target /<<RMAN01
startup mount;
CONFIGURE RETENTION POLICY TO REDUNDANCY 7;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/opt/backup/%d/%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO COMPRESSED BACKUPSET;
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/opt/backup/%d/%T_%d_%s_%U.bak';
crosscheck archivelog all;
crosscheck backupset;
delete noprompt obsolete;
backup as compressed backupset database plus archivelog delete all input;
shutdown immediate;
exit;
RMAN01

CONFIGURE RETENTION POLICY TO REDUNDANCY 7;
There will be at least 7 newer backups before the backup gets obsolete.

CONFIGURE CONTROLFILE AUTOBACKUP ON;
Autobackup Controlfile.

CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO ‘/opt/backup/%d/%F’;
Path and filenameformat for the controlfile.

CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO COMPRESSED BACKUPSET;
Compress the backup.

CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT ‘/opt/backup/%d/%T_%d_%s_%U.bak’;
Path and filenameformat for the backupfile.

Jul 242010
 

Get all invalid objects:

SELECT * FROM dba_objects WHERE status<>'VALID';

Generate a script to compile invalid objects:

SELECT 'ALTER ' || object_type || ' ' || owner || '."' || object_name || '" COMPILE;' AS "INVALID OBJECTS"
 FROM dba_objects
WHERE status<>'VALID'
AND object_type NOT IN ('PACKAGE BODY','TYPE BODY','UNDEFINED','JAVA CLASS','SYNONYM')
UNION
SELECT 'ALTER PACKAGE ' || owner || '.' || object_name || ' COMPILE BODY;'
 FROM dba_objects
WHERE status<>'VALID'
AND object_type='PACKAGE BODY'
UNION
SELECT 'ALTER TYPE ' || owner || '.' || object_name || ' COMPILE BODY;'
FROM dba_objects
 WHERE status<>'VALID'
AND object_type='TYPE BODY'
UNION
SELECT 'ALTER MATERIALIZED VIEW ' || owner || '.' || object_name || ' COMPILE;'
FROM dba_objects
WHERE status<>'VALID'
 AND object_type='UNDEFINED'
UNION
SELECT 'ALTER JAVA CLASS ' || owner || '."' || object_name || '" RESOLVE;'
FROM dba_objects
WHERE status<>'VALID'
AND object_type='JAVA CLASS'
 UNION
SELECT 'ALTER SYNONYM ' || owner || '.' || object_name || ' COMPILE;'
FROM dba_objects
WHERE status<>'VALID'
AND object_type='SYNONYM'
AND owner<>'PUBLIC'
 UNION
SELECT 'ALTER PUBLIC SYNONYM ' || object_name || ' COMPILE;'
FROM dba_objects
WHERE status<>'VALID'
AND object_type='SYNONYM'
AND owner='PUBLIC';
Jul 222010
 

Switch to your network configuration scripts

cd /etc/sysconfig/network-scripts/

Create the bond file.

vi ifcfg-bond0
# bond0 (eth0,eth1) - Public
DEVICE=bond0
BOOTPROTO=dhcp
IPV6INIT=yes
IPV6_AUTOCONF=yes
ONBOOT=yes
DHCP_HOSTNAME=myhost.myworld.com
TYPE=Ethernet
PEERDNS=yes
USERCTL=no

Configure your Interfaces to use the bond device as master

vi ifcfg-eth0
# Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
vi ifcfg-eth1
# Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet
DEVICE=eth1
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
vi /etc/modprobe.conf
alias bond0 bonding

You can now bond as many devices as you wish to get a better network overall performance.
More about bonding and network configuration can be found at http://www.linuxtopia.org/online_books/rhel5/rhel5_administration/rhel5_s1-networkscripts-interfaces.html#s2-networkscripts-interfaces-chan.