分类: Oracle
2011-08-17 14:55:09
关机:
先关监听,再关数据库。先关主库,再关standby库。
(1)监听器(两个库的监听都关掉)
# lsnrctl
LSNRCTL> stop
(2)主库
# su – oracle
#sqlplus "/ as sysdba"
SQL> alter system switch logfile;
SQL> shutdown immediate
(3)standby库
# su – oracle
#sqlplus "/ as sysdba"
SQL> alter database recover managed standby database finish;
SQL> shutdown immediate
开机:
先开standby库,再开主库。
(1)监听器(两个数据库都开)
# lsnrctl
LSNRCTL> start
(2)standby库
# su – oracle
#sqlplus "/ as sysdba"
SQL>startup nomount
SQL>alter database mount standby database;
SQL>alter database recover managed standby database disconnect;
(3)主库
# su – oracle
#sqlplus "/ as sysdba"
SQL>startup
内外宾数据库归档路径外宾:/u03/archive
内宾:/u05/archive2
主备数据库的切换(1)主数据库还可使用的情况
将主库切换为standby库(主库上操作)
# su – oracle
#sqlplus "/ as sysdba"
SQL>alter database commit to switchover to standby;
SQL>shutdown immediate
SQL>startup nomount
SQL>alter database mount standby database;
将standby库切换为主库(standby库上操作)
# su – oracle
#sqlplus "/ as sysdba"
SQL>alter database recover managed standby database finish;
SQL>alter database commit to switchover to primary;
SQL>shutdown immediate
SQL>startup
(1)主数据库已无法使用
以下操作在standby库上操作
# su – oracle
# lsnrctl
LSNRCTL> stop
LSNRCTL> exit
#sqlplus "/ as sysdba"
SQL>alter database recover managed standby cancel;
SQL>alter database activate standby database;
SQL>shutdown immediate
修改standby库的IP地址为原主库的IP
#smitty tcpip
# lsnrctl
LSNRCTL> start
LSNRCTL> exit
#sqlplus "/ as sysdba"
SQL>startup