Monday, August 13, 2012

Oracle Database Listener Service Registration

  • I do not have listener.ora file. How is service registration working:
Service registration can happen dynamically or statically. By default, listener uses dynamic service registration before attempting static registration. For dynamic configuration, listener.ora file is not needed.
Dynamic service registration is configured in the database initialization file. It does not require any configuration in the listener.ora file.  For dynamic registration to work, you should set service_names and instance_names in init.ora. or it defaults to default value (INSTANCE_NAME is set to ORACLE_SID and service_names is set to global database name: DB_NAME +DB_DOMAIN). If your local listener is listening on a non-default port, you need to set LOCAL_LISTENER parameter and remote_listener ,typically used in RAC, needs to set with remote_listener parameter.
The static configuration reads information from listener.ora file to configure the services. An instance with status UNKNOWN is statically registered. For additional info check out the following:
  • How do I know which naming method is being used to connect:
Tnsping utility can be used to determine whether the listener for a service on an Oracle net network can be reached.
If you can ping the server host from client, use tnsping to test if client can reach Oracle net service. Tnsping also states the naming method which was used to connect.
Additional info:
http://edstevensdba.wordpress.com/2011/03/19/ora-12514/ ( look for all post under TNS category)

Setting swap on Solaris 11


  • After the system is installed, swap areas and swap files are listed in /etc/vfstab file
  • Create swap
    • zfs create -V 2G rpool/swap2
    • swap -a /dev/zvol/dsk/rpool/swap2
  • Increase the swap size to 40G
root@dat02:~# zfs get volsize rpool/swap
NAME        PROPERTY  VALUE  SOURCE
rpool/swap  volsize   4G     local


root@dat02:~# zfs set volsize=40G rpool/swap

root@dat02:~# zfs get volsize rpool/swap
NAME        PROPERTY  VALUE  SOURCE
rpool/swap  volsize   40G    local


  • Has the system previously swapped

Check if kthr:w has non-zero value in vmstat output. Refer to following blog for additional info:
http://ritukamboj.blogspot.com/2012/03/vmstat-shows-high-value-in-w-column.html

  • Is the system currently swapping

Check out the sr field of vmstat output

  • What is the total swap available

swap field of vmstat output as well swap -s displays the value of available swap

root@etchst8:~# vmstat 2
 kthr      memory            page            disk          faults      cpu
 r b w   swap  free  re  mf pi po fr de sr s3 s1 s1 s1   in   sy   cs us sy id
 0 0 0 169977852 94409120 1192 930 341 0 0 0 1064 6 2 0 2 2793 6433 3146 0 1 99
 0 0 0 175557112 93864204 29 44 0 0 0 0  0  0  0  0  1 2268 1540 1531  0  0 100
 0 0 0 175556024 93863128 0 4 0 0  0  0  0  0  0  0  0 2450 1411 1620  0  0 100
 0 0 0 175554632 93861728 0 1 0 0  0  0  0  1  0  0  0 2382 1385 1581  0  0 100
^C
root@etchst8:~# swap -s -h
total: 552M allocated + 217M reserved = 768M used, 167G available

 



  • Additional info:

http://www.solarisinternals.com/wiki/index.php/ZFS_Troubleshooting_Guide#Resizing_ZFS_Swap_and_Dump_Devices
https://blogs.oracle.com/observatory/entry/zone_swap_space
http://www.softpanorama.org/Solaris/Processes_and_memory/swap_space_management.shtml

Tuesday, July 24, 2012

Using DBCA to generate database creation scripts

Invoke dbca . Select "Create Database" and then Advanced Options. Select your options to create the DB.

Select <Custom Database template> on Database Template page  (If you do not use custom db template, all other templates will result in a script that does rman restore from a backup that comes with the product). Selecting 'custom database template' will result in scripts built around "Create database" sql statement

On the creation options page, deselect Create Database and select Generate DB creation Scripts before you finish. Note the directory name where scripts will be generated.

Friday, July 13, 2012

FC: Which storage/controller is HBA connected to

  • Get info about the HBA

