Showing posts with label UNIX. Show all posts
Showing posts with label UNIX. Show all posts

Saturday 24 October 2020

Clear RAM cache, buffer and swap space in Linux

 

Clean up the page-cache :

   # sync; echo 1> / proc / sys / vm / drop_caches

  

Clean dentrie and inode caches:

     # sync; echo 2> / proc / sys / vm / drop_caches

 

To clean the page-cache, dentrie and inode caches:

     # sync; echo 3> / proc / sys / vm / drop_caches

 

# swapoff -a && swapon -a

 

1) Shutdown the database and its services (pg_ctl stop , sudo service postgresql stop, etc.)

2) sync

3) sudo echo 3> / proc / sys / vm / drop_caches

4) Start the database server

 

free && sync && echo 3> / proc / sys / vm / drop_caches && free

Found this post interesting? Subscribe us  ðŸ˜ŠðŸ˜‰


Read more 

Configure Streaming Replication in PostgreSQL

All about Physical Replication and Log shipping in Postgres 

Streaming-Replication Sync and Async, benefits of streaming replication over Log-shipping

Monday 13 August 2018

Linux Important Files and Description



/etc/passwd - User Settings

/etc/group - Group settings for users.

/etc/hosts -  Host name lookup information

/etc/sysctl.conf  - Kernel parameters for Linux.

/etc/fstab  - Files to check for File System entries

/etc/oratab  - Oracle Registered instance (DBCA)

/etc/redhat- release - get the OS release information

/etc/selinux/config  - Enable or disable security feature.

/proc/meminfo  - To determine To determine the RAM size

/var/log/messages  - Check System and error logs and messages

/home/oracle/.bash_profile  - Oracle user profile setting file in Linux.

/etc/security/limits.conf  - Specify process and open files related limits



-

Attack every problem with enthusiasm... as if your survival depends upon it



ASM Interview Questions | PDF Download

How to Crack DBA Interviews | Tips 

Frequently Asked Questions for 2+ Years

30+ Oracle Dataguard Questions | PDF Download

Monday 27 June 2016

Useful simple vi commands for DBA’s


Join us at FACEBOOK


COMMAND                                                        EFFECT
:.=                                                        find out the current line number
:1                                                         go to line 1
Ctrl-d                                                 page down
Ctrl-u                                                 page up
Shift-g                                               go to end of file
i                                                           insert text at current position
Shift-a                                               append text after end of current line
Shift-I                                                insert text before start of current line
Esc                                                      get out of edit mode, back into normal vi command mode
dd                                                        delete current line
10dd                                                  delete 10 lines from current line on down
d shift-g                                            delete all lines from current line and below
d 1 shift-g                                                            delete all lines from current line and above
.                                                            repeat previous command
shift-y                                               yank (copy) current line
p                                                          paste that copy into line below
/data                                                  search forward for occurencies of string "data"
/                                                           search forward for next occurrence of remembered search string
?                                                           search backward for next occurrence of remembered search string
:set ic                             make searches case insensitive
:1,$s/data/index/g                      replace all occurrencies of "data" with "index"
:1,$s/"//g                                        remove all " characters
:1,$s/$/ ;/                                       append " ;" to the end of every line
:1,$s/^/rem /                                insert "rem " to the start of every line
:w                                                        write (save) file
:q                                                         quit out of vi
:q!                                                        quit out of vi without saving changes
:wq                                                     write (save) file and quit out of vi
shift-z                           shift-z       same as above ":wq" except does not write (change file modification
                                                              times) if you have not made any changes.
:n                                                         next file (when vi'ing a series of files, e.g. with using "vi *" at the
                                                             command prompt)
u                                                          undo last command
shift-j                                                 Join next line onto end of current line





                           
                    VI Quick Reference Guide
                     ---------------------------------


BASIC commands

$ vi filename              - normal mode
$ vedit filename       - user friendly edit
$ esc                              - return to command mode

                       

INSERTING
o                  - insert a line after cursor
O                 - insert a line before cursor
i                   - insert text at cursor
a                  - insert text after cursor
I                   - insert text at start of line
A or $a      - insert text at eol



SAVING AND QUITING                      
ZZ               - save and exit                     
:w               - save without exiting              
:w!              - save write protected file         
:q                - quit editor                       
:q!               - quit without saving

                     

DELETING

dd               - delete current line
x                  - delete char at cursor
X                 - delete char before cursor
dw              - delete word
D or d$     - delete from cursor to eol


              
CURSOR MOVEMENT                 

     k                            
     ^                             
h < > l                          
     v                            
      j                             
     
                           
        REPLACING / CHANGING
 
R - replace till eol
r - replace one character
C - change all text after cursor
cw - change a word
c$ - change from cursor to EOL
cG - change from cursor to EOF


MOVING ABOUT                            
 
f  - page forward                 
 b  - page back
 d  - 1/2 page forward
 u  - 1/2 page back
 w  - next word                       
 b  - previous word     
^B  - Goes one page UP
^  - start of line (shift 6)                                                        
 G  - go to end of file                        
 1G - go to beginning of file                  
 g  - show position in file               
^D  - Goes half page down                  
^U  - Goes half page up 
^F  - Goes one page DOWN                                       
 $  - end of line
 nG - go to nth line


MOVING TEXT
 
To move n lines of text from A to B

1. move cursor to A
2. ndd - delete n lines
3. move cursor to B
4. P - pull text in after cursor
p - pull text in before cursor
 
(,(   next, previous sentence
},{   next, previous paragraph
]],[[ next, previous section
%    goto matching parenthesis () {} []

YANK OPERATOR TO BUFFER
 yw - yank word
 y$ - yank from cursor to EOL
 yG - yank from cursor to EOF
 yy - yank complete current line
 p  - paste from buffer after cursor
 P  - paste from buffer before cursor
 
 
                               USEFUL COMMANDS
 
                         . - repeat last command
                         u - undo last command
                         U - undo changes made to current line
                         J - join the next line to the current line
                        ^G - Show the current filename and status
                         ! - Ejecuta uan linea del shell
 
           :1,$s/old/new/g - global search and replace old with new *
           :.,$d           - delete from current line to eof
           :r filename     - read filename into this vi buffer
           :n,mw filename  - write lines n through m to filename
 

SEARCHING
/abc - search for string "abc"
N - find previous occurrence
n - find next occurrence 

COPYING TEXT
To copy n lines of text from A to B

1. move cursor to A
2. nyy - yank n lines
3. move cursor to B
4. P - pull text in after cursor                                            
    p - pull text in before cursor

Monday 23 May 2016

Findiing & Removing (Deleting) Files by 'n' Dates in LINUX



Finding & Removing (Deleting) Files by 'n' Dates in LINUX

There are three times associated with a file

·         atime  - last access time
   
·         ctime  - last status change time

·         mtime  - last modify time

Remove all files from /home/dpafumi older than 5 days:
$ find /home/dpafumi -type f -mtime +5 -exec rm -f {} \;

Print out what files from /home/dpafumi older than 5 days:
$ find /home/dpafumi -type f -ctime +5 -print

Finding the top 5 largest files
$ find . -ls | sort -nrk 7 | head -5

Find files larger than 100MB
$ find . -size +100000k

Delete audit records that’s older than 30 days
$ find $ORACLE_HOME/rdbms/audit -name "*.aud" -mtime +30 -exec rm {} \;

Delete files in /tmp that’s older than 30 days
$ find /tmp -group dba -type f -mtime +5 -exec rm -f {} \; find /tmp/dba -group dba -type f -mtime +5 -exec rm -f {} \;

Delete *.trc files more than 5 days old
$ find $TRACE_DIR -name '*.trc' -type f -mtime +5 -exec rm {} \;

Display top 5 largest files in a current directory
$ ls -alS | head -5

Largest space-consuming directories (Does not include sub-directories)
$ du -Sm . | sort -nr | head -5

Report the sum of space consumed by a directory and its subdirectories
$ du . | sort -nr | head -5

List files in a directory greater than 300M
$ ls -l | awk '{if ($5 >314572800) print $0}' |sort +4