Wednesday, December 07, 2005

Configure Subversion server

It's surprisingly easy to configure Subversion server using SSH authentication. Actually, as long as SSH is in place, you don't need to set up anything extra to get the Subversion server working. Simply install the Subversion client into your client box, that's all you need to do.

Here I give a sample:

$ svn co svn+ssh://john@host/data/svn/myproject

Of course, this is the simplest configuration to get started. There are some others which you can find in some svn book.

Note: Only one thing you may be aware. You may need to modify /etc/default/login to set the initial shell path properly so that the SSH daemon can find where svnserve is. Otherwise, you will get error on the client side.

Wednesday, November 16, 2005

Invalid permissions after installing 10.2

Afeter installing Oracle 10gR2 on Solaris 64-bit, the permission bit of the directories and files under $ORACLE_HOME has been set incorrectly. A lot of directories and files have been set to 0 for others. Hence they are inaccessbile for any other user. This is related to an Oracle bug 4516865. The Doc. 612605.992 in MetaLink discussed how to work around this problem.

Monday, November 14, 2005

Triple size as the source table after copying tables through database links

Today I find out an interesting symptom. After copying tables from the source database in 9.2.0.5 to the target database in 10.1.0.2 via a database link, the size of every column related to CHAR including CHAR and VARCHAR2 in the target database is three times as large as the their source. There is no problem while using exp/imp to clone the tables from the source to the target. I suspect the different character sets in the 2 databases affect the result. It's UTF8 in the source DB as it's AL32UTF8 in the target DB.

Friday, November 11, 2005

Database duplication using RMAN

Scenario 1:

Starting on Nov. 3, 2005
Duplicate ARBORBP without a password file and SQLNET connection, after restoring a full backup taken on Oct. 14, 2005, RMAN errors below appear

RMAN-00571:===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS===============
RMAN-00571:===========================================================
RMAN-03002: failure of Duplicate Db command at 11/04/2005 06:51:49
RMAN-06136: ORACLE error from auxiliary database: ORA-01503: CREATE CONTROLFILE failed
ORA-01990: error opening password file '/dg04/vol01/app/oracle/product/9.2/dbs/orapw'
ORA-27037: unable to obtain file status
SVR4 Error: 2: No such file or directory

Conclusion:
A password file must be created before using RMAN to duplicate a database

Scenario 2:

Starting on Nov. 4, 2005
Creating a password file for the auxiliary instance TEST
Add entry for TEST to listener.ora and tnsnames.ora as well
Duplicate ARBORBP without specifying UNTIL clause, lasting for around 17 hours, after applying the incremental backup taken on Oct. 31, 2005, RMAN errors below appear

Oracle Error:
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: '/dg02/vol01/oradata/restore/system_01.dbf'

released channel: ch1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 11/05/2005 14:33:05
RMAN-03015: error occurred in stored script Memory Script
RMAN-06053: unable to perform media recovery because of missing log
RMAN-06025: no backup of log thread 1 seq 44833 scn 572637893394 found to restore
RMAN-06025: no backup of log thread 1 seq 44832 scn 572637892189 found to restore
RMAN-06025: no backup of log thread 1 seq 44831 scn 572637891001 found to restore
RMAN-06025: no backup of log thread 1 seq 44830 scn 572637889406 found to restore
.
.
.

Conclusion:
This is a known problem of DUPLICATE command refers to Oracle Metalik Doc. 274118.1. You must make sure all the archived log required to clone a database have been backed up. UntilNov. 7, 2005, only the archived logs prior to 44635 have been backed up but not all. This caused this try to fail.

Scenario 3:

Starting on Nov. 8, 2005
Specify the UNTIL clause 'sysdate - 2', date back to Nov. 6, 2005
Since there is another incremental backup on Nov. 7, 2005, it's expected all the necessary archived log have already been backed up
On Nov. 4, 2005, there is a new tablespace BCS2004 added into the DB, hence a new datafile. At the first try, there is no entry for the newly added datafile in RMAN command file. The below error appears.

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 11/08/2005 10:31:08
RMAN-05501: aborting duplication of target database
RMAN-05001: auxiliary filename /dg02/vol04/oradata/arborbp/bcs2004_01.dbf conflicts with a file used by the target database

At the second try, an entry below added into RMAN command file to reflect this change.

SET NEWNAME FOR DATAFILE 27 TO '/dg02/vol01/oradata/restore/bcs2004_01.dbf';

However, still get the error below

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 11/08/2005 11:09:38
RMAN-03015: error occurred in stored script Memory Script
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 27 found to restore

Finally, the file entry is removed from the RMAN command file and a SKIP TABLESPACE claus is added to skip the newly added tablespace BCS2004. Moreover, to specify the point in time more accurately, using UNTIL SEQUENCE instead of TIME. A sequence number 44965 of the last archive log which has been backed up to tape on Nov. 7, 2005 has been specified. Without restoring the incremental backup taken on Nov. 7, 2005, the incremental backup taken on Oct. 31, 2005 has been applied. Afterwards, Oracle began to applying the archived log from 44635 which is generated right after finishing the incremental backup on Oct. 31, 2005. After applying around 200 archived logs without any problem, the below erros appear while encountering the log 44835.

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 11/10/2005 05:16:51
RMAN-03015: error occurred in stored script Memory Script
ORA-00283: recovery session canceled due to errors
RMAN-11003: failure during parse/execution of SQL statement: alter database recover logfile '/dg02/vol01/oradata/restore/arch/arch_1
_44835.arc'
ORA-00283: recovery session canceled due to errors
ORA-01244: unnamed datafile(s) added to controlfile by media recovery
ORA-01110: data file 27: '/dg02/vol04/oradata/arborbp/bcs2004_01.dbf'

The log 44835 was produced on Nov. 4, 2005. The newly added datafile was recorded in it.

Conclusion:
You must use a full set of backups to duplicate a database. From the time when the latest inremental 0 backup is taken to a point in time you want the duplicating database recovered to, there should NOT be any structural change like adding datafile.

Scenario 4:

Starting on Nov. 10, 2005
Still no entry for the newly added file and SKIP TABLESPACE BCS2004, this time the archived log 44640 is specified in SET UNTIL clause. This should meet all the requirements to duplicate a database. All the necessary logs have been backed up to tape; from the last incremental level 0 backup taken on Oct. 14, 2005 to the archived log 44640, no datafile has been added. There are 2 incremental level 1 backup taken on Oct. 24, 2005 and Oct. 31, 2005 respectively and a few number of archived logs between 44635 and 44640 to be applied.
Without luck, got errors below again!

ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: '/dg02/vol01/oradata/restore/system_01.dbf'

released channel: ch1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 11/11/2005 11:32:07
RMAN-03015: error occurred in stored script Memory Script
RMAN-06053: unable to perform media recovery because of missing log
RMAN-06025: no backup of log thread 1 seq 44635 scn 572614439208 found to restore

After looking into the case, the root cause of this error is because we are using CONTROLFILE of the target database rather than the RMAN catalog. Due to the limited space in the controlfile, after finishing the incremental level 1 backup taken on Nov. 7, 2005, all the archived log backed up on Oct. 31, 2005 have been flushed out of the controlfile. Since 44635 is the last one, there is no trace of it.

RMAN> list backup of archivelog all completed before '31-oct-2005';


RMAN> exit

However, all the archived logs from 44636 do exist in the control file since they have been backed up on Nov. 7, 2005 in the inremental level 1 backup.

Finally things turn out to be a little simple! According to the Metalink Doc. 274118.1, I manually restored the required archived logs between 44635 and 44640 in the production database ARBORBP by connecting to the RMAN catalog. I then transferred them to the auxiliary box to be applied to the auxiliary instance. The rest of work is pretty straightforward! Using SQL*Plus to recover the auxiliary instance and open it with RESETLOGS option. I didn't bring the instance to 44640 since it's not necessary. I only brought it to 44638, a consistent state!

$ sqlplus /nolog

SQL*Plus: Release 9.2.0.5.0 - Production on Fri Nov 11 12:17:08 2005

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

SQL> connect / as sysdba
Connected.
SQL> recover database using backup controlfile;
ORA-00279: change 572614439988 generated at 10/31/2005 17:28:33 needed for
thread 1
ORA-00289: suggestion : /dg02/vol01/oradata/restore/arch/arch_1_44635.arc
ORA-00280: change 572614439988 for thread 1 is in sequence #44635


Specify log: {=suggested | filename | AUTO | CANCEL}

ORA-00279: change 572614473618 generated at 10/31/2005 20:09:22 needed for
thread 1
ORA-00289: suggestion : /dg02/vol01/oradata/restore/arch/arch_1_44636.arc
ORA-00280: change 572614473618 for thread 1 is in sequence #44636
ORA-00278: log file '/dg02/vol01/oradata/restore/arch/arch_1_44635.arc' no
longer needed for this recovery


Specify log: {=suggested | filename | AUTO | CANCEL}
cacel
ORA-00308: cannot open archived log 'cacel'
ORA-27037: unable to obtain file status
SVR4 Error: 2: No such file or directory
Additional information: 3


Specify log: {=suggested | filename | AUTO | CANCEL}
CANCEL
Media recovery cancelled.
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '/dg02/vol01/oradata/restore/system_01.dbf'


SQL> recover database using backup controlfile;
ORA-00279: change 572614473618 generated at 10/31/2005 20:09:22 needed for
thread 1
ORA-00289: suggestion : /dg02/vol01/oradata/restore/arch/arch_1_44636.arc
ORA-00280: change 572614473618 for thread 1 is in sequence #44636


Specify log: {=suggested | filename | AUTO | CANCEL}

ORA-00279: change 572614824171 generated at 11/01/2005 06:06:40 needed for
thread 1
ORA-00289: suggestion : /dg02/vol01/oradata/restore/arch/arch_1_44637.arc
ORA-00280: change 572614824171 for thread 1 is in sequence #44637
ORA-00278: log file '/dg02/vol01/oradata/restore/arch/arch_1_44636.arc' no
longer needed for this recovery


Specify log: {=suggested | filename | AUTO | CANCEL}
CANCEL
Media recovery cancelled.
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '/dg02/vol01/oradata/restore/system_01.dbf'


SQL> recover database until cancel using backup controlfile;
ORA-00279: change 572614824171 generated at 11/01/2005 06:06:40 needed for
thread 1
ORA-00289: suggestion : /dg02/vol01/oradata/restore/arch/arch_1_44637.arc
ORA-00280: change 572614824171 for thread 1 is in sequence #44637


Specify log: {=suggested | filename | AUTO | CANCEL}

ORA-00279: change 572614825088 generated at 11/01/2005 06:07:50 needed for
thread 1
ORA-00289: suggestion : /dg02/vol01/oradata/restore/arch/arch_1_44638.arc
ORA-00280: change 572614825088 for thread 1 is in sequence #44638
ORA-00278: log file '/dg02/vol01/oradata/restore/arch/arch_1_44637.arc' no
longer needed for this recovery


Specify log: {=suggested | filename | AUTO | CANCEL}
CANCEL
Media recovery cancelled.
SQL> alter database open resetlogs;

Database altered.

SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.5.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.5.0 - Production

Monday, November 07, 2005

My problematic 7D get replaced yesterday


Lotus
Originally uploaded by Flyhorse@LonelyPlanet.
Last saturday the shopper Digi 33 called me and said there are Minolta 7Ds available while I was on the way to Shen Zhen. Pretty excited since I was told previously I may have to wait for a long time.

Well... yesterday I went to the shop to replace the problematic 7D. Again, obviously the so-called new 7D is not a brand-new one. I found out the S/N is even earlier than mine. With the caution, I thoroughly chcked it. There was some hair on the mirror and the WB button was moved. These made me very uncomfortable since the shopper is not honest at all! They even told me there is no way to replace once more and they were out of stock again! What they can do is to fix my problematic one! Jesus! I don't want them to fix my 7D. Who knows where they will bring my 7D, probably not the Minolta maintenance centre. I'd rather pay Minolta to fix it if I must fix it! Anyway, using my blower, I wiped the hair off the mirror. Through a thorough examination, there was not any other problem for the time being.

My wife and I were going to Repulse Bay after the replacement. However, we decided to go to Hong Kong park to test this new 7D. This picture has been taken in the park yesterday. Using Sigma 70-210/2.8 at 210mm end, I took this picture without a tripod at f5.6@40 with ISO 100. Minolta's unique anti-shake function is pretty cool. This picture is very sharp even it's was taken at 1/40" at 210mm without a tripod.

Wednesday, November 02, 2005

How to install Veritas DB Agent for Oracle on Solaris

Well... it's pretty straightforward. If you install from a CD natively, it won't be a problem; if you install from a CD remotely, you need to tar the whole CD first and untar into a temporary directory in the target box as root. Simply run 'install' shell script and complete the installation by following the steps.

After the installation, you need to make a symbolic link for the Media Manager library in the Oralce home.

$ > cd $ORACLE_HOME/lib
$ > ln -s /usr/openv/netbackup/bin/libobk.so64.1 libobk.so

However, there is no need to relink the Oracle executable as some doc. ask you to do so. When you make a call in RMAN, the library will be linked dynamically by Oracle.

To test the connectivity, run RMAN:

RMAN> run {
2> allocate channel ch1 device type 'sbt_tape' parms 'ENV=(NB_ORA_POLICY=ipdev_oracle,NB_ORA_SERV=maple)';
3> }

allocated channel: ch1
channel ch1: sid=27 devtype=SBT_TAPE
channel ch1: VERITAS NetBackup for Oracle - Release 5.1 (2004043016)
released channel: ch1

A successful installation!

Monday, October 31, 2005

A beautiful dusk

This picture has been taken by Minolta Dynax 7D at 6pm Oct. 30, 2005 while my wife and I was walking back to my parent's home.
Actually the visibility was not good at the day time. Everything looked gray. But close to dusk the sky turned clear. It's breezing softly. What a beautiful evening! The view was quite breath-taking at the time. Sun already sank and the street lamps were lit. The clouds formed a long beautiful curve and were being burned by the sunset glow. Posted by Picasa

Wednesday, October 26, 2005

Photo Gallery: Best Wildlife Photos Announced


Wildlife Photographer of the Year is the world's largest wildlife- photograph competition. Organized by London's Natural History Museum and BBC Wildlife Magazine, the 2005 competition's top images are on exhibit at the museum through April 23, 2006. The exhibition will then tour internationally.

Overall Winner: "Sky Chase"


Friday, October 21, 2005

Learn Something New Every Day: Easy Connect Identifier

Prior to Oracle 10g, after creating a new database and configuring the listener, to connect to the DB from other box, you must first either create a TNSNAMES.ORA file in your local box or set up an entry for the DB in some name services (Oracle NAMES or LDAP). Sometimes it's annoying. Since Oracle 10g Release 1, you don't have to do this any more. Just like using thin JDBC to connect to a DB by providing host, port and SID, you can now easily connect to a DB via SQLNET by providing host, port and sevice name without any extra configuration.

Pretty cool! Below are from Oracle SQL*Plus Documentation

Easy Connection Identifier

The easy or abbreviated connection identifier has the syntax:

[//]host[:port][/[service_name]]

Example 4–4 Start a command-line session to the sales database using the easy connection identifier

sqlplus hr/password@sales-server:1521/sales.us.acme.com

Example 4–5 CONNECT to the sales database using the easy connection identifier

connect hr/password@sales-server:1521/sales.us.acme.com

The easy connection identifier can be used wherever you can use a full connection identifier, or a net service name. The easy syntax is less complex, and no tnsnames.ora entry is required.

However, through some tests, I found out you still have to put the below entry into SQLNET.ORA file. Otherwise, you will keep receiving ORA-12154 error either using 'sqlplus' or 'connect'. It's very frustrating!

NAMES.DIRECTORY_PATH= (EZCONNECT, TNSNAMES)

After adding the EZCONNECT entry, I tried the command line 'sqlplus' many times but without success. Below are some output. Still trying ... :-(

swong@sun:nemo > sqlplus sysman@"mars:1521/flyhorse.domain"

SQL*Plus: Release 10.1.0.2.0 - Production on Fri Oct 21 11:27:33 2005

Copyright (c) 1982, 2004, Oracle. All rights reserved.

ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor


Enter user-name: ^C
swong@sun:nemo > sqlplus sysman@'mars:1521/flyhorse.domain'

SQL*Plus: Release 10.1.0.2.0 - Production on Fri Oct 21 11:27:46 2005

Copyright (c) 1982, 2004, Oracle. All rights reserved.

ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor


Enter user-name: ^C
swong@sun:nemo > sqlplus sysman@'//mars:1521/flyhorse.domain'

SQL*Plus: Release 10.1.0.2.0 - Production on Fri Oct 21 11:27:53 2005

Copyright (c) 1982, 2004, Oracle. All rights reserved.

Usage: SQLPLUS [ [] [] [] ]
where ::= -H | -V | [ [-C ] [-L] [-M ] [-R ] [-S] ]
::= [/][@] | / | /NOLOG
::= @|[.] [ ...]
"-H" displays the SQL*Plus version banner and usage syntax
"-V" displays the SQL*Plus version banner
"-C" sets SQL*Plus compatibility version
"-L" attempts log on just once
"-M " uses HTML markup options
"-R " uses restricted mode
"-S" uses silent mode
swong@sun:nemo > sqlplus sysman@"//mars:1521/flyhorse.domain"

SQL*Plus: Release 10.1.0.2.0 - Production on Fri Oct 21 11:28:00 2005

Copyright (c) 1982, 2004, Oracle. All rights reserved.

Usage: SQLPLUS [ [] [] [] ]
where ::= -H | -V | [ [-C ] [-L] [-M ] [-R ] [-S] ]
::= [/][@] | / | /NOLOG
::= @|[.] [ ...]
"-H" displays the SQL*Plus version banner and usage syntax
"-V" displays the SQL*Plus version banner
"-C" sets SQL*Plus compatibility version
"-L" attempts log on just once
"-M " uses HTML markup options
"-R " uses restricted mode
"-S" uses silent mode
swong@sun:nemo > sqlplus sysman@//mars:1521/flyhorse.domain

SQL*Plus: Release 10.1.0.2.0 - Production on Fri Oct 21 11:28:10 2005

Copyright (c) 1982, 2004, Oracle. All rights reserved.

Usage: SQLPLUS [ [] [] [] ]
where ::= -H | -V | [ [-C ] [-L] [-M ] [-R ] [-S] ]
::= [/][@] | / | /NOLOG
::= @|[.] [ ...]
"-H" displays the SQL*Plus version banner and usage syntax
"-V" displays the SQL*Plus version banner
"-C" sets SQL*Plus compatibility version
"-L" attempts log on just once
"-M " uses HTML markup options
"-R " uses restricted mode
"-S" uses silent mode
swong@sun:nemo > sqlplus sysman@mars:1521/flyhorse.domain

SQL*Plus: Release 10.1.0.2.0 - Production on Fri Oct 21 11:28:14 2005

Copyright (c) 1982, 2004, Oracle. All rights reserved.

ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor


Enter user-name: ^C

I worked out another way to bypass this problem, that's using 'connect'. You need to enclose the connection identifier with quote marks! Here are some tests including both success and failure. Here we go!

swong@sun:nemo > sqlplus /nolog

SQL*Plus: Release 10.1.0.2.0 - Production on Fri Oct 21 11:08:30 2005

Copyright (c) 1982, 2004, Oracle. All rights reserved.


11:08:31 connect sysman@"//mars:1521/flyhorse.domain"
Enter password:
Connected.
11:08:48 sysman@flyhorse> connect sysman@'//mars:1521/flyhorse.domain'
Enter password:
Connected.
11:09:03 sysman@flyhorse> connect sysman@//mars:1521/flyhorse.domain
SP2-0306: Invalid option.
Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}]
where ::= [/][@] | /
11:09:16 sysman@flyhorse> connect sysman@mars:1521/flyhorse.domain
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor


Warning: You are no longer connected to ORACLE.
11:09:28 sysman@flyhorse> connect sysman@"mars:1521/flyhorse.domain"
Enter password:
Connected.
11:10:33 sysman@flyhorse> connect sysman@'mars:1521/flyhorse.domain'
Enter password:
Connected.

Guess what? You still have to enclose the connection identifier with quote marks while using the command line 'sqlplus' no matter you use the double slashes or not. Slash doesn't matter but the quote marks really matter here! The only difference from 'connect' is you need an extra step, that's to escape the quote marks! It's Oracle to interpret the quote marks rather than Solaris (I am working on Solaris). So you need to pass the connection identifier with the quote marks to Oracle. Below are some samples.

swong@sun:nemo > sqlplus sysman@\"mars:1521/flyhorse.domain\"

SQL*Plus: Release 10.1.0.2.0 - Production on Fri Oct 21 11:39:22 2005

Copyright (c) 1982, 2004, Oracle. All rights reserved.

Enter password:

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options

11:39:27 sysman@flyhorse> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
swong@sun:nemo > sqlplus sysman@\'mars:1521/flyhorse.domain\'

SQL*Plus: Release 10.1.0.2.0 - Production on Fri Oct 21 11:39:51 2005

Copyright (c) 1982, 2004, Oracle. All rights reserved.

Enter password:

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options

11:39:53 sysman@flyhorse> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
swong@sun:nemo > sqlplus sysman@\"//mars:1521/flyhorse.domain\"

SQL*Plus: Release 10.1.0.2.0 - Production on Fri Oct 21 11:40:35 2005

Copyright (c) 1982, 2004, Oracle. All rights reserved.

Enter password:

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options

11:40:37 sysman@flyhorse> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
swong@sun:nemo > sqlplus sysman@\'//mars:1521/flyhorse.domain\'

SQL*Plus: Release 10.1.0.2.0 - Production on Fri Oct 21 11:40:55 2005

Copyright (c) 1982, 2004, Oracle. All rights reserved.

Enter password:

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options

11:40:58 sysman@flyhorse> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options

This connection mechamism can also be used to create a database link.

17:17:11 ops$swong@FLYHORSE> create database link report@user
17:17:41 2 connect to user identified by password
17:17:48 3 using 'mybox.com:1521/testdb.com';

Database link created.

Elapsed: 00:00:00.36

Wednesday, October 19, 2005

Most of films have been saved in this roll!

This roll of film is the 1st roll which I loaded into my Minolta 800si, one of two I brought with me for this Tibet trip. In the morning of Sep. 16, 2005, near the holy mountain Kailash, I loaded it in and took few pictures. At dawn on Sep. 19, 2005, the day after Chinese mid-autumn festival, while waiting for the sunrise at Gu Ge Dynasty, I took it out and used it again for those beautiful clouds in the morning sunlight as well as the Gu Ge Dynasty. Absolutely it's precious time for me and it's difficult to catch them again! Unfortunately, 2 days later, I opened the camera back accidentally while the whole roll has not been rolled back into the box! How careless I am! Usually rolls will be automatically rolled back after the last one has been exposed. The reason why it didn't work this time is because I changed the default setting in order to take 1 incompleted roll out for the future reload. However, I forgot to change it back. So the automatic rolling back was disabled. I didn't realize at the time and opened the back. Even I closed it almost in no time, but I know some of films must be fully exposed. I am even afraid all of them have been destroyed! Just like a nightmare! I had been blaming myself all the time. How come on the earth I am reckless like this! This is not me! But I know it happened. No matter how much I blame myself. The only one thing I wanna do is to print and develop this roll as soon as possible. However, I dare not to process it in Shi Quan He. I have to wait until we go back to Lhasa. Meanwhile, I was suffering from this. I was really angry at myself!

