All entries for Tuesday 21 November 2006

November 21, 2006

Common features of Java Applications

Agenda

  • Database features
  • Share knowledge
  • Using Java to monitor database

Database Features

Firstly I want to outline some common features of Java web application. These features will influence how a DBA manage his Oracle databases.

First one is a lot of Java applications only use basic Oracle developing functions. All the business logics reside in the middle tier.

Second one is most Java applications use connection pool to cache the connection to databases. Those connections often cross the network.

Third one is that with the popularity of the object-relation-mapping (ORM) tools, Java applications are able to generate SQL, which can be either good news or bad news for DBAs.

Last one is that since it is a n-tier application and any part of this link can be a bottleneck, can be a problem.

Install what you need only

Nowadays, Java developer community is talking about vendor independent. They want their Java applications independent of hardwares, operation systems, databases and even Java application servers. So a Java application wont use such Oracle features like store procedures, triggers , jobs, etc. They only use tables, views, sequences.
This is good for DBA. Most of Oracle recommended components like Java Virtual Machine (JVM), Text, XML wont be used at all. You should choose not to use them when creating the database. This will make the database small and easy to maintain , to upgrade.
I once upgraded two database from 9i to 10g. One has JVM installed and one does not. The one with JVM took more than 2 times longer than the one without.

Consider logical standby database for high availability

Logical standby database is difficult to maintain. I think everyone agree on this. Because Java application often only use tables, views and sequences, it is relatively easy for logical standby to replicate.
Logical standby database has unique advantages over physical standby.
  • First you can use it as a reporting server, thus off-load the traffic to primary servers
  • Second you can do rolling upgrade. You can upgrade standby server first, do a switchover, then upgrade old primary server, then do a switchover. For oracle 10g, you can do a major upgrading, from 10g R1 to 10g R2. According to Oracle, you can even upgrade from 10g to 11g. This will achieve zero downtime. Very appealing to environment requiring high availability.
  • Another very useful point is that you can make logical standby work as a test server as well. You can use the command “alter database guard standby”. This will prevent the developer from modify the replication from primary. However, they can create new schema on standby database and do various testing.
    The server use for standby database usually has very similar power as primary, the test is very close to product environment.
    Since you have to maintain this logical standby database, so making it as a test server wont add too much extra cost to you. You can reduce the number of test servers.

Oracle logical standby database at play

We activated logical standby db as primary db last Friday. On next Monday, I began to convert old primary db as new logical standby.

  • flashback need some log files.
    The old primary turned on flashback feature so I can just flashback it as new primary. A great feature in 10g. It complains two archive logs are missing. The files is backup and deleted by RMAN. That backup was deleted on Sunday midnight. I tried to get it back from Networker backup and found that Networker failed to backup them.(too bad. you think you can trust it and it lets you down) Just when I gave up and planned to re-instantiate the logical standby, it suddenly occurred to me that the log was shipped to old standby and I can get them from there
  • logical apply service read old archive from new primary*
    Because two days passing by now, there are about 900 archivelogs. Logical apply pulled the logs from new primary at a speed of 1 file per 2 minutes. It took 1 and half days finish reading
  • Apply
    First I issued dbms_logstdby.skip to skip some test data importing operation from a test server.
    It then stopped give an ora-600 errors about “grant select on table to someone”. I then issued several dbms_logstdby.skip_transaction to skip each one.
    It again stopped at “update table set row=id where rowid = ‘xxx’”. Logical standby does not support rowid operation. So I had to dbms_logstdby.skip_error to ignore this operation. there are a couple dozens of similar SQL.
    The table is quite small and I was able to adjust its values manually.
    At last, it managed to catch up with the new primary. One and half days pass by.
  • Switchover
    Another developer and I did switchover the following day.
    After the first two steps, the value of SELECT SWITCHOVER_STATUS FROM V$DATABASE did not return expected value, which means I cannot proceed. I then found out that the value of log_archive_dest_state_2 is set to defer.
    I try to cancel the switchover and start again. The command ALTER DATABASE PREPARE TO SWITCHOVER TO LOGICAL STANDBY CANCEL received a ORA-00905: missing keyword. I then found out that proceeding command is used for 10g R2.
    For 10g R1, you should use
    ALTER DATABASE PREPARE TO SWITCHOVER cancel    

on both servers. After restart the switchover process, it now worked fine.

Lesson: prior to switchover, you can do a switdhover test, then cancel it. You might find unexpected error.

  • Conclusion
    Logical standby is not too bad. It did need careful monitoring. This server is 10gR1. 10g R2 should be better.

Search this blog

Search Warwick Blogs

 

Tags

Most recent comments

  • Oracle 11g is the clear leader in this area. Oracle has invested heavily into self–tuning capabiliti… by shaane on this entry
  • All the features are very nice.I like Repair Advisors the most.Oracle 10G introduced some of the dat… by lucy on this entry
  • "logical standby failed to re–start, I am also getting the same error. I have search on internet and… by anemia on this entry
  • Thanks for the nice information because from last three days i am stuck on this problem…. by robot vacuum on this entry
  • So what happen City speed dating when you tried this coding once in your PC.. Please tell me so i am… by John Bergeron on this entry
Not signed in
Sign in

Powered by BlogBuilder
© MMXXII