Monday, December 15, 2014

WWC-41417 UNABLE TO LOGIN TO PORTAL

When user is unable to login Portal system with following error , deletion of user record from  portal.wwsec_person$ table can solve this issue.

Internal error (WWC-00006)
Unexpected error encountered in wwsec_app_priv.process_signon (User-Defined Exception) (WWC-41417)
There is a conflict with your assigned user name. There is a user entry with this name, but with a different globally unique identifier, which must be resolved before you can log on with this name. Notify your administrator. (WWC-41742)

According to MOS , this issue can occur when user is deleted from OID or recreated in OID and portal tables are not getting the update.

Friday, December 12, 2014

Unexpected SYSAUX tablespace growth because of WRH$_LATCH_CHILDREN

For a while , I have seen unexpected growth at SYSAUX tablespace . When listed objects ordered by size , WRH$_LATCH_CHILDREN table is on the top and as a result of examination , it was caused from statistics_level parameter. For a performance issue i have changed this parameter from TYPICAL to ALL to get more detail information . But after performance issue resolved , i have not changed parameter back and it affected tablespace SYSAUX increased to bigger values.

After changing parameter to old value "TYPICAL" , growth decreased to expected values.


Not only statistics_level parameter can cause this issue according to metalink note, also low snapshot interval can cause. For interval 60 minutes is ideal.

Thursday, December 11, 2014

MapViewer Runtime Failure After Upgrading BI from Release 11.1.1.6 to Release 11.1.1.7

After upgrade of current OBIEE to 11.1.1.7 from 11.1.1.6 when trying to access mapviewer URL (http://localhost:7001/mapviewer  below error occured.

"HTTP 500 Internal Server Error" 

Mapviewer was deployed into bi_server1 and related logfile were examined located at $DOMAIN_HOME/bifoundation_domain/servers/bi_server1/logs. Log files had entries like

WatchRuleType: Log
WatchRule: (SEVERITY = 'Error') AND ((MSGID = 'WL-101020') OR (MSGID = 'WL-101017') OR (MSGID = 'WL-000802') OR (MSGID = 'BEA-101020') OR (MSGID = 'BEA-101017') OR (MSGID = 'BEA-000802'))
WatchData: DATE = Dec 5, 2014 8:49:56 PM EET SERVER = bi_server1 MESSAGE = [ServletContext@1774584388[app:mapviewer module:/mapviewer path:/mapviewer spec-version:2.5 version:11.1.1]] Root cause of ServletException.

java.lang.NoClassDefFoundError: oracle/adfinternal/view/faces/taglib/html/HtmlHtmlTag
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
        at java.lang.Class.getConstructor0(Class.java:2699)
        at java.lang.Class.newInstance0(Class.java:326)
        at java.lang.Class.newInstance(Class.java:308)


As a solution Oracle  suggests to delete some files of MapViewer deployment and delete the Weblogic internal cache of the MapViewer application. 

1. Stop Managed server (bi_server1)
2. Delete the following files from MapViewer deployment MW_HOME/Oracle_BI1/bifoundation/jee/mapviewer.ear

  • web.war/WEB-INF/lib/adf-faces-api.jar
  • web.war/WEB-INF/lib/adf-faces-impl.jar
  • web.war/WEB-INF/lib/commons-digester.jar
  • web.war/WEB-INF/lib/commons-logging-1.1.jar
  • web.war/WEB-INF/lib/jsf-api.jar
  • web.war/WEB-INF/lib/jsf-impl.jar
  • web.war/WEB-INF/lib/jsr173_1.0_api.jar
  • web.war/WEB-INF/lib/mvutil.jar
  • web.war/WEB-INF/lib/xdb.jar
  • web.war/WEB-INF/adf-faces-config.xml
  • web.war/WEB-INF/orion-web.xml
 3. Delete the directory
 MW_HOME/user_projects/domains/bifoundation_domain/servers/bi_server1/tmp/_WL_user/mapviewer_11.1.1

4. Restart the managed server

Source 
http://docs.oracle.com/cd/E28280_01/doc.1111/e14770/biee.htm#CHDJIDBD

Friday, October 31, 2014

Tips & Tricks 4 : Conditional index

Client asked me if it is possible to create unique index on any table on condition. For example only 1 record is acceptable for any document which has active_flag as '1'. For active_flag '0' there can be more than 1 record.

In order to do this  we will create unique index with condition

SQL> create table t1 (document_id number,active_flag char(1));

Table created.

SQL> create unique index t1_idx on t1(case when active_flag='1' then document_id else null end);




For active_flag as '1' index will be populated with document_id , and for '0' not.

 
SQL> insert into t1 values (1,'1');

1 row created.

SQL> insert into t1 values (2,'1');

1 row created.

SQL> insert into t1 values (1,'0');

1 row created.

SQL> insert into t1 values (1,'0');

1 row created. -- able to insert same record

SQL> insert into t1 values (1,'1');
insert into t1 values (1,'1')
*
ERROR at line 1:
ORA-00001: unique constraint (TEST.T1_IDX) violated

-- Not able to insert same record for active_flag '1' value .

Saturday, September 13, 2014

Tips & Tricks 3 : Exclude table ,schema from Expdp

From command line if you would like to exclude table , tables or schema following command can be used .

For specific table(s)
expdp system/pass directory=dp_dir dumpfile=sample.dmp exclude=TABLE:\ "IN \(\'TAB1\',\'TAB2\',\'TAB3\'\)\"

For schema(s)
expdp system/pass directory=dp_dir dumpfile=sample.dmp exclude=SCHEMA:\ "IN \(\'SCHEMA_NAME1\',\'SCHEMA_NAME2\'\)\"

Thursday, September 4, 2014

Tips & Tricks 2 : Disable autostart of High Availability Service

Whenever  any components like ASM,listener,database is down, or when server restarted, component called HAS (High Availability Service) restarts the failed components and bring them up. This is done automatically. Sometimes it is not wanted to start itself automatically. In order to disable these property below command is executed ,

[root@test01 bin]# ./crsctl disable has
CRS-4621: Oracle High Availability Services autostart is disabled.
[root@test01 bin]#


http://docs.oracle.com/cd/E18283_01/server.112/e17120/restart004.htm#CIHGFJEB

Tips & Tricks 1 : Give debug privilege to user

Sometimes small tips and tricks may be useful for administrating db, apps etc... I would like to add related posts into my blog contains tips and tricks.

Tips & Tricks 1 : Give debug privilege to user.

Any user with whom you need debug procedure,function or package , related user must have

DEBUG CONNECT SESSION
DEBUG ANY PROCEDURE

privileges.

In order to give these ,

grant DEBUG CONNECT SESSION userx;
grant DEBUG ANY PROCEDURE userx

Thursday, August 7, 2014

UPGAST-00224:The specified database does not contain any schemas for Oracle MDS ...

From Oracle Error Message documentation,

UPGAST-00224: The specified database does not contain any schemas for {0} or the database user lacks privilege to view the schemas.

Cause: The database you have specified does not contain any schemas registered as belonging to the component you are upgrading, or else the current database user lacks privilege to query the contents of the schema version registry.

Action: Verify that the database contains schema entries in schema version registry. If it does not, specify a different database. Verify that the user has DBA privilege. Connect to the database as DBA.

Level: 1
Type: ERROR
Impact: Upgrade

While upgrading OBIEE from 11.1.1.6 to 11.1.1.7 i have encountered UPGAST-00224 error at stage of PSA for the update of MDS schema .

I was doing upgrade process at TEST enviroment and related MDS + BIPLATFORM schemas have been imported from LIVE database to TEST database by changing schema names in order to sepearate TEST and LIVE . My original schema names were OBI_MDS and OBI_BIPLATFORM  and changed to OBIUPG_MDS ,OBIUPG_BIPLATFORM After done this process system.SCHEMA_VERSION_REGISTRY$ must be updated with new schema information.

To do this , system.SCHEMA_VERSION_REGISTRY$ can be exported and imported from live into TEST , or related MDS and BIPLATFORM data can be inserted or updated  at TEST enviroment.

Thursday, July 24, 2014

Firefox Update comes with sec_error_ca_cert_invalid (Security Error)

After I have patched firefox to version 31.0 when i try to connect  Enterprise Manager 12c , browser throws an SSL error : sec_error_ca_cert_invalid 

An error occurred during a connection to https://<OMS host>:port . Issuer certificate is invalid. (Error code: sec_error_ca_cert_invalid)



Because of certificate of grid control is self generated and not signed by a  trusted Certificate Authority , browser shows an error that it does not recognise the certificate . To skip this situation there are 2 ways that can be done.

1. Third Party certificate from well know certificate authority  can be used.

Third party certificates can be obtained from a well-known Certificate Authority and imported into the OMS and Agents. 

2. Import Self-signed certificate into browsers certificate store

To recognise self-signed certificate from any browser , this certificate can be added browser store.Whenever grid control URL is called from explorer or chrome , these browsers can continue to work even if you accept risk.But firefox can not. To skip firefox issue i have used "internet explorer" to get related certificate and imported it into firefox store by using following steps,

1.Clear SSL cache from "Internet Options > Content Tab > Clear SSL State"

2.Remove any certificate entry from "Internet Options > Content Tab > Certificates" related with your Grid Console or Enterprise Manager Cloud control in following tabs

Personal
Other People
Intermediate Certification Authorities
Trusted Root Certification Authorities
Trusted Publishers
Untrusted Publishers

3. Click Ok and close the browser

4. Open browser and go to https://<OMS host>:port/em

5. Continue to this website (not recommended) is selected

6. After this login screen is opened but "Certifacate Error" link is came up beside address bar of explorer. Click this link.

7. Click "View certificates"



8. Goto "Certification Path" tab 



9. Select top or root certificate and click "View Certificate"



10. Click "Install Certificate"


11. Click "Next" and choose "Place all certificates in the following store" in the following screen.


10. Click "Browse" button and select "Trusted Root Certification Authorities"

11. Click "Next" and "Finish" button sequentially

12. Click "Yes" on Last "Security Warning" screen and "The import was successful" message comes up

13. After reopen the browser and calling OMS url https://<OMS host>:port/em certificate error does not occur again.

Now , i have imported self-signed certificate into internet explorer certificate store and i can export it to import into firefox store.

1. From internet explorer choose "Internet Options > Content Tab > Certificates" and goto "Trusted Root Certification Authorities" 

2. Select your certificate regarding your OMS host name in "Issued To" column.

3. Click export 

4. Click Next

5. Select "DER encoded binary X.509 (.CER)

6. Click next and give a name as a file name for certificate

7. Click next and finish.

8. Open firefox

9. Goto "Advanced > Certificates > View Certificates"



10. Goto "Authorities" tab and click "Import" button

11. Select your exported certification file with open file editor and click "Ok" without selecting any purposes.



12. Reopen firefox and enter OMS url again.

Login screen opened .


Saturday, July 19, 2014

Estimate size of index using explain plan

Today i have learned cool way to define after index rebuilt what will the index size be ? This method , estimating index size is based on explain plan . Not only rebuild process , additionally creation of index is  involved .

Basically ,

1. create table tbl1 as select * from dba_objects;
2. insert into tbl1 select * from tbl1 -- 2 times
3. commit;
3. call dbms_stats.gather_table_stats('USER','TBL1');
4. explain plan for create index user.tbl_idx1 on tbl1(object_name);
5. commit;

6. select * from table (dbms_xplan.display);

-----------------------------------------------------------------------------------
| Id  | Operation              | Name     | Rows  | Bytes | Cost (%CPU)| Time     |
-----------------------------------------------------------------------------------
|   0 | CREATE INDEX STATEMENT |          |   414K|  9707K|   441   (3)| 00:00:03 |
|   1 |  INDEX BUILD NON UNIQUE| TBL_IDX1 |       |       |            |          |
|   2 |   SORT CREATE INDEX    |          |   414K|  9707K|            |          |
|   3 |    TABLE ACCESS FULL   | TBL1     |   414K|  9707K|   334   (3)| 00:00:02 |
-----------------------------------------------------------------------------------

Note
-----
   - estimated index size: 16M bytes



6. create index user.tbl_idx1 on tbl1(object_name);

7. select bytes/1024 from dba_segments where segment_name='TBL_IDX1'

Size : 16384K

As a result , actual size and estimate size are so close . 

CArlos Sierra has a great article and script about this method which can be applied to whole system , schema ,table or single index . Object create DDL is used with explain plan statement to detect approximate size like this,

declare
  v_ddl clob;
begin

  select replace(dbms_metadata.get_ddl(object_type => 'INDEX',name => 'TBL_IDX1'),chr(10),' ') into v_ddl   FROM DUAL;

  execute immediate 'explain plan for '||v_ddl;
  commit;

end ;

After script execution,below sql gives segment size and estimated size

select object_name,object_owner,info estimatedSize,ds.BYTES segmentSize
  from (select p.object_name,p.object_owner,extractvalue(value(d), '/info/@type') type,
               extractvalue(value(d), '/info') info
          from plan_table p,
               table(xmlsequence(extract(xmltype(p.other_xml), '/*/info'))) d
         where p.other_xml is not null)X,dba_segments ds
 where type = 'index_size'
   and ds.owner=X.object_owner
   and ds.segment_name=X.object_name


OBJECT_NAME    OBJECT_OWNER    ESTIMATEDSIZE    SEGMENTSIZE
TBL_IDX1           USER                     16777216    16777216


This post was based on below blog posts

http://carlos-sierra.net/2014/07/18/free-script-to-very-quickly-and-cheaply-estimate-the-size-of-an-index-if-it-were-to-be-rebuilt/

http://richardfoote.wordpress.com/2014/04/24/estimate-index-size-with-explain-plan-i-cant-explain/

Wednesday, July 9, 2014

IAS_ADMIN account password reset

When you do not know ias_admin password or forget it , you can reset its password. Ias_admin is used for 
Application Server for administration. For 10.1.2.3.0 below steps can be used in order to change or reset password.

1.Shutdown Application Server console

$ORACLE_HOME/bin/emctl stop iasconsole

2.jazn-data.xml file should be backed up located in $ORACLE_HOME/sysman/j2ee/config

cd  $ORACLE_HOME/sysman/j2ee/config
cp jazn-data.xml jazn-data.xml.bak

3.With vi editor find <name>ias_admin</name>  and remove the credentials line under <name> tag

<name>ias_admin</name>
<credentials>{903}+7qAmdyLk7lsa7CxvLpFeDesddzaJWS3qEA/AvKpA+bw=</credentials>

4.Following command is used to reset ias_admin account password

$ORACLE_HOME/bin/emctl set password reset <newpassword>

5.Start Application Server console

$ORACLE_HOME/bin/emctl start iasconsole

Password can be changed from command line if you know current ias_admin account password,

$ORACLE_HOME/bin/emctl set password <oldpassword> <newpassword>

Monday, June 30, 2014

Unable to launch discoverer because of Missing Required Permissions Manifest Attribute In Main Jar & Security Exception, JVM Shared, not allowed to set security manager

After client java upgrade for EBS R12 from jre 1.6.0_33 to 1.7.0_51 we have been warned , clients getting below error whenever invoking discoverer.

Missing Required Permissions Manifest Attribute In Main Jar :

For this error we have applied 17347648 ,17303613 and 17874742 sequentially. At last below error occured ,

Security Exception, JVM Shared, not allowed to set security manager

More inclusive patch 18219024 adviced from support.But not able to patch because of this error,

Running prerequisite checks... 
Prerequisite check "CheckPatchApplicableOnCurrentPlatform" failed. 
The details are: 
Patch ( 18219024 ) is not applicable on current platform. 
Platform ID needed is : 226 
Platform IDs supported by patch are: 46 
[ Error during Prerequisite for apply Phase]. Detail: OPatch failed during prerequisite checks: Prerequisite check "CheckPatchApplicableOnCurrentPlatform" failed. 
System is intact, OPatch will not restore the system 

Despite Oracle published patch is generic platform , i could not apply patch to linux platform. Oracle support has a solution which is  changing  <platform name="" > entry to proper value in  PATCH_LOCATION/etc/config/inventory.xml file.

I have changed 
 <platform name="Linux Intel" id="46"/>
to
 <platform name="Linux Intel" id="226"/>

With this solution patch has been applied successfully and discover problem has gone.

Monday, June 23, 2014

Instant Data file growth - KTSJ - SMCO (Space Management Coordinator)

I have encountered an issue last weekend which was all datafiles in tablespace extended without reason. There was lots of wasted space approximetaly 125 GB.Firstly i have thougth that there was a procedure or job which processed big data and it caused this instant growth. But no clear point or anything like this i could not find in AWR reports in related time.

In order to detect this issue firstly i have queried exact time when this occured. Below sql helped me to find it.

select f1.snap_id,
       f1.sumts,f2.sumts2,((f1.sumts-f2.sumts2)*8)/1024/1024 diff
  from (select d1.snap_id, sum(tablespace_size) sumts
          from dba_hist_tbspc_space_usage d1, v$tablespace v1
         where d1.tablespace_id = v1.TS#
           and rtime >= '06/22/2014'
           and rtime < '06/23/2014'
         group by d1.snap_id) f1 ,       (select snap_id,sum(tablespace_size) sumts2
          from dba_hist_tbspc_space_usage d1
         group by d1.snap_id) f2   
where f2.snap_id=f1.snap_id-1  

This sql gave me issue occured between 05:00 AM - 06:00 AM. I have to find which session(s) caused this and best way to find was dba_hist_active_session_history with below sql

select d3.sample_id,
       d3.sample_time,
       d3.session_type,
       d5.USERNAME,
       d3.session_id,
       d3.session_serial#,
       d3.sql_opname,
       d3.sql_id,
       d3.event,
       d3.module,
       d3.action,
       d3.delta_read_io_requests,
       d3.delta_write_io_requests,
       d3.delta_read_io_bytes,
       d3.delta_write_io_bytes,
       d4.sql_text
  from dba_hist_active_sess_history d3, dba_hist_sqltext d4, dba_users d5
 where d3.sample_time >=
       to_date('22/06/2014 05:00:00', 'dd/mm/yyyy hh24:mi:ss')
   and d3.sample_time <
       to_date('22/06/2014 06:00:00', 'dd/mm/yyyy hh24:mi:ss')
   and d3.sql_id = d4.sql_id(+)
   and d3.user_id = d5.USER_ID(+)
 order by d3.sample_id

By ordering delta_write_io_bytes column ,interesting session  KTSJ Slave listed with highest delta_write_io_bytes . Sum of the delta_write_io_bytes of KTSJ was 119 GB and this was what i was looking for. Key word  was KTSJ or KTSJ Slave. After googling and with Oracle support , lastly i have found myself reading SMCO (Space Management Coordinator) master note :) 