The output below indicates that I have 2 HBAs and both of them are online.

root@dat01:~# fcinfo hba-port  | ggrep "HBA Port" root@dat01:~# fcinfo hba-port  | ggrep "State"
HBA Port WWN: 21000024ff30b222
HBA Port WWN: 21000024ff30b223
  • What remote device is the HBA connected to. Does it have SCSI target.


    The output below indicates that both the HBAs have SCSI targets.
root@dat01:~# fcinfo remote-port -p  21000024ff30b222 Remote Port WWN: 20360080e5249ad6
        Active FC4 Types:
        SCSI Target: yes
        Port Symbolic Name:
        Node WWN: 20060080e5249ad6
root@dat01:~# fcinfo remote-port -p 21000024ff30b223
Remote Port WWN: 20370080e5249ad6
        Active FC4 Types:
        SCSI Target: yes
        Port Symbolic Name:
        Node WWN: 20060080e5249ad6


The first HBA is connected to remote device 20360080e5249ad6 and the second HBA is connected to remote device 20370080e5249ad6
Both the remote devices have the same node WWN (20060080e5249ad6) which indicates that the remote device is probably a dual controller device.

  •  Get detailed info about the SCSI targets (Optional)
Detailed info about the SCSI targets can be obtained by following 2 commands:
  • fcinfo remote-port -sl -p 21000024ff30b223
  •  fcinfo lu -v 

  • Get WWNs from the storage

Storage has following WWN:
Node WWN: 20:06:00:80:E5:24:9A:D6
Array WWN: 60:08:0E:50:00:24:A7:7C:00:00:00:00:4E:CC:74:CF
It has two controllers:
Both the controllers have 4 ports out of which only 2 ports are enabled:

Controller A: port 1:
20:36:00:80:E5:24:9A:D6
20:06:00:80:E5:24:9A:D6

Controller A: port 2
20:46:00:80:E5:24:9A:D6
20:06:00:80:E5:24:9A:D6


Controller B: Port 1
20:37:00:80:E5:24:9A:D6
20:06:00:80:E5:24:9A:D6

Controller B: Port 2
20:47:00:80:E5:24:9A:D6
20:06:00:80:E5:24:9A:D6


Note that the node WWN for all ports is identical: 20060080E5249AD6 (which is the node WWN of the storage)
  • Find out which controller is connected to which HBA

Combining output from storage and fcinfo remote-port, we conclude that controller A port 1 is connected to first HBA and Controller B port 1 is connected to second HBA


        State: online
        State: online

Tuesday, June 19, 2012

NFS setup for Oracle install

  • On the client side:

mkdir /test1
Edit the /etc/vfstab file and add the following line to mount the file system as NFS

10.129.195.224:/export/test1    -       /test1  nfs     -       yes     rw,bg,hard,nointr,rsize=32768,wsize=32768,proto=tcp,noac,forcedirectio,vers=3,suid

or
zfssaIp:/fs    -    /clientfs    nfs    -    yes    {mount options}

Refer to following metalink doc for mount option info
Mount Options for Oracle files when used with NFS on NAS devices [ID 359515.1]

You can unmount the filesystem with the following command
umount /test1

  • On the storage side:

Create a storage pool (Configuration ->Storage).
Create a new project (Shares->Project)
Create a FS under that project (Shares->Shares)


  • Issue resolution:

  • Direct NFS: Failed to set socket buffer size.wtmax=[1048576] rtmax=[1048576], errno=-1
You have to increase tcp_buf_size. Kindly set the value of the tcp buffer to a value higher than wtmax and rtmax specified above. Setting to the same value does not resolve the issue.

You can issue the following commands to set and display the values:

# /usr/sbin/ndd -set /dev/tcp tcp_max_buf 1056768
# /usr/sbin/ndd -set /dev/tcp tcp_xmit_hiwat 1056768
#  /usr/sbin/ndd -set /dev/tcp tcp_recv_hiwat 1056768
#
# /usr/sbin/ndd /dev/tcp tcp_max_buf
1056768
# /usr/sbin/ndd /dev/tcp tcp_xmit_hiwat
1056768
# /usr/sbin/ndd /dev/tcp tcp_recv_hiwat
1056768
Refer to  MOS ID 1352886.1 for details.



  • Additional info:

https://blogs.oracle.com/taylor22/entry/nfs_root_access_on_sun
http://robpetti.com/?p=85 : NFS mounts as nobody:nobody




Backup Solaris Zones

Find out zonepath of the zone you need to backup


root@isve-111-116:~# zonecfg -z rac4Zone info zonepath
zonepath: /zonepools/zones/rac4Zone

Find out the data-set of zonepath

root@isve-111-116:~# zfs list -H -o name /zonepools/zones/rac4Zone
zonepools/zones/rac4Zone

Create a snapshot of the zonepath

root@isve-111-116:~# zfs snapshot -r zonepools/zones/rac4Zone@backup1

Verify that snapshot was successfully created

 zfs snapshot -r zonepools/zones/rac4Zone@backup1

root@isve-111-116:~# zfs list -t snap -r zonepools/zones/rac4Zone
NAME                                                      USED  AVAIL  REFER  MOUNTPOINT
zonepools/zones/rac4Zone@backup1                             0      -    34K  -
zonepools/zones/rac4Zone/rpool@backup1                       0      -    31K  -
zonepools/zones/rac4Zone/rpool/ROOT@backup1                  0      -    31K  -
zonepools/zones/rac4Zone/rpool/ROOT/solaris@install      6.97M      -   291M  -
zonepools/zones/rac4Zone/rpool/ROOT/solaris@backup1       387K      -  5.36G  -
zonepools/zones/rac4Zone/rpool/ROOT/solaris/var@install  27.4M      -  66.2M  -
zonepools/zones/rac4Zone/rpool/ROOT/solaris/var@backup1      0      -  82.5M  -
zonepools/zones/rac4Zone/rpool/dump@backup1                  0      -    16K  -
zonepools/zones/rac4Zone/rpool/export@backup1                0      -    32K  -
zonepools/zones/rac4Zone/rpool/export/home@backup1       6.24M      -  1.83G  -
zonepools/zones/rac4Zone/rpool/swap@backup1                  0      -    16K  -


Archive the zonepath

zfs send -rc zonepools/zones/rac4Zone@backup1 > /cont/rac4

Verify that the archive of the zonepath is created
root@isve-111-116:/cont# file /cont/rac4
/cont/rac4:     ZFS snapshot stream

iSCSI setup

This blog describes the steps to setup S7420 storage as iSCSI device.

Verify that the iscsi initiator service is enabled on the Solaris initiator. If not, enable the service.


root@dat02:~# svcs | grep initiator
online         Jun_08   svc:/system/fcoe_initiator:default
online         Jun_08   svc:/network/iscsi/initiator:default


Log on to Solaris initiator and find out the IQN value of the server and the number of configured sessions

root@dat02:~# iscsiadm list initiator-node
Initiator node name: iqn.1986-03.com.sun:01:002128f52ca4.4fb2e431
Initiator node alias: dat02
        Login Parameters (Default/Configured):
                Header Digest: NONE/-
                Data Digest: NONE/-
                Max Connections: 65535/-
        Authentication Type: NONE
        RADIUS Server: NONE
        RADIUS Access: disabled
        Tunable Parameters (Default/Configured):
                Session Login Response Time: 60/-
                Maximum Connection Retry Time: 180/-
                Login Retry Time Interval: 60/-
        Configured Sessions: 1



Solaris initiator can use the target only after configuring a discovery method (a way to identify targets on the network). Solaris supports three discovery methods
  • static discovery
  • SendTargets
  • iSNS

The following commands list which discovery method is enabled

root@dat02:~# iscsiadm list discovery
Discovery:
        Static: disabled
        Send Targets: enabled
        iSNS: disabled

The following commands enables the sendTarget discovery method

SendTargets:

Enable the send target discovery method and add the IP address of the target (storage) to the discovery address.

root@dat02:~# iscsiadm modify discovery --sendtarget enable
root@dat02:~# iscsiadm add discovery-address 10.129.195.222


You can list the IP address of target that is discovered by the server using the list command:

root@dat01:/etc# iscsiadm list discovery-address
Discovery Address: 10.129.195.222:3260
The following commands deletes a particular iSCSI target from discovery list :

root@dat01:/etc# iscsiadm remove discovery-address 10.129.195.222
root@dat01:/etc# iscsiadm list target -vS


This discovery method can be disabled as under:

iscsiadm modify discovery --sendtargets disable


Once the initiator is configured with a valid discovery method, the initiator should see one or more targets by issuing the list target subcommand

iscsiadm list target


root@dat02:~# iscsiadm list target
Target: iqn.1986-03.com.sun:02:b3c7500a-b7ca-c791-a949-d79bf0862c17
        Alias: iscsi-target
        TPGT: 2
        ISID: 4000002a0000
        Connections: 1
To get the list of all the LUNs exposed to the server, use -S option

root@dat02:~# iscsiadm list target  -help
iscsiadm: '-h': invalid option
        iscsiadm list target [OPTIONS] [<target-name ...>]
        OPTIONS:
                -v, --verbose
                -S, --scsi-target
For more information, please see iscsiadm(1M)
root@dat02:~# iscsiadm list target  -vS
Target: iqn.1986-03.com.sun:02:b3c7500a-b7ca-c791-a949-d79bf0862c17
        Alias: iscsi-target
        TPGT: 2
        ISID: 4000002a0000
        Connections: 1
                CID: 0
                  IP address (Local): 10.129.195.190:32957
                  IP address (Peer): 10.129.195.222:3260
                  Discovery Method: SendTargets
                  Login Parameters (Negotiated):
                        Data Sequence In Order: yes
                        Data PDU In Order: yes
                        Default Time To Retain: 20
                        Default Time To Wait: 2
                        Error Recovery Level: 0
                        First Burst Length: 65536
                        Immediate Data: yes
                        Initial Ready To Transfer (R2T): yes
                        Max Burst Length: 262144
                        Max Outstanding R2T: 1
                        Max Receive Data Segment Length: 32768
                        Max Connections: 32
                        Header Digest: NONE
                        Data Digest: NONE

        LUN: 3
             Vendor:  SUN
             Product: ZFS Storage 7420
             OS Device Name: /dev/rdsk/c0t600144F0EE8675B100004FD626260006d0s2
        LUN: 2
             Vendor:  SUN
             Product: ZFS Storage 7420
             OS Device Name: /dev/rdsk/c0t600144F0EE8675B100004FD61BBC0005d0s2
        LUN: 1
             Vendor:  SUN
             Product: ZFS Storage 7420
             OS Device Name: /dev/rdsk/c0t600144F0EE8675B100004FD39DE50004d0s2
        LUN: 0
             Vendor:  SUN
             Product: ZFS Storage 7420
             OS Device Name: /dev/rdsk/c0t600144F0EE8675B100004FD39CC80003d0s2



On the storage side:

Go to Configuration->SAN-> and setup target and initiator portal. There is a default target and initiator created  which can be used as well.
Go to Confiiguration->Storage pool and create a new storage pool if required
Go to Shares->Project and create a new project.
Add LUNS to these project and select the target and initiator portals for the LUNS.(the default ones or the ones you created for extra security). You can select the target and initiator options under the Protocol sections when you edit the LUN

You do not need to create target and initiator group. The default ones work one. If you can discovery address and cannot view the target, check /var/adm/messages for any error messages. Try restarting iSCSI service on target ZFSSA and reboot the Solaris server , if needed.
Additional info:

http://prefetch.net/articles/solarisiscsi.html
  http://sosc-dr.sun.com/bigadmin/features/articles/7000_oracle_iscsi_asm.pdf
http://www.youtube.com/watch?feature=endscreen&NR=1&v=iETgvITMQ1w
http://www.oracle.com/technetwork/articles/servers-storage-admin/o11-104-iscsi-luns-linux-518400.html