Friday, December 20, 2013

Changing archivelog destination in STANBY side

If you did not set log_archive_dest_* or db_recovery_file_dest in stanby database`s parameter file during creation of stanbdy, primary`s archivelogs will be transferred to default location of standby database.
This is $ORACLE_HOME/dbs (in linux/unix).

SQL> select status,instance_name,database_role from v$database,v$instance;

STATUS     INSTANCE_NAME    DATABASE_ROLE
------------ ---------------- ----------------
OPEN     STND      PHYSICAL STANDBY

Disconnect recovery managed

SQL> alter database recover managed standby database cancel;

Database altered.

Check current location of archivelogs

[oracle@fcdbdb_stby trace]$ ls -lrt /u01/app/oracle/product/11.2.0.3/db_1/dbs/
total 133444
-rw-r--r--. 1 oracle oinstall     2851 May 15  2009 init.ora
-rw-r-----. 1 oracle oinstall       24 Dec 19 14:43 lkSTND
-rw-r--r--. 1 oracle oinstall     1520 Dec 19 14:55 initSTND.ora
-rw-r-----. 1 oracle oinstall     1536 Dec 19 14:56 orapwSTND
-rw-r-----. 1 oracle oinstall  1141248 Dec 19 15:02 arch1_11_834576721.dbf
-rw-r-----. 1 oracle oinstall  1459200 Dec 19 15:02 arch1_12_834576721.dbf
-rw-r-----. 1 oracle oinstall    93696 Dec 19 15:04 arch1_13_834576721.dbf
-rw-r-----. 1 oracle oinstall    15872 Dec 19 15:04 arch1_14_834576721.dbf
-rw-r-----. 1 oracle oinstall  4966912 Dec 19 16:15 arch1_15_834576721.dbf
-rw-r-----. 1 oracle oinstall    83456 Dec 19 16:17 arch1_16_834576721.dbf
-rw-r-----. 1 oracle oinstall 40787968 Dec 19 22:00 arch1_17_834576721.dbf
-rw-r-----. 1 oracle oinstall 37803008 Dec 20 02:26 arch1_18_834576721.dbf
-rw-r-----. 1 oracle oinstall 38546432 Dec 20 11:01 arch1_19_834576721.dbf
-rw-r-----. 1 oracle oinstall  1888768 Dec 20 11:37 arch1_20_834576721.dbf
-rw-r-----. 1 oracle oinstall    66560 Dec 20 11:38 arch1_21_834576721.dbf

Check db_recovery_file_desc`s value

SQL> show parameters db_rec

NAME     TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest     string
db_recovery_file_dest_size     big integer 4122M
db_recycle_cache_size     big integer 0

Set db_recovery_file_dest

SQL> alter system set db_recovery_file_dest='/u01/app/oracle/fast_recovery_area' scope=both;

System altered.


Connect recovery managed

SQL> alter database recover managed standby database disconnect from session;

Database altered.


On Primary side enforce archivelog

SQL> alter system switch logfile;

System altered.

And check in Standby side :

[oracle@fcdbdb_stby trace]$ ls -lrt /u01/app/oracle/fast_recovery_area/STND/archivelog/2013_12_20/
total 12240
-rw-r-----. 1 oracle oinstall    51200 Dec 20 11:40 o1_mf_1_22_9c7x32kp_.arc

As you see, staring 22th archivelog file transferred to new destination.

You can do it using dgmgrl utiliy.



No comments:

Post a Comment