Posts

Showing posts from May, 2015

sed and awk for DBAs

OS - *ix Some useful sed, awk and bash commands for dbas. Some of them needs bit of improvements and might well have other better alternatives (e.g. one liners). 1. Provided with line by line list which needs to be put in to sql " IN " clause. [stefan@oc8233082860 ~]$ cat list.txt RMS_USER_ROLE_DEFINITION RMS_USER_ROLE RMS_USER_DETAILS [stefan@oc8233082860 ~]$ cat list.txt | awk -vORS=, '{ print $1 }' | sed 's/,$/\n/' > list2.txt [stefan@oc8233082860 ~]$ sed -r 's/,([^ ),]+)/,'\''\1'\''/g; s/,,/,'\'\'',/g' list2.txt RMS_USER_ROLE_DEFINITION,'RMS_USER_ROLE','RMS_USER_DETAILS' [stefan@oc8233082860 ~]$ 2. Getting datafile name removing the directory path. [stefan@pc_stefan ~]$ cat cmd_test.txt /dc2_db2/PACS/data/system.dbf /dc2_db2/PACS/data/undo.dbf /dc2_db2/PACS/data/sysaux.dbf /dc2_db2/PACS/data/pacs_cust_data01.dbf /dc2_db2/PACS/data/

ORA-01578 after rman recovery

Oracle - 11.2 This is a brief list pointing out some factors on nologging operations which results unrecoverability in database. Once a db backup with unrecoverable operations fully recovered, accessing affected objects will still return ORA--1578. 1. Detecting unrecoverable operations. Rman " report unrecoverable " will provide list of datafiles which are in unrecoverable state. Also unrecoverable_time column of v$datafile can be queried to see the last unrecoverable action performed on particular datafile, but this column will not be updated after a backup is made from rman. 2. There want be any errors during the restore/recovery operations in rman  logs. Even during a nologging operation small amount of redo is generated. These logs simply says that affected block is for nologging operation. So during a roll-forward these logs will be applied, but they will logically corrupt the affected blocks. 3. After full restore/recovery of daabase with nologging corr