2007年12月15日 星期六
Return object by browser
2007年11月12日 星期一
Simple Sort in Java
selection sort algorithm is O(N^2) comparisons, O(N) swaps. runs in O(N^2) time
insertion sort algorithm is O(N^2) comparisons, runs in O(N^2) time. runs twice as fast as the bubble sort and faster than the selection sort.
If the data is almost sorted, insertion sort runs in almost O(N) time. which makes it a simple and efficient way to order a file that is only slightly out of order.
2007年11月10日 星期六
Vista 安裝 IIS
選擇 Turn Windows features on or off
選擇 Internet information Services
按下OK就可以了
2007年10月11日 星期四
JList - Select example
list = new JList(m_employee);
MouseListener mlst = new MouseAdapter() {
public void mouseClicked(MouseEvent evt) {
if (evt.getClickCount() == 1) {
System.out.print( list.getSelectedValue().toString()) ;
}
}
};
list.addMouseListener(mlst);
2007年7月14日 星期六
認證準備資料連結匯整
Oracle 9i DBA 認證考試 :
- Introduction to Oracle9i: SQL (1Z0-007)
- Database: Fundamentals I (1Z0-031)
- Oracle9i Database: Fundamentals II (1z0-032)
- Oracle9i Database: Performance Tuning (1Z0-033)
Java 認證考試 :
- Sun Certified Web Component Developer for J2EE 1.4 beta exam SCWCD 1.4
- Sun Certified Business Component Developer for Java 2 Platform, Enterprise Edition 1.3 SCBCD 1.3
- Sun Certified Mobile Application Developer for the Java 2 Platform, Micro Edition SCMAD
BEA 認證考試 :
Oracle 9i Database -- DBA Fundamentals II (12)
Loading Data into a Database
- The conventional path of data loading involves the generation of redo logs, makes use of the COMMIT command to make changes permanent in the table, allows data loading into clustered tables, and allows other users to make changes to the tables while the data loading is in progress.
- The Direct-path method of transporting data, unlike the conventional load method, bypasses the buffer cache, requires that the character sets on both client and server be the same, and can be set by specifying DIRECT=y.
Oracle 9i Database -- DBA Fundamentals II (11)
RMAN Maintenance
- CHANGE BACKUPSET xxx KEEP FOREVER LOGS , when the keep parameter is specified, the parameters outline by the retention policy are overridden. And a recovery catalog has to be used. Thus the database ban be restored from this backup up to the point of failure. Keep is used with until clause or a nokeep can be used instead.



Oracle 9i Database -- DBA Fundamentals II (10)
User-Managed Incomplete Recovery
- V$RECOVERY_LOG view provides a list of all the archived redo log files that are necessary for recovery.
- V$LOG_HISTORY view provides information about the log files from the control file.
- V$ARCHIVE_LOG view provides information about all the archived log files from the control file.
- V$RECOVERY_FILE view identifies the datafiles that need recovery, and also points to the starting System Change Number for recovery.
RMAN Incomplete Recovery
- RMAN does not use files marked as ‘unavailable’ for restoration and recovery.
- The VALIDATE command enables you to choose any backup set for examination in order to verify that it can be restored.

Oracle 9i Database -- DBA Fundamentals II (8)
- The Open Database backup backed up datafiles, control files, and parameter files, password files.
- During direct load operations, setting the tablespace or table being backed up to a nonlogging mode facilitates faster transfer of data. This is the result of bypassing the buffer cache during direct load operations, which eliminates the recording of redo. However, this also means that data lost during this operation cannot be recovered, and thus it is recommended that the tablespace or table be backed up as soon as the direct load operation is concluded.

Oracle 9i Database -- DBA Fundamentals II (7)
Configuring the Database Archiving Mode
- The V$DATABASE view provides the current archiving state of the database, whether it is in ARCHIVELOG or NO ARCHIVELOG mode.
Oracle Recovery Manager Overview and Configuration
- The incarnations of the database are reported by the LIST command.
- The CONFIGURE command include specifying the maximum size of the backup piece and size of the backup set, specifying the default device type such as disk and tape, and specifying the parameters of the default retention policy such as recovery window and redundancy.






Oracle 9i Database -- DBA Fundamentals II (5)
Usage and Configuration of the Oracle Shared Server
- The dedicated server option is ideally suited for a scenario where the database will support a low number of clients and the clients will remain connected to the database for long periods of time.
- The SHARED_SERVER_SESSIONS initialization parameter specifies the total number of Oracle Shared Server user sessions that are allowed to be implemented. The limit placed on the number of shared server processes allows Oracle to reserve memory and CPU resources for dedicated user sessions.

