Sunday, 6 October 2013

Install Oracle 11g Express (XE) on CentOS


http://www.davidghedini.com/pg/entry/install_oracle_11g_xe_on 


This post will cover basic installation and configuration of Oracle 11g Express Edition (XE) on CentOS.

We will also take a quick look at configuring Application Express (APEX) for 11g XE.

Basic installation is straight forward.

If you just want to get up and running, you can just do steps 1 to 4 below (and 10 and 11 for Apex). The remaining steps (5 to 9) cover basic backup, recovery, and performance configuration.

The full system requirements are here


Your CentOS box should have swap equal to 2xRAM.

On every CentOS installation I have done for XE, I just needed to update/install the packages for libaio, bc, and flex.

  1. [root@ms3 ~]#  yum install libaio bc flex  


Step 1: Download and Install Oracle 11g XE rpm



You can download the Oracle XE rpm, oracle-xe-11.2.0-1.0.x86_64.rpm.zip, from the OTN here

Unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip:

  1. [root@ms3 ~]# unzip -q oracle-xe-11.2.0-1.0.x86_64.rpm.zip  


This will create the directory Disk1. Change to the Disk1 directory:

  1. [root@ms3 ~]# cd Disk1  
  2. [root@ms3 Disk1]# ls  
  3. oracle-xe-11.2.0-1.0.x86_64.rpm  response  upgrade  


Install the rpm using rpm -ivh oracle-xe-11.2.0-1.0.x86_64.rpm

  1. [root@ms3 Disk1]# rpm -ivh oracle-xe-11.2.0-1.0.x86_64.rpm  
  2. Preparing...                ########################################### [100%]  
  3.    1:oracle-xe              ########################################### [100%]  
  4. Executing post-install steps...  
  5. You must run '/etc/init.d/oracle-xe configure' as the root user to configure the database.  
  6.   
  7. [root@ms3 Disk1]#  


Step 2: Configure 11g XE Database and Options



When installation completes, run '/etc/init.d/oracle-xe configure' to configure and start the database.

Unless you wish to change the ports, except the defaults and set SYS/SYSTEM password.

  1. [root@ms3 Disk1]# /etc/init.d/oracle-xe configure  
  2.   
  3. Oracle Database 11g Express Edition Configuration  
  4. -------------------------------------------------  
  5. This will configure on-boot properties of Oracle Database 11g Express  
  6. Edition.  The following questions will determine whether the database should  
  7. be starting upon system boot, the ports it will use, and the passwords that  
  8. will be used for database accounts.  Press <enter> to accept the defaults.  
  9. Ctrl-C will abort.  
  10.   
  11. Specify the HTTP port that will be used for Oracle Application Express [8080]:  
  12.   
  13. Specify a port that will be used for the database listener [1521]:  
  14.   
  15. Specify a password to be used for database accounts.  Note that the same  
  16. password will be used for SYS and SYSTEM.  Oracle recommends the use of  
  17. different passwords for each database account.  This can be done after  
  18. initial configuration:  
  19. Confirm the password:  
  20.   
  21. Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]:y  
  22.   
  23. Starting Oracle Net Listener...Done  
  24. Configuring database...Done  
  25. Starting Oracle Database 11g Express Edition instance...Done  
  26. Installation completed successfully.</enter>  


The installation created the directory /u01 under which Oracle XE is installed.


Step 3: Set the Environment



To set the required Oracle environment variables, use the oracle_env.sh the script included under cd /u01/app/oracle/product/11.2.0/xe/bin
  1. [root@ms3 Disk1]# cd /u01/app/oracle/product/11.2.0/xe/bin  


To set the environment for your current session run '. ./oracle_env.sh':

  1. [root@ms3 bin]# . ./oracle_env.sh  


To set the environment permanently for users, add the following to the .bashrc or .bash_profile of the users you want to access the environment:

  1. . /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh  


You should now be able to access SQL*Plus

  1. [root@ms3 bin]# sqlplus /nolog  
  2.   
  3. SQL*Plus: Release 11.2.0.2.0 Production on Wed Sep 21 08:17:26 2011  
  4.   
  5. Copyright (c) 1982, 2011, Oracle.  All rights reserved.  
  6.   
  7. SQL> connect sys/Password as sysdba  
  8. Connected.  
  9. SQL>  



Step 4: Allow Remote Access to Oracle 11g XE GUI



To allow remote access to Oracle 11g XE GUI (as well as Application Express GUI) issue the following from SQL*Plus

  1. SQL> EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);  
  2.   
  3. PL/SQL procedure successfully completed.  


You should now be able to access the Oracle 11g XE Home Page GUI at:

http://localhost:8080/apex/f?p=4950:1

Replace localhost above with your IP or domain as required.

Log in as SYSTEM using the password you selected in Step 2 above.


Step 5: Move the Flash Recovery Area (Fast Recovery Area)



To protect against disk failure, you should move the Flash Recovery Area to a separate disk.

This is actually now called the Fast Recovery Area, but the existing documentation still refers to it as the Flash Recovery Area

If a separate disk is not in your budget you should, at the very least, move the Flash Recovery Area to a partition other than the Oracle installation directory.

By default, the Fast Recovery Area will be located under /u01/app/oracle/fast_recovery_area

  1. SQL> show parameter DB_RECOVERY_FILE_DEST;  
  2.   
  3. NAME                                 TYPE        VALUE  
  4. ------------------------------------ ----------- ------------------------------  
  5. db_recovery_file_dest                string      /u01/app/oracle/fast_recovery_area  
  6. db_recovery_file_dest_size           big integer 10G  
  7. SQL>  
So, to move it elsewhere, first create the new directory

  1. [root@ms3 ~]# mkdir /opt/fra  


Change the owner to oracle and the group to dba

  1. [root@ms3 ~]# chown oracle:dba /opt/fra  


Now, change the DB_RECOVERY_FILE_DEST to the location you selected above.

  1. SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST = '/opt/fra';  
  2.   
  3. System altered.  
  4.   
  5. SQL>  
To move the files use the movelog.sql script:
  1. SQL> @?/sqlplus/admin/movelogs  
  2. SQL> SET FEEDBACK 1  
  3. SQL> SET NUMWIDTH 10  
  4. SQL> SET LINESIZE 80  
  5. SQL> SET TRIMSPOOL ON  
  6. SQL> SET TAB OFF  
  7. SQL> SET PAGESIZE 100  
  8. SQL> declare  
  9.   2     cursor rlc is  
  10.   3        select group# grp, thread# thr, bytes/1024 bytes_k  
  11.   4          from v$log  
  12.   5        order by 1;  
  13.   6     stmt     varchar2(2048);  
  14.   7     swtstmt  varchar2(1024) := 'alter system switch logfile';  
  15.   8     ckpstmt  varchar2(1024) := 'alter system checkpoint global';  
  16.   9  begin  
  17.  10     for rlcRec in rlc loop  
  18.  11    stmt := 'alter database add logfile thread ' ||  
  19.  12                 rlcRec.thr || ' size ' ||  
  20.  13                 rlcRec.bytes_k || 'K';  
  21.  14        execute immediate stmt;  
  22.  15        begin  
  23.  16           stmt := 'alter database drop logfile group ' || rlcRec.grp;  
  24.  17           execute immediate stmt;  
  25.  18        exception  
  26.  19           when others then  
  27.  20              execute immediate swtstmt;  
  28.  21              execute immediate ckpstmt;  
  29.  22              execute immediate stmt;  
  30.  23        end;  
  31.  24        execute immediate swtstmt;  
  32.  25     end loop;  
  33.  26  end;  
  34.  27  /  
  35.   
  36. PL/SQL procedure successfully completed.  
  37.   
  38. SQL>  
  39. SQL>  


Now, set an appropriate size for the Fast Recovery Area. Use df -h to insure that there is ample space.

  1. SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE = 20G;  
  2.   
  3. System altered.  


Verify the new location and size.

  1. SQL> show parameter DB_RECOVERY_FILE_DEST;  
  2.   
  3. NAME                                 TYPE        VALUE  
  4. ------------------------------------ ----------- ------------------------------  
  5. db_recovery_file_dest                string      /opt/fra  
  6. db_recovery_file_dest_size           big integer 20G  
  7. SQL>  


Step 6: Add Redo Log Members to Groups



You should have at least two Redo Log Groups and each group should have at least two members.

Additionally, the members should be spread across disks (or at least directories)

For whatever reason, only one member is created per group on install.

You can view the redo log files using SQL> SELECT * FROM V$LOGFILE;

Since the default location for the two members is the Flash Recovery Area, the two existing members have been moved to our new FRA.

You should now add an additional member for each group under /u01/app/oracle/oradata/XE

  1. SQL> ALTER DATABASE ADD LOGFILE MEMBER '/u01/app/oracle/oradata/XE/log1b.LOG' TO GROUP 1;  
  2.   
  3. Database altered.  
  4.   
  5. SQL> ALTER DATABASE ADD LOGFILE MEMBER '/u01/app/oracle/oradata/XE/log2b.LOG' TO GROUP 2;  
  6.   
  7. Database altered.  
  8.   
  9. SQL>  



Step 7: Set Sessions and Processes Parameters



The default values for parameters and sessions is quite low on the default installation.

  1. SQL> show parameters sessions;  
  2.   
  3. NAME                                 TYPE        VALUE  
  4. ------------------------------------ ----------- ------------------------------  
  5. java_max_sessionspace_size           integer     0  
  6. java_soft_sessionspace_limit         integer     0  
  7. license_max_sessions                 integer     0  
  8. license_sessions_warning             integer     0  
  9. sessions                             integer     172  
  10. shared_server_sessions               integer  
  11.   
  12. SQL> show parameters processes;  
  13.   
  14. NAME                                 TYPE        VALUE  
  15. ------------------------------------ ----------- ------------------------------  
  16. aq_tm_processes                      integer     0  
  17. db_writer_processes                  integer     1  
  18. gcs_server_processes                 integer     0  
  19. global_txn_processes                 integer     1  
  20. job_queue_processes                  integer     4  
  21. log_archive_max_processes            integer     4  
  22. processes                            integer     100  


You can increase these parameters.

After each change, you will need to restart the database.

Increase sessions and then bounce database.

  1. SQL> alter system set sessions=250 scope=spfile;  
  2.   
  3. System altered.  
  4.   
  5. SQL> shutdown immediate  
  6. Database closed.  
  7. Database dismounted.  
  8. ORACLE instance shut down.  
  9. SQL> startup  
  10. ORACLE instance started.  
  11.   
  12. Total System Global Area 1068937216 bytes  
  13. Fixed Size                  2233344 bytes  
  14. Variable Size             780143616 bytes  
  15. Database Buffers          281018368 bytes  
  16. Redo Buffers                5541888 bytes  
  17. Database mounted.  
  18. Database opened.  


Verify change to sessions parameter:

  1. SQL> show parameters sessions;  
  2.   
  3. NAME                                 TYPE        VALUE  
  4. ------------------------------------ ----------- ------------------------------  
  5. java_max_sessionspace_size           integer     0  
  6. java_soft_sessionspace_limit         integer     0  
  7. license_max_sessions                 integer     0  
  8. license_sessions_warning             integer     0  
  9. sessions                             integer     252  
  10. shared_server_sessions               integer  


Increase processes and restart database

  1. SQL> alter system set processes=200 scope=spfile;  
  2.   
  3. System altered.  
  4.   
  5. SQL>  
  6.   
  7.   
  8. Database dismounted.  
  9. ORACLE instance shut down.  
  10. SQL> startup  
  11. ORACLE instance started.  
  12.   
  13. Total System Global Area 1068937216 bytes  
  14. Fixed Size                  2233344 bytes  
  15. Variable Size             763366400 bytes  
  16. Database Buffers          297795584 bytes  
  17. Redo Buffers                5541888 bytes  
  18. Database mounted.  
  19. Database opened.  


Verify change to processes parameter:

  1. SQL>  show parameters processes;  
  2.   
  3. NAME                                 TYPE        VALUE  
  4. ------------------------------------ ----------- ------------------------------  
  5. aq_tm_processes                      integer     0  
  6. db_writer_processes                  integer     1  
  7. gcs_server_processes                 integer     0  
  8. global_txn_processes                 integer     1  
  9. job_queue_processes                  integer     4  
  10. log_archive_max_processes            integer     4  
  11. processes                            integer     200  
  12. SQL>  



Step 8: Enable Archivelog Mode



To enable online or "hot" backups, Archivelog Mode must be enabled.

Additionally, if you do not enable Archivelog Mode and take only offline or "cold" backups, should you need to restore the database you will only be able to restore to the last backup

To enable Archivelog Mode, shutdown the database and then startup mount:

  1. SQL> shutdown immediate  
  2. Database closed.  
  3. Database dismounted.  
  4. ORACLE instance shut down.  
  5. SQL> startup mount  
  6. ORACLE instance started.  
  7.   
  8. Total System Global Area 1068937216 bytes  
  9. Fixed Size                  2233344 bytes  
  10. Variable Size             763366400 bytes  
  11. Database Buffers          297795584 bytes  
  12. Redo Buffers                5541888 bytes  
  13. Database mounted.  


Enable Archivelog Mode

  1. SQL> alter database archivelog;  
  2.   
  3. Database altered.  


Open the database and verify that Archivelog Mode is enabled

  1. SQL> alter database open;  
  2.   
  3. Database altered.  
  4.   
  5. SQL>  
  6.   
  7. SQL> SELECT LOG_MODE FROM SYS.V$DATABASE;  
  8.   
  9. LOG_MODE  
  10. ------------  
  11. ARCHIVELOG  
  12.   
  13. SQL>  



Step 9: Create Online Backup Script



To create automated backups, you can modify the backup.sh included under /u01/app/oracle/product/11.2.0/xe/config/scripts

Create a directory for your backup script

  1. [root@ms3 ~]# mkdir /opt/ora_backup  


Change the owner to oracle and the group to dba

  1. [root@ms3 ~]# chown oracle:dba /opt/ora_backup  


Copy the backup.sh script from /u01/app/oracle/product/11.2.0/xe/config/scripts to the directory you created above.

  1. [root@ms3 ~]# cp  /u01/app/oracle/product/11.2.0/xe/config/scripts/backup.sh /opt/ora_backup/backup.sh  


Open the backup.sh script in a text editor or vi. The last section will look like this:
  1. else  
  2.    echo Backup of the database succeeded.  
  3.    echo Log file is at $rman_backup_current.  
  4. fi  
  5.  
  6. #Wait for user to press any key  
  7. echo -n "Press ENTER key to exit"  
  8. read userinp   


Change it to:

  1. else  
  2.    echo Backup of the database succeeded.  
  3.    echo Log file is at $rman_backup_current.  
  4.    mail -s 'Oracle Backup Completed' 'david@davidghedini.com' < /u01/app/oracle/oxe_backup_current.log  
  5. fi  
  6.  
  7. #Wait for user to press any key  
  8. #echo -n "Press ENTER key to exit"  
  9. #read userinp   


