Posts

Showing posts from May, 2018

Netezza Commands

Table Size  select tablename, used_bytes/pow(1024,4) as used_TB   from _v_table_storage_stat  where tablename  in (  select tablename from _v_table where tablename not like  '_VT_%' and tablename not like '_T_%'); Objects owned by a user: select o.objname, d.database, oc.classname, u.usename from _t_object o, _t_user u, _t_object_classes oc, _v_database d where u.usename='username' and u.usesysid=o.objowner and o.objclass=oc.objclass and o.objdb=d.objid; Tip: Use NZ_HELP to get   syntax of all commands Like -    nz_help | grep grant [nz@dfw86inzb-04 ~]$ nz_help | grep grant nz_db_group_access_listing           To show what groups have been granted access to what databases. nz_db_user_access_listing            To show what users have been granted access to what databases. nz_ddl_grant_group    ...

Sample Python Script

from pymongo import MongoClient client = MongoClient('localhost:27018') collection = client.ucc_ppt.storage with open('/home/kolguk01/cfit_ucc_account_new.txt') as f:     for word in f.readlines():         collection.delete_many({'account': word.rstrip()}) How to execute it .. Python name.py

MongoDB Version Upgrade 3.4 to 3.6

Upgrade of Mongo 3.4 to 3.6 Please follow below steps to upgrade from Mongo 3.4 to 3.6 Pre-requisites: 1.        Make sure your Mongo version running on Mongo 3.4 2.        Connect to Mongo Shell and run the below command on the Primary Node a.        db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } ) POC:PRIMARY> db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } ) { "ok" : 1 } POC:PRIMARY> 3.        Make sure you have the Mongo 3.6 binaries ready Upgrade Procedure: 1.        Stop the Mongod service on one of the secondary node Sudo /etc/init.d/monogd stop 2.        Un-tar the Mongo.3.6.tz file to a location [root@dfwlncmgdb-06 kolguk01]# tar -xvf mongodb-linux-x86_64-rhel62-3.6.3.tgz 3.          Replace the...

Linux Commands

cp -R SRCFOLDER DESTFOLDER/   --copy folder Cp file destination   -- copy a file #Remove lines with containing specific text sed -i '/pattern to match/d' ./infile #renaming the file Mv oldfilename newfilename # send email echo 'Body of mail .' | mailx -s 'subject of mail ' -a   /pathtotheattachment    mailid du -hs *|sort -h   --> size in sorting order tar -zcvf consumer.gz    /home/kolguk01/consumer   -- Gunzip folder Rm -rf    --- remove folder Check IP address of Linux server /sbin/ifconfig Remove files   older than 14 days /usr/bin/find   /home/kolguk01/rpcache/mongo*.txt   -mtime   +14   -type f -exec rm {} \; Replace a string :%s/pattern/replace/ /g for all at once Convert Windows text file to Unix file --we do it by removing the character "\r" Od -c filename | head -- to check if it has windows characters ...