Friday, 3 April 2015

How to Configure the DNS Server for 11gR2 SCAN



From Oracle 11gR2, the Single Client Address Network (SCAN) has introduced and it is a requirement of networking setup to accommodate Oracle RAC network configuration. This note explains how to configure the DNS server for 11gR2 SCAN.  In most case this task is carried out by Network Administrator, but awareness these steps can be very useful for DBA in term of assisting NA in setting up properly DNS for RAC.
When installing Oracle Grid Infrastructure, there are 2 options:
1.      Configure GNS (Grid Naming Service) and let it handle name resolution
2.      Configure SCAN name with IP address defined in DNS
Oracle recommends using a separate DNS server, but for test environment only DNS server can be installed on one node of RAC servers.
Configuration
In my test environment, I am using a cluster node (racln1,192.168.1.110) as DNS server.
Domain is: localdomain
Node Name
Public IP
Private IP
VIP IP
racln1.localdomain
192.168.1.110
192.168.2.110
192.168.1.112
racln2.localdomain
192.168.1.111
192.168.2.111
192.168.1.113

1.      On racln1.localdomain install the DNS Server Package:
# yum install bind-libs bind bind-utils
Three packages must be installed on Linux for DNS Server:
  • bind (includes DNS server, named)
  • bind-utils (utilities for querying DNS servers about host information)
  • bind-libs (libraries used by the bind server and utils package)
You can obtain an account from the Yum Server which will install the package for you automatically. 
2.      On racln1.localdomain edit the "/etc/named.conf" file
Configure the "forwarder" under "options" in "/etc/named.conf "
We need to make sure the DNS is listening on the correct port for both the local and external IP address. This is done by the "listen-on" setting. This DNS server is only resolving the names of the servers on local network, so make sure that servers on external networks, like the internet, are resolved properly. To do this you add a "forwarder" entry to the end of the "options" section.

options {

        listen-on port 53 { 127.0.0.1; 192.168.1.110; };

        listen-on-v6 port 53 {::1;}

        directory /”var/named”;

        // Leave the rest of the config as it is.

        // Forwarder: Anything this DNS can't resolve gets forwarded to my ISPs DNS.

        forwarders { 192.168.1.1; };

        // End My Additions

};

3.      Configure Zone Entries for your domain in "/etc/named.conf "  
If you are using localdomain, it has been automatically configured and you can skip this step.
For other case we need to add the following lines to "/etc/named.conf"
. zone "abc.com" IN {
type master;
file "abc.com.zone";
allow-update { none; };
};
The "file" parameter specifies the name of the file in the "/var/named/" directory that contains the configuration for this zone.
4.      Configure reverse lookup in "/etc/named.conf "
Reverse lookup is used to let the client find out if the hostname matches to the related IP. In the case of a RAC installation, I want to create reverse lookups for my public (192.169.0.*) network, so I must add the following zone entry.

zone "1.168.192.in-addr.arpa." IN {
        type master;
        file "1.168.192.in-addr.arpa";
        allow-update { none; };
};

 5.      On dns1.testenv.com edit the config  files under /var/named
Because I am using localdomain so I have to edit /var/named/localdomain.zone, for other domains, for example abc.com, edit the file name: abc.com.zone and localdomain.zone. Add the line below to the end of this file (if the files don’t exist, create them):
racln1-vip IN A 192.168.1.112
racln2-vip IN A 192.168.1.113
rac-scan IN A 192.168.1.11
rac-scan IN A 192.168.1.12
rac-scan IN A 192.168.1.13

Put all the private IPs, VIP and SCAN VIPs in the DNS config file.  If you only want the DNS to resolve the scan-vip, only include the rac-scan with its three corresponding IP addresses in the file. 
Create/Edit the "/var/named/1.168.192.in-addr.arpa" file for reverse lookups as follows:

$ORIGIN 0.168.192.in-addr.arpa.
$TTL 1H
@       IN      SOA     racln1.localdomain.     root.racln1.localdomain. (      2
                                                3H
                                                1H
                                                1W
                                                1H )
0.168.192.in-addr.arpa.         IN NS      racln1.localdomain.
 
101     IN PTR  racln1.localdomain.
102     IN PTR  racln2.localdomain.
111     IN PTR  racln1-vip.localdomain.
112     IN PTR  racln2-vip.localdomain.
121     IN PTR  rac-scan.localdomain.
122     IN PTR  rac-scan.localdomain.
123     IN PTR  rac-scan.localdomain.

6.      Stop and start DNS Server to ensure it can be successfully restarted and make sure the DNS Server will be started automatically:

# service named stop
# service named start
# chkconfig named on

       7.      Edit file /etc/resolv.conf on all node to point to new DNS server

search localdomain #replace with your domain name

nameserver 192.168.1.110

8.      Change the hosts search order in  /etc/nsswitch.conf on all nodes
 
hosts: dns files nis

19.  At this point the configuration is complete, it is ready for test using reverse lookups  command.
# nslookup rac-scan.localdomain
Server: 192.168.1.110
Address: 192.168.1.110#53
Name: rac-scan.localdomain
 Address: 192.168.1.11
Name: rac-scan.testenv.com
Address: 192.168.1.12
Name: rac-scan.testenv.com
Address: 192.168.1.13

Wednesday, 1 April 2015

Simplifying Oracle Pre- installation Task on Oracle Linux 6

