Merubah Nama/Direktori Datafile pada Oracle Data Guard


Ketika kita merubah nama datafile pada primary database , perubahan tersebut tidak akan otomatis dilakukan di standby database. Oleh karena itu, jika kita ingin merubah nama datafile pada database primary kita harus merubah juga di standby dengan nama datafile yang sama perubahan di primary. Hal ini harus tetap kita lakukan meskipun parameter STANDBY_FILE_MANAGEMENT bernilai AUTO.

*untuk perubahan directory tanpa disertai dengan perubahan nama file maka tidak akan menimbulkan error pada standby database.

Berikut adalah langkah-langkah yang diperlukan merubah nama datafile di primary database dan juga standby database.

  1. To rename the datafile in the primary database, take the tablespace offline:

SQL> ALTER TABLESPACE EKOESDATA OFFLINE;

  1. Exit from the SQL prompt and issue an operating system command, such as the following UNIX cp command, to copy the datafile on the primary system:

$cp /u01/oracle/data/EKOESDATA03.dbf /u07/oracle/data/EKOESDATA03x.dbf

$cp /u01/oracle/data/EKOESDATA04.dbf /u07/oracle/data/EKOESDATA04x.dbf

  1. Rename the datafile in the primary database and bring the tablespace back online:

SQL> alter tablespace EKOESDATA

rename datafile ‘/u01/oracle/data/EKOESDATA03.dbf’ to ‘/u07/oracle/data/EKOESDATA03x.dbf’;

SQL> alter tablespace EKOESDATA

rename datafile ‘/u01/oracle/data/EKOESDATA04.dbf’ to ‘/u07/oracle/data/EKOESDATA04x.dbf’;

SQL> ALTER TABLESPACE EKOESDATA ONLINE;

  1. Connect to the standby database, query the V$ARCHIVED_LOG view to verify all of the archived redo log files are applied, and then stop Redo Apply:

SQL> SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;

SEQUENCE# APP

——— —

8 YES

9 YES

10 YES

11 YES

4 rows selected.

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

  1. Shut down the standby database:

SQL> SHUTDOWN IMMEDIATE;

  1. Rename the datafile at the standby site using an operating system command, such as the UNIX cp command:

$cp /u01/oracle/data/EKOESDATA03.dbf /u05/oracle/data/EKOESDATA03x.dbf

$cp /u01/oracle/data/EKOESDATA04.dbf /u05/oracle/data/EKOESDATA04x.dbf

  1. Start and mount the standby database:

SQL> STARTUP MOUNT;

  1. Rename the datafile in the standby control file. Note that the STANDBY_FILE_MANAGEMENT initialization parameter must be set to MANUAL.

SQL> ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=MANUAL

SQL> ALTER DATABASE RENAME FILE ‘/u01/oracle/data/EKOESDATA03.dbf’ to ‘/u05/oracle/data/EKOESDATA03x.dbf’;

SQL> ALTER DATABASE RENAME FILE ‘/u01/oracle/data/EKOESDATA04.dbf’ to ‘/u05/oracle/data/EKOESDATA04x.dbf’;

SQL> ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO

  1. On the standby database, restart Redo Apply:

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE

DISCONNECT FROM SESSION;

 

*note : karena pada step 2 dan 6 menggunakan cp file maka ketika rename datafile sudah selesai jangan lupa untuk menghapus file source-nya

Dengan kaitkata , , , , , , ,

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: