High Availbility

OS & Virtualization

Wednesday, February 27, 2013

Installing Oracle on Solaris

How to Add Access to CD or DVD Media in a Non-Global Zone


7.Loopback mount the file system with the options ro,nodevices (read-only and no devices) in the non-global zone.
global# zonecfg -z my-zone
zonecfg:my-zone> add fs
zonecfg:my-zone:fs> set dir=/cdrom
zonecfg:my-zone:fs> set special=/cdrom
zonecfg:my-zone:fs> set type=lofs
zonecfg:my-zone:fs> add options [ro,nodevices]
zonecfg:my-zone:fs> end
zonecfg:my-zone> commit
zonecfg:my-zone> exit

8.Reboot the non-global zone.
global# zoneadm -z my-zone reboot

9.Use the zoneadm list command with the -v option to verify the status.
global# zoneadm list -v


Error Checking


ERROR Checking monitor: must be configured to display at least 256 colors >>> Could not execute auto check for
 display colors using command /usr/openwin/bin/xdpyinfo. Check if the DISPLAY variable is set. Failed <<<<
 Some requirement checks failed. You must fulfill these requirements before continuing with theinstallation, at which time they will be rechecked.

Solution(s):
 1. Install SUNWxwplt package
 2. Set DISPLAY variable
 3. Execute xhost + on target (set in DISPLAY) computer


Error : libXm.so.4 library might be missing otherwise. Proceed to check the status of the
package as shown in the previous example.
#
pkg info -r motif
#
pkg install motif

Monday, February 18, 2013

Copying & Moving Files efficiently with xargs

How to move and/or copy a subset of files from one directory

 
eg 1 zip files older than 10 days


 find . -type f -name '*.trc' -mtime +10 | xargs tar -cvzf bdump_$(date +%Y%m%d).gz.tar --remove-files

From time to time I need to move and/or copy a subset of files from one directory to another


 #-- delete
find . -type f -ctime -1 | xargs -i rm {}

 #-- COPY
find . -type f -ctime -1 | xargs -I '{}' cp {} /some/other/directory

 #-- MOVE
find . -type f -ctime -1 | xargs -I '{}' mv {} /some/other/directory

 

It is very easy to compress a Whole Linux/UNIX directory. It is useful to backup files, email all files, or even to send software you have created to friends. Technically, it is called as a compressed archive. GNU tar command is best for this work. It can be use on remote Linux or UNIX server. It does two things for you:
=> Create the archive
=> Compress the archive

You need to use tar command as follows (syntax of tar command):





 
 tar -zcvf archive-name.tar.gz directory-name




Friday, February 15, 2013

Installing Oracle Database 11g Release 2 on Oracle Solaris 11

 


I just finished installing Oracle database 11g Release 2 (11.2.0.3) on Oracle Solaris 11 and from what I experienced, Oracle Solaris 11 has a minimal package prerequisite requirement in order to install Oracle database 11g Release 2 (11.2.0.3) on Oracle Solaris 11. Most of the requirements from Solaris 10 has been integrated or consolidated into other packages which has reduced number of prerequisite packages needed in order to install Oracle database 11g Release 2



In order for remote DISPLAY to work on S11, you will need the following package: SUNWxwplt

root@s11_sparc# pkg install pkg://solaris/compatibility/packages/SUNWxwplt

You can now set the DISPLAY variable for the user installing Oracle database.







Regarding dependency on Motif and Xt libraries, you can set the toolkit as environment variable for the user installing the oracle database:

$ export AWT_TOOLKIT=XToolkit

(For more info on XToolkit, refer: http://docs.oracle.com/javase/1.5.0/docs/guide/awt/1.5/xawt.html)

Thats it! Now you should be able to proceed with Oracle database 11g Release 2 (11.2.0.3) installation on Solaris 11 server by running runInstaller

Thursday, February 14, 2013

Securing the Oracle Listener

The Oracle Database Listener is the database server software component that manages the network traffic between the Oracle Database and the client. The Oracle Database Listener listens on a specific network port (default 1521) and forwards network connections to the Database.

The listener is one of the most critical components to database operations;


  • It is responsible for the ability to have a client/server communication
  • In dedicated mode it is responsible for creating a new process (or thread on Windows) on behalf of the client and setting up the communications
  • On Windows each such server process actually speaks on a new tcpip port and the listener redirects the client to this port
  • On Unix streaming continues on the original port
    • The listener forks a new process
    • The listener then closes its own fd-s; the new process continues to speak on the fd-s
  • In MTS the listener is responsible to assign and set up the connection with the least loaded dispatcher. The dispatchers get requests from the client and place them on the request queues for the shared server processes, and read responses from the response queues to send to the client
  • How to set listener password


    Set the Listener password to stop most attacks and security issues. Setting the password manually in listener.ora using the PASSWORDS_ parameter will result in the password being stored in cleartext.


    LSNRCTL> set current_listener
    LSNRCTL> change_password Old password:

    New password:
    Reenter new password:

    LSNRCTL> set password Password:
    LSNRCTL> save_config


    Thursday, February 07, 2013

    MYSQL basic command

    MySQL Commands List


    Here you will find a collection of basic MySQL statements

    General Commands



     
     
    USE database_name
    Change to this database. You need to change to some database when you first connect to MySQL
    mysql>
    SELECT DATABASE();
    DESCRIBE table_name
     
    SET PASSWORD=PASSWORD('new_password')
     
    OPTIMIZE [table]
     
    SHOW variables
     
    SHOW DATABASES 
    Lists all MySQL databases on the system. To find out which database is currently selected, use the DATABASE() function
    show tables  [FROM database_name]
    Lists all tables from the current database or from the database given in the command
    SHOW FIELDS FROM table_name
     
    SHOW COLUMNS FROM table_name
    These commands all give a list of all columns (fields) from the given table, along with column type and other info.
    SHOW INDEX FROM table_name
    Lists all indexes from this tables.
    show open tables 
     
    show procedure status
     
    show function status
     
    show binary log
    Lists the binary log files on the server
    show master log
    Lists the binary log files on the server
     
     


    How to troubleshoot mysql database server high cpu usage/slowness

    1. Firstly find out what's causing server CPU high usage
      • vmstat 2 20top -b -n 5
    2. check mysql error log , slow query log etc from /etc/my.cnf
      • innodb_buffer_pool_size=20000M 
    3. mysql > show engine innodb status\G

    Other administration commands

    • display in vertical : -E, --vertical
    • variables : --print-defaults
    • save output : -tee=
    • save html : -H
    • alive : mysqladmin -p ping
    • status : mysqladmin -p ,
    • How to Find out current Status of MySQL server?
      • mysqladmin -u root -p extended-status
    • How to check MySQL version?
      • : mysqladmin -u root -p version
    • How to stop MYSQL?
      • : mysqladmin -p shutdown
    • How to set root password?
      • : mysqladmin -u root password YOURNEWPASSWORD
    • How to check all the running Process of MySQL server?
      • mysqladmin -u root -p processlist
    • How to kill a process

      • : mysqladmin kill id
    • How to create a job

    Configuration Files

    • my.cnf - usually located in /etc/my.cnf, /etc/mysql/my.cnf

    Directories

    • basedir ($MYSQL_HOME)
      - e.g. /opt/mysql-5.1.16-beta-linux-i686-glib23
    • datadir (defaults to $MYSQL_HOME/data)
    • tmpdir (important as mysql behaves unpredictability if full)
    • innodb_[...]_home_dir
      - mysql> SHOW GLOBAL VARIABLES LIKE '%dir'