change primary DB time and physical standby DB timezone step
一、 On Primary to defer redo
NODE 1: Alter system set log_archive_dest_state_2=’DEFER’;
NODE 2: Alter system set log_archive_dest_state_2=’DEFER’;
二、 On physical standby to change timezone
1. If the MRP0 or MRP process exists, then the standby database is
applying redo.
SQL> SELECT PROCESS, STATUS FROM v$MANAGED_STANDBY;
2. Sure all archivelogs received in standby are applied
SQL> select NAME,DEST_ID,THREAD#,SEQUENCE#,APPLIED,first_time
from v$archived_log where APPLIED = 'NO';
no rows selected
3. Cancel Redo Apply
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
4. Stop listener
stdb1[/oracle]$ Lsnrctl stop
5. Shut down the standby database.
SQL> Shutdown immediate;
6. Change standby database timezone parameter
stdb1[/]#more /etc/TIMEZONE #!/sbin/sh # @(#)B.11.31_LR TZ=MST7MDT export TZ |
vi .profile
Root用户:TZ=EAT-8
Export TZ
Oracle用户:TZ=EAT-8
Export TZ
NOTE: best reboot OS
7. Start listener
stdb1[/oracle]$ Lsnrctl start
8. Start and mount the physical standby data base
SQL> STARTUP MOUNT
三、 On Primary to change os time
Product version: ORACLE RAC 10.2.0.4
OS:HP-UX
SID:bosdb
1. check crs status
crs_stat –t
2. stop dbconsole
cpfdb1 :emctl stop dbconsole
cpfdb2 :emctl stop dbconsole
3. stop database
srvctl stop instance -d bosdb -i bosdb1 -o immediate (tail alert)
srvctl stop instance -d bosdb -i bosdb2 -o immediate (tail alert)
4. stop nodeapps
srvctl stop nodeapps -n cpfdb1
srvctl stop nodeapps -n cpfdb2
5. stop crs stack(root user)
cpfdb1 :/oracle/product/10.2/crs/bin/crsctl stop crs
cpfdb2 :/oracle/product/10.2/crs/bin/crsctl stop crs
or:/etc/init.d/init.crs stop
6. sure none process(in 2 nodes)
ps -ef|grep ora
ps -ef|grep crs
ps -ef|grep evmd
ps -ef|grep cssd
7. check os cluster status
root@cpfdb1:/# cmviewcl
CLUSTER STATUS CPF-DB up
NODE STATUS STATE cpfdb1 up running
PACKAGE STATUS STATE AUTO_RUN NODE cpf-db-pkg1 up running enabled cpfdb1
NODE STATUS STATE cpfdb2 up running
PACKAGE STATUS STATE AUTO_RUN NODE cpf-db-pkg2 up running enabled cpfdb2 |
8. stop hp os cluster
cmhaltcl -f –v
9. change primary database os time
cpfdb1 :date -s ‘date’
cpfdb2 :date -s ‘date’
10. reboot os
shutdown -ry 0
11. start hp os cluster
cmruncl –v
12. check nfs
oracle@cpfdb1:/oracle$ bdf (in 2 node)
oracle@cpfdb2:/oracle$ bdf
Filesystem kbytes used avail %used Mounted on /dev/vg00/lvol3 20971520 738760 20076752 4% / /dev/vg00/lvol1 1835008 304072 1519048 17% /stand /dev/vg00/lvol8 8912896 3430504 5439608 39% /var /dev/vg00/lvol7 4456448 3091680 1354144 70% /usr /dev/vg00/lvol4 524288 355888 167216 68% /tmp /dev/vg00/lvol9 41943040 16829855 23602851 42% /oracle /dev/vg00/lvol6 7536640 6119896 1405696 81% /opt /dev/vg00/lvol5 131072 6008 124152 5% /home /dev/vg00/lvol10 104857600 34750537 65725931 35% /expdata /dev/vgcpfarch1/lvol1 104841216 166040 98133240 0% /cpfarchive1 cpfdb2:/cpfarchive2 104841216 166052 98133229 0% /cpfarchive2
|
if not auto mount then manual:
cpfdb2:mount -F nfs cpfdb1:/cpfarchive1 /cpfarchive1
13. database and nodeapps will auto start by crs
if not auto start then manual:
cpfdb1:/oracle/product/10.2/crs/bin/crsctl start crs
cpfdb2:/oracle/product/10.2/crs/bin/crsctl start crs
14. check RAC status
oracle@cpfdb1:/oracle$ crs_stat -t Name Type Target State Host ------------------------------------------------------------ ora....b1.inst application ONLINE ONLINE cpfdb1 ora....b2.inst application ONLINE ONLINE cpfdb2 ora.bosdb.db application ONLINE ONLINE cpfdb1 ora....B1.lsnr application ONLINE ONLINE cpfdb1 ora.cpfdb1.gsd application ONLINE ONLINE cpfdb1 ora.cpfdb1.ons application ONLINE ONLINE cpfdb1 ora.cpfdb1.vip application ONLINE ONLINE cpfdb1 ora....B2.lsnr application ONLINE ONLINE cpfdb2 ora.cpfdb2.gsd application ONLINE ONLINE cpfdb2 ora.cpfdb2.ons application ONLINE ONLINE cpfdb2 ora.cpfdb2.vip application ONLINE ONLINE cpfdb2 |
15. Primary db start though read spfile will auto enable redo transfer.
check log_archive_dest_state_2 parameter :
oracle@cpfdb1:/oracle$ sqlplus /nolog SQL*Plus: Release 10.2.0.4.0 - Production on Mon Apr 26 15:38:24 2010 Copyright (c) 1982, 2007, Oracle. All Rights Reserved. SQL> conn / as sysdba Connected. SQL> show parameter log_archive_dest_state_2 NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ log_archive_dest_state_2 string ENABLE |
if not enable then manual:
节点1:Alter system set log_archive_dest_state_2=’ENABLE’;
节点2:Alter system set log_archive_dest_state_2= ‘ENABLE’;
四、 On physical standby to Start Redo Apply:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE
DISCONNECT FROM SESSION;
五、 ALL DATABASE CURRENT TIME
PRIMARY |
PRI CURRENT TIME |
STANDBY CURRENT TIME |
REAL TIME IN BEIJING |
BOSDB1 |
Wed Apr 21 10:55:27 EAT 2010 |
Wed Apr 21 10:57:15 MDT 2010 |
Wed Apr 21 11:03:46 EAT 2010 |
BOSDB2 |
Wed Apr 21 11:01:46 EAT 2010 | ||
HISDB |
Wed Apr 21 10:52:25 EAT 2010 |
Wed Apr 21 10:57:25 MDT 2010 | |
BIDB |
Wed Apr 21 11:01:50 EAT 2010 |
NO STANDBY |
五、 restart primary db and standby db sequence
If you want to shutdown on both primary and standby, you can follow this sequence
shutdown immediate -- primary
shutdown immediate -- standby
to startup
startup -- primary
startup mount -- standby
alter database recover managed standby database;
参考文献:How can we reboot physical standby dataguard environment safely? [ID 839987.1]