2013-3-19資料庫DG切換

perfychi發表於2013-03-18
 
(1) DG切換
--查詢角色及切換狀態
select database_role, switchover_status from v$database;
--查詢歸檔最大序列號:
select max(sequence#) from v$archived_log where applied='YES';
--首先:主庫切換到備庫
alter database commit to switchover to physical standby with session shutdown;
shutdown immediate
startup mount
alter database recover managed standby database disconnect from session;(開啟恢復)
--然後:備庫切換到主庫
alter database commit ot switchover to primary  with session shutdown ;
alter database open;
--改密碼:
alter user product identified by XXXXX;
--最後檢查程式:
(主庫執行,啟用遠端歸檔)
alter system set log_archive_dest_state_2=ENABLE;
alter system switch logfile;
(備庫執行,檢查是否有MRP、RFS兩個程式)
select process, status from v$managed_standby;

(2) DG關閉
--查詢角色:
select database_role, switchover_status from v$database;
--先關主庫:
shutdown immediate;
lsnrclt stop    ->重啟伺服器
--再關備庫
alter database recover managed standby database cancel;
shutdown immediate;
lsnrclt stop    ->重啟伺服器
(3) DG 開啟
--先開備庫:
lsnrctl start
startup mount
alter database recover managed standby database disconnect from session;(開啟恢復)
--再開主庫:
lsnrctl start
startup
 
--改密碼:
alter user product identified by XXXXX;
--最後檢查程式:
(主庫執行,啟用遠端歸檔)
alter system set log_archive_dest_state_2=ENABLE;
alter system switch logfile;
(備庫執行,檢查是否有MRP、RFS兩個程式)
select process, status from v$managed_standby;
 
---修改密碼:
alter user product identified by XXXXX;
alter user PRODUCT_B2B identified by XXXXX;
 

(4)中央改密碼:
alter user product identified by XXXXX;
alter user PRODUCT_B2B identified by XXXXX;

一、【1.14】:
------------------------
CT_WAREHOU CENTER.CENTER.WXXR.COM.CN                PRODUCT         CENTER-WXXRDB                            2012-12-17 21:03:49
SE
WAREHOUSE  WXXRDB1_26.CENTER.WXXR.COM.CN            PRODUCT         CENTER-WXXRDB                            2012-12-17 21:02:50
WAREHOUSE  CENTER.CENTER.WXXR.COM.CN                PRODUCT         CENTER-WXXRDB                            2012-09-17 22:43:46
----------------------------
(1) CENTER.CENTER.WXXR.COM.CN
sqlplus CT_WAREHOU/ct_warehouse
drop database link CENTER.CENTER.WXXR.COM.CN;
create database link CENTER.CENTER.WXXR.COM.CN connect to product identified by XXXXX using 'CENTER-WXXRDB';
select * from ;
(2) WXXRDB1_26.CENTER.WXXR.COM.CN
sqlplus WAREHOUSE/warehouse
drop database link WXXRDB1_26.CENTER.WXXR.COM.CN;
create database link  WXXRDB1_26.CENTER.WXXR.COM.CN connect to product identified by XXXXX using 'CENTER-WXXRDB';
select * from ;
(3) CENTER.CENTER.WXXR.COM.CN
sqlplus WAREHOUSE/warehouse
drop database link CENTER.CENTER.WXXR.COM.CN ;
create database link  CENTER.CENTER.WXXR.COM.CN connect to product identified by XXXXX using 'CENTER-WXXRDB';
select * from ;

二、【1.18】
----------------------------------
WAREHOUSE  WXXRDB.CENTER.WXXR.COM.CN      PRODUCT    CENTER-WXXRDB                            2013-02-07 11:03:13
WAREHOUSE  WXXRDB1_26.CENTER.WXXR.COM.CN  PRODUCT    CENTER-WXXRDB                            2013-02-01 10:20:10
----------------------------------
(1) WXXRDB.CENTER.WXXR.COM.CN
sqlplus/ as sysdba
drop database link WXXRDB.CENTER.WXXR.COM.CN;
create database link WXXRDB.CENTER.WXXR.COM.CN connect to product identified by XXXXX using 'CENTER-WXXRDB';
(2) WXXRDB1_26.CENTER.WXXR.COM.CN
sqlplus/ as sysdba
drop database link WXXRDB1_26.CENTER.WXXR.COM.CN;
create database link WXXRDB1_26.CENTER.WXXR.COM.CN connect to product identified by XXXXX using 'CENTER-WXXRDB';
三、【1.74】
------------------------------
STAGEAREA  WXXRDB.CENTER.WXXR.COM.CN      PRODUCT    WXXRDB.CENTER.WXXR.COM.CN           2012-12-27 13:46:41
PUBLIC     WXXRDB.CENTER.WXXR.COM.CN      PRODUCT    WXXRDB.CENTER.WXXR.COM.CN           2012-12-19 09:12:39

--------------------------------------
(1) WXXRDB.CENTER.WXXR.COM.CN
sqlplus STAGEAREA/stagearea
drop database link  WXXRDB.CENTER.WXXR.COM.CN;
create database link WXXRDB.CENTER.WXXR.COM.CN  connect to  PRODUCT  identified by XXXXX using 'WXXRDB.CENTER.WXXR.COM.CN';
select * from ;
(2) WXXRDB.CENTER.WXXR.COM.CN
sqlplus / as sysdba
drop public database link WXXRDB.CENTER.WXXR.COM.CN;
create public database link WXXRDB.CENTER.WXXR.COM.CN  connect to  PRODUCT  identified by XXXXX using 'WXXRDB.CENTER.WXXR.COM.CN';
select * from ;

四 、【1.24】
export ORACLE_SID=wxxrdbjx
sqlplus / as sysdba
alter user product identified by XXXXX;

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/27042095/viewspace-756480/,如需轉載,請註明出處,否則將追究法律責任。

相關文章