The line we added above, mail -s 'Oracle Backup Completed' 'david@davidghedini.com' < /u01/app/oracle/oxe_backup_current.log, will send us an email notification that the backup has completed as well as cat the backup log to the body of the email.

Note that we have also commented out the last two lines of the script (the prompt).

Create a cron job to run the script as user oracle.

You should run it at least once a day. With Archivelog Mode enabled, it is important that backups be taken regularly to prevent the Flash Recovery Area from filling.


Step 10: Oracle 11g XE and Application Express (APEX)



Oracle 11g Express Edition comes with Application Express 4.0.2 already installed.

If you elect to upgrade to the latest version (4.1 as of this writing), you can do so but will loose access to the XE GUI. Not a huge loss, but something to keep in mind.

Although Apex is already installed, you will need to set the Internal Admin password.

To do so, run the apxchpwd.sql located under /u01/app/oracle/product/11.2.0/xe/apex:

Note: pick something simple like Password123! as you will be prompted to change it on first log in anyways.

  1. SQL> @/u01/app/oracle/product/11.2.0/xe/apex/apxchpwd.sql  
  2. Enter a value below for the password for the Application Express ADMIN user.  
  3.   
  4.   
  5. Enter a password for the ADMIN user              []  
  6.   
  7. Session altered.  
  8.   
  9. ...changing password for ADMIN  
  10.   
  11. PL/SQL procedure successfully completed.  
  12.   
  13.   
  14. Commit complete.  
  15.   
  16. SQL>  


You can access the Application Express GUI at:

http://localhost:8080/apex/f?p=4550:1

Replace localhost above with your IP or domain as required.

Workspace: Internal
User Name: admin
Password: (whatever you selected above).

Alternatively, you can access via

http://localhost:8080/apex/f?p=4550:10 or http://localhost:8080/apex/apex_admin

Again, replace localhost above with your IP or domain as required.


Step 11: Oracle 11g XE: Configure EPG or Apex Listener



Unless you have a license for Oracle HTTP Server (OHS), your options are the embedded PLSQL Gateway (EPG) or Apex Listener.

The Application Express that comes installed with Oracle 11g XE is configured using the EPG.

While the EPG is simpler than Apex Listener, it can be painfully slow as of Apex 3.2.

Apex Listener, while quite fast, adds an extra layer of complexity.

You will need to install an application server to run Apex Listener.

I have run Apex Listener on both Tomcat (unsupported) as well as Oracle GlassFish 3.x (supported) and was not impressed with either.

A lot of people who know far more than I do about APEX (read: 99.9999% of the population) like the Apex Listener.

Apex Listener and it's installation guide can be found here.

The Apex Listener installation guide is well done and simple to follow.

If you need to install Oracle GlassFish or GlassFish CE (basic installation is the same), you can use my GlassFish 3.1 instructions here.

If you want to be an outlaw and use Tomcat, you can use my Tomcat 6 installation guide here. or my Tomcat 7 installation guide here..

Sunday, 7 July 2013

Linux command (yum)

NAME

       yum - Yellowdog Updater Modified


SYNOPSIS

       yum [options] [command] [package ...]


DESCRIPTION

       yum  is  an interactive, automated update program which can be used for
       maintaining systems using rpm

       command is one of:
        * install package1 [package2] [...]
        * update [package1] [package2] [...]
        * check-update
        * upgrade [package1] [package2] [...]
        * remove | erase package1 [package2] [...]
        * list [...]
        * info [...]
        * provides | whatprovides feature1 [feature2] [...]
        * clean [ packages | headers | metadata | cache | dbcache | all ]
        * makecache
        * groupinstall group1 [group2] [...]
        * groupupdate group1 [group2] [...]
        * grouplist [hidden]
        * groupremove group1 [group2] [...]
        * groupinfo group1 [...]
        * search string1 [string2] [...]
        * shell [filename]
        * resolvedep dep1 [dep2] [...]
        * localinstall rpmfile1 [rpmfile2] [...]
        * localupdate rpmfile1 [rpmfile2] [...]
        * deplist package1 [package2] [...]

       Unless the --help or -h option is given, one of the above commands must
       be present.


       install
              Is  used  to install the latest version of a package or group of
              packages while ensuring that all dependencies are satisfied.  If
              no  package  matches the given package name(s), they are assumed
              to be a shell glob and any matches are then installed.


       update If run without any packages, update will update every  currently
              installed  package.   If one or more packages are specified, Yum
              will only update the listed packages.  While updating  packages,
              yum  will  ensure  that  all  dependencies are satisfied.  If no
              package matches the given package name(s), they are  assumed  to
              be a shell glob and any matches are then installed.

              If  the  --obsoletes  flag  is  present yum will include package
              obsoletes in its calculations - this makes it  better  for  dis-
              tro-version  changes,  for example: upgrading from somelinux 8.0
              to somelinux 9.


       check-update
              Implemented so you could know if your machine  had  any  updates
              that  needed  to  be  applied  without running it interactively.
              Returns exit value of 100 if there are packages available for an
              update.  Also  returns  a list of the pkgs to be updated in list
              format. Returns 0 and no packages are available for update.


       upgrade
              Is the same as the update command with the --obsoletes flag set.
              See update for more details.


       remove or erase
              Are  used  to  remove  the specified packages from the system as
              well as removing any packages which depend on the package  being
              removed.


       list   Is  used  to  list various information about available packages;
              more complete details are available in the List Options  section
              below.


       provides or whatprovides
              Is used to find out which package provides some feature or file.
              Just use a specific name or a file-glob-syntax wildcards to list
              the packages available or installed that provide that feature or
              file.


       search Is used to find any packages matching a string in  the  descrip-
              tion,  summary, packager and package name fields of an rpm. Use-
              ful for finding a package you do not know by name  but  know  by
              some word related to it.


       info   Is  used  to  list  a  description and summary information about
              available packages; takes the same  arguments  as  in  the  List
              Options section below.


       clean  Is  used  to clean up various things which accumulate in the yum
              cache directory over time.  More complete details can  be  found
              in the Clean Options section below.


       shell  Is  used  to enter the ’yum shell’, when a filename is specified
              the contents of that file is executed in  yum  shell  mode.  See
              yum-shell(8) for more info


       resolvedep
              Is  used  to list packages providing the specified dependencies,
              at most one package is listed per dependency.


       localinstall
              Is used to install a set of local rpm  files.  If  required  the
              enabled repositories will be used to resolve dependencies.


       localupdate
              Is used to update the system by specifying local rpm files. Only
              the specified rpm files of which an  older  version  is  already
              installed  will  be  installed, the remaining specified packages
              will be ignored.  If required the enabled repositories  will  be
              used to resolve dependencies.


       deplist
              Produces  a  list  of all dependencies and what packages provide
              those dependencies for the given packages.




