Articles Comments

AskDba.org Weblog » Entries tagged with "Tips"

Use awk/sed in vi

Thought of sharing some useful info which can help you to do your work faster in vi.You can use awk/sed scripts in vi using following command in vi :%!scriptname Here the scriptname file should have execute privilges for user. I used this to create a useful script which I was doing by typing multiple substitution command in vi. e.g Your file contains list of table $cat t.lst BANK005 BJSTM BJS_ORG CHAINED_ROWS CORR_BAM CORR_CAM CORR_EIT CORR_GAC CORR_GAM CORR_ITC CORR_LDT CORR_LHT Create script (quotes)  with following command and give execute permission to user. sed -e “s/^/’/g” -e “s/$/’,/” $1|awk ‘{printf (“%s”,$0)}’|sed -e “s/^/(/g” -e “s/,$/)/g” open t.lst in vi and type :%!quotes ('BANK005','BJSTM','BJS_ORG','CHAINED_ROWS','CORR_BAM','CORR_CAM','CORR_EIT','CORR_GAC','CORR_GAM','CORR_ITC','CORR_LDT','CORR_LHT') Similarly if you wish to remove blank lines, have a file blank like awk ‘!NF==0 {print $0}’ $1 Blank lines can also be directly removed from vi using :g/^$/d Isn’t it cool.. … Read entire article »

Filed under: Unix

CRSCTL CheatSheet

You can find below various commands which can be used to administer Oracle Clusterware using crsctl. This is for purpose of easy reference. Start Oracle Clusterware #crsctl start crs Stop Oracle Clusterware #crsctl stop crs Enable Oracle Clusterware #crsctl enable crs It enables automatic startup of Clusterware daemons Disable Oracle Clusterware #crsctl disable crs It disables automatic startup of Clusterware daemons. This is useful when you are performing some operations like OS patching and does not want clusterware to start the daemons automatically. Checking Voting disk Location $crsctl query css votedisk 0. 0 /dev/sda3 1. 0 /dev/sda5 2. 0 /dev/sda6 Located 3 voting disk(s). Note: -Any command which just needs to query information can be run using oracle user. But anything which alters Oracle Clusterware requires root privileges. Add Voting disk #crsctl add css votedisk path Remove Voting disk #crsctl delete css votedisk path Check CRS Status $crsctl check crs Cluster … Read entire article »

Filed under: oracle, rac