After going back to Lhasa, I was going to process this roll in one pro-like shop. I just couldn't wait more. My wife told me not to do so there. "You've already been waiting for many days! Why don't you wait for few more and take all of them back to HK to process them safely and securely?" I was convinced again even I was dying to see the final impact.

Finally I came back to HK and processed all the rolls. Thank God! Things were not like that bad as I thought previously! Only the last 10 films have been fully exposed but the rest are all preserved! Especially for those I took in that morning at Gu Ge Dynasty! The attached photo is one of them! Is it Kailash's blessing? Posted by Picasa

Oracle Secure Backup (OSB) - a replacement for Veritas DB Agent for Oracle

Sounds cool! If it's the case, we don't have to buy Veritas DB agent for Oracle any more. Previously, we must buy Veritas DB agent for Oracle as well as NetBackup client to backup a Oracle DB directly to tape library. Otherwise, the tape library can only been seen by Veritas MML and unseen by RMAN. To backup a DB to offline tapes, we can only backup it to hard disks as a staging place first and load the backup files onto tapes later via NetBackup Client. Despite the inconvenience, this method will cause a lot of other problems such as availability and managebility. One of them is like this: RMAN thinks all the backups remain in the hard disks by the data in the repository, but actually they are not since they have been archived to offline storage. There will be always inconsistencies between RMAN repository and Veritas MM database.

Oracle Database 10g Release 2: Top Features for DBAs: "In Oracle Database 10g Release 2, a new tool called Oracle Secure Backup (OSB), available in the first quarter of 2006, makes this requirement much more affordable by replacing the MML specific to third-party tape management systems. OSB can back up to a tape library directly, so you don't need any other media management layer. And, best of all, OSB is tightly integrated with the database engine and thus can be controlled and administered via Oracle Enterprise Manager."

Monday, October 17, 2005

Oracle Database 10g Release 2: Online Limit Changes

This feature is pretty useful as we don't have to re-create the controlfile to make the changes any more. Previously, taking such an action is critical and dangerous. You must be very careful to rebuild the controlfile. Moreover, the database must be opened in RESETLOG mode and a lot of information will be lost during the process.

Oracle Database 10g Release 2: Top Features for DBAs: "Online Limit Changes


When you want change parameters defined during the creation of the database, such as MAXDATAFILES, MAXLOGFILES, and so on, what are your options? Prior to Oracle Database 10g Release 2, the only option is to follow these steps:

1. Take a backup of controlfile to trace.
2. Modify the parameter you want to change in that trace file.
3. Shut the database down.
4. Startup Mount.
5. Recreate the control file.
6. Open the database in RESETLOGS mode.

Needless to say, this approach degrades availability. In addition, because RMAN keeps the metadata about backups in the control file as well as in the catalog, that information is lost during this process. The controlfile is created in RESETLOGS mode, so some backup information may be lost too.

In Oracle Database 10g Release 2, you needn't recreate the control file to change these parameters. Thus, you do not have to lose the RMAN information stored there."

Friday, October 14, 2005

My first time to see a group of Tibetan Antelope

In the morning on Sep. 16, 2005, it's the first time in my life to see wild life, a group of Tibetan Antelope. They are such amazing animals, slim, alert and active. All the group members I encountered are male with long horns on their heads. Doubtlessly, three of us, meimei, my wife and I all felt very excited at the time. We were trying to get closer to them but without success. They were so alert and always sprung away when we still were 200 or 300m away from them. The electrical poles in the background are not harmonized with the whole natural environment but truly exist there. Do they feel strange about the poles or already get used to such civilization products? Who knows? This is reality, anyway. The conflicts and collissions between the nature and our civilization progress! Let's pray they will live a safe life forever on their own land! Posted by Picasa

Tuesday, October 11, 2005

Google's New Service

个人一直都比较喜欢Google推出的各种新服务,不仅方便,而且实用。可以看出,Google一直在努力地提升着自己的服务,仍然是一家朝气蓬勃的公司,发展潜力依旧是巨大的!公司的竞争力也还在不断增强!昨天,继前一阶段推出了Google Talk之后,Google又在Google Lab里面推出了一个新服务的测试,名字叫Google Reader。大家看到这里,也许已经猜到了这项新服务的用处。对,它就是一个新闻阅读器,也是时下非常流行的RSS阅读器。那么,它和其它类似的RSS新闻阅读器差别又在哪里呢?又有什么特别之处呢?
第一,最大的差别我想就是无需再安装软件或者插件,它是一个完全基于WEB的服务,只要你能够上网,任何一个浏览器都可以用到这个服务。由于所有订购的新闻都存储在Google服务器中,在何时何地我们都可以浏览自己感兴趣的新闻!省去了用OPML在软件之间来回导入导出的麻烦,而且,有些RSS阅读器还不支持OPML。
第二,仍然是Google在这项新服务中集成了搜索功能,这也是Google的一贯宗旨。我们可以对自己感兴趣的话题进行查找,Google可以把相关的新闻源列出来,我们可以再从中选择然后进行订购。省去了自己在网上大海捞针式查找的麻烦。
第三,标签功能也是必不可少的,这一概念也被其它的公司所逐渐采用,如Yahoo。具体应用在这项服务中,是对所订购的新闻源进行标签,一个新闻源可能与科学有关,同时又是关心健康的一些话题。这样,我们可以把这个新闻源同时标以科学和健康,便于准确定位。当然,只有在订购的新闻源数量特别多的时候才会体会到这项功能的方便性,道理和Gmail是一样的。
此外的功能还有将自己感兴趣的某一具体话题用Starred标注起来。可以将话题直接Gmail给自己的朋友,也可以对话题直接进行博客等等。
因为现阶段只是测试版本,相信Google还会对一些功能进行改良,并逐渐加入一些更加好的新的功能进来。
大家可以到以下这个网址试用这个服务:

http://reader.google.com/

Wednesday, August 17, 2005

万事具备,只欠东风

朝思暮想的,魂牵梦萦的西藏之行终于就要实现了。四年,整整想了它四年,中间都因为种种因素而放弃。其中有个人的原因,也有工作的原因。今年想怎么着也得趁着新婚之喜,和老婆一起同游西藏,那一片对于我来说仍旧陌生,仍旧神秘的土地。
在过去的四年中,不知有多少次就在它的旁边经过,在从那片土地上孕育出来的江河上穿过,在从那里延伸出来的山脉上走过,可就是无法踏足它。无奈,遗憾的同 时,想去的欲望也就越来越强烈。眼前总是不时出现它的影像,有从照片上获得的,也有自己的想象。甚至于,繁忙都市中偶尔一次晴朗的天,偶尔一丝凉爽的风都 能勾起我对西藏的遐想。
终于,无法再忍受这种煎熬,和老婆商量决定了出行日期之后,于7月初便请了9月中的长假。搞得同事们都说用得着这么早请嘛,提前快3个月。可是要知道,请 3个星期,15个工作日的长假对于我来说是怎样的困难。我是做IT的,自从2000年IT不景之后,能生存下来已经很不容易了。可是,生存的代价便是无休 止的工作,一个人做以前几个人的活儿。而且这个职位上只有自己一个人,我离开了公司,就意味着没有人能够继续我的工作。所以,3个星期的长假能够获得批准 是非常难得的。这恐怕是我第一次请这么长时间的假期,也将会成为我最后一次,起码在这间公司。前几天,收到上级的邮件,说我这次是例外,以后最长只能请 10个工作天。也就是说,以后最多请17天假期。17天,怎么能够来得及走川藏?除非走马观花。所以,这一次的出行对我显得尤其重要。为了成行,我拼命地 工作,尽量减低在我离开公司期间出问题的可能性,尽量给领导好的印象,争取在成行之前完成今年设定的项目。总之,不惜一切来保证这次出行。可是,总有你计 划不到的情况出现,一个同事被通知成为陪审团的候选人,就在今天去报到!一旦被正式选为陪审团,就要上庭履行义务。如果开庭时间和我的放假时间有冲突,那 上级就很有可能取消我的假期,尽管已经批准了。毕竟,一个是社会责任,一个是私人理由。这就是为什么只欠东风的原因。大部分人,一生可能也不会被通知成为 陪审团候选人。可这个同事就偏偏在这个节骨眼上收到通知。虽然自己的工作他不能承担,但是监视服务器,报告问题他还是可以的,而这也是我不在公司期间能够 让他代为执行的一切,以前我放假也是此人代替我的职务。我想,现在我的心情一定比他本人还紧张(或许他丝毫不紧张)。我反而象是一个站在被告席上的被告, 已经完成了结案陈词,等着还没有成为陪审员的他履行着陪审员的义务,等着他口中Guilty或者Not Guilty的宣判。天知道,我是无罪的!

Thursday, July 28, 2005

Response time analysis for tuning Oracle SQL query

Jul. 21, 2005, Last Thursday I received a request from my manager to tune a SQL query statement. At the time, this SQL always take around 4 hours to finish. It's really an unacceptable response time!

After receiving this request, the first thing came in my mind is the methodology, response time analysis. Throughout these years, the methods about how to tune the Oracle performance comes and goes. It has been being developed and revised.

As the 1st generation, DBAs liked to use so-called ratio analysis. As the name indicated, people usually collect the hit ration of the various database SGA area from those statistics tables. After collecting people try to maximize the hit-ratio by enlarging the corresponding memory area and so forth. It's somewhat effective but most of time it's not. It does have it's own limitation as well.

Afterwards, the wait analysis emerged. It measures what the database is really waiting for at the time. This improved much in tuning Oracle performance. Many DBAs including me are still using this method to tune SQL, most of time. It can tell you immediately what a running SQL is waiting. By concentrating on what caused the waits and reduce/eliminate them, most of time you can efficiently and effectively improve the SQL performance. However, it can only tell you what the DB is waiting for, it can NOT tell you where the majority of time is being consumed. That's why the response time analysis comes in place and take the role!

The response time analysis measures how and where applications eat the time before the completion. It needs to turn on the Oracle trace feature. There is a lot of information in Oracle raw trace file as well as the TKPROF file produced from the raw file. By turn on TIME_STATISTICS parameter and enable the event 10046 trace, everything during the SQL execution could be recorded in raw trace file including CPU time, elapsed time, physical reads, consistent gets, db block gets and so on. You will be able to exactly know which part of a SQL consumes the time aggressively regardless the cache ratio and the waiting time. Hence you can focus on it and work against it!

Time to get back to the case! In this case, the wait analysis doesn't help much. There is always 'db file sequential read' in v$session_wait and a high CPU usage on OS level. Based on these facts, I really have no idea what's going on during the SQL execution. Even there is always 'db file sequential read' in v$session_wait, the total waited time is only a small portion of the total execution time told by v$session_event after finishing. So the root cause is neither an inefficient index nor the I/O problem. By turning on Oracle trace using 'oradebug' utility, I find out the root cause is there are too many consistent gets. The more the consistent gets, the longer elapsed time, the longer the CPU time. This also is the cause of the high CPU usage! This also bring another popular tuning topic out, minimizing the logical I/O. Once the logical I/O has been minimized, the physical ones will be minimized as well automatically. If you take care pennies, dollar will take care of itself! Following this clue, I also figure out the abnormal consistent gets are produced by the improper order of nested loops in the SQL execution plan generated by Oracle. By reversing the order, consistent gets dropped dramatically. From user's point of view, the response time dropped down by 87.5%, from original 80 minutes to 9 minutes! A big improvement!

--
Flyhorse@LonelyPlanet
=================================
Life can only be understood backwards,
but it must be lived forwards!
=================================

Sunday, June 05, 2005

My Web BETA - Yahoo!

My Web BETA - Yahoo!

Yahoo! 最近退出了一个叫做My Web的服务,试用了一下,觉得想法相当不错!也许也是Internet发展的一个趋势!
先简单介绍一下什么是My Web.基本概念就是把你感兴趣的网站或者网页收藏起来.你也是会说,这有什么稀奇,不是早就有了吗,IE早就可以把网站收藏到收藏夹里了.可是你想过没有,浏览器所做的只是把那些网站收藏到你的本地电脑里面.当你随身没有携带那部电脑而又想不起来你感兴趣的一个网站的地址怎么办?只好通过搜索引擎查找了.你也许又会说,反正现在搜索引擎很强大,应该可以找得到.可是,往往事实并非如此,搜索的结果也许让你非常泄气.如果时间紧迫,更是如此.有了Yahoo! My Web,你就无需担心了.你可以把你感兴趣的网站存在属于你自己的Yahoo! 帐户里,是在Yahoo!的服务器里,而不是你本人的电脑里!这样,无论你在哪里,只要你可以上网,便能够立即找到你感兴趣的网站!
告诉你吧!还有一个更加强大,方便的功能,就是My Web不止可以存放你感兴趣的网页或者网站,而且还可以存放你当时浏览它们的拷贝,也就是一个Snapshot!这个有什么用?用处可大了!我们都知道,网页会不断地更新.你在之后通过一个网址看到的网页未必就是你之前在同一地址所看到的.原因就是内容被更新了.这时我们如果只对之前看到的内容感兴趣该怎么办?不要紧,My Web可以帮助你!在你将一个网址存到My Web的时候,可以选择同时也保存一份拷贝.同样,这份拷贝也是放在Yahoo的服务器里面的.这样一来,无论什么时候你需要看之前的内容的话,都可以通过My Web来办到.个人觉得这个功能非常有用!也是我喜欢My Web的最重要一点!
另外还有一个功能就是可以把你曾经通过Yahoo搜索引擎查找所用过的关键字存下来.Google也提供有相同的功能.

Friday, June 03, 2005

远期自助旅游 -- 05年春季西藏计划(阿里,珠峰,修订版)

远期自助旅游 -- 05年春季西藏计划(阿里,珠峰,修订版)
从绿野抄录的一个西藏阿里地区行程表,似乎还不错。可以借鉴一下!
行程中包括两天冈仁波齐神山的转山,第一天23公里需时9小时,第二天32公里需时12小时。平均时速不到3公里,但由于高海拔,估计还是比较辛苦。必须要有心理准备。

Saturday, May 28, 2005

Milnota Configuration

Flyhorse@LonelyPlanet
www.kangrinpoche.com
NB-2A, S-2A

50/2.8, 20/2.8, 80-200/2.8G APO, 28-70/2.8G, 17-35/3.5G

Gitzo 1226

Friday, May 27, 2005

香港相机商铺一览

Flyhorse@LonelyPlanet
友好商戶推介
 

* 先達 ND (買行水DC平)
九龍旺角亞皆老街 83號先達廣場壹樓 F68 號
ND Mongkok : 23805199
ND Wan Chai : 21470188
 
* 好世界攝影器材(買自捲film, SLR/DSLR+腳架等貨品比較平)
地址: 中環機利文新街8號地下
電話: 2543-5657
 
* 新三共 (買filter平)
地址: 尖沙咀彌敦道50號金域假日酒店G19地鋪
電話: 23670350
 
* 相機維修中心 (買step ring 齊)
地址: 尖沙咀 香檳大廈
電話: 2366 3002

*

旺角

先達 ND (買行水DC平)
九龍旺角亞皆老街 83號先達廣場壹樓 F68 號
電話: 23805199

萬成攝影器材
九龍旺角通菜街 106 號地下
電話: 2396 2996

永成攝影器材
九龍旺角西洋菜街 66 號地下
電話: 2396 6886, 2396 6961

旺角鐳射
九龍旺角花園街 85-87 號地下
電話: 2391 5451
CITICALL Limited 雷射
G/F, 85-87 Fa Yuen Street, Mongkok, Kln.
CITICALL Limited 雷射
Shop 3-4, G/F, Mongkok City Centre, 74-78 Sai Yeung Choi St. South, Mongkok
CITICALL Limited 雷射
Shop G06-07, G/F, Hollywood Plaza, No. 610 Nathan Road, Mongkok, Kln.

Ultro Pro Computer LTD
Causeway Bay 皇室堡 1123-1124 (電話: 28817052)
Mongkok 先達 一樓 F88 (電話: 23803082)

莫斯科專門店
九龍旺角彌敦道信和中心閣樓 M25 店
電話: 2332 5765
 
*

尖沙咀、佐敦

新三共 (filter 抵)
尖沙咀彌敦道50號金域假日酒店G19地鋪
電話: 23670350

九龍生活攝影器材
九龍油麻地吳淞街 5 號地下
電話: 2384 9302

沙龍影音
九龍尖沙咀宜昌街 3 號地下 (HMV後面)
電話: 2376 0906

陳烘相機公司
九龍尖沙咀金巴利道 16 號香檳大廈 15 號
電話: 2723 3886

大家好
九龍尖沙咀金巴利道 16 號香檳大廈 B4 地下
電話: 2721 3761

天祥 (星期日下晝都開)
九龍尖沙咀彌敦道 100 號東英大廈 26 室
電話: 2722 1265