GENERAL OPTIONS

       Most command line options can be set using the  configuration  file  as
       well  and  the descriptions indicate the necessary configuration option
       to set.


       -h, --help
              Help; display a help message and then quit.

       -y     Assume yes; assume that the answer to any question  which  would
              be asked is yes.
              Configuration Option: assume-yes

       -c [config file]
              Specifies the config file location - can take http, ftp urls and
              local file paths.

       -d [number]
              Sets the debugging level to [number] -  turns  up  or  down  the
              amount of things that are printed. Practical range: 0 - 10
              Configuration Option: debuglevel

       -e [number]
              Sets the error level to [number] Practical range 0 - 10. 0 means
              print only critical errors about which you must be told. 1 means
              print  all  errors,  even ones that are not overly important. 1+
              means print more errors (if any) -e 0 is good for cron jobs.
              Configuration Option: errorlevel

       -R [time in minutes]
              Sets the maximum amount of time yum will wait before  performing
              a command - it randomizes over the time.

       -C     Tells  yum  to  run  entirely  from cache - does not download or
              update any headers unless it has to  to  perform  the  requested
              action.

       --version
              Reports the yum version number and exits.

       --installroot=root
              Specifies  an  alternative  installroot,  relative  to which all
              packages will be installed.
              Configuration Option: installroot

       --enablerepo=repoidglob
              Enables specific repositories by id or glob that have been  dis-
              abled in the configuration file using the enabled=0 option.
              Configuration Option: enabled

       --disablerepo=repoidglob
              Disables specific repositories by id or glob.
              Configuration Option: enabled

       --obsoletes
              This  option  only  has  affect  for an update, it enables yum´s
              obsoletes processing logic. For more information see the  update
              command above.
              Configuration Option: obsoletes

       --exclude=package
              Exclude  a  specific package by name or glob from updates on all
              repositories.
              Configuration Option: exclude

       --noplugins
              Run with all plugins disabled.
              Configuration Option: plugins



LIST OPTIONS

       The following are the ways which you can invoke yum in list mode.  Note
       that  all list commands include information on the version of the pack-
       age.


       yum list [all | regexp1] [regexp2] [...]
              List all available and installed packages.

       yum list available [regexp1] [...]
              List all packages  in  the  yum  repositories  available  to  be
              installed.


       yum list updates [regexp1] [...]
              List  all  packages  with updates available in the yum reposito-
              ries.


       yum list installed [regexp1] [...]
              List the packages specified by args.  If an  argument  does  not
              match  the  name  of an available package, it is assumed to be a
              shell-style glob and any matches are printed.


       yum list extras [regexp1] [...]
              List the packages installed on the system that are not available
              in any yum repository listed in the config file.


       yum list obsoletes [regexp1] [...]
              List  the packages installed on the system that are obsoleted by
              packages in any yum repository listed in the config file.


       yum list recent
              List packages recently added into the repositories.


       Specifying package names
              All the list options mentioned above take file-glob-syntax wild-
              cards or package names as arguments, for example yum list avail-
              able foo* will list all available packages that match foo*.




CLEAN OPTIONS

       The following are the ways which you can invoke yum in clean mode.


       yum clean packages
              Eliminate any cached packages from the system.  Note that  pack-
              ages are not automatically deleted after they are downloaded.


       yum clean headers
              Eliminate  all  of  the  files  which  yum uses to determine the
              remote availability of packages. Using this  option  will  force
              yum to download all the headers the next time it is run.


       yum clean all
              Runs yum clean packages and yum clean headers as above.




