Starting the Observer in the background

One question that I get asked often in my Data Guard courses (also this week) is, how to start the observer for Fast-Start Failover in the background.

Many customers use a remote terminal emulation to manage their Data Guard configuration, so it would be a problem if it would be required to keep the window open on which they started the dgmgrl-shell for the observer. This is also not very well documented in our – apart from that very helpful – Online Documentation. On the Linux command line, it works like this:

nohup dgmgrl -silent sys/oracle@prima "start observer" &

This gives you a text file on your current directory called nohup.out on which you can do a tail -f later on, if you would like to see te actions of the observer. The Data Guard Observer is kind of quiet, it waits with messages until there is actually something to do. You can verify its presence with dgmgrl from the primary site with the command

DGMGRL> show configuration verbose
 Name:                myconf
 Enabled:             YES
 Protection Mode:     MaxAvailability
 Fast-Start Failover: ENABLED
 prima - Primary database
 physt - Physical standby database
 - Fast-Start Failover target
Fast-Start Failover
 Threshold: 30 seconds
 Observer:  uhesse
Current status for "myconf":

Alternatively, you can query v$database like this:

     from v$database;

  1. #1 by Uwe Hesse on September 27, 2010 - 09:47

    During one of my Data Guard courses, I got aware that there is a very nice alternative to nohup here: screen can also be used (not only) to start the observer in the background. Look at for the documentation of screen.

  2. #2 by Rico on November 17, 2010 - 15:37

    Here an example to start the “observer” in background using “screen”:

    su - oracle -c 'screen -dmS observer -s /bin/bash dgmgrl -logfile /path/observer_$(date '+%d%m%Y').log sys/password@db "start observer"'

    Put this in "rc.local" to start the observer automaticaly.


  3. #3 by sunilbhola on February 10, 2011 - 07:04

    nohup dgmgrl -silent sys/oracle@DB_NAME “start observer” &


    nohup dgmgrl -silent sys/XXXXXXX@DB_NAME “start observer” & >> observer_jan_26.log

  4. #4 by tom on February 15, 2011 - 11:43

    hmmm. this solutions suck since the sys password is visible with a simple ps -ef

  5. #5 by Uwe Hesse on February 15, 2011 - 12:45

    Mr “realtom”, apparently you are one of the many guys who just claim things without ever checking not to speak proving them. That differentiates you from the real Tom, by the way.

    The password of sys is not exposed by a ps -ef if the observer is started in the background as with the demonstration in the posting. Although I thought so before, I have just checked that again (with 11.2 – probably it is the same with 10g also).

    Please refrain from using insultive language in the future or I will delete your comments.

  6. #6 by Troy Meyerink on March 25, 2011 - 16:26

    Thanks for the information! Do you know how this might translate to Windows? I am alos trying to use the -logfile parameter in conjunction with having it run in the background.

  7. #7 by Uwe Hesse on March 29, 2011 - 20:43

    I have limited experience with Data Guard on Windows. Once at a customers site, the DBA told me that they just call the observer in a DOS-Box and then terminate that window while the observer continues. I haven’t tested that, though.

  8. #8 by Frank on January 9, 2012 - 16:41

    Uwe Hesse:

    Thank you so much to pay attention on this topic. It is very useful. The reqular Oracle Documentation didn’t descripbe this issue. Your solution help many DBAs to handle this effciently.

  9. #9 by Uwe Hesse on January 9, 2012 - 16:48

    you’re welcome 🙂
    Thanks for stopping by and leaving the nice comment!

  10. #10 by Frank on January 9, 2012 - 18:14

    Uwe Hesse:

    When I log into Linux box as oracle user, then type this command line in prompt

    $nohup dgmgrl -silent sys/password@primary_db “start observer” &

    The system return this:
    $-bash: @primary_db: event not found.

    However, if I connect like this, it will do:

    DGMGRL> connect sys/passowrd@primary_db
    DGMGRL> connected

    Can you give some tips on this? Thanks a lot.

  11. #11 by Uwe Hesse on January 9, 2012 - 18:34

    I just did this:
    nohup dgmgrl -silent sys/oracle@prima “start observer” &
    and it works (with at least my Linux):
    [oracle@uhesse]$ uname -a
    Linux uhesse 2.6.32-100.28.5.el6.x86_64 #1 SMP Wed Feb 2 18:40:23 EST 2011 x86_64 x86_64 x86_64 GNU/Linux

    Should be the same at your site also.

  12. #12 by Frank on January 9, 2012 - 19:10


    I checked my command line with yours. I couldn’t find why it runs on your Linux, not on mine. Here is my command lines:

    $ uname -a
    Linux 2.6.18- #1 SMP Tue Jan 4 16:26:54 EST 2011 x86_64 x86_64 x86_64 GNU/Linux

    $ nohup dgmgrl -silent sys/password@primary ‘start observer’ &
    -bash: !@primary: event not found

    The issue is shell bash? or anything else? Sorry to bother you by this.

  13. #13 by Frank on January 9, 2012 - 19:38


    I guess it is caused by oracle user password. I loginto Linux with my individual passowrd, Then I
    $sudo su – oracle
    enter my individual passowrd again into oracle user login path. probably my individual password has no privilege to run nohup. Does this make sense?

  14. #14 by Frank on January 9, 2012 - 22:27


    I am sorry to post so many here. I just want to tell you that your command is working. The problem is my sys password. It contains a “!”. Then bash think command want to repeat last command. But it couldn’t find last command. So return ‘back ” !@primary: event not found’. I changed sys password. It run through. Observer is started and run in background. Thanks for your help.

  15. #15 by Uwe Hesse on January 10, 2012 - 10:05

    no need to apologize! I appreciate comments and especially that you took the time to tell about the solution of this problem 🙂

  16. #16 by omid on July 2, 2013 - 13:45

    after observer failover to standby and stand by role changed to primary what should i do for set my old primary to my real primary db?

  17. #17 by Uwe Hesse on July 9, 2013 - 20:11

    Omid, I suppose you mean a reinstate of the old primary? The Observer tries that automatically after you start the instance. If it succeeds, you just need to switchover.

  18. #18 by omid on July 13, 2013 - 09:11

    ok thank you
    its fix ok
    i have more question
    i know that we can just have one observer in ADG
    what should i do if i want have a back up for my observer?

  19. #19 by Uwe Hesse on July 19, 2013 - 19:21

    Omid, you may write your on watchdog for that – we have none on the command line. But that is actually an option with Grid Control, where you can specify an alternate observer host. The Grid Control Agent starts the observer there if the original host fails.

  20. #20 by Bharat Dwa on December 16, 2014 - 20:27

    Hope this is still open. I have two questions: 1. Can we start multiple observer in the same machine to setup FSFO to multiple dataguard env? 2. how do we monitor to ensure that the observer itself does not die? Can the observer be monitored by EMC12c?

  21. #21 by Uwe Hesse on December 20, 2014 - 20:39

    1) Yes, that should be possible, although I have not seen that personally yet 2) DGMGRL> show configuration verbose; EMC12c can do it also, I suppose.

  22. #22 by bernd on April 26, 2016 - 09:56

    Hi Uwe,
    here is another solution to start observer using a script:
    cat start_observer.ksh

    dgmgrl -echo -logfile observer.log <<EOF
    connect /@
    start observer file’fsfo_.dat

    nohup ./start_observer.ksh &
    ps shows the running script, but no connect informations.
    script has been started on an oracle client machine by the owner of the oracle client software.
    Environment and tnsnames.ora have to be configured.

  23. #23 by Uwe Hesse on April 27, 2016 - 09:10

    Hi Bernd, thank you for sharing that information here 🙂

  24. #24 by Sandeep R Narani on January 16, 2017 - 22:30

    How can we configure the Multiple Observers on different hosts for single Oracle database ?
    Like wise adding the alernate host & alernate Oracle home in OEM. Is there way how to connect using dgmgrl or manually not with the OEM

  25. #25 by Uwe Hesse on January 18, 2017 - 10:57

    Multiple Observers for the same DG configuration are a 12cR2 New Feature. You can see how it works here:
    Alternate Observers are an OEM feature and the major difference is that there is just one observer running at any given time. The OEM agents monitor the observer and if that host fails, the agent on the alternate host starts the observer then there.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: