------------方法1从库移动数据文件路径方法1--------------
将表空间offline的方法不行
1.退出日志应用
alter database recover managed standby database cancel;
2.修改表空间为离线状态
SQL> alter tablespace TPS_DATA offline;
alter tablespace TPS_DATA offline
*
ERROR at line 1:
ORA-16000: database open for read-only access
3.复制表空间对应文件到新的位置
cd /u01/app/oracle/oradata
mv tps_data02.dbf /u01/app/oracle/oradata/slnngkdg/tps_data03.dbf
4、修改表空间数据文件路径
SQL> alter tablespace TPS_DATA rename datafile '/u01/app/oracle/oradata/tps_data02.dbf' to 'u01/app/oracle/oradata/slnngkdg/tps_data03.dbf';
5、修改表空间为在线状态
SQL> alter tablespace sysaux TPS_DATA;
------------方法2从库移动数据文件路径方法1--------------
1.退出日志应用
alter database recover managed standby database cancel;
2.关闭数据库
shutdown immediate
3.拷贝原来的数据文件到新的地方
cd /u01/app/oracle/oradata
mv tps_data02.dbf /u01/app/oracle/oradata/slnngkdg/tps_data03.dbf
4.启动到mount
SQL> startup mount
5.修改数据库路径
alter database rename file '/u01/app/oracle/oradata/tps_data02.dbf' to '/u01/app/oracle/oradata/slnngkdg/tps_data03.dbf';
SQL> alter database rename file '/u01/app/oracle/oradata/tps_data02.dbf' to '/u01/app/oracle/oradata/slnngkdg/tps_data03.dbf';
alter database rename file '/u01/app/oracle/oradata/tps_data02.dbf' to 'u01/app/oracle/oradata/slnngkdg/tps_data03.dbf'
*
ERROR at line 1:
ORA-01511: error in renaming log/data files
ORA-01275: Operation RENAME is not allowed if standby file management is automatic.
解决办法:
alter system set standby_file_management = MANUAL;
6.启用日志
alter database recover managed standby database using current logfile disconnect from session;
7.打开数据库
alter database recover managed standby database cancel;
alter database open;
--再次引用
alter database recover managed standby database using current logfile disconnect from session;
8.修改 standby_file_management 为 auto
alter system set standby_file_management = auto;
9.尝试在主库创建一个文件
alter tablespace TPS_DATA add datafile '/u01/app/oracle/oradata/slnngk/tps_data04.dbf' size 10m;
可以看到从库日志也相应添加的了数据文件
Thu Mar 07 11:27:50 2019
Recovery created file /u01/app/oracle/oradata/slnngkdg/tps_data04.dbf
Successfully added datafile 9 to media recovery
Datafile #9: '/u01/app/oracle/oradata/slnngkdg/tps_data04.dbf'
-- The End --
阅读(9867) | 评论(0) | 转发(0) |