Thursday, June 21, 2018

In Oracle SQL*Plus, how do I change the prompt to show the connected user and database ?


-- This is how to change the SQL prompt in Oracle SQL*Plus to show the currently connected user and database name

-- There is a file called "glogin.sql" under "$ORACLE_HOME/sqlplus/admin" folder
-- First take a backup of this file to use it if anything goes wrong, this is the way I work everytime I make a change to an Oracle internal file.

[oracle@exatestdbadm01] /u01/app/oracle/product/12.1.0.1/dbhome_1/sqlplus/admin > cp glogin.sql glogin.sql-201607200951

-- Just add add line "set sqlprompt "_user'@'_connect_identifier > " to the very end of the file by openning it in "vi" editor and that's all

[oracle@exatestdbadm01] /u01/app/oracle/product/12.1.0.1/dbhome_1/sqlplus/admin > vi  glogin.sql
--
-- Copyright (c) 1988, 2005, Oracle.  All Rights Reserved.
--
-- NAME
--   glogin.sql
--
-- DESCRIPTION
--   SQL*Plus global login "site profile" file
--
--   Add any SQL*Plus commands here that are to be executed when a
--   user starts SQL*Plus, or uses the SQL*Plus CONNECT command.
--
-- USAGE
--   This script is automatically run
--
set sqlprompt "_user'@'_connect_identifier > "

[oracle@exatestdbadm01] /u01/app/oracle/product/12.1.0.1/dbhome_1/sqlplus/admin >

[oracle@exatestdbadm01] /u01/app/oracle/product/12.1.0.1/dbhome_1/sqlplus/admin > sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Wed Jul 20 09:54:06 2016

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options

SYS@fenikstd1 >

Wednesday, June 20, 2018

How to check the number of configured and free HugePages in an Oracle Linux server


-- You can use the below command to find the number of configured and free HugePages in an Oracle Linux server

[oracle@exatestdbadm01] /home/oracle > grep HugePages /proc/meminfo
HugePages_Total:   60000
HugePages_Free:    40059
HugePages_Rsvd:       56
HugePages_Surp:        0
[oracle@exatestdbadm01] /home/oracle >


How to check if a 12c database is an Oracle Multitenant container database or not


-- This how to make sure the connected database is an Oracle Multitenant container database or not

SYS@AHEDWH1 > SELECT CDB FROM V$DATABASE;

CDB
---
NO

SYS@AHEDWH1 >

ERROR: Unable to get logical block size for spfile '+DATAC1/AHEDWH/spfileAHEDWH.ora'


-- We started to get the following error in the database alert log of one of our RAC databases

[oracle@exatestdbadm01] /u01/app/oracle/diag/rdbms/ahedwh/AHEDWH1/trace > tail -f alert_AHEDWH1.log

Wed Jun 20 12:57:30 2018
Thread 1 advanced to log sequence 60256 (LGWR switch)
  Current log# 110 seq# 60256 mem# 0: +DATAC1/AHEDWH/ONLINELOG/group_110.1851.973682373
  Current log# 110 seq# 60256 mem# 1: +RECOC1/AHEDWH/ONLINELOG/group_110.4617.973682375
Wed Jun 20 12:59:53 2018
ERROR: Unable to get logical block size for spfile '+DATAC1/AHEDWH/spfileAHEDWH.ora'.
Wed Jun 20 12:59:53 2018
ERROR: Unable to get logical block size for spfile '+DATAC1/AHEDWH/spfileAHEDWH.ora'.
Wed Jun 20 12:59:53 2018
ERROR: Unable to get logical block size for spfile '+DATAC1/AHEDWH/spfileAHEDWH.ora'.
Wed Jun 20 12:59:53 2018
ERROR: Unable to get logical block size for spfile '+DATAC1/AHEDWH/spfileAHEDWH.ora'.
Wed Jun 20 12:59:53 2018
ERROR: Unable to get logical block size for spfile '+DATAC1/AHEDWH/spfileAHEDWH.ora'.
Wed Jun 20 12:59:53 2018
ERROR: Unable to get logical block size for spfile '+DATAC1/AHEDWH/spfileAHEDWH.ora'.
Wed Jun 20 13:01:15 2018
Thread 1 advanced to log sequence 60257 (LGWR switch)
  Current log# 101 seq# 60257 mem# 0: +DATAC1/AHEDWH/ONLINELOG/group_101.2240.973682247
  Current log# 101 seq# 60257 mem# 1: +RECOC1/AHEDWH/ONLINELOG/group_101.8217.973682249
Wed Jun 20 13:05:03 2018
Thread 1 advanced to log sequence 60258 (LGWR switch)
  Current log# 102 seq# 60258 mem# 0: +DATAC1/AHEDWH/ONLINELOG/group_102.3461.973682335
  Current log# 102 seq# 60258 mem# 1: +RECOC1/AHEDWH/ONLINELOG/group_102.4274.973682337
Wed Jun 20 13:08:57 2018
Thread 1 advanced to log sequence 60259 (LGWR switch)
  Current log# 103 seq# 60259 mem# 0: +DATAC1/AHEDWH/ONLINELOG/group_103.3361.973682339
  Current log# 103 seq# 60259 mem# 1: +RECOC1/AHEDWH/ONLINELOG/group_103.5095.973682341
Wed Jun 20 13:12:45 2018
Thread 1 advanced to log sequence 60260 (LGWR switch)
  Current log# 104 seq# 60260 mem# 0: +DATAC1/AHEDWH/ONLINELOG/group_104.1897.973682343
  Current log# 104 seq# 60260 mem# 1: +RECOC1/AHEDWH/ONLINELOG/group_104.8399.973682345
Wed Jun 20 13:16:27 2018
Thread 1 advanced to log sequence 60261 (LGWR switch)
  Current log# 105 seq# 60261 mem# 0: +DATAC1/AHEDWH/ONLINELOG/group_105.1460.973682349
  Current log# 105 seq# 60261 mem# 1: +RECOC1/AHEDWH/ONLINELOG/group_105.23181.973682351
Wed Jun 20 13:20:09 2018
Thread 1 advanced to log sequence 60262 (LGWR switch)
  Current log# 106 seq# 60262 mem# 0: +DATAC1/AHEDWH/ONLINELOG/group_106.3367.973682353

----------

-- We checked the srvctl database parameters

[oracle@exatestdbadm01] /home/oracle > envo
ORACLE_SID=AHEDWH1
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/dbhome_1
[oracle@exatestdbadm01] /home/oracle > srvctl config database -d AHEDWH
Database unique name: AHEDWH
Database name: AHEDWH
Oracle home: /u01/app/oracle/product/12.1.0.2/dbhome_1
Oracle user: oracle
Spfile: +DATAC1/AHEDWH/PARAMETERFILE/spfile.2907.971266891
Password file: +DATAC1/AHEDWH/PASSWORD/pwdahedwh.2899.971266511
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: RECOC1,DATAC1
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: dba
OSOPER group: racoper
Database instances: AHEDWH1,AHEDWH2
Configured nodes: exatestdbadm01,exatestdbadm02
Database is administrator managed

--We checked the init.ora file contents

[oracle@exatestdbadm01] /home/oracle > cd $ORACLE_HOME/dbs
[oracle@exatestdbadm01] /u01/app/oracle/product/12.1.0.2/dbhome_1/dbs > more initAHEDWH1.ora
SPFILE='+DATAC1/AHEDWH/spfileAHEDWH.ora'

--We checked the spfile parameter value in the database

[oracle@exatestdbadm01] /u01/app/oracle/product/12.1.0.2/dbhome_1/dbs > sql

SQL*Plus: Release 12.1.0.2.0 Production on Wed Jun 20 13:45:35 2018

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options

SYS@AHEDWH1 > sho parameter spfile