Duty of this coordinator is coordinating execution of space management tasks , such as proactive space allocation and space reclamation. If datafiles have autoextend Yes property this coordinator can extend datafilesize to its max size even it has not reached maxsize. This is of course fine that sessions need not wait for space allocation that has already done. But instant growing like this may  make storage admin angry :) To be in safe disable option is available.

"Tablespace-level space (Extent) pre-allocation" feature provided by SMCO process can be disabled by setting "_enable_space_preallocation" to 0 as below,

alter system set "_enable_space_preallocation"=0;

To enable this feature, parameter can be set to 3 which is the default value,

alter system set "_enable_space_preallocation"=3;


Sunday, June 8, 2014

Replicat process abends with OGG-01091 Unable to open file... (Error 2, no such file or directory)

After abnormal crash of server , all databases has been restarted and existing goldengate replicat processes abended with below error,

 ERROR   OGG-01091  Oracle GoldenGate Delivery for Oracle, RANK1.prm:  Unable to open file <trail_file> (error 2, No such file or directory)

Whenever start of replicat process everytime same error occured. Although trail file exists in related directory, process could not start. To fix this error , related replicat process has been altered to begin with specific trail file which seems absent.

alter replicat <REPLICAT_NAME>,extseqno <trail file seq no> ,extrba 0

trail file seq no is absent file no


After this changement replicat process began successfully.

Monday, June 2, 2014

ORA-07445 [kkpamIsPKeyFKeyJoin()+154]

On database 12cr1 we have seen ORA-07445 [kkpamIsPKeyFKeyJoin()+154]  error when reference partitioning and join are used between tables. Actually error has not occured for all sql statemens except one.

For Oracle support setting parameter "_full_pwise_join_enabled" to false can be used to avoid this error.I have used hint for specific sql like select /*+ OPT_PARAM('_full_pwise_join_enabled' 'false') */ .

By breaking large joins into small joins , memory is used better and this process is distributed amaong parallel server processes effective. So Benefits of partition-wise join must be thought before turn off this parameter at database level.

Thursday, May 22, 2014

uln_register "This system profile has already been registered"

Whenever cloned or previously registered machine would like to be registered again via uln_register to linux support , "This system profile has already been registered" may occur. These two possibilites of error can be avoided regenerate system uuid .

From ULN web interface related system information can be deleted from System tab. If you could not find any related system on list , following steps can be done.

With "uuidgen -r" command random id is generated ,with "uuidgen -t" generated id is based on system MAC address.For several versions of linux support , following actions can be done.

For Oracle Linux 4 and 5

Output of uuidgen -t is replaced the existing value of rhnuuid parameter of /etc/sysconfig/rhn/up2date-uuid file. up2date is run again.