MISC

       Specifying package names
              A  package can be referred to for install,update,list,remove etc
              with any of the following:

              name
              name.arch
              name-ver
              name-ver-rel
              name-ver-rel.arch
              name-epoch:ver-rel.arch
              epoch:name-ver-rel.arch

              For example: yum remove kernel-2.4.1-10.i686




PLUGINS

       Yum can be extended through the use of plugins. A plugin  is  a  Python
       ".py"  file  which  is installed in one of the directories specified by
       the pluginpath option in yum.conf. For a plugin to work, the  following
       conditions must be met:

       1.  The plugin module file must be installed in the plugin path as just
       described.

       2. The global plugins option in /etc/yum.conf must be set to ‘1’.

       3. A configuration file for the plugin must exist  in  /etc/yum/plugin-
       conf.d/<plugin_name>.conf and the enabled setting in this file must set
       to ‘1’. The minimal content for such a configuration file is:

              [main]
              enabled = 1

       See the yum.conf(5) man page for more  information  on  plugin  related
       configuration options.




FILES

       /etc/yum.conf
       /etc/yum/repos.d/
       /etc/yum/pluginconf.d/
       /var/cache/yum/




SEE ALSO

       yum.conf (5)
       http://linux.duke.edu/yum/




AUTHORS

       See the Authors file included with this program.




BUGS

       There  of  course  aren’t any bugs, but if you find any, they should be
       sent  to  the  mailing  list:  yum@lists.linux.duke.edu  or  filed   in
       bugzilla.

Friday, 21 June 2013

Hosts file location on various platform

Windows 7:         %systemroot%\system32\drivers\etc\
                        or, c:\windows\system32\drivers\etc\

 where,
 %systemroot% is usually c:\windows unless you installed Windows on a different partition.

Tuesday, 11 June 2013

How to Enable Telnet Client in Windows 7

Telnet Client is used to connect to remote machine by using the Telnet protocol. For example, I'm an old fashion IT guy, and I still like to configure Cisco Switches/Routers using telnet. If you started to use Windows 7, you will notice that telnet is not enabled by default !! Don't panic, it is just a matter of few clicks and telnet will be enabled again.
Telnet Client allows a computer to connect to a remote Telnet server and run applications on that server. Once logged on, a user is given a command prompt that can be used as if it had been opened locally on the Telnet server's console. Commands that you type at the Telnet client command prompt are sent to the Telnet Server and executed there, as though you were locally logged on to a command prompt session at the server. Output from the commands that you run are sent back to the Telnet client where they are displayed for you to view.

When you first try to run a telnet command, Windows will informs you that telnet is not recognized as a command




To enable Telnet Client on Windows 7, follow these steps :
  1. Click on Start    then right click on Control Panel

  2. From Control Panel, click on Programs

  3. Under Programs and Features, click on Turn Windows Features on or off

  4. From the Windows Features window, using the slider, scroll down till you reach Telnet Client, select the checkbox beside it, then click on OK



    The selected feature will be installed.



    Once it is installed, the Windows Features windows will be closed.
  5. To confirm that Telnet is installed, open command prompt and type telnet /?



Summary

By default, Telnet Client is not enabled in Windows 7. To enable it, you have to add the Telnet Client Windows Feature.

Another Method:
  • Open a command prompt window.
  • Click Start,type cmd in start search box, and then press Enter.
  • Type the following command
pkgmgr /iu:"TelnetClient"
  • If the User Account Control(UAC) dialog box appears, confirm that the action it displays is want you want, and then click continue.
  • When the command prompt appears again, the installation is complete

Friday, 26 April 2013

ORACLE Export/Import






Oracle Import :

imp
Username:.......
Password:.......
Import data Only: no
Import file: EXPDAT.DMP
List contents of import file only (yes/no): no > no
Ignore create error due to object existence:>no
Import grants>yes
Import table data>yes
Import entire export file>no
Username:........


[root@fws Desktop]# cd /opt
[root@fws opt]# source /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh
[root@fws opt]# ls
Disk1                             New Text Document.txt
f101(1).sql                       oracle-xe-11.2.0-1.0.x86_64.rpm
f111(4).sql                       putty.rpm
image.sql                         rh
libaio-0.3.109-5.fc17.x86_64.rpm  SAJIB(1.oct.13).sql
lsnrctl status                    SAJIB.5.oct.13.DMP
lsnrctl status~                   teamviewer_linux.rpm
[root@fws opt]# imp

Import: Release 11.2.0.2.0 - Production on Tue Oct 8 03:51:27 2013

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

Username: system
Password:

Connected to: Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

Import data only (yes/no): no > no

Import file: expdat.dmp > SAJIB.5.oct.13.DMP

Enter insert buffer size (minimum is 8192) 30720>

Export file created by EXPORT:V11.02.00 via conventional path

Warning: the objects were exported by SAJIB, not by you

import done in AL32UTF8 character set and AL16UTF16 NCHAR character set
List contents of import file only (yes/no): no > no

Ignore create error due to object existence (yes/no): no > no

