Posts

Showing posts with the label Database

Installation of Oracle Database 11g-R2

Image
Oracle Express Edition can be distributed and can be used to provide third party demonstration and training. (all the above information is taken from  oracle.com ) Prerequisites Software: VMware Workstation ( VMware Workstation Link ) Oracle Enterprise Linux ( Oracle Enterprise Linux Link ) Oracle Database ( Oracle Database Link ) In this guide the below software versions are used:  VMware Workstation v10.0.0 Oracle Enterprise Linux v5.7 x86-64 Oracle Database Express Edition 11g R2 for Linux x86-64 Installation of VMware Workstation and OEL is not covered in this guide because it is straightforward. Just install them, start them. ( Notice that during the installation of OEL you must check oracle-validated-1.1.* package in system tools ) To install Oracle Database Express Edition: Log in as root user and run the executable 'oracle-xe-11.2.0-1.0.x86_64.rpm' You must run '/etc/init.d/oracle-xe configure' as the root user to configure the database. ...

Configure IP address on Oracle Linux

Adding IP address in Oracle Linux can be done by editing the network-scripts. While this procedure is tested on Oracle Linux, i'm sure it should work on  Redhat Enterprise Linux and other versions of Redhat . Editing network - scripts    The network interface configuration files are found in the directory:     /etc/sysconfig/network-scripts/   To add an IP address to an interface eth0  # cd  /etc/sysconfig/network-scripts/  # vi ifcfg-eth0   Enter the below parameters for static configuration   DEVICE="eth0"  BOOTPROTO="static"  BROADCAST="192.168.2.255"  HWADDR="00:0C:29:DS:22:26"  IPADDR="192.168.2.2"  NETMASK="255.255.255.0"    NETWORK="192.168.2.0"     ONBOOT="yes"  TYPE="Ethernet"   Save the file by typing  ESC :wq   R estart the network service for the changes to take effect.    # service network restart   

Oracle Directory Object

Oracle offers two ways  for a session to read or write operating system files. 1.Oracle directories 2. UTL_FILE package UTL_FILE package contains many PL/SQL procedures for manipulating directory objects. Operating system directories that can be accessed by UTL_FILE are only those listed in UTL_FILE_DIR instance parameter. This parameter default to NULL but can be set to any comma separated list as well as * (wildcard) which means any directory in operating system. SQL > SELECT   NAME, VALUE             FROM     V$PARAMETER             WHERE    UPPER(NAME) = 'UTL_FILE_DIR' Result --------------------------------------------------------------------------------------------------- utl_file_dir             NULL All the directories listed will be visible to all sessions. To give a value for UTL_FILE_DIR parameter file use the following command. SQL > sqlplus /...

Installation Guide of Oracle 11gR2 Data Guard

Installation Guide of Oracle 11gR2 Data Guard (11.2.0.1) for Oracle Enterprise Linux 5R4 over VMware Server 2.0.2 This guide requires the existence of pre-installed Oracle Enterprise Linux EL 5 U4. This guide requires the existence of pre-installed Oracle Database 11gR2. Creation of profile for user Oracle on both nodes cd vi .bash_profile add the following lines: export ORACLE_SID=prod export ORACLE_BASE=/home/oracle/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1 export TNS_ADMIN=$ORACLE_HOME/network/admin export PATH= $ORACLE_HOME/bin :$PATH Execute profile . .bash_profile In standby system ORACLE_SID will be dg Creation of database with dbca (database creator assistant) Before starting dbca we create a listener with network configuration assistant: [oracle@prod ~]$ netca You should follow the default steps Now run dbca (database configuration assistant) [oracle@prod ~]$ dbca Choose Create a Database and click Next. We will choose a ...

SQL SELECT

The SELECT statement is used to select data from a database. The result is stored in a result table, called the result-set. To select only some columns you want you can use the following syntax: SELECT  column_name , column_name FROM  table_name ; By using the following syntax you select all columns of a table: SELECT * FROM  table_name ; If you want to select only some records who fulfill a specific criterion, you can use the where clause:  SELECT  column_name , column_name FROM  table_name WHERE  column_name operator value ;

TIME INTERVAL in Oracle

Understanding TIME INTERVAL Data Types in Oracle INTERVAL YEAR TO MONTH and INTERVAL DAY TO SECOND are two data types added to store interval of two dates. They can be use both in SQL and PL/SQL. The syntax is as below: INTERVAL YEAR[(year_precision)] TO MONTH INTERVAL DAY[(day_precision)] TO SECOND[(fractional_seconds_precision)] There are defaults for precision. Two digest for year and day and six digest for fractional seconds. SQL>   SELECT INTERVAL '5-9' YEAR TO MONTH FROM DUAL Result: +05-09 Cover a time interval of 5 years and 9 months SQL>   SELECT INTERVAL '7 15:20:07.7' DAY TO SECOND FROM DUAL Result: +07 15:20:07.700000 Cover a time interval of 7 days, 15 hours, 20 minutes, 7 seconds and 7 milliseconds. SQL>   SELECT INTERVAL '7 15:20:07.7' DAY TO SECOND(1) FROM DUAL Result: +07 15:20:07.7 Cover a time interval of 7 days, 15 hours, 20 minutes, 7 seconds and 7 milliseconds.