For Oracle Linux 6 

Following command writes generated uuid into the related file which is "/etc/sysconfig/rhn/up2date"

echo "uuid=`uuidgen -t`" >> /etc/sysconfig/rhn/up2date

uln_register is run again.



Wednesday, May 21, 2014

ora-00942 resolution with errorstack trace

Whenever developer warned me that application took ORA-00942 -  table or view does not exist error , i have asked which sql . From one reason related sql could not be captured , so i have decided to open tracing for specific error on level 3.

For ora-00942 -  table or view does not exist error , i have executed ,

alter system set events '942 trace name errorstack level 3';

Error entries were in the alert log file , and it was showing related trace files. But more trace files occured in dump directory that i expect.Most of them were indicating 1 table , but this table was not the cause of error . I have used "grep" command to eliminate irrelevant files in order to detect actual table.

In every trace files there was a entry which is "about to signal 942" helped me to query all related files and "Name:" entry at the end of file showing table name.

grep "about to signal 942" * | grep "^Name:" * | grep -v "TABLE2"

Output ,

testdb_ora_23427.trc:Name: TABLEX
testdb_ora_2626.trc:Name: TABLEX
testdb_ora_2692.trc:Name: TABLEX
testdb_ora_2708.trc:Name: TABLEX
testdb_ora_29230.trc:Name: TABLEX
testdb_ora_31956.trc:Name: TABLEX

Table2 was irrelevant table and with "-v" parameter command only executed for other tables.As a result relevant table has been determined.

After resolution , you can disable errostack tracing,

alter system set events '942 trace name errorstack off';

Sunday, May 18, 2014

lots of audit files under ASM home

Yesterday, I had as issue which was standby log shipping giving below error ,

PING[ARC2]: Heartbeat failed to connect to standby '<stbyDb>' Error is 1033.

On Standby server , db side was giving below error ,

NOTE: Deferred communication with ASM instance
ORA-09925: Unable to create audit trail file
Linux-x86_64 Error: 28: No space left on device

ASM side was giving also,
OS Audit file could not be created; failing after 6 retries

Oracle support has a note about this issue which is "Large Number of Audit Files Generated by Oracle Restart or Grid Infrastructure (Doc ID 1378881.1)"  . Oracle restart deamons is checking availability of registered services within  a CHECK_INTERVAL parameter duration.Default it is 1 second. 

crsctl status res ora.asm -p command shows that checking frequency of asm service availability is 1 second. Modifying value of parameter can avoid execessive generation of audit files. 

crsctl modify res ora.asm -attr "CHECK_INTERVAL=60"

But this change will provide checking service availability every minute and unavailability will be detected one minute later in worst case.If it is acceptable , parameter can be changed. I have not changed parameter. I have solved issue by adding script into crontab which work everyhour and deletes ASM audit files

