How to Find Out Oracle Clusterware Cluster Name ?

For 12c GI, cluster name is SCAN name by default with “Typical Install”, cluster name can only be customized in “Advanced installation”.

The cluster name is case-insensitive, must be unique across your enterprise, must be at least one character long and no more than 15 characters in length, must be alphanumeric, cannot begin with a numeral, and may contain hyphens (-). Underscore characters (_) are not allowed.

For 12c,  the SCAN is the name of the cluster , If you configure a Standard cluster, and choose a Typical install.

In an Advanced installation, The SCAN and cluster name are entered in separate fields during installation. So you can choose and give cluster name only in “Advanced installation”.

Select cluster name carefully. After installation, you can only change the cluster name by reinstalling Oracle Grid Infrastructure.

Here are a couple of ways to find Oracle Clusterware cluster name:

a) Run “cemutlo” command under GI_HOME/bin.

$cd /u01/app/12.1.0.2/grid/bin
$./cemutlo -n
RACTEST-CLUSTER

b) It is under from $GI_HOME/cdata.

$ cd /u01/app/12.1.0.2/grid/cdata
$ls -l
total 1280
drwxrwxr-x 2 grid oinstall 4096 Sep 19 08:23 RACTEST-CLUSTER
drwxr-xr-x 2 grid oinstall 4096 Sep 18 12:36 racnode1
-rw------- 1 root oinstall 503484416 Sep 19 08:28 racnode1.olr
drwxr-xr-x 2 grid oinstall 4096 Sep 18 12:24 localhost

c) From crsconfig_params or cluster.ini file.

$cd /u01/app/12.1.0.2/grid/crs/install/
$ grep -i cluster_name crsconfig_params
CLUSTER_NAME=RACTEST-CLUSTER

$cd /u01/app/12.1.0.2/grid/install
$cat cluster.ini
[cluster_info]
cluster_name=RACTEST-CLUSTER

d) From OEM:

cluster_name

e) Run “olsnodes” command under GI_HOME/bin.

$cd /u01/app/12.2.0.1/grid/bin 
$./olsnodes -c
RACTEST-CLUSTER

PRVE-10077 : NOZEROCONF parameter was not specified or was not set to ‘yes’ in file “/etc/sysconfig/network”

For any GI/RAC deployment, It is a good practice to have cluster pre-installation checks by running cluvfy or runcluvfy.sh.

When doing cluster pre-installation health checks, got  the following error messages :

grid@racnode1:/u01/app/software/CVU/bin$ ./cluvfy stage -pre crsinst -n racnode1,racnode2 -verbose
Performing pre-checks for cluster services setup
Checking node reachability...
Node reachability check passed from node "racnode1"
Checking user equivalence...
User equivalence check passed for user "grid"
Checking node connectivity...
Checking hosts config file...
Verification of the hosts config file successful
....
...
..
Starting check for zeroconf check ...

ERROR:
PRVE-10077 : NOZEROCONF parameter was not specified or was not set to 'yes' in file "/etc/sysconfig/network" on node "racnode2"
PRVE-10077 : NOZEROCONF parameter was not specified or was not set to 'yes' in file "/etc/sysconfig/network" on node "racnode1"
Check for zeroconf check failed
Pre-check for cluster services setup was unsuccessful on all the nodes.

After adding “NOZEROCONF=yes” into  “/etc/sysconfig/network” on both servers, then rerun it again successfully without errors any more.

grid@racnode1:/u01/app/software/grid$ ./runcluvfy.sh stage -pre crsinst -n racnode1,racnode2 -verbose
Performing pre-checks for cluster services setup
Checking node reachability...
Node reachability check passed from node "racnode1"
Checking user equivalence...
User equivalence check passed for user "grid"
....
...
..
Starting check for /boot mount ...
Check for /boot mount passed
Starting check for zeroconf check ...
Check for zeroconf check passed
Pre-check for cluster services setup was successful.

The pre-check tool can be obtained from either GI binary media, that is called “runcluvfy.sh “, or from downloading “cvupack_Linux_x86_64.zip”, the name is “cluvfy”.

So the command will be either :

$runcluvfy.sh stage  -pre crsinst -n racnode1,racnode2 -verbose

$cluvfy stage  -pre crsinst -n racnode1,racnode2 -verbose

How to Tell If Oracle Database is Standard Edition or Enterprise Edition

Standard Edition and Enterprise Edition License.

Standard Edition

$ sqlplus / as sysdba 

SQL*Plus: Release 11.2.0.4.0 Production on Fri Mar 4 14:13:15 2016

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

Connected to:
Oracle Database 11g Release 11.2.0.4.0 - 64bit Production

OR

SQL> select * from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE 11.2.0.4.0 Production
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production

Enterprise Edition

$sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Thu Mar 3 20:16:33 2016

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

OR

SQL> select * from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production

Restore JAVA Virtual Machine and Oracle Multimedia

SYMPTOM

When installing 12.1.0.2 Oracle options from DBCA, there are memory issues during install JVM and Oracle multimedia, so the installation failed by leaving those two options with status ‘LOADING’, those two unhealthy options could not be removed cleanly by DBCA, so manual removing and reinstalling are required for fixing it.

SQL> select COMP_NAME,VERSION,STATUS,SCHEMA 
from dba_registry
order by 3;

COMP_ID COMP_NAME VERSION STATUS SCHEMA ------- ------------------------ ------------ -------- ------ JServer JAVA Virtual Machine LOADING SYS Oracle Multimedia LOADING ORDSYS Oracle Database Catalog Views 12.1.0.2.0 VALID SYS Oracle Database Packages and Types 12.1.0.2.0 VALID SYS Oracle Workspace Manager 12.1.0.2.0 VALID WMSYS Oracle Text 12.1.0.2.0 VALID CTXSYS Oracle XML Database 12.1.0.2.0 VALID XDB
7 rows selected.

Please note your issue and situation might be different. Please raise a SR to Oracle Support to get advice for critical environment, otherwise it may cause issue worse and results in database unrecoverable which will need full database restore and recover, because manually removing and installing JVM and Multimedia is a  highly destructive action according to Oracle Support.

Remove and Reinstall Oracle JVM

  • Cold backup of whole database.
  • Removing Oracle unhealthy JVM :
Shutdown the database instance
Create the following REMOVAL script, full_rmjvm.sql
Run it from a new SQL*Plus session

spool full_rmjvm.log
set echo on
connect / as sysdba
startup mount
alter system set "_system_trig_enabled" = false scope=memory;
alter system enable restricted session;
alter database open;
@?/rdbms/admin/catnojav.sql
@?/xdk/admin/rmxml.sql
@?/javavm/install/rmjvm.sql
truncate table java$jvm$status;
select * from obj$ where obj#=0 and type#=0;
delete from obj$ where obj#=0 and type#=0;
commit;
select owner, count(*) from all_objects
where object_type like '%JAVA%' group by owner;
select obj#, name from obj$
where type#=28 or type#=29 or type#=30 or namespace=32;
select o1.name from obj$ o1,obj$ o2
where o1.type#=5 and o1.owner#=1 and o1.name=o2.name and o2.type#=29;
shutdown immediate
set echo off
spool off
exit
-- End of File full_rmjvm.sql
  • Check the log full_rmjvm.log, we can see JVM was not installed at all, in this case, we just reload it in next step.
SQL> Rem =====================================================================
SQL> Rem Check CATJAVA and JAVAVM status; conditionally abort the script
SQL> Rem =====================================================================
SQL> 
SQL> WHENEVER SQLERROR EXIT;
SQL> 
SQL> BEGIN
 2 IF dbms_registry.status('CATJAVA') IS NULL THEN
 3 RAISE_APPLICATION_ERROR(-20000,
 4 'CATJAVA has not been loaded into the database.');
 5 END IF;
 6 IF dbms_registry.is_loaded('JAVAVM') != 1 THEN
 7 RAISE_APPLICATION_ERROR(-20000,
 8 'JServer is not operational in the database; ' ||
 9 'JServer is required to remove CATJAVA from the database.');
 10 END IF;
 11 END;
 12 /
BEGIN
*
ERROR at line 1:
ORA-20000: CATJAVA has not been loaded into the database. 
ORA-06512: at line 3
  • Install the JVM
    Be sure the REMOVAL script, full_rmjvm.sql, completed successfully
    Create the following INSTALL script, full_jvminst.sql
    Run it from a new SQL*Plus session
    
    -- Start of File full_jvminst.sql
    spool full_jvminst.log;
    set echo on
    connect / as sysdba
    startup mount
    alter system set "_system_trig_enabled" = false scope=memory;
    alter database open;
    select obj#, name from obj$
    where type#=28 or type#=29 or type#=30 or namespace=32;
    @?/javavm/install/initjvm.sql
    select count(*), object_type from all_objects
    where object_type like '%JAVA%' group by object_type;
    @?/xdk/admin/initxml.sql
    select count(*), object_type from all_objects
    where object_type like '%JAVA%' group by object_type;
    @?/xdk/admin/xmlja.sql
    select count(*), object_type from all_objects
    where object_type like '%JAVA%' group by object_type;
    @?/rdbms/admin/catjava.sql
    select count(*), object_type from all_objects
    where object_type like '%JAVA%' group by object_type;
    shutdown immediate
    set echo off
    spool off
    exit
    -- End of File full_jvminst.sql
  • Check log and found no errors.
$ls -ltr full*jvm*
-rw-r--r--. 1 oracle oinstall 784 Nov 15 21:51 full_rmjvm.sql
-rw-r--r--. 1 oracle oinstall 2948 Nov 15 21:52 full_rmjvm.log
-rw-r--r--. 1 oracle oinstall 855 Nov 15 21:58 full_jvminstall.sql
-rw-r--r--. 1 oracle oinstall 9885882 Nov15 22:06 full_jvminst.log

$grep ORA- full_jvminst.log
129 dbms_output.put_line('retrying because of ORA-01545');
SQL> ## ORA-00028 it means that the database has not been restarted
SQL> ## ORA-29539: Java system classes already installed
SQL> ## ORA-29554: unhandled Java out of memory condition
 17 -- If the class does not exist an ORA-29532 (Uncaught Java
 27 -- If the class does not exist, an ORA-29532 (Uncaught Java
 43 -- If the class does not exist an ORA-29532 (Uncaught Java
 59 -- If the class does not exist an ORA-29532 (Uncaught Java
543 -- If the java schema object does not exist an ORA-29532 (Uncaught Java
 32 -- exist, an ORA-29532 (Uncaught Java exception) will occur.
 42 -- exist, an ORA-29532 (Uncaught Java exception) will occur.
 58 -- exist an ORA-29532 (Uncaught Java exception) will occur.
 74 -- exist an ORA-29532 (Uncaught Java exception) will occur.
SQL> -- in the current session it will cause an ORA-29549 (session state cleared)
SQL> ## ORA-01476: divisor is equal to zero
SQL>
  • Validate the Installation
SQL> column owner format A30
-- Validation Query 1
select count(*), object_type
from all_objects
where object_type like '%JAVA%'
and owner = 'SYS'
group by object_type;

COUNT(*) OBJECT_TYPE ---------- --------------- 297 JAVA DATA 911 JAVA RESOURCE 27473 JAVA CLASS 2 JAVA SOURCE
SQL> select owner, count(*)
from all_objects 
where object_type like '%JAVA%'
and owner = 'SYS'group by owner;

OWNER   COUNT(*)
------  ---------
SYS     28683

SQL> select owner, object_type, count(*)
from all_objects 
where object_type like '%JAVA%'
and status <> 'VALID'
and owner = 'SYS'
group by owner, object_type;

no rows selected
SQL>select comp_id,COMP_NAME,VERSION,STATUS,SCHEMA 
from dba_registry
order by 3;
COMP_ID COMP_NAME VERSION STATUS SCHEMA
------- ---------------------------------- ---------- ------ ------ CATALOG Oracle Database Catalog Views 12.1.0.2.0 VALID SYS CONTEXT Oracle Text 12.1.0.2.0 VALID CTXSYS OWM Oracle Workspace Manager 12.1.0.2.0 VALID WMSYS XDB Oracle XML Database 12.1.0.2.0 VALID XDB CATJAVA Oracle Database Java Packages 12.1.0.2.0 VALID SYS CATPROC Oracle Database Packages and Types 12.1.0.2.0 VALID SYS JAVAVM JServer JAVA Virtual Machine 12.1.0.2.0 VALID SYS XML Oracle XDK 12.1.0.2.0 VALID SYS ORDIM Oracle Multimedia LOADING ORDSYS 9 rows selected.
  • ADDITIONAL REMINDER: If you previously had any of the following database options installed:
    • Oracle Multimedia (ORDSYS, ORDIM)
    • Oracle Spatial (MDSYS)
    • Oracle Warehouse Builder (OWBSYS)
    • OLAP

    These options will need to be re-installed to reload their java dependencies.  This can be achieved by contacting the respective support teams for each product by logging a new Service Request.

Reinstall Oracle Multimedia

Install Oracle Mutlmedia according  to “Multimedia User’s Guide” section B Managing Oracle Multimedia Installations

  1. Check the prerequisites are existed including PL/SQL, Oracle JVM, Oracle XML Database, and Oracle XDK.
    SQL> select version,status 
    from dba_registry
    where comp_id='JAVAVM'; SQL> select version, status from dba_registry where comp_id='XDB'; SQL> select version, status from dba_registry where comp_id='XML';
  2. Go to /rdbms/admin directory and run catcon.pl  script to create the users and grant the appropriate privileges. The first parameter is the tablespace for Oracle Multimedia; the second parameter is the tablespace for Oracle Spatial and Graph.

    $ perl catcon.pl -u SYS -d $ORACLE_HOME/ord/admin -b ordinst ordinst.sql '--pSYSAUX' '--pSYSAUX' 
    catcon: ALL catcon-related output will be written to ordinst_catcon_14555.lst
    catcon: See ordinst*.log files for output generated by scripts
    catcon: See ordinst_*.lst files for spool files, if any
    Enter Password: 
    catcon.pl: completed successfully
  3. Run the script to install the Oracle Multimedia types and packages.
    $ perl catcon.pl -u SYS -d $ORACLE_HOME/ord/im/admin -b catim catim.sql
    catcon: ALL catcon-related output will be written to catim_catcon_14649.lst
    catcon: See catim*.log files for output generated by scripts
    catcon: See catim_*.lst files for spool files, if any
    Enter Password: 
    catcon.pl: completed successfully
  4. Verify the installation of Oracle Multimedia.
SQL> CONNECT sys as sysdba
SQL> execute sys.validate_ordim;
PL/SQL procedure successfully completed.

If the validation procedure detects invalid objects, it lists the first few invalid objects and sets the registry entry to INVALID; otherwise, it silently sets the Oracle Multimedia registry entry  VALID.

SQL> select version, status 
from dba_registry
where comp_id='ORDIM';
VERSION STATUS ------------ ------- 12.1.0.2.0 VALID
  • Check options validations.
SQL>select comp_id,COMP_NAME,VERSION,STATUS,SCHEMA 
from dba_registry
order by 4;
COMP_ID COMP_NAME VERSION STATUS SCHEMA --------- --------------------- ------------ ---------- ------ ------ ORDIM Oracle Multimedia 12.1.0.2.0 VALID ORDSYS CONTEXT Oracle Text 12.1.0.2.0 VALID CTXSYS OWM Oracle Workspace Manager 12.1.0.2.0 VALID WMSYS XDB Oracle XML Database 12.1.0.2.0 VALID XDB CATJAVA Oracle Database Java Packages 12.1.0.2.0 VALID SYS CATPROC Oracle Database Packages and Types 12.1.0.2.0 VALID SYS JAVAVM JServer JAVA Virtual Machine 12.1.0.2.0 VALID SYS XML Oracle XDK 12.1.0.2.0 VALID SYS CATALOG Oracle Database Catalog Views 12.1.0.2.0 VALID SYS 9 rows selected. SQL> select count(*) from dba_objects where status!='VALID'; COUNT(*) ---------- 0

How to Install Example Schemas in 12c Database

Situation

When trying to access sample schema tables, just realized the sample schemas are not installed.

SQL> desc hr.employees; ERROR: ORA-04043: object hr.employees does not exist

There are a couple of ways to install sample schemas in 12c database like using DBCA, here we choose to install sample schemas manually.

  • Download “linuxamd64_12102_examples.zip” from Oracle website
Capture

Run  runInstaller to install example schemas into target ORACLE_HOME

Capture1
Capture2
Capture3
Capture4
Capture5

Run SQL to create sample schemas

SQL> @?/demo/schema/mksample manager change_on_install hr oe pm ix sh bi EXAMPLE TEMP /u01/app/oracle/product/12.1.0/dbhome_1/demo/schema/log/

SQL>@?/demo/schema/mksample systempwd syspwd hrpwd oepwd pmpwd ixpwd shpwd bipwd default_tablespace temp_tablespace log_file_directory The mksample script expects 11 parameters. Provide the password for SYSTEM and SYS, and for schemas HR, OE, PM, IX, and SH. Specify a temporary and a default tablespace, and make sure to end the name of the log file directory with a trailing slash. The mksample script produces several log files:

  • mkverify.log is the Sample Schema creation log file.
  • hr_main.log is the HR schema creation log file.
  • oe_oc_main.log is the OE schema creation log file.
  • pm_main.log is the PM schema creation log file.
  • pm_p_lob.log is the SQL*Loader log file for PM.PRINT_MEDIA.
  • ix_main.log is the IX schema creation log file.
  • sh_main.log is the SH schema creation log file.
  • cust.log is the SQL*Loader log file for SH.CUSTOMERS.
  • prod.log is the SQL*Loader log file for SH.PRODUCTS.
  • promo.log is the SQL*Loader log file for SH.PROMOTIONS.
  • sales.log is the SQL*Loader log file for SH.SALES.
  • sales_ext.log is the external table log file for SH.COSTS.

Uninstall Sample Schemas

If you need to remove the sample schemas from the installation, run script drop_sch.sql .

@?/demo/schema/drop_sch.sql systempwd spool_file_name

Script drop_sch.sql uses two parameters: systempwd is the password for SYSTEM user, and spool_file_name is the name of the spool file that captures the log of the operation.