To simplify the database pre-installation task, from Oracle 11gR2 and 12C on Oracle Linux the DBA can install a new tool which provided by Oracle for Oracle Linux 4,5,6.
In this article I will show how to install  oracle-rdbms-server-12cR1-preinstall or oracle-rdbms-server-11gR2-preinstall RPM on Oracle Linux via the Oracle public yum repository. The same steps outlined in the following section can be used for either version of the preinstall RPM package. I started with a system running Oracle Linux Release 6 Update 4 for x86_64.
Set up a yum configuration file that pointed to the correct repository, and then I installed the oracle-rdbms-server-11gR2-preinstall RPM from that repository.
As an authorized user (for example, root), retrieve the file that configures repository locations:
    # cd /etc/yum.repos.d
    # wget http://public-yum.oracle.com/public-yum-ol6.repo
Using a text editor, modify the file, changing the field enabled=0 to enabled=1 to reflect repositories that correspond to the machine's operating system release
Here is an sample of public-yum-old6.repo with the changed lines in boldface
[ol6_latest]
name=Oracle Linux $releasever Latest ($basearch)
baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL6/latest/$basearch/
gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol6
gpgcheck=1
enabled=1

[ol6_UEK_latest]
name=Latest Unbreakable Enterprise Kernel for Oracle Linux $releasever ($basearch)
baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL6/UEK/latest/$basearch/
gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol6
gpgcheck=1
enabled=1
Because the target system is running Oracle Linux Release 6 Update 4 for x86_64, which installs the Oracle Unbreakable Enterprise Kernel by default, there are two repositories to enable, [ol6_latest] and [ol6_UEK_latest].
Next, install the oracle-rdbms-server-11gR2-preinstall RPM using the yum install command.
    # yum install oracle-rdbms-server-11gR2-preinstall
At this point, the system is ready for the installation of Oracle Database
For futher information about this tool you can check at http://public-yum.oracle.com/

Saturday, 7 February 2015

Using Automatic Memory Management (11G)



Using Automatic Memory Management
This article includes three sections:
·         Oracle Automatic Memory Management
·         Enabling Automatic Memory Management
·         Monitoring and Tuning Automatic Memory Management

1.      Oracle Automatic Memory Management
Automatic Memory Management has introduced by Oracle from Oracle 10G, and enhanced in 11G, 12C. This is the best way to manage Oracle Database memory. To do so (on most platforms), you set only a target memory size initialization parameter (MEMORY_TARGET) and optionally a maximum memory size initialization parameter (MEMORY_MAX_TARGET). The instance then tunes to the target memory size, redistributing memory as needed between the system global area (SGA) and the instance program global area (instance PGA).
If you create your database with Database Configuration Assistant (DBCA) and choose the basic installation option, automatic memory management is enabled.
2.      Enabling Automatic Memory Management
a.       Start SQL*Plus and connect to the database as SYSDBA.
b.      Calculate the minimum value for MEMORY_TARGET as follows
                                                  i.      Determine the current sizes of SGA_TARGET and PGA_AGGREGATE_TARGET by entering the following SQL*Plus command:
            SHOW PARAMETER TARGET

NAME                          TYPE        VALUE
------------------------------ ----------- ----------------
archive_lag_target             integer     0
db_flashback_retention_target  integer     1440
fast_start_io_target           integer     0
fast_start_mttr_target         integer     0
memory_max_target              big integer 0
memory_target                  big integer 0
pga_aggregate_target           big integer 90M
sga_target                     big integer 272M


                                                ii.      Run the following query to determine the maximum instance PGA allocated since the database was started:
select value from v$pgastat where name='maximum PGA allocated';
                                              iii.      Compute the maximum value between the query result from step 2b and PGA_AGGREGATE_TARGET. Add SGA_TARGET to this value.
memory_target = sga_target + max(pga_aggregate_target, maximum PGA allocated)
c.       Choose the value for MEMORY_TARGET that you want to use.
d.      For the MEMORY_MAX_TARGET initialization parameter, decide on a maximum amount of memory that you would want to allocate to the database for the foreseeable future. That is, determine the maximum value for the sum of the SGA and instance PGA sizes. This number can be larger than or the same as the MEMORY_TARGET value that you chose in the previous step.
e.       If you started your Oracle Database instance with a server parameter file, which is the default if you created the database with the Database Configuration Assistant (DBCA), enter the following command:
ALTER SYSTEM SET MEMORY_MAX_TARGET = nM SCOPE = SPFILE;
If you started your instance with a text initialization parameter file, manually edit the file so that it contains the following statements:
memory_max_target = nM
memory_target = mM
 
f.       Shut down and restart the database.
3.      Monitoring and Tuning Automatic Memory Management
The dynamic performance view V$MEMORY_DYNAMIC_COMPONENTS shows the current sizes of all dynamically tuned memory components, including the total sizes of the SGA and instance PGA.
The view V$MEMORY_TARGET_ADVICE provides tuning advice for the MEMORY_TARGET initialization parameter.
SQL>  select * from v$memory_target_advice order by memory_size;
 
MEMORY_SIZE MEMORY_SIZE_FACTOR ESTD_DB_TIME ESTD_DB_TIME_FACTOR    VERSION
----------- ------------------ ------------ ------------------- ----------
        180                 .5          458               1.344          0
        270                .75          367              1.0761          0
        360                  1          341                   1          0
        450               1.25          335               .9817          0
        540                1.5          335               .9817          0
        630               1.75          335               .9817          0
        720                  2          335               .9817          0

The row with the MEMORY_SIZE_FACTOR of 1 shows the current size of memory, as set by the MEMORY_TARGET initialization parameter, and the amount of DB time required to complete the current workload. In previous and subsequent rows, the results show a number of alternative MEMORY_TARGET sizes.

Reference resources: Oracle Metalink, Oracle 11G reference docs