ORA-12519: TNS:no appropriate service handler found

The number of database processes that can run in Oracle DB is set to 150 as default which can be viewed from v$resource_limit.

select * from v$resource_limit where resource_name = 'processes';


RESOURCE_NAME CURRENT_UTILIZATION MAX_UTILIZATION INITIAL_ALLOCATION LIMIT_VALUE
------------- ------------------- --------------- ------------------ -----------
processes     148                 149              150                150

We face this issue – ORA-12519 ,  randomly when the number of DB processes utilized by our application is more that 150. So we need to increase the number of DB processes inorder to avoid the issue. Use below steps to incresae the limit.


sqlplus / as sysdba
sqlplus>alter system set processes=500 scope=spfile;
sqlplus>shutdown immediate;
sqlplus>startup

Now query the view to see the new limits in effect.

select * from v$resource_limit where resource_name = 'processes';


RESOURCE_NAME CURRENT_UTILIZATION MAX_UTILIZATION INITIAL_ALLOCATION LIMIT_VALUE
------------- ------------------- --------------- ------------------ -----------
processes      279                  285             500                500

 

 

Advertisements
Posted in ARTICLES, HOWTO, SQL, TIPS & T RICS | Tagged , , | Leave a comment

pexpect alternative in python for remote connection

We generally use python pexpect module to connect system remotely with ssh and execute our tasks. But sometimes pexpect module is not found to be installed in remote systems which create problems. And this problem can be solved with the python select module with poll.

Here is the sample code that can be used.

https://github.com/kumarprd/pexpect-alternate

Posted in ARTICLES, OperatingSystem, Operations, Programming, SCRIPTING | Tagged , , | Leave a comment

Accessing Host from Docker Container

Sometime we need to access the services that are running in the host machine to be accessible from the docker container.  e.g. In on of my project, we needed to connect to the oracle db (port 1521) from inside the container within code.

The default behaviour of containers are, they cant access the host network directly unless the firewall of the host machine allows the network interface of docker to ACCEPT the packets.

So the docker container will communicate with the host machine using the gateway ip. First find the gateway ip inside the container.

Run below command inside the container to get the gateway ip and observer I am not able to connect to port 1521.


# nc -vz dockerhost 1521

dockerhost [172.18.0.1] 1521 (?) : Connection timed out

# ip route | awk '/^default via /{print $3}'

172.18.0.1

Next  task is to get the interface name of the docker network which is binded with the container.  Most of the cases its docker0.

But it can also be customized, so check ifconfig output which matches the inet addr of the container gateway.


# ifconfig

br-4e83b57c54cf Link encap:Ethernet  HWaddr 02:42:AF:CD:B5:DA

inet addr:<strong>172.18.0.1</strong>  Bcast:0.0.0.0  Mask:255.255.0.0

# ip addr show br-4e83b57c54cf

10: br-4e83b57c54cf: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP

link/ether 02:42:af:cd:b5:da brd ff:ff:ff:ff:ff:ff

inet <strong>172.18.0.1/16</strong> scope global br-4e83b57c54cf

valid_lft forever preferred_lft forever

Here the interface name is : br-4e83b57c54cf

Now add a iptables rule in Linux host:


iptables -A INPUT -i br-4e83b57c54cf -j ACCEPT

Now try to access the host port from container.


# nc -vz dockerhost 1521

dockerhost [172.18.0.1] 1521 (?) open

There are other ways also available on internet , but I found none of them working.

 

 

 

 

 

 

 

 

 

 

 

Posted in ARTICLES, Concepts, Container, FOSS, HOWTO, OperatingSystem, TIPS & T RICS | Tagged , , , , | Leave a comment

SNMP Poller tool to monitor any thing on network

Few years ago, I had created one SNMP Poller tool using perl and snmp utilites that can poll OID informations from any network devices, which is kind of passive monitoring mechanism.

Thought to make it Opensource under GNU GPL.

The details of the utility with its usage can be found here, if anyone is interested to use it.

https://github.com/kumarprd/snmp-poller

Posted in ARTICLES, FOSS, Monitoring, Programming, SCRIPTING | Tagged , , , , , | Leave a comment

My MongoDB cheatsheet

Few years ago, I was working on one mongoDB project.Its a NoSQL database , easy to learn and its pure JSON based.

I learned it myself and had created a cheatsheet for it, so I can easily recall it anytime I want. It can help anyone who is interested in learning it quickly.

Thought to share the sheet. It can be found here :

https://github.com/kumarprd/mongo-guide/blob/master/my-mongo_guide.txt

 

 

 

Posted in ARTICLES, Concepts, Database, NoSQL, TIPS & T RICS | Tagged , , | Leave a comment

chef attribute : avoiding “undefined method `[]’ for nil:NilClass” error

In chef, when a nested attribute that might not exist/or not crated yet, you can use rescue as a modifier to an if statement.

For example, assuming that only some of your nodes have node[‘install_wls’][‘isManaged’]defined:

if node['install_wls']['isManaged']
do the stuff
end rescue NoMethodError

will avoid the chef run bailing with “undefined method `[]’ for nil:NilClass” error.

Though there are any legit method errors within your if block to handle empty/nil/blank attributes, you’ve just caught an exception you shouldn’t.

I use this in cookbooks that have extra functionality if some dependency of other component recipe happens to be installed. For example, the odi cookbook  depend on wls or odi depends on oracldb.

Posted in ARTICLES, Configurtion management, DevOps, HOWTO | Tagged , , , , | Leave a comment

chef knife tricks: Add a node in an environment

 

Sometime during automation of a large deployment process, we have to bootstrap a node , create environment and add the node in that particular environment on the fly.

 

  1. Bootstraping :

knife bootstrap  slcn09vmf0209.us.ora.com -x root -P welcome1 -N node2

2. Create environment dynamically from inside the programme:(python here)


## Create an envtemplate with required values in it

envtemplate = """

{
"name": \""""+envname+"""\",
"description": "The master development branch",
"cookbook_versions": {
},
"json_class": "Chef:Environment",
"chef_type": "environment",
"default_attributes": {
"revrec":
{
"required_version": \""""+appVersion+"""\"

}
},
"override_attributes": {
}
}

##write the envtemplate in a file

with open("/tmp/"+envname+".json","w") as f:
f.write(envtemplate)
f.close()

## Create env from the teplate json file

subprocess.call("knife environment from file /tmp/"+envname+".json", shell=True)

3. Add the node in the environment:


knife exec -E 'nodes.find("name:node2") {|n| n.chef_environment("env209");n.save }'

 

Posted in ARTICLES, Configurtion management, DevOps, HOWTO, Programming | Tagged , , , | Leave a comment