Wednesday, July 22, 2015

DB12c Concepts

    Multitenant Overview
  • Container Database (CDB) : On the surface this seems very similar to a conventional Oracle database, as it contains most of the working parts you will be already familiar with (controlfiles, datafiles, undo, tempfiles, redo logs etc.). It also houses the data dictionary for those objects that are owned by the root container and those that are visible to all PDBs.
  • Pluggable Database (PDB) : Since the CDB contains most of the working parts for the database, the PDB only needs to contain information specific to itself. It does not need to worry about controlfiles, redo logs and undo etc. Instead it is just made up of datafiles and tempfiles to handle it's own objects. This includes it's own data dictionary, containing information about only those objects that are specific to the PDB.








Views

The introduction of the multitenant option brings with it an extra layer of data dictionary views, allowing reporting across the root container and the pluggable databases (PDBs). Ignoring editions for the moment, prior releases had the following hierarchy.
DBA_ : All objects in the database.
|
--ALL_ : Objects accessible by the current user, including those owned by the current user.
  |
  --USER_ : Objects owned by the current user.
With Oracle 12c, an extra layer is added to the hierarchy.
CDB_ : All objects in all containers (root and all PDBs).
|
--DBA_ : All objects in the current container (root or PDB).
  |
  --ALL_ : Objects accessible by the current user in the current container (root or PDB), including those owned by the current user.
    |
    --USER_ : Objects owned by the current user in the current container (root or PDB).

Wednesday, July 8, 2015

Checking RAC status

1. Cluster status
 $crs_stat -t
$crsctl check crs


2. Check status of individual nodes and all the necessary applications

$srvctl status nodeapps -n host<n>
 
3.   check the status of the ASM on both nodes
 
$srvctl status asm -n host<n>
 
4. Check database status
 
$srvctl status database -d <dbname> 

5.Querying the RAC

SQL> select instance_name, host_name, archiver, thread#, status
  2  from gv$instance
  3  /
 
SQL> select file_name, bytes/1024/1024
  2  from dba_data_files
  3  /
 
SQL> select group#, type, member, is_recovery_dest_file
  2  from v$logfile
  3  order by group#
  4  /
 
SQL> select group_number, name,allocation_unit_size alloc_unit_size,state,type,total_mb,usable_file_mb
from v$asm_diskgroup; 

SQL> select name, path, header_status, total_mb free_mb, trunc(bytes_read/1024/1024) read_mb, trunc(bytes_written/1024/1024) write_mb
from v$asm_disk;
 
SQL> select name from v$datafile
  2  union
  3  select name from v$controlfile
  4  union
  5  select name from v$tempfile
  6  union
  7  select member from v$logfile
  8  /
 
SQL> select tablespace_name, file_name
  2  from dba_data_files
  3  union
  4  select tablespace_name, file_name
  5  from dba_temp_files
  6  /
 
SQL> select group_number, file_number, bytes/1024/1024/1024 GB, type, striped, modification_date
  2   from v$asm_file
  3  where TYPE != 'ARCHIVELOG'
  4  / 

SQL> select group_number, file_number, compound_index, incarnation, block_size, bytes/1024/1024/1024 GB, type, striped,
  2  creation_date, modification_date
  3  from v$asm_file
  4  where TYPE != 'ARCHIVELOG'
  5  /

Tuesday, July 7, 2015

How to Start 11g R2 RAC Cluster

There are 2 methods.
Method 1:
1).Start the HAS (High Availability Service) on each node.
$ crsctl start has
2).To Start the Cluster on both the nodes.
$ crsctl start cluster –all
If OHASD is already running, you can start the Clusterware stack on any node from local node
Method 2:
1).Run the below command on each node. Starts both HAS and CRS
$ crsctl start crs