照相館
九龍尖沙咀彌敦道 100 號東英大廈 G36
電話: 2722 0068, 2722 0161

松屋影音
九龍尖沙咀彌敦道 83-97 號華源大廈 15 號
電話: 2724 0893

忠誠相機公司
九龍尖沙咀金巴利道 16 號香檳大廈地下商場 2 號舖
電話: 2721 2308, 2722 4299

好友相機公司
九龍尖沙咀彌敦道 100 號東英大廈 G1C
電話: 2368 7332

回音 Echo Photo & Audio Ltd
尖沙咀漢口道14號
電話: 23760478, 23762523

金馬攝影器材公司
尖沙咀 凱悅酒店商場
電話:2369 1063

富山懾影材公司
尖沙咀 樂道
電話:2369 5677

影藝攝影器材公司
尖沙咀 香檳大廈
電話:2721 4391

相機服務中心
尖沙咀 香檳大廈
電話:2367 6548 傳真:2367 6567
 
*

深水步

遠達攝影器材公司
九龍青山道 74 號地下
電話: 2728 6783
 
*

中環 及上環

好世界攝影器材
中環機利文新街8號地下
電話:2543-5657 (Mon-Sat 9:30am-6:30pm)

攝影科學
香港中環士丹尼街 6 號地下
電話: 25229979

永佳攝影器材
香港中環士丹利街 28 號地下 (電話:25236916)
香港中環士丹利街 27 號地下 (電話:25234708 )

世界攝影器材有限公司
香港中環士丹利街 66 - 68 號地下
電話: 2523 2087, 2524 6249

中大攝影器材
香港中環域多利皇后街 13 號地下
電話: 2526 6281

鍾沛攝影器材行
香港中環士丹利街 40 號地下 (電話: 2868-4135)
廣大照相器材行 (電話: 25228648 )
香港中環士丹利街 32 號地下

興利相機公司
服務 : 香港中環擺花街 25 號地下
電話: 2544 7593, 2544 9043

美麗華相機音響公司
香港中環士丹利街 25 號地下

摄影真是一个无底洞

Flyhorse@LonelyPlanet
为了实现今年去西藏的梦想,为了能让短暂的旅程变为永恒,为了好好的准备这次旅程,狠了狠心,在一些朋友怂恿之下买了一部二手的Minolta顶级专业35mm相机Maxxum 9.由此,便开始了在摄影器材上的执着.
首先需要一个Tripod,这么好的一部相机,怎么着也不能随便买一部次的三角架吧?如果不好,那还不如不买.于是,又锁定了差不多最好的Gitzo.但实在狠不下心来买新的,太贵!
其次,需要闪光灯,配合高级闪光灯,高速闪灯同步速度可以达到1/12000秒!没理由让这个功能浪费!而且,外置闪灯说什么也比内置的功能要强很多.以前用800si,也不是太多机会用闪光,内置的也凑合了.可是这部9,不能凑合,一切都要配合,否则,心里总是觉得个应!好吧,Minolta 5600HS又被加进了购物车中.
镜头!原来的Sigma 28-200镜头AF对焦坏了,不止是自己坏,如果继续用,可能会损害到机身!而且,成像质量也一般.不能再继续用下去了!买一部好的,一定要买一部好的!我不是一个纯粹的品牌追求者,可是却是一个质量的高要求者.Sigma的28-70/2.8似乎还不错?那么就先锁定它吧!还是不够,以前的出行就觉得高不成,低不就,长焦不够长是广角不够广.哎,还需要一个广角外加一个增距镜.嗯,差不多了,好像齐活儿了!慢着!还有滤镜呢?起码得有保护性的UV和偏振镜吧?对于户外摄影,偏振镜可是必不可少的一种武器!
就是这样,我在下坠,并且还没有看见底!

还是Gmail最好用

Flyhorse@LonelyPlanet
自从申请了Gmail以后,一直被它深深地吸引住.当然,同时也还在使用之前申请的一些邮件服务.一方面是为了做比较,另一方面是很多朋友已经不清楚我在使用哪个邮箱了.以至于在任何一个邮箱里我都可能收到来自一些朋友的邮件.
在刚开始,我觉得Gmail好可能还是出于对它的新鲜感.可是,到今天,差不多申请了1年了,我仍然坚定不移地认为Gmail是我用过里面感觉最好的Web邮件服务.速度快(也许对内地用户并非如此,常常有人抱怨进不去),没有乱七八糟的广告,易操作性.所有这些都让我对Gmail情有独钟.而且,我们可以看到,Gmail还在不断改善它的服务,比如更好的中文支持,甚至有了中文界面,一度这是很多朋友抗拒使用它的主因.最近,存储容量也大幅增加,而且仍然在增加着.当然,很难知道是否真的有那么大,我想,没有多少人的邮箱可以达到2GB而去测试它的最大容量是否真的如它所说如此大.不过,仍旧说明了一个问题,就是Google一直在提升自己的服务!
最不好用的当属MSN Hotmail,尽管它也许是拥有最大用户量的一个邮件服务,部分归功于它的即时通讯工具MSN Messenger.就其邮件服务来讲,真是不敢恭维.速度慢,而且没有什么定制功能.看一个附件需要层层进入.当然,我们了解这也许出于安全理由,可也实在不用如何繁琐,毕竟我们要在安全和操作性中间取得平衡.如果一个东西不好用,安全性再好,我想也没有多少人会喜欢.很后悔,当初居然付费买了Hotmail的大容量服务.如果再等几个月,我就会知道Gmail了.哎!事后诸葛亮!另外一个原因就是微软是最多惹人攻击的,它的邮件服务自然也不例外!垃圾邮件非常多,也许正由于这个原因,一些公司会封住Hotmail的网址禁止员工上去,本人公司便是如此!
Yahoo!邮件还不错.容量也还过得去.就是垃圾邮件和广告多了些.

Thursday, May 26, 2005


My wife and myself in Yangshuo in Mar 2005 Posted by Hello