Sunday, March 23, 2014

Start as a Database Adminstrator

You need to pen down and classify your thoughts into below as per my personal experience

-  Architecture diagrams
-  Run books/ Procedural steps/ screenshots that describe the way in which
-  Short Notes
-  Frequently used commands
-  Text Books to be referenced
-  Questions pending answers -> Tracker

Saturday, March 22, 2014

Set path to login to database and export

In NIX machine,

$export ORACLE_SID=<ORACLE_SERVICE_NAME>

$export ORACLE_HOME=<Path_to_ORACLE_SERVICE_NAME_in_ORATAB>

Navigate to the bin folder of the db_home

./sqlplus / as sysdba


 In Windows Machine

Check in services.msc

C:\set ORACLE_SID=<Oracle_service_name>

C:\set PATH=<Path to the bin file of the ORACLE_service_name>

C:\set ORACLE_HOME=<Path to the db_1 location of the database>

Then you can get into SQLPLUS prompt.

C:\sqlplus

Network Latency Issues

It is sometimes common that we see network network hiccups or connectivity issues in Alert log files. Usually it would be an System Admin who may determine whether there is something wrong on the NIC or Network Engineer if something is wrong over the network.

In case this happens when you are logged in to the Database and suddenly you find there is some network issue you can try below troubleshooting steps

1. Ping to the Loop back interface ( To check on NIC Card)

Messages sent to loopback IP addresses like 127.0.0.1 do not reach outside to the local area network (LAN) but instead are automatically re-routed by the computer's own network adapter back to the receiving end of the TCP/IP stack.

2. Ping to the default gateway ( To test connection between your computer and your router)

3. Trace route command (to the destination server IP)
This would determine the number of hops and the response of each path in the Network Path.

4. Check the domain Name resolution of the destination server using it hostname.
This tests your computer and network's ability to resolve network names (translating them to IP addresses).



Note:- In server which are placed in DMZ, Ping requests would be disabled.

We can Enable or Disable ping requests as below

On Windows Server
(How to enable  -> Start >> Administrative Tools >> Windows Firewall with Advanced Security >> Inbound Rules >> File and Printer Sharing (Echo Request – ICMPv4-IN) >> right click and select Enable Rule ) OR from command line (netsh firewall set icmpsetting 8)



On Linux Server

# iptables -A INPUT -p icmp -j DROP

OR

 # echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_all   // "0" - Disables ping request

OR

Append In
# vi /etc/sysctl.conf  

net.ipv4.icmp_echo_ignore_all =1 // 0 - Disables the ping request


Layered Approach in Networking - Oracle Net and Listener configuration

Firstly, tnsnames.ora is the file used for name resolution of the client application to the Database.


Its important to know the fundamentals of Network layers, as we would have some files (listener.ora, sqlnet.ora, tnsnames.ora) which would use some concepts of Networking in its operation

Layered Approach Model is a model in which each layer addresses a process. Each process procides required effective communication. It tells what must be done, who wwill do, what order, how to relate.

Application Layer(A) - Provides user interface.

Presentation Layer(P) - Provides data, handles processing such as encryption. It provides coding, compression, encryption.

Sessions Layer(S) - Keeps different applications data separate. NFS, RPC, SQL, Apple Talk session Protocols are protocols used by this layer. Simple, Half-duplex, Full Duplex.

Transport Layer (T) - Provides End-to-End logical connection, reliable and unreliable delivery. Services present in here, segments and reassembles data from upper layer applications unite onto the same data stream. Services present in Transport layer, segments and reassembles data from upper layer applications unite onto same data stream. Establishes a logical connection between host and destination on a internetwork. TCP, UDP are the protocols used.

Network Layer (N) - Provides logical addressing, which routers use for path determination. Transferring packets between devices that are not locally attached. When a packet is received at a Router interface -> checked in Routing Table -> If not found Drop -> If found packet routes till the exit.  If the interface is found then it is framed to the local network.
There are 2 types of packets
Data - User data and protocos
Route Update - Update neighbor routers & protocols(RIP, OSPF, EIGRP)

Data Link Layer(D) - combines packets, converts to bytes to frames and vice-versa. Provides access to media using MAC Address, performs error detection.

Physical Layer(L) - moves bits between devices, specifies voltage, wire speed and pin out cables based on Physical Topology.

A - P - S - How applications within end work stations communicate with each other, with users and between hosts

T - N - D - L - How data is transmitted end to end

Advantages of this model
  • Complex into simple manageable layers
  • Only one layer can be changed
  • Define standard interface


Here is a sample of  listener.ora

 LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.3)(PORT = 1521))
    )
  )
LISTENER2 =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.2)(PORT = 1525))
    )
  )
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /u01/my10g/orcl)
      (PROGRAM = extproc)
    )
  )

In
SQL>show parameters

Note:- db_name, db_domain parameters, together constitute GLOBAL NAME

SQL>SELECT * FROM GLOBAL_NAME;
db_name.db_domain

To recognize a listener on a local network

Here is sample of  tnsnames.ora
LISTENER =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.3)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = ORCL)
    )
  )
LISTENER2 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.2)(PORT = 1525))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = ORCL)
    )
  )
EXTPROC_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
    (CONNECT_DATA =
      (SID = PLSExtProc)
      (PRESENTATION = RO)
    )
  )


A listener status could more or like look like this. We would observe TCP being the protocol, also IPC is used if you are not working a Development Environment and you have a development instance and you are accessing always locally interactively.



LSNRCTL> status

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))

STATUS of the LISTENER

------------------------


~~~~ (parts are cut)


Listener Parameter File /u01/app/11.2.0/grid/network/admin/listener.ora

Listener Log File /u01/app/oracle/diag/tnslsnr/SERVER_NAME/listener/alert/log.xml

Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=X.X.X.X)(PORT=1521)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=X.X.X.X)(PORT=1521)))

Sunday, March 16, 2014

Oracle Database Patching Error - /bin/sh ld command not found

As below environment variable was not set in the $ORACLE_HOME path, got the Error

 
LD_LIBRARY_PATH=$ORACLE_HOME:/usr/local/lib

Oracle Database Patching Error - /bin/sh gcc command not found Error

check whether gcc utility exists on the Linux Server

#rpm -qa | grep gcc

If it does not exist install it using

#yum install gcc

In my Linux server it did was not there hence we got the error and patching was successful

P.S - Always search for My Oracle Support Community forums to check in the Erros

Steps for Refreshing a Pre-PROD database to that of PROD



Ø  Check the free space and Size of the database.
Ø  Take a backup in Prod and copy it to Destination Server(DEV\QA\UAT)
Ø  Take backup of users and permissions of Pre-PROD DB
Ø  Take backup of destination if its small(less than 1 or 2GB)
Ø  Import the dump using the script
Ø  Run the users and permissions script
Ø  Cross verify DB and users permissions