NAME                                 TYPE
------------------------------------ -----------
VALUE
------------------------------------------------------------
spfile                               string
+DATAC1/AHEDWH/PARAMETERFILE/spfile.2907.971266891
SYS@AHEDWH1 >

-- Check if the spfle exists in the ASM or not

[root@exatestdbadm01] /root > su - grid
[grid@exatestdbadm01] /home/grid > asmcmd -p
ASMCMD [+] > ls -l +DATAC1/AHEDWH/PARAMETERFILE/spfile.2907.971266891
Type           Redund  Striped  Time             Sys  Name
PARAMETERFILE  MIRROR  COARSE   JUN 20 11:00:00  Y    spfile.2907.971266891
ASMCMD [+] > ls -l +DATAC1/AHEDWH/
Type  Redund  Striped  Time             Sys  Name
                                        Y    CONTROLFILE/
                                        Y    DATAFILE/
                                        Y    ONLINELOG/
                                        Y    PARAMETERFILE/
                                        Y    PASSWORD/
                                        Y    TEMPFILE/
ASMCMD [+] >

-- We saw that the alias for the spfile that normals stays under "+DATAC1/AHEDWH/" is not there

----------

Solution :

ASMCMD [+] > mkalias +DATAC1/AHEDWH/PARAMETERFILE/spfile.2907.971266891 +DATAC1/AHEDWH/spfileAHEDWH.ora
ASMCMD [+] > ls -l
State    Type    Rebal  Name
MOUNTED  NORMAL  N      DATAC1/
MOUNTED  NORMAL  N      DBFS_DG/
MOUNTED  NORMAL  N      FLASH1/
MOUNTED  NORMAL  N      RECOC1/
ASMCMD [+] > ls -l +DATAC1/AHEDWH/
Type           Redund  Striped  Time             Sys  Name
                                                 Y    CONTROLFILE/
                                                 Y    DATAFILE/
                                                 Y    ONLINELOG/
                                                 Y    PARAMETERFILE/
                                                 Y    PASSWORD/
                                                 Y    TEMPFILE/
PARAMETERFILE  MIRROR  COARSE   JUN 20 11:00:00  N    spfileAHEDWH.ora => +DATAC1/AHEDWH/PARAMETERFILE/spfile.2907.971266891
ASMCMD [+] >

-- We also need to set the correct spfile setting in srvctl

[oracle@exatestdbadm01] /home/oracle > srvctl config database -d AHEDWH
Database unique name: AHEDWH
Database name: AHEDWH
Oracle home: /u01/app/oracle/product/12.1.0.2/dbhome_1
Oracle user: oracle
Spfile: +DATAC1/AHEDWH/PARAMETERFILE/spfile.2907.971266891
Password file: +DATAC1/AHEDWH/PASSWORD/pwdahedwh.2899.971266511
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: RECOC1,DATAC1
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: dba
OSOPER group: racoper
Database instances: AHEDWH1,AHEDWH2
Configured nodes: exatestdbadm01,exatestdbadm02
Database is administrator managed
[oracle@exatestdbadm01] /home/oracle >

[oracle@exatestdbadm01] /home/oracle > srvctl modify database -d AHEDWH -spfile "+DATAC1/AHEDWH/spfileAHEDWH.ora"
[oracle@exatestdbadm01] /home/oracle > srvctl config database -d AHEDWH
Database unique name: AHEDWH
Database name: AHEDWH
Oracle home: /u01/app/oracle/product/12.1.0.2/dbhome_1
Oracle user: oracle
Spfile: +DATAC1/AHEDWH/spfileAHEDWH.ora
Password file: +DATAC1/AHEDWH/PASSWORD/pwdahedwh.2899.971266511
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: RECOC1,DATAC1
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: dba
OSOPER group: racoper
Database instances: AHEDWH1,AHEDWH2
Configured nodes: exatestdbadm01,exatestdbadm02
Database is administrator managed
[oracle@exatestdbadm01] /home/oracle >

-- Check that it is also updated in the secaond RAC node

[root@exatestdbadm02] /root > so
[oracle@exatestdbadm02] /home/oracle > . .profile_ahedwh
[oracle@exatestdbadm02] /home/oracle > srvctl config database -d AHEDWH
Database unique name: AHEDWH
Database name: AHEDWH
Oracle home: /u01/app/oracle/product/12.1.0.2/dbhome_1
Oracle user: oracle
Spfile: +DATAC1/AHEDWH/spfileAHEDWH.ora
Password file: +DATAC1/AHEDWH/PASSWORD/pwdahedwh.2899.971266511
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: RECOC1,DATAC1
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: dba
OSOPER group: racoper
Database instances: AHEDWH1,AHEDWH2
Configured nodes: exatestdbadm01,exatestdbadm02
Database is administrator managed
[oracle@exatestdbadm02] /home/oracle >



Tuesday, June 19, 2018

How to find last reboot time of an Oracle Linux server


-- This is how to find the last reboot time of an Oracle Linux server

[oracle@ahetools trace]$ last reboot|head -1
reboot   system boot  2.6.32-300.10.1. Fri Jul  1 09:08          (04:01)   
[oracle@ahetools trace]$

Monday, June 18, 2018

How to get the creation script of a table by using dbms_metadata


-- Below is how you can extract the creation script of a table by using dbms_metadata.
-- You can play with the "dbms_metadata.set_transform_param" commands to get the output style you want.


--------------
exec dbms_metadata.set_transform_param(dbms_metadata.session_transform, 'DEFAULT');
exec dbms_metadata.set_transform_param(dbms_metadata.session_transform, 'PRETTY', true);
exec dbms_metadata.set_transform_param(dbms_metadata.session_transform, 'STORAGE', true);
exec dbms_metadata.set_transform_param(dbms_metadata.session_transform, 'SEGMENT_ATTRIBUTES', true);
exec dbms_metadata.set_transform_param(dbms_metadata.session_transform, 'TABLESPACE', true);
exec dbms_metadata.set_transform_param(dbms_metadata.session_transform, 'SQLTERMINATOR', true);
exec dbms_metadata.set_transform_param(dbms_metadata.session_transform, 'CONSTRAINTS_AS_ALTER', true);
exec dbms_metadata.set_transform_param(dbms_metadata.session_transform, 'REF_CONSTRAINTS', true);

-- Below command returns the creation script of the table together with constraints of the related table

select
  dbms_metadata.get_ddl(object_type => 'TABLE', name => t1.table_name, schema => t1.owner)
  from dba_tables t1
 where t1.owner||'.'||t1.table_name = 'USER_01.TABLE_01'
order by t1.owner, t1.table_name; 

-- Below command returns the creation script of the comments on table, if exists

select
  dbms_metadata.get_dependent_ddl(object_type => 'COMMENT', base_object_name => t1.table_name, base_object_schema => t1.owner)
  from dba_tables t1
 where t1.owner||'.'||t1.table_name = 'USER_01.TABLE_01'
   and exists (select 1
                 from dba_tab_comments
                where owner = t1.owner
                  and table_name = t1.table_name) 
order by t1.owner, t1.table_name;
-- Below command returns the creation script of the indexes on table
             
select
  dbms_metadata.get_ddl(object_type => 'INDEX', name => t1.index_name, schema => t1.owner)
  from dba_indexes t1
 where t1.table_owner||'.'||t1.table_name = 'USER_01.TABLE_01'
order by t1.table_owner, t1.table_name, t1.index_name; 

-- Below command returns the creation script of the triggers on table, if exists

select 
  dbms_metadata.get_dependent_ddl('TRIGGER', t1.table_name, t1.owner)
  from dba_tables t1
 where t1.owner||'.'||t1.table_name = 'USER_01.TABLE_01'
   and exists (select 1
                 from dba_triggers
                where table_owner = t1.owner
                  and table_name = t1.table_name)
order by t1.owner, t1.table_name;

-- Below command returns the creation script of the synonyms for the table