Import grants (yes/no): yes > yes

Import table data (yes/no): yes > yes

Import entire export file (yes/no): no > no
Username: sajib

Enter table(T) or partition(T:P) names. Null list means all tables for user
Enter table(T) or partition(T:P) name or . if done:

. importing SAJIB's objects into SAJIB
. . importing table              "ADD_STOCK_FIBER"          4 rows imported
. . importing table                    "APEX$_ACL"          0 rows imported
. . importing table               "APEX$_WS_FILES"          0 rows imported
. . importing table             "APEX$_WS_HISTORY"          0 rows imported
. . importing table               "APEX$_WS_LINKS"          0 rows imported
. . importing table               "APEX$_WS_NOTES"          0 rows imported
. . importing table                "APEX$_WS_ROWS"          0 rows imported
. . importing table                "APEX$_WS_TAGS"          0 rows imported
. . importing table      "APEX$_WS_WEBPG_SECTIONS"          0 rows imported
. . importing table "APEX$_WS_WEBPG_SECTION_HISTORY"          0 rows imported
. . importing table          "APEX_ACCESS_CONTROL"         42 rows imported
. . importing table            "APEX_ACCESS_SETUP"          2 rows imported
. . importing table                          "BAF"         20 rows imported
. . importing table                          "BZB"         38 rows imported
. . importing table                         "CEPZ"         61 rows imported
. . importing table                          "CGB"         57 rows imported
. . importing table                         "CHKB"         59 rows imported
. . importing table                         "CHMB"          0 rows imported
. . importing table                         "CHWB"          0 rows imported
. . importing table               "DEMO_CUSTOMERS"          7 rows imported
. . importing table                  "DEMO_ORDERS"         10 rows imported
. . importing table             "DEMO_ORDER_ITEMS"         49 rows imported
. . importing table            "DEMO_PRODUCT_INFO"         10 rows imported
. . importing table                  "DEMO_STATES"         51 rows imported
. . importing table                   "DEMO_USERS"          2 rows imported
. . importing table                         "DEPT"          4 rows imported
. . importing table                         "DWHB"         67 rows imported
. . importing table                          "EMP"         14 rows imported
. . importing table                          "FGB"          0 rows imported
. . importing table                          "FWT"         29 rows imported
. . importing table                          "GEC"         71 rows imported
. . importing table                           "HQ"        332 rows imported
. . importing table                         "IMGB"         41 rows imported
. . importing table                         "KEPZ"         26 rows imported
. . importing table                          "KGB"          1 rows imported
. . importing table                          "KSB"         79 rows imported
. . importing table                          "LKB"         35 rows imported
. . importing table                       "MCOURT"          0 rows imported
. . importing table                          "MEB"         31 rows imported
. . importing table                          "MGB"         19 rows imported
. . importing table                          "NGB"         41 rows imported
. . importing table                          "NKB"        146 rows imported
. . importing table                          "PLB"         64 rows imported
. . importing table              "RADIO_LINK_INFO"         49 rows imported
. . importing table                           "SI"          0 rows imported
. . importing table                          "SPB"          1 rows imported
. . importing table                  "STOCK_FIBER"          6 rows imported
. . importing table                  "SWITCH_INFO"         56 rows imported
. . importing table                       "TEST10"          1 rows imported
. . importing table                  "UNIQUE_TEST"          4 rows imported
About to enable constraints...
Import terminated successfully without warnings.
[root@fws opt]#

Wednesday, 24 April 2013

Oracle-ARCHIVELOG

command on command Prompt:
...............................
sqlplus /nolog
connect / as sysdba

or sqlplus / as sysdba


Backing Up and Recovering:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>



***Enabling ARCHIVELOG Mode for Media Failure Protection:***
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

>sqlplus / as sysdba
>select log_mode from v$database;
>SHUTDOWN IMMEDIATE
>STARTUP MOUNT
>ALTER DATABASE ARCHIVELOG;
>ALTER DATABASE OPEN;
>exit;



***Flash Recovery Area***
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Two parameters:
* DB_RECOVERY_FILE_DEST and
* DB_RECOVERY_FILE_DEST_SIZE

Flash Recovery Area Default Location:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Linux:    /usr/lib/oracle/xe/app/oracle/flash_recovery_area/
Windows:  c:\oraclexe\app\oracle\flash_recovery_area/

To change the flash recovery area location:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

>sqlplus /as sysdba
>ALTER SYSTEM SET DB_RECOVERY_FILE_DEST = 'new_path';
>@?/sqlplus/admin/movelogs
Example:(for windows)
>ALTER SYSTEM SET DB_RECOVERY_FILE_DEST = 'E:\FRA';
>@?/sqlplus/admin/movelogs

 "C:\oraclexe\app\oracle\product\11.2.0\server/sqlplus/admin/movelogs.sql"



To Changing the Flash Recovery Area Size:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE = new_size;
>exit;
Example:
>ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE = 20G;
>exit;



Monitoring Location & Space in the Flash Recovery Area:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


