Wednesday, June 22, 2016

Oracle HAS setup after Hostname and IP change

Oracle HAS setup after Hostname and IP change


On my laptop, I have my virtual machines for oracle ASM and oracle RAC. I cloned one of the ASM single instance virtual machine and changed its hostname and IP address to a new one. After I made the change the database and the asm instance did not start. I learned that I had to reconfigure the Oracle High Availability Services. It is true even if you have a stand alone installation. lets see how it works…
How to Reconfigure Oracle Restart [ID 986740.1]
BEFORE the change of hostname and IP

[oracle@rhel5 ~]$ srvctl config asm
ASM home: /oracle/app/oracle/product/11.2.0/grid
ASM listener: LISTENER
Spfile: /oracle/app/oracle/product/11.2.0/grid/dbs/spfile+ASM.ora
ASM diskgroup discovery string:
[oracle@rhel5 ~]$ srvctl config listener
Name: LISTENER
Home: /oracle/app/oracle/product/11.2.0/grid
End points: TCP:1521
[oracle@rhel5 ~]$ srvctl config database
TEST11G
[oracle@rhel5 ~]$ srvctl config database -d TEST11G
Database unique name: TEST11G
Database name: TEST11G
Oracle home: /oracle/app/oracle/product/11.2.0/dbhome_1
Oracle user: oracle
Spfile: +DATA/TEST11G/spfileTEST11G.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Database instance: TEST11G
Disk Groups: DATA,FRA
Services:
MAKE  the change of hostname and IP
You can chenge the IP and the hostname for a server using the command gui system-config-network. Also change the /etc/hosts file for the new IP and hostname.

old IP : 192.168.254.128 ----------new IP : 192.168.254.129
old hostname : rhel5       ----------new hostname : stndby
After we reboot the server, we see that HAS features are not functioning properly. High availabilty services has to be reconfigured.

[oracle@stndby ~]$ crsctl check has
CRS-4639: Could not contact Oracle High Availability Services
[oracle@stndby ~]$ srvctl start asm
PRCR-1070 : Failed to check if resource ora.asm is registered
Cannot communicate with crsd
Reconfigure HAS
Goto $GRID_HOME/crs/install directory and run the roothas.pl script for deconfiguration. It has to be run by the root user.

[root@stndby install]# ./roothas.pl -deconfig -force
Using configuration parameter file: ./crsconfig_params
CRS-4639: Could not contact Oracle High Availability Services
CRS-4000: Command Stop failed, or completed with errors.
CRS-4639: Could not contact Oracle High Availability Services
CRS-4000: Command Delete failed, or completed with errors.
CLSU-00100: Operating System function: opendir failed with error data: 2
CLSU-00101: Operating System error message: No such file or directory
CLSU-00103: error location: scrsearch1
CLSU-00104: additional error information: cant open scr home dir scls_scr_getval
CRS-4544: Unable to connect to OHAS
CRS-4000: Command Stop failed, or completed with errors.
Successfully deconfigured Oracle Restart stack

Goto $GRID_HOME/crs/install directory and run the roothas.pl script for reconfiguration. It has to be run by the root user.

[root@stndby install]# ./roothas.pl
Using configuration parameter file: ./crsconfig_params
LOCAL ADD MODE
Creating OCR keys for user 'oracle', privgrp 'dba'..
Operation successful.
LOCAL ONLY MODE
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4664: Node stndby successfully pinned.
Adding Clusterware entries to inittab


stndby 2013/01/31 04:07:34 /oracle/app/oracle/product/11.2.0/grid/cdata/stndby/backup_20130131_040734.olr
Successfully configured Oracle Grid Infrastructure for a Standalone Server
Now lets check the configuration. As you can see, has has been enabled but the resources are not started, ASM and database are not registered as a resource.

[oracle@stndby ~]$ . .grid_env
[oracle@stndby ~]$ crsctl config has
CRS-4622: Oracle High Availability Services autostart is enabled.
[oracle@stndby ~]$ crs_stat
NAME=ora.cssd
TYPE=ora.cssd.type
TARGET=OFFLINE
STATE=OFFLINE


NAME=ora.diskmon
TYPE=ora.diskmon.type
TARGET=OFFLINE
STATE=OFFLINE


NAME=ora.evmd
TYPE=ora.evm.type
TARGET=ONLINE
STATE=ONLINE on stndby


NAME=ora.ons
TYPE=ora.ons.type
TARGET=OFFLINE
STATE=OFFLINE
Register and start the resources

[oracle@stndby ~]$ crsctl start resource "ora.cssd"
CRS-2672: Attempting to start 'ora.cssd' on 'stndby'
CRS-2672: Attempting to start 'ora.diskmon' on 'stndby'
CRS-2676: Start of 'ora.diskmon' on 'stndby' succeeded
CRS-2676: Start of 'ora.cssd' on 'stndby' succeeded
[oracle@stndby ~]$ crs_stat
NAME=ora.cssd
TYPE=ora.cssd.type
TARGET=ONLINE
STATE=ONLINE on stndby


NAME=ora.diskmon
TYPE=ora.diskmon.type
TARGET=OFFLINE
STATE=OFFLINE


NAME=ora.evmd
TYPE=ora.evm.type
TARGET=ONLINE
STATE=ONLINE on stndby


NAME=ora.ons
TYPE=ora.ons.type
TARGET=OFFLINE
STATE=OFFLINE
lets add the listener as a resource but before we do that we need to change the listening IP of the listener.
before :

[oracle@stndby ~]$ cat /oracle/app/oracle/product/11.2.0/grid/network/admin/listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = rhel5)(PORT = 1521))
)
)

after

[oracle@stndby ~]$ cat /oracle/app/oracle/product/11.2.0/grid/network/admin/listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = stndby)(PORT = 1521))
)
)
now we can add the listener as a resource and after that we can start it

[oracle@stndby ~]$ srvctl add listener -l LISTENER
[oracle@stndby ~]$ srvctl start listener
[oracle@stndby ~]$ srvctl status listener
Listener LISTENER is enabled
Listener LISTENER is running on node(s): stndby
[oracle@stndby ~]$ crs_stat ora.LISTENER.lsnr
NAME=ora.LISTENER.lsnr
TYPE=ora.listener.type
TARGET=ONLINE
STATE=ONLINE on stndby
now we can add the asm we do not need to create spfile for asm. we can use the one before.

[oracle@stndby ~]$ srvctl add asm -l LISTENER -p "/oracle/app/oracle/product/11.2.0/grid/dbs/spfile+ASM.ora"
[oracle@stndby ~]$ srvctl start asm
[oracle@stndby ~]$ srvctl status asm
ASM is running on stndby

Finally we can add or database TEST11G

[oracle@stndby ~]$ srvctl add database -d TEST11G -o /oracle/app/oracle/product/11.2.0/dbhome_1 -p +DATA/TEST11G/spfileTEST11G.ora -r PRIMARY -s open -t immediate -a "DATA,FRA"
[oracle@stndby ~]$ srvctl start database -d TEST11G
[oracle@stndby ~]$ srvctl status database -d TEST11G
Database is running.
After the addition of all resources

[oracle@stndby ~]$ crs_stat
NAME=ora.DATA.dg
TYPE=ora.diskgroup.type
TARGET=ONLINE
STATE=ONLINE on stndby


NAME=ora.FRA.dg
TYPE=ora.diskgroup.type
TARGET=ONLINE
STATE=ONLINE on stndby


NAME=ora.LISTENER.lsnr
TYPE=ora.listener.type
TARGET=ONLINE
STATE=ONLINE on stndby


NAME=ora.asm
TYPE=ora.asm.type
TARGET=ONLINE
STATE=ONLINE on stndby


