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
Configuration Name: myconf Enabled: YES Protection Mode: MaxAvailability Fast-Start Failover: ENABLED Databases: prima - Primary database physt - Physical standby database - Fast-Start Failover target
Fast-Start Failover Threshold: 30 seconds Observer: uhesse
Current status for "myconf": SUCCESS
Alternatively, you can query v$database like this:
SQL> select FS_FAILOVER_STATUS,FS_FAILOVER_OBSERVER_PRESENT,FS_FAILOVER_OBSERVER_HOST from v$database;
#1 von Uwe Hesse am 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 http://www.gnu.org/software/screen/manual/screen.html for the documentation of screen.
#2 von Rico am 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.Rico
#3 von sunilbhola am Februar 10, 2011 - 07:04
nohup dgmgrl -silent sys/oracle@DB_NAME „start observer“ &
OR
nohup dgmgrl -silent sys/XXXXXXX@DB_NAME „start observer“ & >> observer_jan_26.log
#4 von tom am Februar 15, 2011 - 11:43
hmmm. this solutions suck since the sys password is visible with a simple ps -ef
#5 von Uwe Hesse am Februar 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 von Troy Meyerink am März 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 von Uwe Hesse am März 29, 2011 - 20:43
Troy,
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 von Frank am Januar 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 von Uwe Hesse am Januar 9, 2012 - 16:48
Frank,
you’re welcome 🙂
Thanks for stopping by and leaving the nice comment!
#10 von Frank am Januar 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
DGMGRL> connect sys/passowrd@primary_db
DGMGRL> connected
DGMGRL>
Can you give some tips on this? Thanks a lot.
#11 von Uwe Hesse am Januar 9, 2012 - 18:34
Frank,
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 von Frank am Januar 9, 2012 - 19:10
Uwe:
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:
oracle@myserver:/opt/oracle/scripts
$ uname -a
Linux myserver.domain.com 2.6.18-194.32.1.0.1.el5 #1 SMP Tue Jan 4 16:26:54 EST 2011 x86_64 x86_64 x86_64 GNU/Linux
oracle@myserver:/opt/oracle/scripts
$ 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 von Frank am Januar 9, 2012 - 19:38
Uwe:
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 von Frank am Januar 9, 2012 - 22:27
Uwe:
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 von Uwe Hesse am Januar 10, 2012 - 10:05
Frank,
no need to apologize! I appreciate comments and especially that you took the time to tell about the solution of this problem 🙂
#16 von omid am Juli 2, 2013 - 13:45
hi
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 von Uwe Hesse am Juli 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 von omid am Juli 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 von Uwe Hesse am Juli 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 von Bharat Dwa am Dezember 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 von Uwe Hesse am Dezember 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 von bernd am April 26, 2016 - 09:56
Hi Uwe,
here is another solution to start observer using a script:
cat start_observer.ksh
#!/usr/bin/ksh
dgmgrl -echo -logfile observer.log <<EOF
connect /@
start observer file’fsfo_.dat
EOF
#
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 von Uwe Hesse am April 27, 2016 - 09:10
Hi Bernd, thank you for sharing that information here 🙂
#24 von Sandeep R Narani am Januar 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 von Uwe Hesse am Januar 18, 2017 - 10:57
Multiple Observers for the same DG configuration are a 12cR2 New Feature. You can see how it works here: https://uhesse.com/2017/01/13/fast-start-failover-for-maximum-protection-in-oracle-12c/
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.