A Oracle DBA's BLOG

Welcome to my ORACLE DBA blog. You will be Amazing!!!

Tuesday, July 19, 2016

Cleaning up huge file crfclust.bdb

Grid Infrastructure Disk Space Problem 

In 11.2.0.4 i have come across a bug(20186278) that Cluster Health Monitor files created in GRID_HOME.

This file has a default size of 1 GB.But I saw crfclust.bdb file that sized 48 GB.

For an immediate workaround we have to clean up that file

Cleaning Up crfclust.bdb in 11.2.0.4 Grid home


 Stop the Cluster Health Monitor resource ora.crf as grid owner

[oracle@migrator ~]$/u01/app/grid/11.2.0.4/bin/crsctl stop res ora.crf -init
CRS-2673: Attempting to stop 'ora.crf' on 'migrator'
CRS-2677: Stop of 'ora.crf' on 'migrator' succeeded

Remove the huge CHM files

[oracle@migrator ~]$cd / u01/app/grid/11.2.0.4/crf/db/db1

[oracle@migrator ~]$rm *.bdb

NOTE:Deleting bdb files does not have other impact. But By manually removing the files,Youwill lose historical performance data.

[root@migrator ~]$/u01/app/grid/11.2.0.4/bin/crsctl start res ora.crf -init
CRS-2672: Attempting to start 'ora.crf' on 'migrator'
CRS-2676: Start of 'ora.crf' on ' migrator ' succeeded

Do it in the both node!

Wednesday, September 9, 2015

11gR2 Grid infrastructure fail due installation. CRS-4124: Oracle High Availability Services startup failed.

While I'm installing 11gR2 Grid for a standalone server I got some errors.And I find out the solution.
Errors:
CRS-4124: Oracle High Availability Services startup failed.
CRS-4000: Command Start failed, or completed with errors.
So, I try to start manually and the same errors.
# crsctl start has
CRS-4124: Oracle High Availability Services startup failed.
CRS-4000: Command Start failed, or completed with errors.
Cause
The root cause is because the Oracle Grid infrastructure 11.2.0.1 does not support REL 6,
Solution:
1.If you previously ran root.sh (not successfully), simply roll it back:
$GRID_HOME/crs/install/roothas.pl -deconfig -force -verbose
2.edit $GRID_HOME/crs/install/s_crsconfig_lib.pm ( add the following command before # Start OHASD )
my $UPSTART_OHASD_SERVICE = "oracle-ohasd";
my $INITCTL = "/sbin/initctl";
($status, @output) = system_cmd_capture ("$INITCTL start $UPSTART_OHASD_SERVICE");
if (0 != $status)
{
error ("Failed to start $UPSTART_OHASD_SERVICE, error: $!");
return $FAILED;
}
3. Create a file /etc/init/oracle-ohasd.conf
# Oracle OHASD startup
start on runlevel [35]
stop on runlevel [!35]
respawn
exec /etc/init.d/init.ohasd run >/dev/null 2>&1
4.run the root.sh again then finish installation.
Hope its helps.

Sunday, August 9, 2015

Multitenant:Open and close Container(CDB) and Pluggable Databases(PDB)

The following describes in a multitenant container database(CDB) open  pluggable database (PDB) as read write mode and trun off the read only mode.

ALTER PLUGGABLE DATABASE

The ALTER PLUGGABLE DATABASE command can be used from the CDB or the PDB.

ALTER PLUGGABLE DATABASE <pdd-name-clause>  OPEN READ WRITE [RESTRICTED] [FORCE];

ALTER PLUGGABLE DATABASE <pdd-name-clause>  OPEN READ ONLY [RESTRICTED] [FORCE];

ALTER PLUGGABLE DATABASE <pdd-name-clause>  OPEN UPGRADE [RESTRICTED];

ALTER PLUGGABLE DATABASE <pdd-name-clause>  CLOSE [IMMEDIATE];

[oracle@migrator admin]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Thu Aug 6 14:12:58 2015

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, OLAP, Advanced Analytics and Real Application Testing options

SQL> select con_id,dbid,NAME,OPEN_MODE from v$pdbs;

    CON_ID       DBID NAME                           OPEN_MODE

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

         2 4129503604 PDB$SEED                       READ ONLY

SQL> SELECT pdb_name, status FROM   dba_pdbs ORDER BY pdb_name;

PDB_NAME                       STATUS

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

PDB$SEED                      NORMAL

SQL> alter pluggable database pdb$seed open read write;

alter pluggable database pdb$seed open read write

                         *

ERROR at line 1:

ORA-65017: seed pluggable database may not be dropped or altered

SQL> select cdb from v$database;

CDB

---

YES

SQL> alter session set "_oracle_script"=TRUE;

Session altered.

SQL> alter pluggable database pdb$seed close immediate instances=all;

Pluggable database altered.


SQL>  select open_mode from v$database;

OPEN_MODE
--------------------
MOUNTED
SQL> alter pluggable database pdb$seed OPEN READ WRITE;

Pluggable database altered.

SQL> show con_name;

CON_NAME
------------------------------
PDB$SEED


SQL> select open_mode from v$database;

OPEN_MODE
--------------------
READ WRITE


 SQL> alter pluggable database pdb$seed close immediate instances=all;

Pluggable database altered.


SQL> alter pluggable database pdb$seed OPEN READ ONLY;
Pluggable database altered.

SQL> show con_name;

CON_NAME
------------------------------
PDB$SEED


SQL> select open_mode from v$database;

OPEN_MODE
--------------------
READ ONLY

SQL> alter session set "_oracle_script"=FALSE;
Session altered.

That’s all, Hope this helps.

Sunday, July 5, 2015

Database Upgrade from 11.2.0.4 to 12.1.0.1 using DBUA

Database Upgrade from 11.2.0.4 to 12.1.0.1 using DBUA



I recently try to test upgrade an Oracle 11.2.0.4 to Oracle 12.1.0.1 and It was successful. So, I would like to present this post to be useful.
In oracle 12c the utlu121s.sql script has been replaced with the preupgrd.sql and also catupgrd.sql replaced with new catctl.pl which provides to run upgrade scripts in parallel taking.
Also if flashback database is enable,dbua creates a guaranteed restore point which can be used in case fail in the upgrade process.

So, we have to follow the steps.
      We first need to install the new binaries into an Oracle home for 12c.
      Backup Oracle full database and profile (I’II take it due dbua)
      Stop listener
      Change ORACLE_HOME environment
      Create new listener for oracle 12c
      Check the version and components
Select instance_name,host_name,version,status from  V$INSTANCE;
Select  comp_name, version, status from dba_registry ORDER BY status;
      Run The scripts
      Run DBUA
      Run Post upgrade
So, Lets Start
1.     Check version & compenents
 

2.Change ORACLE_HOME environment 


3.     Run The scripts

As you see there are 3 script preupgrede.log, preupgrade_fixups.sql and postupgrade_fixups.sql. We will check the errors or warnigs in log file. Then we will run fix script then we’ll start.
Next we need to go to the directory where the preupgrd.sql file is located: 

At log file I see some parameter to fix and gather statistics. 


So, Run fix script


Now run the DBUA  
cd /opt/oracle/product/12.1.0/db/bin
 ./dbua
This will start the GUI to begin the upgrade.  

Select the Upgrade And click Next



Select which DB you wanna upgrade 
You see which errors or warning choose options to do and click next

Select parallelism  and timezone data
Click Next

I wan to configure Enterprise Manager but not cloud control i’ll do it later.

İf you prefer to move DBFİLES so select it but i didnt,click next

Choose your listener and click next

NOTE: i created new listener for oracle 12c.



So, take backup by RMAN and you can change path, İ prefered default.

As You see summary upgrade it almost ready so finish it

 

Click activity log and alert log to see if errors or warning ocur. 


So, Here we go, its going well


That’s it.

So,check the result

Control backup/restore result
 


Check the Oratab file
 

Look at inventory.xml for Oracle HOME
 
So, check Oracle Version & CDB
 

Check Upgrade time

Check Compenents