http://grassbell.itpub.net/post/26/18902
补充一点:
改名之前在standby上先执行 ALTER SYSTEM SET standby_file_management='MANUAL' SCOPE=BOTH;。
需要注意的是:
如果你想让primary 和standby 上的数据文件结构保持一致的话,在primary 上rename a datafile后,即使STANDBY_FILE_MANAGEMENT = auto,也需要在standby上手工执行相同的操作。当然,如果不想保持一致,standby上可以不作任何动作。
-------------------------修改相应的primary数据文件路径-----------------------
1.Offline 表空间:
Alter tablespace tools offline NORMAL;
2.Mv dbfile:
Mv /data4/oradata/crmtemp/tools02.dbf /disk3/oradata/crmtemp/
3.Rename:
Alter tablespace tools
rename datafile '/data4/oradata/crmtemp/tools02.dbf'
To '/disk3/oradata/crmtemp/tools02.dbf';
4.Online:
Alter tablespace tools online;
-------------------------修改相应的standby 数据文件路径-----------------------
1.Recover
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE
2> DISCONNECT FROM SESSION;
确定已经所有的log都已经应用了。
(或用脚本sh /home/oracle/admin/recover_stby.sh)
2.Cancel RECOVER:
SQL> SELECT NAME, SEQUENCE#, ARCHIVED, APPLIED
2> FROM V$ARCHIVED_LOG;
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
3.Shutdown
SQL> SHUTDOWN;
4.Mv dbfile:
Mv /data4/oradata/crmtemp/tools02.dbf /disk3/oradata/crmtemp/
5.mount
SQL> STARTUP NOMOUNT;
SQL> ALTER DATABASE MOUNT STANDBY DATABASE;
6.Rename:
ALTER DATABASE RENAME FILE
'/data4/oradata/crmtemp/tools02.dbf'
To '/disk3/oradata/crmtemp/tools02.dbf';
7.Recover:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE
2> DISCONNECT FROM SESSION;
(或用脚本sh /home/oracle/admin/recover_stby.sh)