SQL*Plus not showing headings

On one database, I noticed that SQL*Plus did not show the heading of the columns when I ran a query. The result was this:

SQL> select instance_name,status from v$instance;
mydb          OPEN

Even when entering “set heading on” didn’t change anything. I then investigated and found out that someone had changed the $ORACLE_HOME/sqlplus/admin/glogin.sql file (SQL*Plus runs this file on startup) and added the following lines:

SET LINESIZE 150
SET PAGESIZE 0

While this is quite nice and replaced the suboptimal default values, this was the cause for my problems mentioned above. Changing the line “SET PAGESIZE 0” to “SET PAGESIZE 1000” solved the problem and now, the query shows up the way I wanted:

SQL> select instance_name,status from v$instance;

INSTANCE_NAME    STATUS
---------------- ------------
mydb             OPEN

MySQL: Return random row

For habere.ch, we launched a contest where we award a restaurant voucher to a random person that wrote a review of a restaurant on our site. For this, we will be using the following query:

SELECT DISTINCT comment_author,comment_author_email
FROM wp_comments
ORDER BY RAND()
LIMIT 1;

What this query does is, that it selects all distinct rows, orders them randomly and shows the first entry of this selection.

Note that this query is relatively slow and should not be used in a program. When you use EXPLAIN on this query, MySQL will explain to you that it will create a temporary table and run a sort. Then only one entry is returned. But when you just use it once to determine a winner, this will work just fine!

BASH: Wait for log entry

For a startup script, I needed to start JBoss and start another component as soon as the complete JBoss server was started. When you execute the “run.sh” script that comes with JBoss, it immediately exits and starts JBoss in the background (which is quite nice I think). Unfortunately, when I started the other component using this method, the additional program was unhappy, since JBoss was not ready yet. So I had to come up with a trick to delay the start of the additional program.

So with the help of the internet and my co-worker, we came up with the following script:

Read the rest of this entry

CAE Exams

I am pleased to report that I passed the Cambridge Certificate in Advanced English with the Grade “A”. Of course I am very pleased with the results and Cambridge states that:

Grade A, which demonstrates an ability at Council of Europe Level C2

Result of the CAE Exams

Nonetheless, I hope to improve my language skills even further and hopefully get more proficient with the English language. But of course, this certificate is also a good way to show my proficiency in English to any employer that might come along…

BASH Setup in Solaris 10

Coming from Linux distributions where BASH is usually already set up and configured, I had to find my way around in a UNIX environment first. So here I present the files necessary for a proper installation of BASH under Solaris 10 (yes, I know Solaris 11 Express is out :)).

So after installing the BASH package (see my other post on setting up Solaris), you might find your new shell to be kinda boring. Also, it simply shows up as bash-3.00#, which by itself does not tell you a lot. So lets improve it a bit.

Read the rest of this entry

New Instance or New Schema?

So when it comes to deploying a new application there is always the question if you should create a new instance on the database server or use the existing instance and just add a new schema? These both are valid options, but lets have a look at both options.

Lets assume you already have one instance running one application, now you need to provide a new database to a user. So depending on the application, you have the choice of creating a new instance for this specific new application or to use an existing database instance and just creating a new schema.

Read the rest of this entry

11g Silent Installation Error

Last week I had to perform an installation of Oracle 11g on a Windows Server 2008 R2 machine. When I tried to install a 11g database with the -silent and -responsefile options, I received the following error:

[SEVERE] - Email Address Not Specified

Obviously, I needed to specify an e-mail address for My Oracle Support. Lets have a look in the responsefile:

Read the rest of this entry

MySQL: Import from CSV

Today I had to import some data from a CSV file into a table on a MySQL server.
So here is how to do it:

LOAD DATA LOCAL INFILE '/importfile.csv' 
INTO TABLE test_table 
FIELDS TERMINATED BY ',' 
LINES TERMINATED BY '\n' 
(field1, filed2, field3);

Source

Of course, you will need to have access to the machine where the database is running. As an alternative, I am sure there are developer tools that can enter the data remotely.

NMAP through VPN

When I tried to run a scan with NMAP over my VPN connection, I received the following error:

PS C:\> nmap -sP 192.168.10.0/24
Starting Nmap 5.21 ( http://nmap.org ) at 2010-11-18 09:35 W. Europe Standard Time
nexthost: Failed to determine dst MAC address for target 192.168.10.0
QUITTING!

Alright… A quick search with Google revealed the following topic: http://seclists.org/nmap-dev/2008/q1/81.

Read the rest of this entry

RAID-Z vs. Hardware RAID 5

Out of curiosity, I decided to run the IOzone tests I performed with a RAID 10 (see this post) on a RAID-Z and compare it to the RAID 5 of the hardware RAID controller. For this test, I am using IOzone and two older HP DL380 G2 servers.

Read the rest of this entry

Hello world

My name is Simon Krenger, I am a Technical Account Manager (TAM) at Red Hat. I advise our customers in using Kubernetes, Containers, Linux and Open Source.

Elsewhere

  1. GitHub
  2. LinkedIn
  3. GitLab