Oracle 9i Database -- DBA Fundamentals II (4)
Basic Oracle Net Services Client-Side Configuration
- The tnsnames.ora file is used for local naming method. Host naming method, TCP/IP procotol has to be installed on both the client and the server. And identifies only one SID per node.
- An Oracle9i database’s service name refer to its global database name, which comprises the database name and the domain name.
- The local naming method can be configured by using Oracle Net Configuration Assistant. For Oracle versions 9i onwards, support for the SPX protocol is suspended.
- Oracle Names will not be supported as a valid naming method after 9i, Directory naming method is used.



Oracle 9i Database -- DBA Fundamentals II (3)
- The RELOAD command shuts down everything except listener address and reloads the listener.ora file, thus providing a mechanism to add or edit services without stopping the listener.
- The SET command of the listener control utility (LSNRCTL) makes change to the existing values of the listener parameters. The SAVE_CONFIG_ON_STOP command makes these changes permanent before the listener exits, provides that the related parameter is ON.
- LOG_STATUS defines whether logging of the listener is turned on or off. SET LOG_FILE is used to defined the file that will contain logging information for the listener. By default, the name of the listener log file is LISTENER.LOG.
- In the SERVICES command of the listener control utility, the services handlers current parameter specifies the number of client connections being handled by the listener at any given time.
- The QUEUESIZE param in a listener configuration specifies the number of expected concurrent connection requests, and is configured in the event of handling large volumes of concurrent connection requests.
- Connect-time failover auto forwards a client request to another instance. (Only in dynamic service registration)
- A listener of any previous version cannot be used with an Oracle 9i db




Oracle 9i Database -- DBA Fundamentals II (2)
- On the client side, Oracle Net maintains information about location of server, handles protocol support by monitoring the different protocols involved, and copes with connection interrupts and exceptions. However, its association with the listener is based on the server side. Oracle client stack consists of Oracle Call Interface (OCI), most database APIs like JDBC, Perl-DBI etc. interface with OCI. However, the Listener is part of Oracle Net server stack.
- During a database session, the client uses OCI to interact with the server, whereas the server uses OPI to interact with the client.


2007年7月13日 星期五
Oracle 9i DBA -- Oracle9i: DBA Fundamentals II (1Z0-032)
在考到OCA之後,接下來就要準備OCP的考試了。這門考試跟1z0-031一樣,相當的簡單,大概念完參考資料後就可以去應考了。接下幾篇文章為當初我準備考試的筆記,希望對大家有幫助。
以下是考試內容綱要:
Networking Overview
Basic Net Server-Side Configuration
Basic Oracle Net Services Client-Side Configuration
Usage and Configuration of the Oracle Shared Server
Instance and Media Recovery Structures
Configuring the Database Archiving Mode
Oracle Recovery Manager Overview and Configuration
User-Managed Backups
RMAN Backups
User-Managed Complete Recovery
RMAN Complete Recovery
User-Managed Incomplete Recovery
RMAN Incomplete Recovery
RMAN Maintenance
Recovery Catalog Creation and Maintenance
Transporting Data Between Databases
Loading Data into a Database
Oracle9i Database: Performance Tuning (10)
Other
n Unique compressed index -> default and max value for compression is “Num of columns in the index -
n Full table scans will place the blocks at the LRU end of the LRU list.
n A fully normalized tables often cause a high number of table joins
n EXECUTE dbms_shared_pool.keep('package_name') pin large objects in the library cache
n Make sure that there is free memory and no cache misses before setting the CURSOR_SPACE_FOR_TIME initialization parameter to TRUE
n LRU and the checkpoint queue are the two lists used to manage the blocks in the buffer cache
n V$SYSTEM_EVENT
Ø total waits for particular events
n V$SESSION_EVENT
Ø display information on waits for an event by session
n V$SESSTAT
Ø display user session statistics
n V$SYSSTAT
Ø the number of sorts in memory, sorts on disk, and rows being sorted
Ø the number of full table scans
n V$INSTANCE_RECOVERY display the number of redo blocks that need to be processed during recovery to satisfy FAST_START_IO_TARGET
n when dirty blocks are written to disk or when a server process is searching for blocks to write to required cache buffers LRU chain latches.
n UNDO_RETENTION initialization parameter specify the time in seconds to retain undo information
n breakable parse locks is held by a statement or PL/SQL object in the library cache for every object it references
n CATBLOCK.SQL creates the DBA_LOCKS and DBA_BLOCKERS views used by the UTLLOCKT.SQL script
n a row-exclusive lock on all the updated rows and a shared lock on the table
n Shared Row Exclusive lock no longer requires an index on the foreign key column in the child table because the implementation of referential integrity has changed
n When monitoring locks , two view DBA_WAITERS and DBA_BLOCKERS created by the CATBLOCK.SQL script displays information about who is holding or waiting for which tables
n use the OVERFLOW clause when creating an index-organized table to allow data that exceeds the index's PCTTHRESHOLD value to be stored in an OVERFLOW segment
n DBMS_SPACE.USED_SPACE use to find the high-water mark and the number of blocks above the high-water mark if analyzing the table is impossible
n Q. How can you calculate the size of the recycle pool? by totaling the buffer cache blocks used by the object or by using the physical reads statistics from a tracing pool


Oracle9i Database: Performance Tuning (9)
Oracle9i Database: Performance Tuning (8)
Monitoring and Detecting Lock Contention
- V$SYSSTAT will have its statistic ENQUEUE DEADLOCKS incremented each time a deadlock is detected and resolved
Tuning Oracle Shared Server
Application Tuning
- The hash value of the current SQL is compared with the Hash value of the SQLs already cached so that the current SQL can use its parsed version
Using Oracle Blocks Efficiently
- A partitioned table can have partitioned and/or non-partitioned indexes. Priviages for partitions are granted on the parent table or index and cannot be granted on individual partitions.Table that is a part of a cluster cannot be partitioned. CBO is used by default when an SQL statement accesses a partitioned table or index.
SQL Statement Tuning
- Histograms : used on the column that have non-uniformly distributed data. on the column that is used in the where clause of most of the queries. on the column that data does not change for a very long time. Should’t use on the column that use bind variables for comparsion.
Oracle9i Database: Performance Tuning (7)
Oracle9i Database: Performance Tuning (6)
Diagnosing Contention for Latches
- Cache buffer chains latch is accessed by server process when they are attempting to locate a data buffer cache. Wait for this latch indicates that some cached blocks are probably being repeatedly searched for in buffer cache.
- Cache Buffer LRU Chain latch is used to manage the blocks on the LRU list in the database buffer. This latch is used while the DBWn write the dirty buffers to the data files and when a server process is searching for a free buffer in the LRU list while reading data from data files.
- V$LATCH SPIN_GETS column : incremented when the latch is acquired on a spin after being unsuccessful
- The redo copy latch is accessed by the user’s server process when its redo records in the redo log buffer.
Oracle9i Database: Performance Tuning (5)
Oracle9i Database: Performance Tuning (4)
Oracle9i Database: Performance Tuning (3)
Sizing the Shared Pool
- V$librarycache è library cache hit ratio è Ratio = sum(PINHITS)/sum(PINS). Or (sum(PINS)- sum(RELOADS))/ sum(PINS)
Sizing the Buffer Cache
- Sized redo log file size so that v$system_event indicates no LOG FILE PARALLEL WRITE WAIT EVENT
- Database buffer cache store
Ø The rollback segments
Ø Temporary segments
Ø Clusters
Ø Database tables
Ø Index
Ø Large objects(LOB)


Oracle9i Database: Performance Tuning (2)
Diagnostic and Tuning Tools
- PERFSTAT is associated with STATSPACK
- DBSNMP is the user that connects intelligent agent with the database
- There are three types of statistics reported in the REPORT.txt file after running UTLESTAT.SQL
Ø Library cache statistics
Ø Buffer busy wait statistics
Ø Rollback contention statistics

Oracle9i Database: Performance Tuning (1)
- Scalability is a major factor to be considered in performance and tuning
- Data dictionary information is held in the memory for a long time than the library cache data. Good hit ratio rate in library cache imply acceptable hit ratios in the dictionary cache. Data dictionary cache misses are more expensive than library cache misses.


Oracle 9i DBA -- Oracle9i Database: Performance Tuning (1Z0-033)
這門考試是考OCP證照的最後ㄧ門考試,這們考試可以是難也可以是簡單,簡單的是內容不多,難的是相關考試資源沒有其他3門考試要來的多。隨後幾篇是當初準備考試的筆記,供大家參考;以下是此門考試的內容 :
- Overview of Oracle9i Performance Tuning
- Diagnostic and Tuning Tools
- Sizing the Shared Pool
- Sizing the Buffer Cache
- Sizing Other SGA Structures
- Database Configuration and I/O Issues
- Optimize Sort Operations
- Diagnosing Contention for Latches
- Tuning Rollback (UNDO) Segments
- Monitoring and Detecting Lock Contention
- Application Tuning
- Tuning Oracle Shared Server
- Using Oracle Blocks Efficiently
- SQL Statement Tuning
- Tuning Operating System and Using Resource Manager
- Other