红联Linux门户
Linux帮助

Linux 9i下Dataguard配置

发布时间:2006-10-03 00:11:45来源:红联作者:hfh08
作者:wangyl1977

环境:
os: linux 9
oracle: oracle9i
primary: 1.1.1.1
standby: 1.1.1.2 (主副主机都是两台普通的pc主机)

第一部分 oracle9i 在linux9上的安装

本来我不想写这方面的东东,但是对比oracl9i在solaris 下和在linux下安装,oracle9i 在linux9上的安装真的是要麻烦很多,下面我把我遇到的问题(好像也是大部分oracle初学者安装时遇到的问题)简要的说一下,oracle9i 在linux9上的安装也折腾了我好几个月,没办法,我太笨了。

1)运行runinstaller的时候报错。
-bash-2.05b$ ./runInstaller
-bash-2.05b$ Initializing Java Virtual Machine from /tmp/OraInstall2005-01-20_06-39-06PM/jre/bin/java. Please wait...
/tmp/OraInstall2005-01-20_06-39-06PM/jre/bin/i386/native_threads/java: error while loading shared libraries: libstdc++-libc6.1-1.so.2: cannot open shared object file: No such file or directory
Oracle Net configuration Assistant
Oracle Database configuration Assistant
Agent configuration Assistant
三个工具的details错误信息都是:
/home/oracle/jre/1.1.8/bin../lib/i686/native_threads/libzip.so :symbol errno,version GLIBC_2.0 not definded in file libc.so.6 with link time reference(libzip.so)
unable to initialize threads: cannot find class java/lang/Thread
Could not create java VM
解决方法:
在运行runInstaller之前做下面的步骤。
export LD_ASSUME_KERNEL=2.4.19
ignore your kernal version
下载文件libcwait.c ftp://people.redhat.com/drepper/libcwait.c (通过IE无法下载的话,就用命令行)用gcc -shared -o libcwait.so -fpic -O2 libcwait.c进行编译然后export LD_PRELOAD=/$path/libcwait.so
上面的方法能使Oracle Net configuration Assistant ,Oracle Database configuration Assistant 安装成功。



修复Agent configuration Assistant不能配置成功的方法:请参考chinaunix上的
在RHAS3上成功安装Oracle9204作者:renxiao2003
----------------------------------------------------------------------------------------------
运行runInstaller之后,出现安装组件的选择结果,这时点“Install”,开始安装,复制文件,进度条在一点一点的增加,当安装并link完后,出现配置工具界面,agent服务不能配置成功,忽略不用管,在下面修复。DBCA,NETCA,HTTP都正确配置完毕哦。呵呵。下面开始修复错误。其实要是把各个界面抓取下来就更好了。
6、安装p3238244_9204_LINUX.zip补丁
此补丁也是从http://metalink.oracle.com下下载,同时要下载一个opatch软件包:p2617419_220_GENERIC.zip,它主要是用来悠agent服务不能启动的错误。
过程如下:[quote:864939f94a]su - oracle
$ cp p2617419_210_GENERIC.zip /tmp
$ cd /tmp
$ unzip p2617419_210_GENERIC.zip
$ export PATH=$PATH:/tmp/OPatch
$ export PATH=$PATH:/sbin # the patch needs "fuser" which is located in /sbin
$ unzip p3238244_9204_LINUX.zip
$ cd 3238244
$ opatch apply

:864939f94a]补丁修复完成,需要relinked一个.mk文件。
$ cd $ORACLE_HOME/network/lib
$ make -f ins_oemagent.mk install
现在在运行agentctl start,看是不是可以成功运行agent服务了啊,可以用stop、status来停止此服务或者检查服务的状态。
在这个成功之后,居然不能启动Oracle,说是不能找到初始化文件,没办法,我用dbca先删除了原来安装时建立的库,再重新建立了数据库。
7、运行dbca来创建数据库。呵呵,一路畅通,完成数据库的安装。
希望你也能成功安装。


运行runInstaller后,安装界面出来出现乱码
export LANG=en_us 再运行runInstaller (这是最简单实用的办法)


报/etc/oratab 错误
如果在机器上以前安装过,再一次安装的时候如果报/etc/oratab 错误。请将/etc/oratab 清空(删除也可)
cp /dev/null /etc/oratab
(4)然后开始建库,当建库到46%时会出现共享内存问题,
  ORA-27123: unable to attach to shared memory segment
这时需要给内核指定内存,可以:
  echo 4294967295 >/proc/sys/kernel/shmmax
或者
  编辑/etc/sysctl.conf
  kernel.shmmax=4294967295
这样就可以数据库的安装。
运行: 要启动oracle要先运行数据库监听程序:lsnrctl start 关闭:lsnrctl stop
   运行oemapp console可以打开oracle企业管理器工具

还有一些错误,可能需要修改/etc/hosts,/etc/sysctl.conf,请大家在google上搜一下按照网友提示的方法进行修改。
另外主副主机的目录设置成一样。都将oracle用户主目录设为/home/oracle.主副主机的数据库名字都设为oracle,实例名也都设为一样,都设为oracle(申明一点,是否必须将主副主机的数据库名字实例名都设为相同,我曾在cu上发过贴子问过,好像大家都说不需要,但我们这的dba说是必须,反正我在这里设的是相同。

第二步:Dataguard配置
首先将主副两主机都设为归档模式。
1. 主节点备份并生成备用数据库控制文件
登陆主节点,进行数据库备份,并生成备用数据库控制文件
[oracle@primary]$ sqlplus "/ as sysdba"
SQL> startup
SQL> shutdown immediate
SQL> exit

[oracle@primary]pwd
/home/oracle
[oracle@primary]$ ls
admin dictionary.ora jre oradata oraInventory oui product soft
[oracle@primary]tar -cvf oradata.tar oradata
[oracle@primary]$ ls -l *.tar
-rw-r--r-- 1 oracle dba 576512000 Aug 16 10:22 oradata.tar
[oracle@primary]$ sqlplus "/ as sysdba"
SQL> startup
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /home/oracle/oradata/primary/archive
Oldest online log sequence 88
Next log sequence to archive 90
Current log sequence 90
SQL> alter database create standby controlfile as '/home/oracle/standby.ctl';
Database altered.
SQL> exit
[oracle@primary]

3. 登陆备用节点(standby),ftp获得primary主机的数据库文件(即oradata.tar文件)、备用控制文件(/home/oracle/standby.ctl) ,口令文件( $ORACLE_HOME/dbs/下的orapworacle)传到standby里的相应位置。
具体步骤:
3.1 在standby的/home/oracle/oradata下,原来有一个oracle的文件夹(里面是该主机下的dbf,redolog文件),再新建一个primary文件夹。将primary主机的oradata.tar解开的文件全部直接(即primary不要再有文件夹)放到primary下,将刚生成的备用控制文件(/home/oracle/standby.ctl)也放到primary下。

3.2 在standby的ORACLE_HOME/dbs/下,先将以前的orapworacle备份一下(改个名字即可),再将primary的$ORACLE_HOME/dbs/下的orapworacle 文件ftp放到standby的ORACLE_HOME/dbs/下.
说明一下,我在查阅eygle的大作及很多人的相关文章,都没有提到这一点,但如果没做这一步的话,再后面的启动备用数据库的时候,即在
[oracle@eygle primary]$ sqlplus "/ as sysdba"
SQL> startup nomount;
SQL> alter database mount standby database;
SQL> alter database recover managed standby database disconnect from session;
这一步时就会报ORA-01991 错误,说是Invalid passwd file.询问我们的dba,说是必须要用primary的orapworacle来替换standby的. 我试过,这样做了后就OK了。
所以我这在这里就把primary的orapworacle来替换standby的orapworacl也当作一步必须步骤,但我真的不能肯定这一步是否是必须的,如果不是必须的,为何我做这一步,总会报错。如果是必须的,为何eygle和其他大牛的大作里都没有提到这一步,难道是因为这个太简单吗?? 我真的是有些疑惑。如果哪位大牛看到这,请给我一个肯定的回答,我不胜感激。

在standby主机的$oracle/home/admin下原来有oracle目录。现在新建
primary目录,再在primary目录下新建bdump,cdump,udump.
Primary的参数文件

oracle@primary_andy $cat .bash_profile
# .bash_profile

# Get the aliases and functions
#if [ -f ~/.bashrc ]; then
# . ~/.bashrc
#fi

# User specific environment and startup programs
#export BASH_ENV=$HOME/.bashrc

PATH=$PATH:/home/oracle/product/9.2.0/bin:$oracle_home/jre/bin:/opt/SUNWspro/bin:/usr/bin:/usr/ccs/bin:/usr/ucb:/etc:/usr/local/bin:/usr/bin/saved:
export PATH
unset USERNAME
ORACLE_OWNER=oracle
ORACLE_BASE=/home/oracle
export ORACLE_BASE
ORACLE_HOME=/home/oracle/product/9.2.0
export ORACLE_HOME
LANG=
LC_ALL=
ORACLE_SID=oracle
export ORACLE_SID

TNS_ADMIN=/home/Oracle/config/9.2.0; export TNS_ADMIN
NLS_LANG=american_america.ZHS16GBK; export NLS_LANG
#ORA_NLS33=$Oracle_HOME/ocommon/nls/admin/data; export ORA_NLS33
CLASSPATH=$Oracle_HOME/JRE:$Oracle_HOME/jlib:$Oracle_HOME/rdbms/jlib:/opt/j2sdk_nb/j2sdk1.4.2/bin
export CLASSPATH
TMPDIR=/tmp;export TMPDIR
umask 022
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/lib/tls:/lib/i686:/usr/openwin/lib:/usr/dt/lib
export LD_LIBRARY_PATH
export LD_PRELOAD=/home/oracle/libcwait.so;
export LD_ASSUME_KERNEL=2.4.19;
DISPLAY=1.1.1.3:0.0;export DISPLAY;
export PS1="\u@\H $"

#cat initoracle.ora_primary
*.aq_tm_processes=1
*.background_dump_dest='/home/oracle/admin/oracle/bdump'
*.compatible='9.2.0.0.0'
*.control_files='/home/oracle/oradata/oracle/control01.ctl','/home/oracle/oradata/oracle/c
ontrol02.ctl','/home/oracle/oradata/oracle/control03.ctl'
*.core_dump_dest='/home/oracle/admin/oracle/cdump'
*.db_block_size=8192
*.db_cache_size=33554432
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=oracleXDB)'
*.fast_start_mttr_target=300
*.hash_join_enabled=TRUE
*.instance_name='oracle'
*.java_pool_size=83886080
*.job_queue_processes=10
*.large_pool_size=16777216
*.log_archive_dest_1='LOCATION=/home/oracle/oradata/archivelog/'
*.log_archive_dest_2='service=standby mandatory reopen=60'
*.log_archive_dest_state_1='ENABLE'
*.log_archive_format='log_%t_%s.arc'
*.log_archive_start=TRUE
*.open_cursors=300
*.pga_aggregate_target=25165824
*.processes=150
*.query_rewrite_enabled='FALSE'
*.remote_login_passwordfile='EXCLUSIVE'
*.shared_pool_size=83886080
*.sort_area_size=524288
*.star_transformation_enabled='FALSE'
*.timed_statistics=TRUE
*.undo_management='AUTO'
*.undo_retention=10800
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/home/oracle/admin/oracle/udump'

修改standby主机的initoracle.ora文件(先备份),我的initoracle.ora如下,供参考

*.aq_tm_processes=1
*.background_dump_dest='/home/oracle/admin/primary/bdump'
*.compatible='9.2.0.0.0'
*.control_files='/home/oracle/oradata/primary/standby.ctl'
*.core_dump_dest='/home/oracle/admin/primary/cdump'
*.db_block_size=8192
*.db_cache_size=33554432
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=oracleXDB)'
*.fast_start_mttr_target=300
*.hash_join_enabled=TRUE
*.instance_name='oracle'
*.java_pool_size=83886080
*.job_queue_processes=10
*.large_pool_size=16777216
*.open_cursors=300
*.pga_aggregate_target=25165824
*.processes=150
*.query_rewrite_enabled='FALSE'
*.remote_login_passwordfile='EXCLUSIVE'
*.shared_pool_size=83886080
*.sort_area_size=524288
*.star_transformation_enabled='FALSE'
*.timed_statistics=TRUE
*.undo_management='AUTO'
*.undo_retention=10800
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/home/oracle/admin/primary/udump'
*.log_archive_format=log_%t_%s.arc
*.log_archive_start=TRUE
*.STANDBY_FILE_MANAGEMENT=AUTO
*.log_archive_dest_1='LOCATION=/home/oracle/oradata/archivelog/'
*.log_archive_dest_state_1 = ENABLE
*.fal_server='primary'
*.fal_client='standby'
*.DB_FILE_NAME_CONVERT=("/home/oracle/oradata/oracle","/home/oracle/oradata/primary") ----(主辅数据库数据文件相互转换的目录)
*.STANDBY_FILE_MANAGEMENT=AUTO 即可实现重命名主库的数据文件!!
*.LOG_FILE_NAME_CONVERT=("/home/oracle/oradata/archivelog","/home/oracle/oradata/archivelog") ----(主辅数据库联机日志redolog相互转换的目录)
*.STANDBY_ARCHIVE_DEST=/home/oracle/oradata/archivelog
----(从主数据库产生的archivelog传到辅数据库的目录)
加粗的是我新添加的选项,基本上都是必需的。红色是注释,实际文件里请不要添加。