select
  dbms_metadata.get_ddl(object_type => 'SYNONYM', name => t1.synonym_name, schema => t1.owner)
  from dba_synonyms t1
 where t1.table_owner||'.'||t1.table_name = 'USER_01.TABLE_01'
order by t1.table_owner, t1.table_name, t1.owner, t1.synonym_name;

-- Below command returns the creation script of the grants given for the table

select
  dbms_metadata.get_dependent_ddl(object_type => 'OBJECT_GRANT', base_object_name => t1.table_name, base_object_schema => t1.owner)
  from dba_tables t1
 where t1.owner||'.'||t1.table_name = 'USER_01.TABLE_01'
order by t1.owner, t1.table_name;

--------------

-- If you need to get only the Referential Integrity constraints of a table, then you can only use the below command

select 
  dbms_metadata.get_dependent_ddl('REF_CONSTRAINT', t1.table_name, t1.owner)
  from dba_tables t1
 where t1.owner||'.'||t1.table_name = 'USER_01.TABLE_01'
   and exists (select 1
                 from dba_constraints
                where owner = t1.owner
                  and table_name = t1.table_name
                  and constraint_type = 'R')
order by t1.owner, t1.table_name;

Tuesday, June 12, 2018

List Oracle RAC Scan Listener configuration info


-- To list Oracle RAC Scan Listener configuration info you can use the below command, first you need to switch to user who is the owner of the Grid Infrastructure (GI) on the server which is the OS user "grid" in this example

[root@exatestdbadm01] /root > su - grid
[grid@exatestdbadm01] /home/grid > srvctl config scan
SCAN name: exatest-scan, Network: 1
Subnet IPv4: 10.10.38.0/255.255.255.0/bondeth0, static
Subnet IPv6:
SCAN 1 IPv4 VIP: 10.10.38.23
SCAN VIP is enabled.
SCAN VIP is individually enabled on nodes:
SCAN VIP is individually disabled on nodes:
SCAN 2 IPv4 VIP: 10.10.38.22
SCAN VIP is enabled.
SCAN VIP is individually enabled on nodes:
SCAN VIP is individually disabled on nodes:
SCAN 3 IPv4 VIP: 10.10.38.24
SCAN VIP is enabled.
SCAN VIP is individually enabled on nodes:
SCAN VIP is individually disabled on nodes:
[grid@exatestdbadm01] /home/grid >

-- The IP adresses above are the Scan IPs that the Scan listener is listening for

Monday, June 11, 2018

ORA-28112: failed to execute policy function


-- After we moved the Oracle EM 13c repository database from 12.1 to 12.2 on another server by using impdp we started to get the below error in new database alert log file.

-- We exported all the schemas like SYSMAN% and MGMT_VIEW schema from old repository database which is v12.1 and imported them to the new repository database which is v12.2

2018-06-10T23:23:44.942757+03:00
Errors in file /u01/app/oracle/diag/rdbms/em13dbk/EM13DBK/trace/EM13DBK_j006_28436.trc:
ORA-12012: error on auto execute of job "SYSMAN"."EM_REPOS_SEV_EVAL"."C_1_1"
ORA-28112: failed to execute policy function
ORA-06512: at "SYSMAN.EM_SEVERITY_REPOS", line 1843
ORA-28112: failed to execute policy function
ORA-06512: at "SYSMAN.EM_SEVERITY_REPOS", line 3134
ORA-06512: at "SYSMAN.EM_SEVERITY_REPOS", line 1828
ORA-06512: at line 1

-- Also when we try to run a select with SYSMAN user

--sysman@em13dbk

    SELECT COUNT(*)
--    INTO   tnum
    FROM   sysman.em_manageable_entities
    WHERE  manage_status = 2
    ;
/*
ORA-28112: failed to execute policy function
*/ 

Solution :

--sys@em13dbk
grant exempt access policy to sysman;

--sysman@em13dbk
    SELECT COUNT(*)
--    INTO   tnum
    FROM   sysman.em_manageable_entities
    WHERE  manage_status = 2
    ;
--OK no error

Friday, June 8, 2018

How to connect to a hung Oracle database

-- If you can not anyway connect to an Oracle database instance that seems to be hung, try to ssh to the server and use the below commands to connect

sqlplus /nolog

set _prelim on

conn / as sysdba

How to restart Oracle ZDLRA services


-- Oracle ZDLRA (Zero Data Loss Recovery Appliance) : Oracle Engineerd system developed for Oracle database backup and recovery purposes

--Stop ZDLRA

[oracle@zdlradbadm01 trace]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Mon Nov 13 14:40:53 2017

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters and Automatic Storage Management options

SQL> connect rasys
Enter password:
Connected.
SQL> SELECT state FROM ra_server;

STATE
----------
ON

SQL> exec dbms_ra.shutdown;

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters and Automatic Storage Management options
[oracle@zdlradbadm01 trace]$ exit
logout
[root@zdlradbadm01 ~]# cd /u01/app/
[root@zdlradbadm01 app]# ls -l
total 16
drwxr-xr-x  3 root   oinstall 4096 Jul 11 17:21 12.1.0.2
drwxr-xr-x  2 oracle oinstall 4096 Jul 12 17:09 emagent
drwxr-xr-x 13 oracle oinstall 4096 Jul 14 14:41 oracle
drwxrwx---  6 oracle oinstall 4096 Jul 14 16:00 oraInventory
[root@zdlradbadm01 app]# cd 12.1.0.2
[root@zdlradbadm01 12.1.0.2]# ls
grid
[root@zdlradbadm01 12.1.0.2]# cd grid
[root@zdlradbadm01 grid]# cd bin
[root@zdlradbadm01 bin]# ./crsctl status res osbadmin
NAME=osbadmin
TYPE=cluster_resource
TARGET=ONLINE
STATE=ONLINE on zdlradbadm01

[root@zdlradbadm01 bin]# ./crsctl stop res osbadmin
CRS-2673: Attempting to stop 'osbadmin' on 'zdlradbadm01'
CRS-2677: Stop of 'osbadmin' on 'zdlradbadm01' succeeded
[root@zdlradbadm01 bin]# ./crsctl status res ob_dbfs rep_dbfs
NAME=ob_dbfs
TYPE=local_resource
TARGET=ONLINE                , ONLINE
STATE=ONLINE on zdlradbadm01, ONLINE on zdlradbadm02

NAME=rep_dbfs
TYPE=local_resource
TARGET=ONLINE                , ONLINE
STATE=ONLINE on zdlradbadm01, ONLINE on zdlradbadm02

[root@zdlradbadm01 bin]# su - oracle
[oracle@zdlradbadm01 ~]$ srvctl stop database -d zdlra -o abort
PRCR-1133 : Failed to stop database zdlra and its running services
PRCR-1132 : Failed to stop resources using a filter
CRS-2529: Unable to act on 'ora.zdlra.db' because that would require stopping or relocating 'ob_dbfs', but the force option was not specified
CRS-2529: Unable to act on 'ora.zdlra.db' because that would require stopping or relocating 'ob_dbfs', but the force option was not specified
[oracle@zdlradbadm01 ~]$ /u01/app/12.1.0.2/grid/bin/crsctl stop res ob_dbfs rep_dbfs
CRS-2673: Attempting to stop 'rep_dbfs' on 'zdlradbadm01'
CRS-2673: Attempting to stop 'ob_dbfs' on 'zdlradbadm01'
CRS-2673: Attempting to stop 'rep_dbfs' on 'zdlradbadm02'
CRS-2673: Attempting to stop 'ob_dbfs' on 'zdlradbadm02'
CRS-2677: Stop of 'rep_dbfs' on 'zdlradbadm01' succeeded
CRS-2677: Stop of 'ob_dbfs' on 'zdlradbadm01' succeeded
CRS-2677: Stop of 'rep_dbfs' on 'zdlradbadm02' succeeded
CRS-2677: Stop of 'ob_dbfs' on 'zdlradbadm02' succeeded
[oracle@zdlradbadm01 ~]$ srvctl stop database -d zdlra -o abort
[oracle@zdlradbadm01 ~]$ /u01/app/12.1.0.2/grid/bin/crsctl status res ob_dbfs rep_dbfs
NAME=ob_dbfs
TYPE=local_resource
TARGET=OFFLINE, OFFLINE
STATE=OFFLINE, OFFLINE

NAME=rep_dbfs
TYPE=local_resource
TARGET=OFFLINE, OFFLINE
STATE=OFFLINE, OFFLINE

[oracle@zdlradbadm01 ~]$ srvctl status database -d zdlra
Instance zdlra1 is not running on node zdlradbadm01
Instance zdlra2 is not running on node zdlradbadm02
[oracle@zdlradbadm01 ~]$ exit
logout
[root@zdlradbadm01 bin]# /u01/app/12.1.0.2/grid/bin/crsctl status server
NAME=zdlradbadm01
STATE=ONLINE

NAME=zdlradbadm02
STATE=ONLINE

-----------------------

--Start ZDLRA

[root@zdlradbadm01 bin]# su - oracle
[oracle@zdlradbadm01 ~]$ srvctl start database -d zdlra
[oracle@zdlradbadm01 ~]$ srvctl status database -d zdlra
Instance zdlra1 is running on node zdlradbadm01
Instance zdlra2 is running on node zdlradbadm02
[oracle@zdlradbadm01 ~]$ /u01/app/12.1.0.2/grid/bin/crsctl status res ob_dbfs rep_dbfs
NAME=ob_dbfs
TYPE=local_resource
TARGET=OFFLINE, OFFLINE
STATE=OFFLINE, OFFLINE

NAME=rep_dbfs
TYPE=local_resource
TARGET=OFFLINE, OFFLINE
STATE=OFFLINE, OFFLINE

[oracle@zdlradbadm01 ~]$ /u01/app/12.1.0.2/grid/bin/crsctl start res ob_dbfs rep_dbfs
CRS-2672: Attempting to start 'rep_dbfs' on 'zdlradbadm01'
CRS-2672: Attempting to start 'rep_dbfs' on 'zdlradbadm02'
CRS-2672: Attempting to start 'ob_dbfs' on 'zdlradbadm01'
CRS-2672: Attempting to start 'ob_dbfs' on 'zdlradbadm02'
CRS-2676: Start of 'ob_dbfs' on 'zdlradbadm01' succeeded
CRS-2676: Start of 'ob_dbfs' on 'zdlradbadm02' succeeded
CRS-2676: Start of 'rep_dbfs' on 'zdlradbadm01' succeeded
CRS-2676: Start of 'rep_dbfs' on 'zdlradbadm02' succeeded
[oracle@zdlradbadm01 ~]$ /u01/app/12.1.0.2/grid/bin/crsctl status res ob_dbfs rep_dbfs
NAME=ob_dbfs
TYPE=local_resource
TARGET=ONLINE                , ONLINE
STATE=ONLINE on zdlradbadm01, ONLINE on zdlradbadm02

NAME=rep_dbfs
TYPE=local_resource
TARGET=ONLINE                , ONLINE
STATE=ONLINE on zdlradbadm01, ONLINE on zdlradbadm02

[oracle@zdlradbadm01 ~]$ sqlplus rasys

SQL*Plus: Release 12.1.0.2.0 Production on Mon Nov 13 15:19:50 2017

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

Enter password:
Last Successful login time: Mon Nov 13 2017 15:19:02 +03:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters and Automatic Storage Management options

SQL> SELECT state FROM ra_server;

STATE
----------
TIMER_WAIT

SQL>

SQL> exec dbms_ra.startup;

PL/SQL procedure successfully completed.

SQL>

SQL> SELECT state FROM ra_server;

STATE
----------
ON

SQL>


---------------------