Posts

Showing posts from July, 2011

Monitor Memory Status (available memory)

copy the following into a .sh file and execute the same from putty #!/usr/bin/ksh #memory calculator um=`svmon -G | head -2|tail -1| awk {'print $3'}` um=`expr $um / 256` tm=`lsattr -El sys0 -a realmem | awk {'print $2'}` tm=`expr $tm / 1000` fm=`expr $tm - $um` echo "\n\n-----------------------"; echo "System : (`hostname`)"; echo "-----------------------\n\n"; echo "\n\n-----------------------"; echo " Users Login information \n"; for ENTRY in `finger | cut -d " " -f1 | grep -v Login | uniq` do echo "`finger -l $ENTRY | head -1 | cut -d \" \" -f14` ---> `finger -l $ENTRY | awk '{ print $2 }' | tail -2 | head -1`"; #finger -l $ENTRY | awk '{ print $2 }' | tail -2 | head -1; done echo "-----------------------\n"; echo "\n----------------------"; echo "Memory Information\n\n"; echo "total memory = $tm MB" echo "free memory = $fm

Search for a string in schema

declare cursor c1 is select column_name , table_name from user_tab_columns where data_type = 'VARCHAR2' ; -- and table_name = 'TABLE_NAME' ; vSQL varchar2 ( 32676 ) := null ; vParam varchar2 ( 100 ) := 'STING_YOU_WANT_TO_SEARCH' ; vcnt number ; begin for x in c1 loop begin vSQL := 'select count(*) from ' ||x.table_name|| ' where ' ||x.column_name|| ' like ' ||chr( 39 )|| '%' ||vparam|| '%' ||chr( 39 ); execute immediate vSQL into vcnt; if vcnt > 0 then dbms_output.put_line( 'Found in ' ||x.table_name|| ' ' ||x.column_name); end if ; exception when others then dbms_output.put_line( 'Problem in ' ||vSQL); end ; end loop ; end ;

Command to set 'NLS_LENGTH_SEMANTICS' after Installation & Creating 11gr2 db.......

1) update PROPS$ SET VALUE$='CHAR' where NAME='NLS_LENGTH_SEMANTICS'; 2) ALTER SYSTEM SET NLS_LENGTH_SEMANTICS=CHAR; 3) ALTER SESSION SET NLS_LENGTH_SEMANTICS=CHAR;

Unable to export tables with 0 rows in Oracle 11g

Scenario: I have used this command in 11g where I was not able to use "exp" utility for exporting tables with no rows. Issue: I was not able to export tables with '0' rows, objects were not created while taking .dmp file. Resolution: Execute below query on tables from where you want to export "select'alter table '||table_name || ' allocate extent;'from user_tables"
Scenario: I have used this command in 11g where I was not able to use "exp" utility for exporting tables with no rows. Issue: I was not able to export tables with '0' rows, objects were not created while taking .dmp file. Resolution: Execute below query on tables from where you want to export select'alter table '||table_name || ' allocate extent;'from user_tables