Wednesday, 25 October 2017

Review: Haier 618 refrigirator

HAIER HRF-618GG 565 LTR SIDE-BY-SIDE REFRIGERATOR


I was planning to upgrade my refrigerator for a long time, started researching around September'17. Evaluated many, some failed on looks/some on features and mostly on price.

As, online Diwali sales kicked in from various online sites, saw best offers from Amazon and Paytm. Good discounts were there on FlipKart too but not very lucrative.

Finally bought from Paytm, sole reason best offer, 20% cashback and some credit card cashback from ICICI. 

Reasons for buying this model 618GG:
  • Golden finish
  • glass finish/layer on door( old one paint bubbled, hopefully this wont)
  • Eco friendly (The gas used is echo friendly and doesn't impact Ozone)
  • Capacity and price good match for me.
  • Warranty
compressor warranty10 Years
warranty1 Year
  • Dimensions:  DxWxH    1790x908x655  (unit:mm)

Experiance so far:
Although it has controls(electronic) for temperature contol, I love the smart cool feature, one button and it controls the temperature automatically, no manual intervention required. Operation is more or less sound less, doenot draw attention due to sound,  but for beautiful looks can't say the same.

Initial hickup: PCB was replaced, was faulty and cooling didnot start before replacement. Recomend buying online as most products get return/replacement commitment if not satisfied(Paytm 7days, post delivery).

Thursday, 28 September 2017

Google DNS or Open DNS etc.

Use any Google or open dns.
Google DNS
Preferred: 8.8.8.8
Alternate: 8.8.4.4
OpenDNS
Preferred: 208.67.222.222
Alternate: 208.67.220.220
How to use:
1. Modify dns in your router normally would be found under internet or wan setup.
2. Modify in your local machine network, see images below for reference.




Google DNS
Preferred: 8.8.8.8
Alternate: 8.8.4.4
OpenDNS
Preferred: 208.67.222.222
Alternate: 208.67.220.220
For my reference:
Spectra DNS:
180.151.151.151
180.151.151.152

Tuesday, 26 September 2017

Review: Amazon Fire TV stick after few days of use

Overall: Amazing product

Bought amazon fire tv stick, got delivery ahead of time, big KUDO's to Amazon folks.

Setup is very simple, detects available wifi's, just enter the pass code and device is ready to go. Amazon prime could be used right away(subscription required). As for other apps like times now, netflix, jio cinema etc, appear as shortcuts and one needs to click and install.

As for performance, prime content plays flawlessly, you can watch all the hosted content in all its glory right away.  Same could not be said for other apps as they depend on external vendors. Eg: Times of india app plays with a lag and lot of pixelation, good thing is gets sharp pretty quickly. No complaints there.


Pros:
* Easy setup
*Ton of content
*Quality of display amazing.


Cons:
* No mouse pointer, primitive point & click design.
* Browser(web), could not find...still trying. Prefer,should there by default.
* Mouse is clicker type, would prefer a more modern point and click.

If you don't have a smart TV, this is a very cool device to have, overwhelming amount of content. Personally very happy with the purchase. I would prefer cost be reduced if content inside is all subscription based. Also have comprehensive TV app something like JIO TV, would make this device even more appealing.


Friday, 8 September 2017

Oracle : Experiment on basic compression on table data

---------Exp start
SQL> select count(1) from scott.xemp;

  COUNT(1)
----------
  14680064

select table_name,COMPRESSION,COMPRESS_FOR from dba_tables where table_name='XEMP';

TABLE_NAME                     COMPRESS COMPRESS_FOR
------------------------------ -------- ------------
XEMP                           DISABLED

SQL> select sum(bytes)/power(1024,2) from dba_segments where segment_name='XEMP';

SUM(BYTES)/POWER(1024,2)
------------------------
                     704


SQL> alter table scott.xemp move compress;

Table altered.

SQL> select sum(bytes)/power(1024,2) from dba_segments where segment_name='XEMP';

SUM(BYTES)/POWER(1024,2)
------------------------
                     176

SQL>  select table_name,COMPRESSION,COMPRESS_FOR from dba_tables where table_name='XEMP';

TABLE_NAME                     COMPRESS COMPRESS_FOR
------------------------------ -------- ------------
XEMP                           ENABLED  BASIC
---------Exp END

Basic compression is free(double check). 

For experiment, table was freshly created with no deletes on the table(i.e. compact). Looks like compression gave about 75% reduction in size. 


This reduces the logical foot print of the table and one may be able to reclaim some space, reduction of file size  is another issue, we may be able to release some space there too(subject to hit and try method).


Monday, 28 August 2017

Buy Samsung A9 Pro or C9 Pro

Just to start, both phones are great to hold and look premiuim. I bought A9 pro and  my brother C9 pro, even I wanted to buy C9 pro but decided against it because of 10k difference(A9 Pro better bargain).

Why buy C9 pro?

  • Light weight
  • Looks and feel amazing.
  • Very resposive.
  • 4000mah battery
  • Greatest 6GB RAM.
So, if you can, definitely go for it. Price 31900/- on Amazon at the time of this blog. Luv this phone and highly recommend it.


Why buy A9 Pro? 
  • Battery 5000mah(lasts long time, sometimes 2 days for me)
  • RAM 4GB(would have luv'd 6), good enough.
  • phone feels heavy and sturdy
  • Supports Samsung Pay(Why missing in C9 at this time no idea)

I am a heavy user of phone, mostly data and ton off apps. Not regretting my buy at this time, lets see what the future brings.

Oh yeah waiting for OS upgrade, its still on Android 6.0.1(Marshmallow) as of Aug/28/17.
Upgraded to 7.0, it came over couple of days back, works like charm.(Posted 18/Sept/2017)

Unadvertised feature in both phone:
* Ultra power save mode: In this mode screen swiches to B/W and bare minimum apps, you have choice to include few you need. Phone can last 3x longer duration.
At this time : Charge is 82% claiming life of 29hr, in Ultra save mode it will last 66hrs. Amazing feature, not sure when I would need with 5K battery but gives me lot of confidence to carry this phone on long trips.



Review: JIO vs Airtel vs Vodaphone plans

Specifically related to 349/- or 399/- plans(price differ per vendor)

My choice go for JIO, only jio plan is all inclusive, others don't have SMS/Roaming(Check).

Jio Plans : https://www.jio.com/en-in/4g-plans

Not including SMS, is really hurting, I am on 349/-(Airtel), i have seen my balance going down, because almost every app uses sms for validation and authentication.

Only data and call in a packaged plan, doesn't make sense, package should be all inclusive.

Note: I have multiple connections of Airtel and Jio.

Also see : http://economictimes.indiatimes.com/industry/services/retail/reliance-jio-vs-airtel-vs-vodafone-vs-other-telcos-which-data-plan-you-should-go-for/articleshow/59562800.cms

Wednesday, 9 August 2017

Oracle : Experiment on filesystemio_options

Careful: Results may vary based on configuration options and hardware.

My experiment on a very low power system(laptop):

SQL> alter system set filesystemio_options=asynch scope=spfile;

System altered.

SQL> startup force;
ORACLE instance started.

Total System Global Area 1570009088 bytes
Fixed Size                  2253584 bytes
Variable Size             889195760 bytes
Database Buffers          671088640 bytes
Redo Buffers                7471104 bytes
Database mounted.
Database opened.
SQL>  select status from V$IO_CALIBRATION_STATUS;

STATUS
-------------
IN PROGRESS

------From another session after above change
SET SERVEROUTPUT ON
11:30:51 SQL> DECLARE
lat INTEGER;
iops INTEGER;
mbps INTEGER;
BEGIN
--DBMS_RESOURCE_MANAGER.CALIBRATE_IO(, ,iops, mbps, lat);
DBMS_RESOURCE_MANAGER.CALIBRATE_IO (28, 10, iops, mbps, lat);
DBMS_OUTPUT.PUT_LINE ('max_iops = ' || iops);
DBMS_OUTPUT.PUT_LINE ('latency = ' || lat);
DBMS_OUTPUT.PUT_LINE ('max_mbps = ' || mbps);
end;
/11:30:59   2  11:30:59   3  11:30:59   4  11:30:59   5  11:30:59   6  11:30:59   7  11:30:
59   8  11:30:59   9  11:30:59  10  11:30:59  11  11:30:59  12
max_iops = 84
latency = 11
max_mbps = 31

PL/SQL procedure successfully completed.

Elapsed: 00:13:13.69
----------End---------------------------------

SQL> alter system set filesystemio_options=setall scope=spfile;

System altered.

SQL> startup force
ORACLE instance started.

Total System Global Area 1570009088 bytes
Fixed Size                  2253584 bytes
Variable Size             889195760 bytes
Database Buffers          671088640 bytes
Redo Buffers                7471104 bytes
Database mounted.
Database opened.

------From another session after above change
11:46:01 SQL> SET SERVEROUTPUT ON
11:46:11 SQL> DECLARE
lat INTEGER;
iops INTEGER;
mbps INTEGER;
BEGIN
--DBMS_RESOURCE_MANAGER.CALIBRATE_IO(, ,iops, mbps, lat);
DBMS_RESOURCE_MANAGER.CALIBRATE_IO (28, 10, iops, mbps, lat);
DBMS_OUTPUT.PUT_LINE ('max_iops = ' || iops);
DBMS_OUTPUT.PUT_LINE ('latency = ' || lat);
DBMS_OUTPUT.PUT_LINE ('max_mbps = ' || mbps);
end;
/11:46:21   2  11:46:21   3  11:46:21   4  11:46:21   5  11:46:21   6  11:46:21   7  11:46:
21   8  11:46:21   9  11:46:21  10  11:46:21  11  11:46:21  12
max_iops = 47
latency = 20
max_mbps = 37

PL/SQL procedure successfully completed.

Elapsed: 00:10:39.87
----------End---------------------------------
SQL> alter system set filesystemio_options=directIO scope=spfile;

System altered.

SQL> startup force
ORACLE instance started.

Total System Global Area 1570009088 bytes
Fixed Size                  2253584 bytes
Variable Size             889195760 bytes
Database Buffers          671088640 bytes
Redo Buffers                7471104 bytes
Database mounted.
Database opened.
SQL>
------From another session after above change
12:02:18 SQL> SET SERVEROUTPUT ON
12:02:22 SQL> DECLARE
lat INTEGER;
iops INTEGER;
mbps INTEGER;
BEGIN
--DBMS_RESOURCE_MANAGER.CALIBRATE_IO(, ,iops, mbps, lat);
DBMS_RESOURCE_MANAGER.CALIBRATE_IO (28, 10, iops, mbps, lat);
DBMS_OUTPUT.PUT_LINE ('max_iops = ' || iops);
DBMS_OUTPUT.PUT_LINE ('latency = ' || lat);
DBMS_OUTPUT.PUT_LINE ('max_mbps = ' || mbps);
end;
/12:02:35   2  12:02:35   3  12:02:35   4  12:02:35   5  12:02:35   6  12:02:35   7  12:02:35   8  12:02:35   9  12:02:35  10  12:02:35  11  12:02:35  12
max_iops = 57
latency = 16
max_mbps = 12

PL/SQL procedure successfully completed.

Elapsed: 00:12:10.24
----------End---------------------------------

Let me know if u don't agree with method or anything else.
Still wip.

Friday, 21 July 2017

Oracle : Retain password of schema

Some time we need to change password for schema for temp reasons, here is is a method how to deal with it:

07:01:58 SQL> 07:01:58 SQL> select
'alter user "'||username||'" identified by values '''||extract(xmltype(dbms_metadata.get_xml('USER',username)),'//USER_T/PASSWORD/text()').getStringVal()||''';'  old_password
from dba_users
where username ='&username';07:02:11   2  07:02:11   3  07:02:11   4
Enter value for username: SCOTT
old   4: where username ='&username'
new   4: where username ='SCOTT'

OLD_PASSWORD
------------------------------------------------------------------------------------------------------------
alter user "SCOTT" identified by values 'F894844C34402B67';

07:02:17 SQL> conn scott/tiger
Connected.
07:03:42 SQL> alter user scott identified by lion;

User altered.

07:03:59 SQL> conn scott/lion
Connected.

07:04:31 SQL> alter user "SCOTT" identified by values 'F894844C34402B67';

User altered.

07:04:52 SQL> conn scott/lion
ERROR:
ORA-01017: invalid username/password; logon denied


Warning: You are no longer connected to ORACLE.
07:05:03 SQL> conn scott/tiger
Connected.
07:05:12 SQL>

Using this method one can actually maintain passwords for safe keeping without actually breaking security and recover from accidental password changed.
Note: Method doesn't work across databases. No method so far to decipher password so far.

Tuesday, 27 June 2017

Oracle : Experiment on DBMS_PARALLEL_EXECUTE

Nice method to work on large tables requiring bulk operation but want to avoid locking the whole table.

Here is my setup for the test on favourite scott schema(XEMP is table created from EMP):
SQL> set time on timing on
12:06:21 SQL> select * from tab;

TNAME                          TABTYPE  CLUSTERID
------------------------------ ------- ----------
BONUS                          TABLE
DEPT                           TABLE
EMP                            TABLE
SALGRADE                       TABLE
XEMP                           TABLE

Elapsed: 00:00:00.00
12:06:30 SQL> select count(1) from xemp;

  COUNT(1)
----------
   7340032

Elapsed: 00:00:10.23
---------------------------Experiment-----------------------------------------------------------

Test 1: Simple update:
07:18:13 SQL> show user
USER is "SCOTT"
07:18:19 SQL> update scott.xemp set sal=sal+1000;
7340032 rows updated.
Elapsed: 00:09:51.99

Test 2: Experiment on proc start.
07:28:29 SQL> 07:28:29 SQL> exec DBMS_PARALLEL_EXECUTE.create_task (task_name => 'exp1');
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.67


COLUMN task_name FORMAT A30
SELECT task_name, status FROM   user_parallel_execute_tasks;

Break into chunks by rowid for processing:

07:37:36 SQL> exec DBMS_PARALLEL_EXECUTE.create_chunks_by_rowid(task_name   => 'exp1', table_owner => 'SCOTT', table_name  => 'XEMP', by_row      => TRUE, chunk_size  => 100000);
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.69

optional check to check success of above procedure:
07:38:05 SQL> COLUMN task_name FORMAT A10

SELECT task_name,
       status
FROM   user_parallel_execute_tasks;

TASK_NAME  STATUS
---------- -------------------
test_task  CHUNKED07:40:07 SQL> 07:40:07 SQL> 07:40:07   2  07:40:07   3
TASK_NAME  STATUS
---------- -------------------
exp1       CHUNKED <=====This is what u get.

Elapsed: 00:00:00.06

If want to see how many chunks got created:
SELECT chunk_id, status, start_rowid, end_rowid FROM   user_parallel_execute_chunks WHERE  task_name = 'exp1' ORDER BY 1;
 In our case got 183 chunks.

Run complete:
07:43:38 SQL> exec DBMS_PARALLEL_EXECUTE.run_task(task_name => 'exp1',sql_stmt       => 'UPDATE scott.xemp set sal=sal+1000  WHERE rowid BETWEEN :start_id AND :end_id',language_flag  => DBMS_SQL.NATIVE,parallel_level => 4);

PL/SQL procedure successfully completed.

Elapsed: 00:04:57.11 ===>Improved run

08:04:24 SQL> SELECT task_name, status FROM   user_parallel_execute_tasks;

TASK_NAME  STATUS
---------- -------------------
exp1       FINISHED
-------------------------------------Experiment Complete-------
During run monitoring session:(see 4 sessions)

select inst_id,s.SID,s.SERIAL#,s.username,s.event,s.WAIT_TIME,s.SECONDS_IN_WAIT/60,s.sql_id,status,sql_id from gv$session s where s.username='SCOTT';

  INST_ID    SID    SERIAL# USERNAME   EVENT                           WAIT_TIME S.SECONDS_IN_WAIT/60 SQL_ID        STATUS   SQL_ID
---------- ------ ---------- ---------- ------------------------------ ---------- -------------------- ------------- -------- -------------
         1     17         27 SCOTT      PL/SQL lock timer                       0           .016666667 bzufv5c7udvb2 ACTIVE   bzufv5c7udvb2
         1     20         15 SCOTT      latch: cache buffers lru chain         -1           .016666667 6zws17szpsmrh ACTIVE   6zws17szpsmrh
         1    138         31 SCOTT      latch: cache buffers chains            -1           .016666667 6zws17szpsmrh ACTIVE   6zws17szpsmrh
         1    146         81 SCOTT      log buffer space                        1           .033333333 6zws17szpsmrh ACTIVE   6zws17szpsmrh

Validating results(if update worked or not):
08:03:01 SQL> l
  1* select sum(sal) as SUMSAL from scott.xemp
08:03:04 SQL> /

                  SUMSAL
------------------------
            176698423480
After Rerun:
08:13:58 SQL> select sum(sal) as SUMSAL from scott.xemp;

                  SUMSAL
------------------------
            184038455480 ====>Verified

All that u need :
exec DBMS_PARALLEL_EXECUTE.create_task (task_name => 'exp2');
COLUMN task_name FORMAT A30
SELECT task_name, status FROM   user_parallel_execute_tasks;
exec DBMS_PARALLEL_EXECUTE.create_chunks_by_rowid(task_name   => 'exp2', table_owner => 'SCOTT', table_name  => 'XEMP', by_row      => TRUE, chunk_size  => 100000);
exec DBMS_PARALLEL_EXECUTE.run_task(task_name => 'exp2',sql_stmt => 'UPDATE scott.xemp set sal=sal+1000  WHERE rowid BETWEEN :start_id AND :end_id',language_flag  => DBMS_SQL.NATIVE,parallel_level => 4);
SELECT task_name, status FROM   user_parallel_execute_tasks;

Note: Once task is marked complete, all steps need to be re done.

Additional step(to cleanup):
exec DBMS_PARALLEL_EXECUTE.drop_task('exp2');

I did the experiement based on chunking on rowid's other method like rows/sql

Good refernence link: https://oracle-base.com/articles/11g/dbms_parallel_execute_11gR2

You could try:
1. Other methods of chunking.
2. Parallel counts.
3. Number of rows per chunk.



Friday, 23 June 2017

ORACLE: Edition-Based Redefinition or EBR and errors (ORA-42300,ORA-38802,ORA-38807)

Edition-Based Redefinition

Looks like nice introduction of versioning in the database. Still researching, bear with me on details:

Reference Sample Commands:
alter database default edition =ORA$BASE;#default no need  to execute, only needed if a differnet version becomes default.
create user scott   identified by scott; #optional if schema exists
grant create session,create procedure to scott;#optional if schema exists with privs
create edition version1 as child of ora$base;
alter user scott enable editions;
 grant use on edition version1 to scott;
 grant use on edition version1 to <ANYSCHEMA>;

 Very imp : alter session set edition = version1;

Experiment one: Only editioned views
1. Create one versioned view on base(default).
2. Created another versioned view  on version created in step 0.

select USERNAME,EDITIONS_ENABLED from dba_users;
USERNAME                       E
------------------------------ -
MGMT_VIEW                      N
SYS                            N
SYSTEM                         N
SCOTT                          Y   <===Enabled editions for this schema
SPACE                          N

create edition version1 as child of ora$base; #I created as sysdba
SQL> alter session set edition =VERSION1;

Session altered.

SQL> create editioning view v1_emp as select empno,ename from scott.emp;

View created.

SQL> select object_name,object_type,status,edition_name  from user_objects;

OBJECT_NAME                    OBJECT_TYPE         STATUS  EDITION_NAME
------------------------------ ------------------- ------- ------------------------------
XEMP                           TABLE               VALID
SALGRADE                       TABLE               VALID
BONUS                          TABLE               VALID
PK_EMP                         INDEX               VALID
EMP                            TABLE               VALID
DEPT                           TABLE               VALID
PK_DEPT                        INDEX               VALID
V1_EMP                         VIEW                VALID   VERSION1  ******

SQL> create edition version2 as child of version1;

Edition created.

SQL> alter session set edition = version2;

Session altered.

SQL> create editioning view v2_dept as select * from scott.dept;

View created.

SQL> select object_name,object_type,status,edition_name  from user_objects;

OBJECT_NAME                                                                                                           OBJECT_TYPE          STATUS  EDITION_NAME
-------------------------------------------------------------------------------------------------------------------------------- ------------------- ------- ------------------------------
XEMP                                                                                                                  TABLE                VALID
SALGRADE                                                                                                              TABLE                VALID
BONUS                                                                                                                 TABLE                VALID
PK_EMP                                                                                                                INDEX                VALID
EMP                                                                                                                   TABLE                VALID
DEPT                                                                                                                  TABLE                VALID
PK_DEPT                                                                                                               INDEX                VALID
V1_EMP                                                                                                                VIEW                 VALID   VERSION1
V2_DEPT                                                                                                               VIEW                 VALID   VERSION2





Errors encountered and explaination:
1. SQL> create edition version1 as child of ora$base;
create edition version1 as child of ora$base
*
ERROR at line 1:
ORA-38807: Implementation restriction: an edition can have only one child

Only one child version allowed. 
eg: ORA$BASE can have child V1, V1 can have V2, V2 can have V3 and so on but V1 cannot have 2 child V2 & V3(parallel versions)

2. SQL> alter session set edition = version1;
ERROR:
ORA-38802: edition does not exist

Version must be create before use. required the following:
create edition version1 as child of ora$base;
alter user scott enable editions;#Once only

3.SQL> alter session set edition = version2;

Session altered.

SQL> create editioning view v2_emp as select empno,ename,job from scott.emp;
create editioning view v2_emp as select empno,ename,job from scott.emp
                                                                   *
ERROR at line 1:
ORA-42300: an Editioning view is already defined on this table

Once editioned view V1_emp is created, another on the same table cannot be created.

Tuesday, 23 May 2017

Oracle: DG(DGMGRL) simple configuration

Already present:
Primary  Database : BLOK
Standby Database : ALOK

Prestep:
1. Set init.ora parameter
dg_broker_start= TRUE (Dynamic/No restart required/both side instances)
2. tns and listnener setup for both primary and standby.
http://aloksk.blogspot.com/2017/05/oracle-dgmgrl-seamless-switch.html

Intent : Configure DGMGRL (no observer)

dgmgrl
DGMGRL for Linux: Version 11.2.0.4.0 - 64bit Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/oracle
Connected.
DGMGRL> SHOW CONFIGURATION;
Error:
ORA-16525: the Data Guard broker is not yet available
Configuration details cannot be determined by DGMGRL

******At this point DGMGRL is not configured.(Ensure tnsnames is configured and listner configured as in http://aloksk.blogspot.com/2017/05/oracle-dgmgrl-seamless-switch.html )

DGMGRL> connect sys/oracle
Connected.
DGMGRL> CREATE CONFIGURATION 'DRSOLUTION' AS PRIMARY DATABASE IS 'BLOK' CONNECT IDENTIFIER IS BLOK;
Configuration "DRSOLUTION" created with primary database "BLOK"
DGMGRL> SHOW CONFIGURATION;

Configuration - DRSOLUTION

  Protection Mode: MaxPerformance
  Databases:
    BLOK - Primary database

Fast-Start Failover: DISABLED

Configuration Status:
DISABLED

DGMGRL> ADD DATABASE 'ALOK' AS  CONNECT IDENTIFIER IS ALOK;
Database "ALOK" added
DGMGRL> SHOW CONFIGURATION;

Configuration - DRSOLUTION

  Protection Mode: MaxPerformance
  Databases:
    BLOK - Primary database
    ALOK - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
DISABLED

****At this point Primary and standby are added to DG config but not enabled.
DGMGRL> show configuration;

Configuration - DRSOLUTION

  Protection Mode: MaxPerformance
  Databases:
    BLOK - Primary database
    ALOK - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
DISABLED

*****Enable the config
DGMGRL> ENABLE CONFIGURATION;
Enabled.
DGMGRL> show configuration;

Configuration - DRSOLUTION

  Protection Mode: MaxPerformance
  Databases:
    BLOK - Primary database
    ALOK - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

****At this DGMGRL can be used for switchover  and switchback

Log of switchover and switchback:

**Status check:
dgmgrl
DGMGRL for Linux: Version 11.2.0.4.0 - 64bit Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/oracle
Connected.
DGMGRL> SHOW DATABASE 'ALOK';

Database - ALOK

  Role:            PRIMARY
  Intended State:  TRANSPORT-ON
  Instance(s):
    ALOK

Database Status:
SUCCESS

DGMGRL> SHOW DATABASE 'BLOK';

Database - BLOK

  Role:            PHYSICAL STANDBY
  Intended State:  APPLY-ON
  Transport Lag:   0 seconds (computed 0 seconds ago)
  Apply Lag:       0 seconds (computed 0 seconds ago)
  Apply Rate:      76.00 KByte/s
  Real Time Query: OFF
  Instance(s):
    BLOK

Database Status:
SUCCESS

*****Switch (twice just for fun  ) u can run show database to see status at any point.
GMGRL> switchover to 'BLOK';
Performing switchover NOW, please wait...
New primary database "BLOK" is opening...
Operation requires startup of instance "ALOK" on database "ALOK"
Starting instance "ALOK"...
ORACLE instance started.
Database mounted.
Switchover succeeded, new primary is "BLOK"
DGMGRL>
DGMGRL> SHOW DATABASE 'BLOK';

Database - BLOK

  Role:            PRIMARY
  Intended State:  TRANSPORT-ON
  Instance(s):
    BLOK

Database Status:
SUCCESS
DGMGRL> SHOW DATABASE 'ALOK';

Database - ALOK

  Role:            PHYSICAL STANDBY
  Intended State:  APPLY-ON
  Transport Lag:   0 seconds (computed 1 second ago)
  Apply Lag:       0 seconds (computed 1 second ago)
  Apply Rate:      0 Byte/s
  Real Time Query: OFF
  Instance(s):
    ALOK

Database Status:
SUCCESS

DGMGRL> switchover to 'ALOK';
Performing switchover NOW, please wait...
Operation requires a connection to instance "ALOK" on database "ALOK"
Connecting to instance "ALOK"...
Connected.
New primary database "ALOK" is opening...
Operation requires startup of instance "BLOK" on database "BLOK"
Starting instance "BLOK"...
ORACLE instance started.
Database mounted.
Switchover succeeded, new primary is "ALOK"
DGMGRL>                                       


Error:
ORA-16525 :  dg_boker_start=true (both instance primary/standby)
ORA-16698: Disable log_archive_dest_NN eg: alter system set log_archive_dest_2='' scope=both Sid='*';      Both at primary and standby
ORA-16809: Generally because of stanby logs discrepency. May need to work on it if 30min wait doesnot get rid of error. In my case i did enable configuration again and then show configuaration worked just fine.


Oracle: DGMGRL seamless switch

Ensure:
Primary and Standby databases : ALOK and BLOK

Command facing problem:
DGMGRL > switchover to 'BLOK';   #means switch roles and make BLOK as primary

Above command when executed, primary converts to standby and standby converts to primary, primary database comes up normally but standby remains down and has to be manually started. Once resolution is in place the switch is seamless. PERFCTO!!!

Responding to :
Unable to connect to database
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor


listner.ora is configured correctly:

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

ADR_BASE_LISTENER = /u01/app/oracle
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME =ALOK_DGMGRL)
      (ORACLE_HOME =/u01/app/oracle/product/11.2.0)
      (SID_NAME = ALOK)
    )
    (SID_DESC =
      (GLOBAL_DBNAME =BLOK_DGMGRL)
      (ORACLE_HOME =/u01/app/oracle/product/11.2.0)
      (SID_NAME = BLOK)
    )
   )

Ensure: In bold _DGMGRL service is up or else standby would have to be manually started. For some reason if the service is not visible, restart listner(reload doesnot help)
oracle@localhost:~$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 01-JUN-2017 10:53:51

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost.localdomain)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                01-JUN-2017 10:52:04
Uptime                    0 days 0 hr. 1 min. 46 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "ALOK" has 1 instance(s).
  Instance "ALOK", status READY, has 1 handler(s) for this service...
Service "ALOKXDB" has 1 instance(s).
  Instance "ALOK", status READY, has 1 handler(s) for this service...
Service "ALOK_DGB" has 1 instance(s).
  Instance "ALOK", status READY, has 1 handler(s) for this service...
Service "ALOK_DGMGRL" has 1 instance(s).
  Instance "ALOK", status UNKNOWN, has 1 handler(s) for this service...
Service "BLOK" has 1 instance(s).
  Instance "BLOK", status READY, has 1 handler(s) for this service...
Service "BLOK_DGB" has 1 instance(s).
  Instance "BLOK", status READY, has 1 handler(s) for this service...
Service "BLOK_DGMGRL" has 1 instance(s).
  Instance "BLOK", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully


Monday, 8 May 2017

Oracle: Primary & Standby switch roles -Switchover easy

This is normally a planned activity. Roles could be flipped as when required for testing or any other purpose as application stack validation.

Steps on Primary : (First primary is converted to standby, followed by  standby to primary).

SQL> -----this is primary
SQL> select NAME,OPEN_MODE,DATABASE_ROLE,GUARD_STATUS from gv$database;

NAME      OPEN_MODE            DATABASE_ROLE    GUARD_S
--------- -------------------- ---------------- -------
ALOK      READ WRITE           PRIMARY          NONE

SQL> set time on
10:33:22 SQL> /

NAME      OPEN_MODE            DATABASE_ROLE    GUARD_S
--------- -------------------- ---------------- -------
ALOK      READ WRITE           PRIMARY          NONE

10:33:23 SQL> alter system switch logfile;

System altered.

10:33:43 SQL> select switchover_status from v$database;

SWITCHOVER_STATUS
--------------------
TO STANDBY

10:34:03 SQL> alter database commit to switchover to physical standby with session shutdown;

Database altered.

10:34:50 SQL> select NAME,OPEN_MODE,DATABASE_ROLE,GUARD_STATUS from gv$database;
select NAME,OPEN_MODE,DATABASE_ROLE,GUARD_STATUS from gv$database
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 11521
Session ID: 125 Serial number: 3


10:35:08 SQL> startup mount;
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
10:35:42 SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining
and Real Application Testing options
oracle@localhost:/oradata$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon May 8 10:35:50 2017

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup mount;
ORACLE instance started.

Total System Global Area 1570009088 bytes
Fixed Size                  2253584 bytes
Variable Size             973081840 bytes
Database Buffers          587202560 bytes
Redo Buffers                7471104 bytes
Database mounted.
SQL> select NAME,OPEN_MODE,DATABASE_ROLE,GUARD_STATUS from gv$database;

NAME      OPEN_MODE            DATABASE_ROLE    GUARD_S
--------- -------------------- ---------------- -------
ALOK      MOUNTED              PHYSICAL STANDBY NONE

SQL> alter database recover managed standby database  parallel 2 disconnect
/  2

Database altered.

SQL> select inst_id,process, status, sequence#, block#,thread# from gv$managed_standby  order by 1,2,3;

   INST_ID PROCESS   STATUS        SEQUENCE#     BLOCK#    THREAD#
---------- --------- ------------ ---------- ---------- ----------
         1 ARCH      CONNECTED             0          0          0
         1 ARCH      CONNECTED             0          0          0
         1 ARCH      CONNECTED             0          0          0
         1 ARCH      CONNECTED             0          0          0
         1 MRP0      WAIT_FOR_LOG         10          0          1

SQL> set time on
10:37:03 SQL> /

   INST_ID PROCESS   STATUS        SEQUENCE#     BLOCK#    THREAD#
---------- --------- ------------ ---------- ---------- ----------
         1 ARCH      CONNECTED             0          0          0
         1 ARCH      CONNECTED             0          0          0
         1 ARCH      CONNECTED             0          0          0
         1 ARCH      CONNECTED             0          0          0
         1 MRP0      WAIT_FOR_LOG         10          0          1

10:37:06 SQL> -----Standby is not converted
10:37:16 SQL> /

   INST_ID PROCESS   STATUS        SEQUENCE#     BLOCK#    THREAD#
---------- --------- ------------ ---------- ---------- ----------
         1 ARCH      CONNECTED             0          0          0
         1 ARCH      CONNECTED             0          0          0
         1 ARCH      CONNECTED             0          0          0
         1 ARCH      CONNECTED             0          0          0
         1 MRP0      WAIT_FOR_LOG         10          0          1

10:38:54 SQL> ----post standby conversion to primary
10:40:50 SQL> /

   INST_ID PROCESS   STATUS        SEQUENCE#     BLOCK#    THREAD#
---------- --------- ------------ ---------- ---------- ----------
         1 ARCH      CLOSING              11          1          1
         1 ARCH      CLOSING              10          1          1
         1 ARCH      CONNECTED             0          0          0
         1 ARCH      CONNECTED             0          0          0
         1 MRP0      WAIT_FOR_LOG         12          0          1
         1 RFS       IDLE                 12         12          1
         1 RFS       IDLE                  0          0          0
         1 RFS       IDLE                  0          0          0

8 rows selected.

10:40:52 SQL> /

   INST_ID PROCESS   STATUS        SEQUENCE#     BLOCK#    THREAD#
---------- --------- ------------ ---------- ---------- ----------
         1 ARCH      CLOSING              13          1          1
         1 ARCH      CLOSING              14          1          1
         1 ARCH      CLOSING              11          1          1
         1 ARCH      CONNECTED             0          0          0
         1 MRP0      WAIT_FOR_LOG         16          0          1
         1 RFS       IDLE                  0          0          0
         1 RFS       IDLE                  0          0          0
         1 RFS       IDLE                  0          0          0
         1 RFS       IDLE                 16          2          1

9 rows selected.

Steps on Standby :

SQL> ------This is Standby
SQL> l
  1* select inst_id,process, status, sequence#, block#,thread# from gv$managed_standby  order by 1,2,3
SQL> /

   INST_ID PROCESS   STATUS        SEQUENCE#     BLOCK#    THREAD#
---------- --------- ------------ ---------- ---------- ----------
         1 ARCH      CLOSING               5          1          1
         1 ARCH      CLOSING               6          1          1
         1 ARCH      CONNECTED             0          0          0
         1 ARCH      CONNECTED             0          0          0
         1 MRP0      WAIT_FOR_LOG          8          0          1
         1 RFS       IDLE                  0          0          0
         1 RFS       IDLE                  8        116          1
         1 RFS       IDLE                  0          0          0
         1 RFS       IDLE                  0          0          0

9 rows selected.

SQL> select NAME,OPEN_MODE,DATABASE_ROLE,GUARD_STATUS from gv$database;

NAME      OPEN_MODE            DATABASE_ROLE    GUARD_S
--------- -------------------- ---------------- -------
ALOK      MOUNTED              PHYSICAL STANDBY NONE

SQL> set time on
10:33:14 SQL> select switchover_status from v$database;

SWITCHOVER_STATUS
--------------------
TO PRIMARY

10:37:46 SQL> alter database commit to switchover to primary;

Database altered.

10:38:07 SQL> alter database commit to switchover to primary;
alter database commit to switchover to primary
*
ERROR at line 1:
ORA-01109: database not open


10:38:15 SQL> alter database open;

Database altered.

10:38:24 SQL> alter database commit to switchover to primary;
alter database commit to switchover to primary
*
ERROR at line 1:
ORA-16109: failed to apply log data from previous primary


10:38:27 SQL> select NAME,OPEN_MODE,DATABASE_ROLE,GUARD_STATUS from gv$database;

NAME      OPEN_MODE            DATABASE_ROLE    GUARD_S
--------- -------------------- ---------------- -------
ALOK      READ WRITE           PRIMARY          NONE

10:38:42 SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
10:39:32 SQL> startup;
ORACLE instance started. <=Done here, db is ready to go

-------Following steps for enabling log shipping  and spfile creation. (Optional)
Total System Global Area 1570009088 bytes
Fixed Size                  2253584 bytes
Variable Size             973081840 bytes
Database Buffers          587202560 bytes
Redo Buffers                7471104 bytes
Database mounted.
Database opened.
10:39:48 SQL> alter system set log_archive_dest_3='SERVICE=ALOK LGWR ASYNC=20480 reopen=60 VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=ALOK' scope=both;
alter system set log_archive_dest_3='SERVICE=ALOK LGWR ASYNC=20480 reopen=60 VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=ALOK' scope=both
*
ERROR at line 1:
ORA-32001: write to SPFILE requested but no SPFILE is in use


10:40:09 SQL> alter system set log_archive_dest_3='SERVICE=ALOK LGWR ASYNC=20480 reopen=60 VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=ALOK';

System altered.

10:40:25 SQL> create spfile from pfile;

File created.

10:41:22 SQL> startup force;
ORACLE instance started.

Total System Global Area 1570009088 bytes
Fixed Size                  2253584 bytes
Variable Size             973081840 bytes
Database Buffers          587202560 bytes
Redo Buffers                7471104 bytes
Database mounted.
Database opened.
10:41:39 SQL> alter system set log_archive_dest_3='SERVICE=ALOK LGWR ASYNC=20480 reopen=60 VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=ALOK' scope=both;

System altered.

10:41:51 SQL> alter system switch logfile;

System altered

At this ppoint role is reversed and new standby is in recovery.

Additional recommendation: Add standby log for real-time recovery on primary & standby. 

Recomended read:
http://aloksk.blogspot.in/2017/05/oracle-activate-standby-database.html

Oracle: Activate Standby Database (Failover/Primary lost situation)

Generally a in a disaster situation when primary is lost and standby needs to take over PRIMARY role.
(alternate Procedure at bottom)
This is a test run for this blog purpose only:

select switchover_status from v$database;

SWITCHOVER_STATUS
--------------------
NOT ALLOWED

SQL> select NAME,OPEN_MODE,DATABASE_ROLE,GUARD_STATUS from gv$database;

NAME      OPEN_MODE            DATABASE_ROLE    GUARD_S
--------- -------------------- ---------------- -------
ALOK      MOUNTED              PHYSICAL STANDBY NONE

SQL> /

NAME      OPEN_MODE            DATABASE_ROLE    GUARD_S
--------- -------------------- ---------------- -------
ALOK      MOUNTED              PHYSICAL STANDBY NONE

SQL>  select inst_id,process, status, sequence#, block#,thread# from gv$managed_standby  order by 1,2,3;

   INST_ID PROCESS   STATUS        SEQUENCE#     BLOCK#    THREAD#
---------- --------- ------------ ---------- ---------- ----------
         1 ARCH      CONNECTED             0          0          0
         1 ARCH      CONNECTED             0          0          0
         1 ARCH      CONNECTED             0          0          0
         1 ARCH      CONNECTED             0          0          0
         1 MRP0      WAIT_FOR_LOG         24          0          1
         1 RFS       IDLE                  0          0          0
         1 RFS       IDLE                  0          0          0
         1 RFS       IDLE                  0          0          0
         1 RFS       IDLE                 24         39          1

9 rows selected.

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

Database altered.

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH;

Database altered.

SQL> ALTER DATABASE ACTIVATE PHYSICAL STANDBY DATABASE;

Database altered.

SQL> select inst_id,process, status, sequence#, block#,thread# from gv$managed_standby  order by 1,2,3;

   INST_ID PROCESS   STATUS        SEQUENCE#     BLOCK#    THREAD#
---------- --------- ------------ ---------- ---------- ----------
         1 ARCH      CONNECTED             0          0          0
         1 ARCH      CONNECTED             0          0          0
         1 ARCH      CONNECTED             0          0          0
         1 ARCH      CONNECTED             0          0          0

SQL> select NAME,OPEN_MODE,DATABASE_ROLE,GUARD_STATUS from gv$database;

NAME      OPEN_MODE            DATABASE_ROLE    GUARD_S
--------- -------------------- ---------------- -------
ALOK      MOUNTED              PRIMARY          NONE

SQL> alter database open;   <=DB is ready for use

Database altered.

SQL> select NAME,OPEN_MODE,DATABASE_ROLE,GUARD_STATUS from gv$database;

NAME      OPEN_MODE            DATABASE_ROLE    GUARD_S
--------- -------------------- ---------------- -------
ALOK      READ WRITE           PRIMARY          NONE
----------------------Alternate Procedure
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
shut immediate;
alter database open;-----opens in read only mode.(If not open or complains on more recovery, stop and recover more)
shut immediate;
startup mount
alter database activate standby database;
shutdown immediate


Oracle: Standby on same host

Source : Turn on force logging on and auto file management on Standby
initBLOK.ora   # this is standby pfile created to mount in NOMOUNT mode

racle@localhost:/u01/app/oracle/product/11.2.0/dbs$ cat initBLOK.ora
BLOK.__db_cache_size=603979776
BLOK.__java_pool_size=16777216
BLOK.__large_pool_size=33554432
BLOK.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
BLOK.__pga_aggregate_target=637534208
BLOK.__sga_target=939524096
BLOK.__shared_io_pool_size=0
BLOK.__shared_pool_size=251658240
BLOK.__streams_pool_size=16777216
*.audit_file_dest='/u01/app/oracle/admin/BLOK/adump'
*.audit_trail='db'
*.compatible='11.2.0.4.0'
*.db_block_size=8192
*.db_domain=''
*.db_name='ALOK'
*.instance_name='BLOK'
*.db_unique_name='BLOK'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=BLOKXDB)'
*.memory_target=1572864000
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'
*.db_file_name_convert='/oradata/ALOK','/oradata/BLOK'
*.log_file_name_convert='/oradata/ALOK','/oradata/BLOK'
control_files='/oradata/BLOK/control01.ctl','/oradata/BLOK/control02.ctl'

Note: Critical one in bold.

RMAN script:

DUPLICATE TARGET DATABASE
  FOR STANDBY
  FROM ACTIVE DATABASE
  NOFILENAMECHECK;

Run log:
RMAN> DUPLICATE TARGET DATABASE
  FOR STANDBY
  FROM ACTIVE DATABASE
  NOFILENAMECHECK;2> 3> 4>

Starting Duplicate Db at 08-MAY-17
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=134 device type=DISK
allocated channel: ORA_AUX_DISK_2
channel ORA_AUX_DISK_2: SID=10 device type=DISK
allocated channel: ORA_AUX_DISK_3
channel ORA_AUX_DISK_3: SID=135 device type=DISK
allocated channel: ORA_AUX_DISK_4
channel ORA_AUX_DISK_4: SID=11 device type=DISK

contents of Memory Script:
{
   backup as copy reuse
   targetfile  '/u01/app/oracle/product/11.2.0/dbs/orapwALOK' auxiliary format
 '/u01/app/oracle/product/11.2.0/dbs/orapwBLOK'   ;
}
executing Memory Script

Starting backup at 08-MAY-17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=17 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=147 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=24 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=143 device type=DISK
Finished backup at 08-MAY-17

contents of Memory Script:
{
   backup as copy current controlfile for standby auxiliary format  '/oradata/BLOK/control01.ctl';
   restore clone controlfile to  '/oradata/BLOK/control02.ctl' from
 '/oradata/BLOK/control01.ctl';
}
executing Memory Script

Starting backup at 08-MAY-17
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
channel ORA_DISK_1: starting datafile copy
copying standby control file
output file name=/oradata/backup/ALOK/snapcf_alok.f tag=TAG20170508T072157 RECID=12 STAMP=943428119
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 08-MAY-17

Starting restore at 08-MAY-17
using channel ORA_AUX_DISK_1
using channel ORA_AUX_DISK_2
using channel ORA_AUX_DISK_3
using channel ORA_AUX_DISK_4

channel ORA_AUX_DISK_2: skipped, AUTOBACKUP already found
channel ORA_AUX_DISK_3: skipped, AUTOBACKUP already found
channel ORA_AUX_DISK_4: skipped, AUTOBACKUP already found
channel ORA_AUX_DISK_1: copied control file copy
Finished restore at 08-MAY-17

contents of Memory Script:
{
   sql clone 'alter database mount standby database';
}
executing Memory Script

sql statement: alter database mount standby database

contents of Memory Script:
{
   set newname for tempfile  1 to
 "/oradata/BLOK/temp01.dbf";
   switch clone tempfile all;
   set newname for datafile  1 to
 "/oradata/BLOK/system01.dbf";
   set newname for datafile  2 to
 "/oradata/BLOK/sysaux01.dbf";
   set newname for datafile  3 to
 "/oradata/BLOK/undotbs01.dbf";
   set newname for datafile  4 to
 "/oradata/BLOK/users01.dbf";
   set newname for datafile  5 to
 "/oradata/BLOK/example01.dbf";
   backup as copy reuse
   datafile  1 auxiliary format
 "/oradata/BLOK/system01.dbf"   datafile
 2 auxiliary format
 "/oradata/BLOK/sysaux01.dbf"   datafile
 3 auxiliary format
 "/oradata/BLOK/undotbs01.dbf"   datafile
 4 auxiliary format
 "/oradata/BLOK/users01.dbf"   datafile
 5 auxiliary format
 "/oradata/BLOK/example01.dbf"   ;
   sql 'alter system archive log current';
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /oradata/BLOK/temp01.dbf in control file

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting backup at 08-MAY-17
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/oradata/ALOK/system01.dbf
channel ORA_DISK_2: starting datafile copy
input datafile file number=00002 name=/oradata/ALOK/sysaux01.dbf
channel ORA_DISK_3: starting datafile copy
input datafile file number=00005 name=/oradata/ALOK/example01.dbf
channel ORA_DISK_4: starting datafile copy
input datafile file number=00003 name=/oradata/ALOK/undotbs01.dbf
output file name=/oradata/BLOK/undotbs01.dbf tag=TAG20170508T072215
channel ORA_DISK_4: datafile copy complete, elapsed time: 00:00:36
channel ORA_DISK_4: starting datafile copy
input datafile file number=00004 name=/oradata/ALOK/users01.dbf
output file name=/oradata/BLOK/example01.dbf tag=TAG20170508T072215
channel ORA_DISK_3: datafile copy complete, elapsed time: 00:01:22
output file name=/oradata/BLOK/users01.dbf tag=TAG20170508T072215
channel ORA_DISK_4: datafile copy complete, elapsed time: 00:00:55
output file name=/oradata/BLOK/sysaux01.dbf tag=TAG20170508T072215
channel ORA_DISK_2: datafile copy complete, elapsed time: 00:02:52
output file name=/oradata/BLOK/system01.dbf tag=TAG20170508T072215
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:03:12
Finished backup at 08-MAY-17

sql statement: alter system archive log current

contents of Memory Script:
{
   switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafile copy RECID=12 STAMP=943428328 file name=/oradata/BLOK/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=13 STAMP=943428328 file name=/oradata/BLOK/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=14 STAMP=943428328 file name=/oradata/BLOK/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=15 STAMP=943428328 file name=/oradata/BLOK/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=16 STAMP=943428328 file name=/oradata/BLOK/example01.dbf
Finished Duplicate Db at 08-MAY-17

RMAN> exit

Post this just adjust archive dest and fal and you are done.

on my primary:
alter system set log_archive_dest_3='SERVICE=BLOK LGWR ASYNC=20480 reopen=60 VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=BLOK' scope=both;

on standby:
SQL> show parameter fal

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
fal_client                           string

fal_server                           string      alok

and started mrp.