Tuesday, May 11, 2010

Download Oracle Softwares Using Wget and Browser



Oracle softwares can be downloaded for free for developing and prototyping your applications (or for strictly self-educational purposes) from its download site. Please read the Development License term for more details. (http://www.oracle.com/technology/software/index.html)
 To download the software, you first need to create an Orcale (some time call Oracle Technology Network) user account here.(https://login.oracle.com/mysso/signon.jsp). Please note, it is different from a MetaLink Support account and MetaLink account can be used as well.  Following show two different ways of downloading the softwares.

1. Download Using Web Browser

It is easy to download using Web Browser. Just select the software from the download list, accept the license agreement, and download and save the software from the browser.

2. Download Using Linux Wget

If you are installing the software in a Linux box or don’t not have access to a browser, you can use wget
(http://www.gnu.org/software/wget/) to donwload the software. The syntax to download using wget is:

wget -vv --post -data="remoteIp=globalId=&redirectUrl=username=&password=&submit=Continue" https://profile.oracle.com/jsp/reg/loginHandler.jsp -o

Where:
remote IP = ip address of the server where wget is issued
login id = oracle account login id
password=oracle account password.
Log file = log file which can use to log information for the download. Just pick a file name.
download path and file name = the directory and file name of the file you want to download.
 
To get the download path and file name information, try to download the file from a browser. After starting the download, copy the url from the browser and past it on the notepad. For example, assuming your want to download database 10g, the url you copy will look like this:

https://profile.oracle.com/jsp/realms/otnLogin.jsp?remoteIp=192.168.1.1&globalId=&redirectUrl=http%3a%2f%2fdownload-llnw.oracle.com%3a80%2fotn%2flinux%2foracle10g%2f10201%2f10201_database_linux32.zip

And the download path and file is:
http%3a%2f%2fdownload-llnw.oracle.com%3a80%2fotn%2flinux%2foracle10g%2f10201%2f10201_database_linux32.zip

For example, to download the  database 10g (10.0.2.1); and, remote IP = 192.168.1.1, oracle account id = bobsmith, password = password and log file = ora.log. The wget command is:

wget -vv --post-data="remoteIp=192.168.1.1&globalId=&redirectUrl=http:%2F%2Fdownload-llnw.oracle.com:80%2fotn%2flinux%2foracle10g%2f10201%2f10201_database_linux32.zip&username=bobsmith&password=password&submit=Continue" https://profile.oracle.com/jsp/reg/loginHandler.jsp -o ora.log

Please note, --post-data is one parameter.
Check the log file for error after the download to make sure a completed file was downloaded.

References:
Related Post:

MySQL: Startup MySQL Server Failed

Starting MySQL/etc/init.d/mysql: line 159: kill: (9193) - No such process [FAILED]

When tried to start the MySQL server ( v. 5.0.51a, in RedHat Linux 4) using /etc/init.d/mysql start, I got the following error message and the server failed to start.

#>/etc/init.d/start
Starting MySQL/etc/init.d/mysql: line 159: kill: (9193) - No such process [FAILED]

Unforturalely, there was not error in the error log to tell what caused the problem. After some debugging, it turned out, it was because there was one of the server variable, which was added to the my.cnf file after the last successfull server start, was not supported. The server variable was:

    open_file_limit

After command out this variable in the my.cnf file, there server started without problem,

In general, if there is any variable which was wrongly entered (misspelled, for example) in the my.cnf file, the server will fail to start. However, there will not be any error message in the error log to inform the user what cause the error.
References:
Related Post:

MySQL: query_cache_size

MySQL Query Cache Variable: query_cache_size

The query cache in MySQL stores the text of SELECT statement as well as its result set. If an identical query is sent to the server later, the server retrieves the result set from the query cache instead parsing and exciting the query again. Therefore, it reduces time and resource that need to execute the query. However, please note that Query Cache only works for identical queries (exactly the same). For example, the following two queries are not considered identical:


Select city, state, zip from address where city = ‘new york’
Vs.
Select city, state, zip from address where city = ‘NEW YORK’

These two queries are also not considered identical:

Select city, state, zip from address where city = ‘NEW YORK’
Vs.
SELECT city, state, zip from address WHERE city= NEW YORK’

Because one use lower case clause word (select and where) and the other use upper case clause (SELECT and WHERE). Also, the cache is not used for queries of the following types:
· Queries that are a subquery of an outer query
· Queries executed within the body of a stored function, trigger, or event

(1.) Query Cache Variables

The following are server variables need to be set to make use of the query cache.

1. Have_query_cache: this variable indicates where or not query cache is available. The default is ‘Yes’ for standard installation.
2. Query_cahce_type: this variable sets the query cache type. It can be set in global and session level. The values for this variable can be 0,1 or 2:
  •  0 - tells the server not to cache results or retrieve results from the query cache. However, this setting dose not deallocate the query cache buffer. Refer to query_cache_size section for how to allocate the query cache buffer.
  •  1 – tells the server to cache all queries except for those that begin with select sql_no_cache. The default for Query_cahce_type is 1.
  •  2 – tells the server to cache query results only for queries that begin with select sql_cache.
3. Query_cache_size: this variable sets the amount of memory allocated for caching query result sets. To disable or deallocate the query cache, set this variable value to 0, which is also the default. Please note that memory are allocated for query cache regardless if Query_cahce_type is set to 0 or not if query_cache_size variable is set to 40960 bytes or more. If the value is set to less than 40960, the server will reset the query_cache_size variable to 0 and place a warning message in the error log.

4. query_cache_min_res_unit: this variable sets the minimum size (in bytes) for) blocks allocated by the query cache. The default value is 4KB. According to the MySQL Manual, this should be adequate for most case. The query cache allocates blocks for storing query results by allocating memory blocks set by the query_cache_min_res_unit variable. If there are many queries with small result sets, the default block size may lead to memory fragmentation; moreover, it can force the query cache to prune (delete) queries from the cache due to lack of memory. In this case, you should decrease the value of the query_cache_min_res_unit variable.

5. Query_cache_limit: this variable sets the maximum size result set that the query cache will store. The default is 1MB.

(2.) Query Cache Status Variables and Monitoring
  1. Qcache_free_memory: this status variable shows that amount of free memory for query cache. If the amount is low in comparing to the amount of the Query_cache_size, memory may be added to the Query_cache_size.
  2. Qcache_not_cached: this status displays the number of queries that were not cached. Not all the queries are cacheable such as a non-select query.
  3. Qchache_queries_in_cache: this status display the number of queries registered in the query cache.
  4. Qcache_total_blocks: this status displays the total number of blocks in the query cache.
  5. Qcache_hits: this status variable displays the number of query cache hits
  6. Qcache_inserts: this status variable displays the number of queries added to the query cache.
  7. Com_select: this status display number of times a select statement has been executed. If a query result is returned from query cache, the server increments the Qcache_hits status variable, not Com_select.
              Com_select = (Qcache_inserts + Qcache_not_cached + queries with errors found during the
                                       column-privileges check)
              The total number of SELECT queries = ( Com_select + Qcache_hits + queries with
                                                                                    errors found  by parser)
              The total number of successfully executed SELECT queries = ( Com_select + Qcache_hits )

              Query cache utilization = (Qcache_hits/ total number of successfully executed SELECT queries)
                          Or
               Query cache utilization = (Qcache_hits/( Com_select + Qcache_hits ))

           Please note that it all depends on the kind of applications, the % Query cache utilization will be
           different.

    8. Qcache_free_blocks: this variable display the number of free memory blocks in the query cache.
    9. Qcache_lowmem_prunes: this status displays the number of queries that were deleted from the query
        cache because of low memory. This status variable value also increases if the cache is not big enough to
        hold the query statements. Also, this variable increase if there were many small query results sets which
        indicates memory fragmentation. If the qcache_lowmem_prunes status variable is greater than 0,
        consider increasing the query_cache_size dynamically and monitor the Qcache_lowmem_prunes status
        variable to make sure that it stop increase.

 (3.) MySQL Commands
To determine if or not the query cache has become fragmented, you can execute the FLUSH QUERY CACHE statement to defragment the cache... After issuing the statement, only a single free block remains. This command dose not removes queries from the cache.

To remove all the queries from the cache, use the RESET QUERY CACHE command.

Some other considerations need to be given when setting up Query Cache. As the size of the query cache grows, it will take longer to scan for matching queries, take longer to retrieve the result sets, and increase mutex contention.

References:
Related Posts: