Posted in 2017

Multiple networks for DBs

srvctl add network -netnum 2 -subnet 192.168.1.0/255.255.255.0/bond0.2 -nettype static
srvctl add vip -node rac-01 -address rac-01-vip.example.com/255.255.255.0 -netnum 2
srvctl add vip -node rac-02 -address rac-02-vip.example.com/255.255.255.0 -netnum 2

srvctl add listener -listener LISTENER_BANK -netnum 2 -endpoints TCP:1521

srvctl add scan -scanname bank-of-europe-scan.example.com -netnum 2
srvctl add scan_listener -netnum 2 -listener LISTENER_BANK -endpoints TCP:1521 -invitednodes rac-01,rac-02

Here we can start everything and check:

 ps -ef| grep tns |grep -v grep| awk '{print $9}' | sort | uniq > /tmp/listener.txt

Generate listener.ora:

for i in $(cat /tmp/listener.txt  | sort | uniq); do
  echo "${i} =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = ${i}))
    )
  )
" | tee -a listener.ora
done
for i in $(cat /tmp/listener.txt  | sort | uniq); do
  echo "ENABLE_GLOBAL_DYNAMIC_ENDPOINT_${i} = ON" | tee -a listener.ora
done
echo
for i in $(cat /tmp/listener.txt  | sort | uniq); do
  echo "VALID_NODE_CHECKING_REGISTRATION_${i} = SUBNET" | tee -a listener.ora
done
echo

for i in $(cat /tmp/listener.txt  | sort | uniq); do
  echo "REGISTRATION_INVITED_NODES_${i}=(rac-01,rac-02)" | tee -a listener.ora
done
echo
for i in $(cat /tmp/listener.txt  | sort | uniq); do
  echo "ADR_BASE_${i} = /products/oracle" | tee -a listener.ora
done
Advertisements

Author:

Database administrator who loves to work with Oracle software. (Sometimes not)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s