Showing posts with label Must Read. Show all posts
Showing posts with label Must Read. Show all posts

Sunday 12 February 2017

What is nohup command ? How to Run Datapump Jobs in Background with ‘’nohup ‘’ mode.



This is used to run Expdp / Impdp Jobs or any other long running jobs in Background.


Step 1: Create a parameter file for export or import

$ cat expdp.par

 

job_name=tab_export

directory=EXP_DIR

dumpfile=EMP_table_.dmp

logfile=export_EMP.log

reuse_dumpfiles=y

 



Step 2:  Create a shell script for your exp par file in nohup.
Also, Change the permission of this file  to execute this.

$ vi exp.sh

nohup expdp parfile=/home/oracle/st/exp.par &


[Esc]

!wq   [ENTER]


$ chmod 744 exp.sh



Step 3: Now run the shell script in nohup using below command.
This will release the prompt immediately and there will not be any running job in the prompt. 

$ nohup export.sh &

[1] 30221


$ nohup: appending output to `nohup.out'


[1]+  Done                    nohup export.sh


Note:
You can see the datapump job running in DBA_DATAPUMP_JOBS view.

Sunday 8 January 2017

Housekeep : Quick Tips for DBA


Many a times , the DBA need to remove/housekeep the files on file system on Server so as to make the database running fine...!!

 
You can also remove files based on the age of the file. For example, say you determine that any trace files more than 2 days old can be safely deleted. Typically, the find command is used in conjunction with the rm command to accomplish this task. Before removing files, first display the results of the find command:

$ find . -type f -mtime +2 -name "*.trc*"



If you are satisfied with the list of files, then add the 'rm' command to remove them:

$ find . -type f -mtime +2 -name "*.trc*" | xargs rm


In the prior line of code, the results of the find command are piped to the xargs command, which executes the rm command for every file found by the find command. This is an efficient method for deleting files based on age. However, be very sure you know which files will be deleted.

Another file that sometimes consumes large amounts of space is the listener.log file. Because this file is actively written to by the listener process


$ cp listener.log /u01/backups




Next, use the cat command to replace (nullify) the contents of the listener.log with the /dev/null file (which contains zero bytes) :

$ cat /dev/null > listener.log



For Archivelog deletion, we can use various policies as below :


On Primary

RMAN>  CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY;

On Standby ( Depends upon where backup is preformed )

RMAN>  CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; 

Wednesday 7 September 2016

What is the biggest lesson you have learned in the corporate world?



Source:  QUORA



  1. Never be the smartest person in the room.
  2. Always listen to your inner voice.  If it "feels wrong" it is.
  3. Debt makes you and your company a slave to someone.
  4. It is never wrong to do the right thing.  It is never right to do the wrong thing.  The ends DO NOT justify the means.   The Ten Commandments are also great safety tips no matter who said them.
  5. Don't hire employees or friends.  Hire people who believe in the vision and want to partner because it makes them feel alive to be apart of something bigger than them or us.
  6. Remember who you wanted to be when you were a kid.  You didn't EVER want to be the dream killer, paper pusher or suit.  You wanted to change the world.  Why aren't you changing the world?  Age is a mind set and the older you are mentally, the less dynamic change you will capture and create.
  7. Love your people. If your end users are viewed as people who are "clicks"  or just customers you will fail.   If you care about them, you will make the product that will actually make their life better or easier.  You both win. Most companies are upside down.  Prioritize:
    A) principals
    B) people (love and respect your end users/vendors and employees/partners
    -- If you have those as your solid foundation and you protect those two things, the next two fall into place naturally.
    C) product. If you know the first two the product becomes obvious
    D) profit.  It is a byproduct.  Never forget that. Making profit your goal is the easiest way to become all that you despise.
  8. Make your word you bond.  Contracts are important but your word is more so.  Let your yes mean yes and no mean no always.  The spirit of the deal is just as important as the words of the deal.  Never dishonor yourself.
  9. Plan on being mocked or told it will never work.  Sometimes they are right, but the best ideas do seem crazy at first to most or everyone would already be doing it.
  10. Know not what you do or make.  But why.  That is the difference between a guy who makes computers and Steve jobs.  He knew why.  ART.
  11. With God all things are possible.
  12. There is no such thing as compartmentalizing ethics.  You can not cheat on your wife or taxes but be honest and trustworthy at the office.   Fix your character flaws.  We all have them.   Master them or they will master you.
  13. Make your weakness your strength        SOURCE : https://www.quora.com/What-is-the-biggest-lesson-you-have-learned-in-the-corporate-world

Monday 25 July 2016

Server Maintenance Tasks for a DBA





To delete files older than 60 days
$  find . -name "*.gz" -depth -mtime +60 -exec rm {} \;


To list files dated May 18
ls -lrt | grep 'May 18' | awk -F' ' '{print$9}'


To delete files dated May 18
rm -rf `ls -lrt | grep ‘May 18' | awk -F' ' '{print$9}'`


To list files of Month May
$  ls -lrt | grep 'May' | awk -F' ' '{print$9}'
$  ls -lrt *.trc|grep 'May'|xargs rm -rf  {}\;

Things need to check during - - Server reboot

Suppose you are working on Dataguard setup or normal Stand-Alone Database,
Following steps mandatory just take backup of following three steps and store it in separate notepad.
Once the server reboot activity completed.. then cross check once which was taken before server reboot.


$  ps -ef|grep pmon

$  ps -ef|grep pmon|wc -l

$  ps -ef|grep inh (OR) ps -ef|grep tns

$  ps -ef|grep inh|wc -l

$  ps -ef |grep d.bin

$  hostname

$  date

$  uname -a

$  cat /etc/oratab  /  cat /var/opt/oracle/oratab

$  uptime

$  who -b

$  df -h  / df –gt



Data Guard Database  Shutdown Procedure

Login as oracle

source the environment

$  sqlplus “/ as sysdba”

SQL >alter database recover managed standby database cancel;
                                                                                ------> to cancel MRM mode

SQL> shutdown immediate;

SQL> exit


Data Guard Db Startup Procedure

$  Sqlplus “/ as sysdba”

SQL> startup nomount;

SQL> alter database mount standby database;

SQL>  recover managed standby database disconnect from session;
                                                                ----------->To put it in MRM MODE