Oracle DG Standby Change Datafiles Location

Oracle · ruyi · 于 1年前发布 · 879 次阅读

In oracle DataGuard, The standby role is different to primary. We need to adjust. Now ,We will to move standby datafile location from /ssd/datax to /datax.

Follow:

Find Database datafile and control files:


SQL> set linesize 200;

SQL> col file_name format a70;

SQL> col tablespace_name format a30;

SQL> select file_name,tablespace_name from dba_data_files;

SQL> select member from v$logfile;

SQL>  select name from v$tempfile;

SQL> show parameter spfile;

SQL> show parameter control_files;

Create pfile from spfile.

SQL> create pfile from spfile;

Recover Cancel & Shutdown database.

SQL> alter database recover managed standby database cancel;
SQL> shutdown immediate;
$ lsnrctl stop

Change location by remonunt datafile

$ mount
/dev/sdb1 on /ssd/data1 type ext4 (rw)
/dev/sdc1 on /ssd/data2 type ext4 (rw)
/dev/sdd1 on /ssd/data3 type ext4 (rw)
/dev/sde1 on /ssd/data4 type ext4 (rw)
/dev/sdf1 on /ssd/data5 type ext4 (rw)
/dev/sdg1 on /ssd/data6 type ext4 (rw)
# mkdir /data1 /data2 /data3 /data4 /data5 /data6
# chown -R oracle:oinstall /data*
# umount /ssd/data1
# umount /ssd/data2
# umount /ssd/data3
# umount /ssd/data4
# umount /ssd/data5
# umount /ssd/data6
# mount /dev/sdb1 /data1
# mount /dev/sdc1 /data2
# mount /dev/sdd1 /data3
# mount /dev/sde1 /data4
# mount /dev/sdf1 /data5
# mount /dev/sdg1 /data6

Modify Parameters

  • Change control_files to new location。
  • Remove db_file_name_convert
  • Change log_archive_dest_1='location=/data/oracle/oradata/arch'
  • Remove log_file_name_convert='/data/oracle/oradata/arch','/home/oracle/arch'

Archive Location

$ ln -s /home/oracle/arch /data/oracle/oradata/arch

Start database to mount:

SQL> create spfile from pfile;
Rename Files
 
SQL> alter system set standby_file_management=manual;

Rename datafile, for example:

SQL> alter database rename file '/ssd/data3/oracle/oradata/yhddb1/system.dbf' to '/data3/oracle/oradata/yhddb1/system.dbf';

Rename redolog, for example:

alter database  rename file '/ssd/data3/oracle/oradata/yhddb1/redo01.log' to '/data3/oracle/oradata/yhddb1/redo01.log';

Rename tempfile, for example:

alter database  rename file '/ssd/data3/oracle/oradata/yhddb1/temp01.dbf' to '/data3/oracle/oradata/yhddb1/temp01.dbf';
SQL>  alter system set standby_file_management=auto;

Open database

$ lsnrctl start
SQL> alter database open;
SQL> alter database recover managed standby database disconnect;
SQL> alter database recover managed standby database cancel;
SQL> alter database recover managed standby database using current logfile disconnect;

如果这篇文章对您有帮助,不妨微信小额赞助我一下,让我有动力继续写出高质量的帖子。

本帖已经被管理员设置为: 精华帖 !
共收到 0 条回复 Oracle Standby Location
没有找到数据。
回复本帖 (需要登录)