SELECT
NAME,
TO_CHAR(SPACE_LIMIT, '999,999,999,999') AS SPACE_LIMIT,
TO_CHAR(SPACE_LIMIT - SPACE_USED + SPACE_RECLAIMABLE, '999,999,999,999')
AS SPACE_AVAILABLE,
ROUND((SPACE_USED - SPACE_RECLAIMABLE)/SPACE_LIMIT * 100, 1)
AS PERCENT_FULL
FROM V$RECOVERY_FILE_DEST;


Restoring and Recovering the Database:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

> On Windows: Click Start, point to Programs (or All Programs), point to
Oracle Database 11g Express Edition, and then select Restore Database.

> On Linux with Gnome: In the Applications menu, point to Oracle Database
11g Express Edition, and then select Restore Database.

> On Linux with KDE: Click the icon for the K Menu, point to Oracle Database
11g Express Edition, and then select Restore Database.






Saturday, 20 April 2013

Setting Enviroment Variables on Linux platform for Oracle

Setting Enviroment Variables on Linux platform

For Bourne,Korn or Bash shell

>source /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh

For C shell:
>source /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.csh

 not path for 11g2

>source /usr/lib/oracle/xe/app/oracle/product/11.2.0/server/bin/oracle_env.sh



For Remote login

SQL>EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);

[sajib@fws ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 05-OCT-2013 22:33:15

Copyright (c) 1991, 2011, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date                05-OCT-2013 22:01:03
Uptime                    0 days 0 hr. 32 min. 12 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Default Service           XE
Listener Parameter File   /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/fws/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=::1)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully



[sajib@fws ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Sat Oct 5 22:34:37 2013

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


Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

SQL> select status from v$instance;

STATUS
------------
OPEN

SQL> select open_mode from v$database;

OPEN_MODE
--------------------
READ WRITE

Check HTTP Port:


SQL>SELECT DBMS_XDB.GETHTTPPORT FROM DUAL;

-- If the above returns 0 then run this

Set HTTP Port:

EXEC DBMS_XDB.SETHTTPPORT(8080);

 SQL>SELECT LOG_MODE FROM SYS.V$DATABASE;

 ARCHIVELOG  or  NO ARCHIVELOG

SQL> select dbms_xdb.gethttpport from dual;

GETHTTPPORT
-----------
       8080


SQL> show parameter DB_RECOVERY_FILE_DEST;

NAME                     TYPE     VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest             string     /u01/app/oracle/fast_recovery_
                         area
db_recovery_file_dest_size         big integer 10G


SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE = 50G;

System altered.

SQL> show parameter DB_RECOVERY_FILE_DEST;

NAME                     TYPE     VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest             string     /u01/app/oracle/fast_recovery_
                         area
db_recovery_file_dest_size         big integer 50G



SQL> SELECT LOG_MODE FROM SYS.V$DATABASE;

LOG_MODE
------------
NOARCHIVELOG

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area  622149632 bytes
Fixed Size            2229048 bytes
Variable Size          394267848 bytes
Database Buffers      222298112 bytes
Redo Buffers            3354624 bytes
Database mounted.
SQL> alter database archivelog;

Database altered.

SQL> alter database open;

Database altered.

SQL> SELECT LOG_MODE FROM SYS.V$DATABASE;

LOG_MODE
------------
ARCHIVELOG

[root@fws Desktop]# lsnrctl status

LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 08-OCT-2013 02:57:19

Copyright (c) 1991, 2011, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date                08-OCT-2013 02:36:40
Uptime                    0 days 0 hr. 20 min. 41 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Default Service           XE
Listener Parameter File   /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/fws/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=fws.colbd.com)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=fws.colbd.com)(PORT=8080))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "XE" has 1 instance(s).
  Instance "XE", status READY, has 1 handler(s) for this service...
Service "XEXDB" has 1 instance(s).
  Instance "XE", status READY, has 1 handler(s) for this service...
The command completed successfully
[root@fws Desktop]#



 expdp system schemas=sajib directory=dmpdir dumpfile=sajib.dmp logfile=expsajib.log

expdp system/051502718 schemas=sajib directory=dmpdir dumpfile=expsajib.dmp logfile=expsajib.log

EXPORT COMMAND
for Full Data Mode:
exp full=y file=dba.dmp grants=y rows=y
exp full=y file=dba.dmp log=dba.log

for User Mode:
exp sajib/sajib file=sajib.dmp owner=sajib grants=y rows=y compress=y log=sajib.log

IMPORT COMMAND

imp full=y ignore=y file=expdat.dmp

Thursday, 18 April 2013

How do I stop firewall?


Start Iptables under Linux


Q. How do I start Iptables firewall under RHEL / Red Hat / CentOS / Fedora Linux from a shell prompt? How do I stop firewall?

A. First, you need to configure firewall rules by editing text file located at /etc/sysconfig/iptables. You can also use setup command to configure firewall. Just type the following as root user:

# setup

Select Firewall configuration and just follow on screen instructions.
Once configuration is updated type the following command at a shell prompt:

To start firewall from a shell enter:

# chkconfig iptables on
# service iptables start

To stop firewall, enter:

# service iptables stop



For Details about iptables:
http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch14_:_Linux_Firewalls_Using_iptables#.UXFvBMr0nIV