ORA-01445: cannot select ROWID from, or sample, a join view without a key-preserved table

April 18, 2013 Leave a comment

One of our developers has problems with a select of different tables:


SELECT ROWID,
 TMP_TABLE_ALIAS.*
FROM
 (select a.*,
 B.*,
 (SELECT MAX(TMP_CODEMP)
 FROM ATE_TABLE
 WHERE TMP_IDTRE = TRE_ID
 and TMP_FI is null
 ) AS TRE_CODEMP,
 (SELECT MAX(REV_DATA) FROM AR_TABLE WHERE REV_ID = TRE_ID
 ) AS TRE_DATREV
 FROM AT_TABLE a,
 AP_TABLE B
 WHERE PER_ID = TRE_ID (+)
 ) TMP_TABLE_ALIAS;

This statement works on the development environment, but in the production environment it fails with:


ORA-01445: cannot select ROWID from, or sample, a join view without a key-preserved table 01445

The database versions is the same in both environments: Oracle 10g Release 2 (10.2.0.5).

After reviewing the tables in the production environment, I noticed that one of the tables has no primary key, and that caused the ORA-01445. Even with a unique index the select fails, it’s mandatory to declare primary keys for the tables when they are involved in joins.

Compress a folder with tar

February 15, 2013 1 comment

To archive and compress a folder with tar use this command:


$ tar -czvf folder.tar.gz folder

Be careful with the parameters order: tar -czvf is not the same as tar -cvfz. The fist one is ok, but the second one ends with an error:

$ tar -cvfz folder.tar.gz folder
tar: folder.tar.gz: Cannot stat: No such file or directory
folder/
folder/file1.txt
folder/file2.txt
folder/file3.txt
tar: Exiting with failure status due to previous errors

An ls will show a z file. The reason is that the -f parameter takes the next argument as the filename to archive, thus the z file in our folder. So you have to use the tar -czvf syntax.

Categories: linux Tags: , ,

Oracle 11g Release 2: ORA-00119: invalid specification for system parameter LOCAL_LISTENER

February 13, 2013 Leave a comment

I’ve recently installed an Oracle 11g Release 2 database (11.2.0.3) and when I bounce the database (using the shutdown and startup commands), the database is unable to start:


SQL> startup
ORA-00119: invalid specification for system parameter LOCAL_LISTENER
ORA-00132: syntax error or unresolved network name 'LISTENER_LAB11'

This is due to the lack of a LOCAL_LISTENER, that must be defined in the TNSNAMES.ORA, according to the Oracle Database Reference 11gR2:

LOCAL_LISTENER specifies a network name that resolves to an address or address list of Oracle Net local listeners (that is, listeners that are running on the same machine as this instance). The address or address list is specified in the TNSNAMES.ORA file or other address repository as configured for your system.

So, in your TNSNAMES.ORA (not in LISTENER.ORA) you must define this entry for the local listener:


LISTENER_LAB11.WORLD =
 (ADDRESS = (PROTOCOL = TCP)(HOST = toralin1)(PORT = 1523))

And now you can startup the database. Be sure to set the .WORLD if you have the parameter names.default_domain set at sqlnet.ora.

You can learn more about the LOCAL_LISTENER in this excellent post of Ed Stevens: Exploring the LOCAL_LISTENER parameter

Install less on Ubuntu with YUI-compressor

February 9, 2013 Leave a comment

Some days ago I’ve been testing twitter bootstrap and I’m very interested on using less on my projects.

Less brings programming into CSS files. Learn more about less in the less website.

To compile the .less files in Ubuntu, first install the requiered packages [please refer to the updated note at the end of the post]:

$ sudo apt-get install lessc

Now you can create your first less file:

@color: #4D926F;

#header {
  color: @color;
}
h2 {
  color: @color;
}

and compile it:


$ lessc my_first_less_file.less

#header {
 color: #4d926f;
}
h2 {
 color: #4d926f;
}

You can redirect the standard otuput to a file to get the css file:

$ lessc my_first_less_file.less > my_first_less_file.css

To output the minified CSS, just add the -x option:

$ lessc -x my_first_less_file.less
#header{color:#4d926f;}
h2{color:#4d926f;}

You can also use the YUI Compressor with less:


$ lessc --yui-compress my_first_less_file.less
#header {
 color: #4d926f;
}
h2 {
 color: #4d926f;
}

Yep! Something’s wrong… Is there an error with less –yui-compress?

I think there’s a problem with the –yui-compress option.

To workaround this, I’ve installed yui-compressor:


$ sudo apt-get install yui-compressor

<em id="__mceDel">

Now, I generate  the css with lessc and then compress it with YUI:


$ lessc --yui-compress my_first_less_file.less > my_first_less_file.css

$ yui-compressor my_first_less_file.css

#header{color:#4d926f}h2{color:#4d926f}

I will do further investigation about the less –yui-compress fail.

Updated!

I’ve installed the incorrect version of less, and the –yui-compress was not working:

I previously installed this packages:

<pre>$ sudo apt-get install libc-ares2 libev4  libnode-less libv8-3.1.8.22 nodejs

But this installs an old version of less:


$ lessc --version
lessc 1.1.0 (LESS Compiler) [JavaScript]

$ sudo apt-get remove lessc --purge

$ sudo apt-get install lessc

$ lessc --version
lessc 1.3.3 (LESS Compiler) [JavaScript]

Now I can compile with –yui-compress working!

Subversion: svn add recursive

January 17, 2013 Leave a comment

The subversion svn add command does not support the recursive option to add several unversioned files.

But you can use this trick from your working copy:


$ svn add --force *

Categories: subversion Tags: , ,

Splitting files with 7zip without compression

January 11, 2013 Leave a comment

I have to copy a large (12GB) file to an external USB Drive that’s formatted in FAT32, which is limited to a maximum of 4GB per file.

I can split the files with the split command, but the owner of the disk has Windows, so I decided to generate a multipart 7zipped file from command line. As the original file is already compressed, I use no compression switch:


$ 7z -a <filename> -mx0 -v4000m <file_to_be_compressed>

The switches stands for:

  • -mx0: level of compression, where 0 means copy mode, i.e., no compression (usr/share/doc/p7zip-full/DOCS/MANUAL/switches/method.htm)
  • -v4000m: create volume size of 4000 MB (/usr/share/doc/p7zip-full/DOCS/MANUAL/switches/volume.htm)

If you use -v4g to generate 4GB chunks, this 4GB will be grater than the FAT32 4GB, and it will be impossible to copy to the FAT32 USB drive .

Once completed, you’ll have several files deppending on the size of the file to compress, named  filename.7z.001, filename.7z.002, …

Categories: ubuntu Tags: , , , ,

2012 in review

January 2, 2013 1 comment

The WordPress.com stats helper monkeys prepared a 2012 annual report for this blog.

Here’s an excerpt:

19,000 people fit into the new Barclays Center to see Jay-Z perform. This blog was viewed about 93.000 times in 2012. If it were a concert at the Barclays Center, it would take about 5 sold-out performances for that many people to see it.

Click here to see the complete report.

Categories: wordpress
Follow

Get every new post delivered to your Inbox.