Posts

Showing posts from February, 2018

Bash: Connect to Oracle DB

Even you dont have tnsora defined for your database , you can still connect to database using below shell script. LOGIN_DATA = "user/password@' (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=XXX.XXX.XXX.XXX)(PORT=1521)) (CONNECT_DATA=(SID=SID)))'" CONNECT =`sqlplus - S ${ LOGIN_DATA } <<- span=""> EOF SET ECHO OFF ; select count (*) from table ; EOF ` echo "$CONNECT"

Firewalld: Add Puppet master ports to firewalld in CentOS7.

1. Find out what are your server's active zones. [root@vihitaatma ~]# firewall-cmd --get-active-zones public   interfaces: ens192 [root@vihitaatma ~]# 2 Puppet has different ports for different services. 3000: Web based installer  8140: Communication port between Puppet Master & Agent.  61613: Used by MCollective for orachestration requests by Puppet agents 443: Puppet Enterprise console web port. 5432: PostgreSQL  8081: Puppet DB Request Port. 8142: Used by Orachestration services to accept inbound traffic/responses from Puppet Agents   [root@vihitaatma ~]# firewall-cmd --zone=public --permanent --add-port=8140/tcp success [root@vihitaatma ~]# firewall-cmd --zone=public --permanent --add-port=61613/tcp success [root@vihitaatma ~]# firewall-cmd --zone=public --permanent --add-port=443/tcp success [root@vihitaatma ~]# firewall-cmd --zone=public --permanent --add-port=5432/tcp success [root@vihitaatma ~]# firewall-cmd --zone=public --

SQL: Give grants to all tables in a schema

Use this procedure and just execute it as normal SQL query BEGIN    FOR R IN (SELECT owner, table_name FROM all_tables WHERE owner='Schema_name 1') LOOP       EXECUTE IMMEDIATE 'grant select,insert,update,delete on '||R.owner||'.'||R.table_name||' to < >';    END LOOP; END; Schema Name 1 : This is like to which schema you needed grants. Schema name 2: This like which schema needed those grants. For example: SchemaA should have access on all tables,view of Schema B, then Schename Name 1 would be Schema B and Schema Name 2 would be Schema A. Thanks Raja