1 * * * * rm -rf /oracle/app/grid/product/12.1.0/grid/rdbms/audit/*.aud

Thursday, May 8, 2014

Data Guard Physical Standby Creation

After setting up new database with ASM , customer also would like to have a physical standby database data guard configured.New version 12c may also have new properties for standby database creation , but i have used traditional methods. Following steps contain these methods ,

Primary Server  : PNODE
Standby Server : SNODE
Db Name : test

I assume that all servers have necessary Oracle binaries installed for ASM and Oracle database . Also ASM diskgroup(s) are ready as same as primary.

1. Primary database must be configured as force logging mode.This step is necessary for ensuring that all changes made in the database will be captured.

2.While primary db is online full backup is taken with following script

rman target /

run {
  allocate channel t1 DEVICE TYPE DISK;
  allocate channel t2 DEVICE TYPE DISK;
  allocate channel t3 DEVICE TYPE DISK;
  allocate channel t4 DEVICE TYPE DISK;
  backup
    as compressed backupset
    full
    format '/dump/stbyBackup/bkpstby-%s-%T-%U'
    (database);
  release channel t1;
  release channel t2;
  release channel t3;
  release channel t4;
}

Locations and directories should be changed according to your enviroments.

3. After backup is completed successfully, standby database controlfile is created on primary ,

alter database create standby controlfile as '/dump/stbyBackup/stbyCtl.ctl';

4. All backup files,standby controlfile,primary password file , primary spfile is copied to standby server into related directories.

5. Create initfile from spfile on standby server and change following parameters ,

sqlplus / as sysdba
create pfile='inittest.ora' from spfile='spfiletest.ora';

## Change controlfiles parameter showing that new standby controlfile (stbyCtl.ctl)

- control_files ='home/oracle/stbyCtl.ctl' ## This parameter should be changed for your locations.
DB_UNIQUE_NAME=teststby
LOG_ARCHIVE_CONFIG='DG_CONFIG=(test,teststby)'
-log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=teststby'
log_archive_dest_state_1='ENABLE'
FAL_SERVER=test
FAL_CLIENT=teststby
STANDBY_FILE_MANAGEMENT =AUTO

6. You can recreate spfile from initfile

sqlplus / as sysdba
create spfile='spfiletest.ora' from pfile='inittest.ora';

7.Startup database in mount mode.

sqlplus / as sysdba
startup mount

8.Begin restore process ,

rman target /

run {
  allocate channel t1 DEVICE TYPE DISK;
  allocate channel t2 DEVICE TYPE DISK;
  allocate channel t3 DEVICE TYPE DISK;
  allocate channel t4 DEVICE TYPE DISK;
  restore database;
  release channel t1;
  release channel t2;
  release channel t3;
  release channel t4;
}

9. Create stanby redo log files on standby server. 

When you have created standby controlfile following warnings occured to create standby redolog files ,

ALTER DATABASE ADD STANDBY LOGFILE 'srl1.f' SIZE 524288000;
ALTER DATABASE ADD STANDBY LOGFILE 'srl2.f' SIZE 524288000;
ALTER DATABASE ADD STANDBY LOGFILE 'srl3.f' SIZE 524288000;
ALTER DATABASE ADD STANDBY LOGFILE 'srl4.f' SIZE 524288000;

Size attribute depends on current redolog file size on primary server.

10. Add tnsnames entires into tnsnames.ora on standby server 

test = (DESCRIPTION=
                (ADDRESS=(PROTOCOL=tcp)(HOST=PNODE)(PORT=1521))
                (CONNECT_DATA=(SID=test))
            )

teststby= (DESCRIPTION=

                (ADDRESS=(PROTOCOL=tcp)(HOST=SNODE)(PORT=1521))
                (CONNECT_DATA=(SID=test))

            )

11. For listener there should be already configured listener from grid home.

Until now, we have created standby database,configured tns and parameters.From this point, primary database parameters will be set and redo apply process will be started.

12. For primary database following parameters are set.

-   log_archive_config='DG_CONFIG=(test,teststby)'
log_archive_dest_2='SERVICE=teststby LGWR async=20840 reopen=15 max_failure=10 optional net_timeout=5 VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=teststby'
-  standby_file_management='AUTO'

13. Add teststby tnsnames entry into tnsnames.ora on primary server

teststby= (DESCRIPTION=
                (ADDRESS=(PROTOCOL=tcp)(HOST=SNODE)(PORT=1521))
                (CONNECT_DATA=(SID=test))

            )

14. By tnsping from both servers connection is controlled.

tnsping test
tnsping teststby

Both commands must return "OK" ,

tnsping teststby >
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=teststby)(PORT=1521)) (CONNECT_DATA=(SID=test)))
OK (10 msec)

15. startup standby database on stanby server and log 

startup nomount;
alter database mount standby database;
alter database recover managed standby database disconnect from session; 

recovery operation starts and redo apply services apply logs to the standby database.

16. Enable log shipping on primary 

alter system set log_archive_dest_state=ENABLE;