4. 配置主节点(primary主机上)的tnsnames.ora文件
primary=(description=
(address=
(protocol=tcp)
(port=1521)
(host=1.1.1.1))
(connect_data=
(SID=oracle)))
standby=(description=
(address=
(protocol=tcp)
(port=1521)
(host=1.1.1.2))
(connect_data=
(SID=oracle)))
同样,在副节点(standby) 的tnsnames.ora文件

5. 在副节点(standby)上配置listener.ora文件, 添加监听服务standby_listener,在相应的节里添加有关的内容.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = oracle)
(GLOBAL_DBNAME = oracle)
(ORACLE_HOME = /home/oracle/oradata)
)
)

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = standby)(PORT = 1521))
)
)

在主副库上启动lsnrctl,
-bash-2.05b$ lsnrctl
LSNRCTL>start # 启动监听服务

6.在主备节点用tnsping测试网络连通性

在primary机上
-bash-2.05b$ tnsping primary
-bash-2.05b$ tnsping standby

在standby机上
-bash-2.05b$ tnsping primary
-bash-2.05b$ tnsping standby

7. 启动副数据库

sql> startup nomount;
SQL> alter database mount standby database;
Database altered.
SQL> alter database recover managed standby database disconnect from session;
Database altered.

8. 在主节点设置归档路径
SQL> alter system set log_archive_dest_2='service=standby mandatory reopen=60';
System altered.
定义了主库向副库传输日志
# 定义归档到备用库,强制归档,重试时间60秒。
# 如果定义为可选状态(optional),那么在归档失败后不会再次尝试归档的。定义
# 为madatory状态后,如果本次归档失败,则在归档下一个日志时会再次尝试
SQL> alter system switch logfile;
System altered.
SQL> /
System altered.
SQL>
在备用节点观察日志
[oracle@eygle bdump]$ tail -f alert_primary.log
MRP0: Background Managed Standby Recovery process started
Starting datafile 1 recovery in thread 1 sequence 90
Datafile 1: '/opt/oracle/oradata/primary/system01.dbf'
Starting datafile 2 recovery in thread 1 sequence 90
Datafile 2: '/opt/oracle/oradata/primary/undotbs01.dbf'
…………………………
-bash-2.05b$ mkdir /home/oracle/oradata/oracle/stdarch
文章评论

共有 1 条评论

  1. hfh08 于 2006-10-03 00:12:10发表:

    9.主辅数据库的切换(停止主数据库,启用备用数据库)
    修改primary的参数文件initoracle.ora(先做好备份)
    增加
    *.standby_archive_dest='/home/oracle/oradata/standbyarch'
    *.fal_server='standby'
    *.fal_client='primary'
    *.DB_FILE_NAME_CONVERT=("/home/oracle/oradata/primary","/home/oracle/oradata/oracle")
    *.LOG_FILE_NAME_CONVERT=("/home/oracle/oradata/archivelog","/home/oracle/oradata/archivelog")
    *.STANDBY_FILE_MANAGEMENT='AUTO'
    删除 log_archive_dest_2参数

    修改standby的参数文件initoracle.ora(先做好备份)
    增加
    *.log_archive_dest_2='service=primary mandatory reopen=60'
    *.log_archive_dest_state_2='ENABLE'
    删除
    *.STANDBY_ARCHIVE_DEST=/home/oracle/oradata/archivelog
    *.fal_server='standby'
    *.fal_client='primary'
    *.DB_FILE_NAME_CONVERT=("/home/oracle/oradata/primary","/home/oracle/oradata/oracle")
    *.LOG_FILE_NAME_CONVERT=("/home/oracle/oradata/archivelog","/home/oracle/oradata/archivelog")
    *.STANDBY_FILE_MANAGEMENT=AUTO

    在primary主机上执行
    SQL> alter database commit to switchover to physical standby with session shutdown ;
    Database altered.
    察看primary主机上的后台日志
    …………………………….

    SQL> shutdown immediate
    ORA-01507: database not mounted
    ORACLE instance shut down.
    以备用模式(standby)启用主数据
    SQL> create spfile from pfile;
    SQL> startup nomount;
    SQL>show parameter standby_file_management;
    SQL> alter database mount standby database;
    Database altered.

    打开备用数据库(在standby主机上执行)
    [oracle@standby oracle]$ sqlplus "/ as sysdba"

    SQL> alter database commit to switchover to primary with session shutdown ;
    Database altered.
    SQL> shutdown immediate;
    ORA-01507: database not mounted
    ORACLE instance shut down
    SQL>create spfile from pfile;
    SQL> startup;
    ……
    Database mounted.
    Database opened.
    SQL> select SEQUENCE#,GROUP#,STATUS from v$log;
    SQL> select sequence#,group#,status from v$log;

    SEQUENCE# GROUP# STATUS
    ---------- ---------- --------------------------------
    72 1 INACTIVE
    73 2 INACTIVE
    74 3 CURRENT

    SQL> alter system switch logfile;

    System altered.

    SQL> select sequence#,group#,status from v$log;

    SEQUENCE# GROUP# STATUS
    ---------- ---------- --------------------------------
    75 1 CURRENT
    73 2 INACTIVE
    74 3 ACTIVE

    在primary主机上执行
    SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
    Database altered.

    在primary主机上观察日志应用情况
    [oracle@primary bdump]$ tail -f alert_oracle.log
    Starting datafile 2 recovery in thread 1 sequence 93
    Datafile 2: '/opt/oracle/oradata/primary/undotbs01.dbf'
    Starting datafile 3 recovery in thread 1 sequence 93
    Datafile 3: '/opt/oracle/oradata/primary/users01.dbf'
    ……………………………………………….
    Media recover


    10.现在可做一个测试,在standby主机上进行数据修改(standby主机现在做primary)

    SQL> create table t as select * from dba_users;
    Table created.
    SQL> alter system switch logfile;
    System altered.

    在从库上(primary主机上)以read only打开数据库,执行查询
    SQL> select username from t;
    select username from t
    *
    ERROR at line 1:
    ORA-01219: database not open: queries allowed on fixed tables/views only
    SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
    Database altered.
    SQL> ALTER DATABASE OPEN READ ONLY;
    Database altered.
    SQL> select username from t;
    USERNAME
    ------------------------------
    SYS
    SYSTEM
    DBSNMP
    OUTLN
    WMSYS
    SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
    Database altered.

    常见问题

    至此,主副的配置已基本完成,可做以下实验来验证配置的准确性。
    1. 在主库上新建一个表,看修改时候能马上传到副库上
    2. 在主库上新建一个表空间,新增加一个datafile,看修改时候能马上传到副库上(应该是只要在副库上执行恢复模式,就能在副库上看到新建的表空间
    3. 在主库上新建一个临时表空间,rename datafile 均不能应用到副库上.
    4. 应当实时察看standby库的alert文件,就能清晰明了地知道主副更新的情况。
    5. 关于启动关闭顺序
    启动的时候,先从库的listener,再启动从库,再启动主库的listener,再主库
    关闭的时候,先关闭主库,再启动从库。
    6. 8i副数据库切换为主的话,将无法再切为副。主数据库也是! 也就是说,只能完成一次切换,这叫failover!9i可实现主副数据库任意切换,这叫switchover
    ------------------------------------------------------------------------------------------------------------------
    第六点我理解得有些问题,看了版主Rollingpig在itpub上的结论,觉得他说的应该是对的,现将他的陈述列在下面!
    Rollingpig
    我给个结论吧。在9i 的dataguad环境中:
    1。Switch Over 必须是Primary 正常,并且是必须Primary 主动先Switch 成 standby. 然后standby 才能switch 成primary.
    2。如果需要作成primary出问题,standby 能接管的话,必须作 failover ,而不是Switch Over
    -------------------------------------------------------------------------------------------------------------------

    7. 察看主机当前的运行状态:
    SQL> select name,open_mode,PROTECTION_MODE,DATABASE_ROLE from v$database;
    NAME OPEN_MODE PROTECTION_MODE DATABASE_ROLE
    --------- ---------- -------------------- ----------------
    PRIMARY MOUNTED MAXIMUM PERFORMANCE PHYSICAL STANDBY
    8.查看主数据库日志是否全部传送到副数据库,可查看v$archive_gap,更简单的方法是查看各自主机的日志归档目录的日志序号即可。

    11. 常用的一些方法:
    可在副数据库上运行一些脚本,确保主数据库上的更新能及时在副数据库上得到实现。可将以下脚本放在crontab表中。
    oracle@standby $cat refresh (刷新脚本)
    ORACLE_SID=oracle
    ORACLE_HOME=/home/oracle/product/9.2.0
    export ORACLE_SID ORACLE_HOME
    DATE=`date '+%Y%m%d'`
    touch /home/oracle/refresh_$DATE.log
    $ORACLE_HOME/bin/sqlplus /nolog << EOF
    spool /home/oracle/refresh_$DATE.log
    connect sys/abc123 as sysdba
    shutdown immediate;
    quit
    EOF
    $ORACLE_HOME/bin/sqlplus /nolog << EOF2
    spool /home/oracle/refresh_2_$DATE.log
    connect sys/abc123 as sysdba
    startup nomount pfile=$ORACLE_HOME/dbs/initoracle.ora;
    alter database mount standby database;
    alter database set standby database to maximize performance;
    alter database recover managed standby database disconnect from session;
    spool off
    EOF2
    oracle@standby $cat readonly (更新脚本)
    #!/bin/sh
    ORACLE_SID=oracle
    ORACLE_HOME=/home/oracle/product/9.2.0
    export ORACLE_SID ORACLE_HOME
    $ORACLE_HOME/bin/sqlplus /nolog << EOF
    spool /home/oracle/refresh-read.log
    connect sys/abc123 as sysdba
    rem change from recover mode to read-only
    alter database recover managed standby database cancel;
    alter database open read only ;
    spool off
    EOF

    switchover过程:

    12.把数据库切换回到主节点
    先将standby此时的initoracle.ora恢复为以前是standby时的参数。
    在主节点(standby主机上)
    SQL> alter database commit to switchover to physical standby;
    Database altered.
    SQL> shutdown immediate
    ORA-01507: database not mounted
    statORACLE instance shut down.
    SQL> startup nomount pfile=/home/oracle/product/9.2.0/dbs/initoracle.ora;
    ;
    ORACLE instance started.
    Total System Global Area 135337420 bytes
    Fixed Size 452044 bytes
    Variable Size 109051904 bytes
    Database Buffers 25165824 bytes
    Redo Buffers 667648 bytes
    SQL> alter database mount standby database;
    Database altered.
    SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
    Database altered.

    在备用节点(在primary主机上)
    先将primary此时的initoracle.ora恢复为以前是primary时的参数。
    SQL> alter database commit to switchover to primary;
    Database altered.
    SQL> shutdown immediate;
    ORA-01507: database not mounted
    ORACLE instance shut down.
    SQL> startup pfile=/home/oracle/product/9.2.0/dbs/initoracle.ora;
    ORACLE instance started.
    Total System Global Area 135337420 bytes
    Fixed Size 452044 bytes
    Variable Size 109051904 bytes
    Database Buffers 25165824 bytes
    Redo Buffers 667648 bytes
    Database mounted.
    Database opened.