NAME=ora.cssd
TYPE=ora.cssd.type
TARGET=ONLINE
STATE=ONLINE on stndby


NAME=ora.diskmon
TYPE=ora.diskmon.type
TARGET=OFFLINE
STATE=OFFLINE


NAME=ora.evmd
TYPE=ora.evm.type
TARGET=ONLINE
STATE=ONLINE on stndby


NAME=ora.ons
TYPE=ora.ons.type
TARGET=OFFLINE
STATE=OFFLINE


NAME=ora.test11g.db
TYPE=ora.database.type
TARGET=ONLINE
STATE=ONLINE on stndby

Thursday, June 16, 2016

Oracle X4-2L and X5-2L

Oracle X4-2L and X5-2L

Set Up the Remote Console

  1. View or establish an IP address for the server SP.To log in to Oracle ILOM remotely using either the command-line interface (CLI) or the web interface, you must know the IP address of the server SP. For instructions on determining the server's IP address, refer to Viewing or Modifying the Service Processor Network Settings in Oracle Server X5-2 Installation Guide .
  2. If you are using a web-based client connection, perform these steps; otherwise go to the next step.
    1. In a web browser, type the IP address for the server SP.
    2. Log in to the Oracle ILOM web interface.The default Oracle ILOM user name is root and the default password is changeme.
      The Oracle ILOM Summary Information page appears.
    3. Redirect the video output from the server to the web client by launching the Oracle ILOM Remote System Console Plus application.
  3. If you are using an SSH client connection, perform these steps.
    1. From a serial console, establish an SSH connection to the server SP. Type: ssh root@hostname, where hostname can be the DNS name or the IP address for the server SP.
    2. Log in to Oracle ILOM.The default Oracle ILOM is root and the password is changeme.
    3. Redirect the serial output from the server to the SSH client. Type:-> start /HOST/console

Wednesday, June 8, 2016

How To Find My Public IP Address From Command Line On a Linux

How To Find My Public IP Address From Command Line On a Linux


Explain IP addresses

An IP is short for Internet Protocol. It is used to identify computers or mobile devices on the Internet. Each device connected to the Internet has an IP address. IP address can be used to personalize information.

Use dig command for determining my public IP address:

  1. Open the Terminal application.
  2. Type the following dig (domain information groper) command on a Linux, OS X, or Unix-like operating systems to see your own public IP address assigned by the ISP:
  3. dig +short myip.opendns.com @resolver1.opendns.com
  4. Or dig TXT +short o-o.myaddr.l.google.com @ns1.google.com
  5. You should see your IP address on screen. This is the fastest way to find out your IP address without using 3rd party site.
Sample outputs:
Fig.01: Use dig command to find your IP address
You can try host command to see the same information:
host myip.opendns.com resolver1.opendns.com
You can also use the Google server to get the same info using dig command:
dig TXT +short o-o.myaddr.l.google.com @ns1.google.com | awk -F'"' '{ print $2}'

How do I store my IP address in a shell variable?

The syntax is:
myip="$(dig +short myip.opendns.com @resolver1.opendns.com)"
echo "My WAN/Public IP address: ${myip}"
Sample outputs:
My WAN/Public IP address: 74.86.144.194

Finding Public/WAN IP address on a router

A few ADSL/Cable router allows you to login to your router using telnet or ssh:
telnet your-router-ip-here
ssh user@your-router-ip-here
telnet 192.168.0.254
ssh admin@192.168.1.254
[admin@dd-wrt ~]#  ifconfig eth1 | grep 'inet addr:' 
[admin@dd-wrt ~]#  ip addr show nas01

Use 3rd party web-sites to get your IP

Please note that I do not recommend following curl/wget method due to security reasons. You have been warned:
curl ifconfig.me
curl icanhazip.com
curl ipecho.net/plain
curl ifconfig.co



  How to Change Instance Type & Security Group of EC2 in AWS By David Taylor Updated April 29, 2023 EC2 stands for Elastic Compute Cloud...